math-exercises 2.1.14 → 2.1.16
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/exercises/exercise.d.ts +1 -1
- package/lib/exercises/exercise.d.ts.map +1 -1
- package/lib/exercises/math/calcul/arithmetics/paritySumsAndProducts.js +1 -1
- package/lib/exercises/math/calculLitteral/equation/binomialsTrinomialsProposedSolutions.js +1 -1
- package/lib/exercises/math/calculLitteral/systems/verifySystemSolution.js +1 -1
- package/lib/exercises/math/derivation/derivative/convexityQuadrinomials.js +1 -1
- package/lib/exercises/math/derivation/derivative/convexityTrinomials.js +1 -1
- package/lib/exercises/math/equaDiff/equaDiffCheckSolutionFirstOrder.js +1 -1
- package/lib/exercises/math/functions/affines/affineAdjustment.d.ts.map +1 -1
- package/lib/exercises/math/functions/affines/affineAdjustment.js +16 -16
- package/lib/exercises/math/functions/affines/affineAdjustmentComplete.d.ts.map +1 -1
- package/lib/exercises/math/functions/affines/affineAdjustmentComplete.js +17 -17
- package/lib/exercises/math/functions/affines/affineAdjustmentRsquared.js +12 -12
- package/lib/exercises/math/functions/affines/affineMeanValue.d.ts +9 -0
- package/lib/exercises/math/functions/affines/affineMeanValue.d.ts.map +1 -0
- package/lib/exercises/math/functions/affines/affineMeanValue.js +77 -0
- package/lib/exercises/math/functions/affines/index.d.ts +1 -0
- package/lib/exercises/math/functions/affines/index.d.ts.map +1 -1
- package/lib/exercises/math/functions/affines/index.js +1 -0
- package/lib/exercises/math/functions/index.d.ts +1 -0
- package/lib/exercises/math/functions/index.d.ts.map +1 -1
- package/lib/exercises/math/functions/index.js +1 -0
- package/lib/exercises/math/functions/integral/index.d.ts +10 -0
- package/lib/exercises/math/functions/integral/index.d.ts.map +1 -0
- package/lib/exercises/math/functions/integral/index.js +25 -0
- package/lib/exercises/math/functions/integral/integralAffines.d.ts +9 -0
- package/lib/exercises/math/functions/integral/integralAffines.d.ts.map +1 -0
- package/lib/exercises/math/functions/integral/integralAffines.js +72 -0
- package/lib/exercises/math/functions/integral/integralDerivatedUCosU.d.ts +10 -0
- package/lib/exercises/math/functions/integral/integralDerivatedUCosU.d.ts.map +1 -0
- package/lib/exercises/math/functions/integral/integralDerivatedUCosU.js +81 -0
- package/lib/exercises/math/functions/integral/integralDerivatedUSinU.d.ts +10 -0
- package/lib/exercises/math/functions/integral/integralDerivatedUSinU.d.ts.map +1 -0
- package/lib/exercises/math/functions/integral/integralDerivatedUSinU.js +86 -0
- package/lib/exercises/math/functions/integral/integralExpAxPlusB.d.ts +10 -0
- package/lib/exercises/math/functions/integral/integralExpAxPlusB.d.ts.map +1 -0
- package/lib/exercises/math/functions/integral/integralExpAxPlusB.js +83 -0
- package/lib/exercises/math/functions/integral/integralExpU.d.ts +10 -0
- package/lib/exercises/math/functions/integral/integralExpU.d.ts.map +1 -0
- package/lib/exercises/math/functions/integral/integralExpU.js +95 -0
- package/lib/exercises/math/functions/integral/integralFractions.d.ts +10 -0
- package/lib/exercises/math/functions/integral/integralFractions.d.ts.map +1 -0
- package/lib/exercises/math/functions/integral/integralFractions.js +109 -0
- package/lib/exercises/math/functions/integral/integralKCosinus.d.ts +9 -0
- package/lib/exercises/math/functions/integral/integralKCosinus.d.ts.map +1 -0
- package/lib/exercises/math/functions/integral/integralKCosinus.js +83 -0
- package/lib/exercises/math/functions/integral/integralKSinus.d.ts +9 -0
- package/lib/exercises/math/functions/integral/integralKSinus.d.ts.map +1 -0
- package/lib/exercises/math/functions/integral/integralKSinus.js +83 -0
- package/lib/exercises/math/functions/integral/integralTrinomials.d.ts +9 -0
- package/lib/exercises/math/functions/integral/integralTrinomials.d.ts.map +1 -0
- package/lib/exercises/math/functions/integral/integralTrinomials.js +78 -0
- package/lib/exercises/math/functions/parity/parityFromAlgebra.js +1 -1
- package/lib/exercises/math/functions/parity/parityFromGraph.js +1 -1
- package/lib/exercises/math/functions/trinoms/extremumTypeFromAlgebricForm.js +1 -1
- package/lib/exercises/math/functions/trinoms/index.d.ts +1 -0
- package/lib/exercises/math/functions/trinoms/index.d.ts.map +1 -1
- package/lib/exercises/math/functions/trinoms/index.js +1 -0
- package/lib/exercises/math/functions/trinoms/trinomialMeanValue.d.ts +9 -0
- package/lib/exercises/math/functions/trinoms/trinomialMeanValue.d.ts.map +1 -0
- package/lib/exercises/math/functions/trinoms/trinomialMeanValue.js +77 -0
- package/lib/exercises/math/functions/trinoms/variationsFromAlgebricForm.js +1 -1
- package/lib/exercises/math/geometry/convexity/convexityTrinomialsGeo.js +1 -1
- package/lib/exercises/math/geometry/vectors/alignementViaColinearity.js +1 -1
- package/lib/exercises/math/geometry/vectors/colinearity.js +1 -1
- package/lib/exercises/math/geometry/vectors/equalCaracteristicFromGraph.js +1 -1
- package/lib/exercises/math/geometry/vectors/paralellismViaColinearity.js +1 -1
- package/lib/exercises/math/geometry/vectors/parallelogramViaEqualVectors.js +1 -1
- package/lib/exercises/math/matrices/matrixGeneralTerm.js +1 -1
- package/lib/exercises/math/probaStat/calculateProbaOfBinomialDistribution.d.ts +13 -0
- package/lib/exercises/math/probaStat/calculateProbaOfBinomialDistribution.d.ts.map +1 -0
- package/lib/exercises/math/probaStat/calculateProbaOfBinomialDistribution.js +85 -0
- package/lib/exercises/math/probaStat/expectedValueOfBinomialProba.d.ts +9 -0
- package/lib/exercises/math/probaStat/expectedValueOfBinomialProba.d.ts.map +1 -0
- package/lib/exercises/math/probaStat/expectedValueOfBinomialProba.js +77 -0
- package/lib/exercises/math/probaStat/independancy.js +1 -1
- package/lib/exercises/math/probaStat/index.d.ts +3 -0
- package/lib/exercises/math/probaStat/index.d.ts.map +1 -1
- package/lib/exercises/math/probaStat/index.js +3 -0
- package/lib/exercises/math/probaStat/stats2var/fineAdjustementExercise.d.ts.map +1 -1
- package/lib/exercises/math/probaStat/stats2var/fineAdjustementExercise.js +20 -9
- package/lib/exercises/math/probaStat/varianceOfBinomialProba.d.ts +9 -0
- package/lib/exercises/math/probaStat/varianceOfBinomialProba.d.ts.map +1 -0
- package/lib/exercises/math/probaStat/varianceOfBinomialProba.js +74 -0
- package/lib/exercises/math/sequences/arithmetic/recognizeArithmeticFromFirstTerms.js +1 -1
- package/lib/exercises/math/sequences/arithmetic/recognizeArithmeticFromGraph.js +1 -1
- package/lib/exercises/math/sequences/genericSequenceVariations.js +1 -1
- package/lib/exercises/math/trigonometry/arcValue.d.ts +9 -0
- package/lib/exercises/math/trigonometry/arcValue.d.ts.map +1 -0
- package/lib/exercises/math/trigonometry/arcValue.js +78 -0
- package/lib/exercises/math/trigonometry/calculateCosSinAndTan.d.ts +7 -0
- package/lib/exercises/math/trigonometry/calculateCosSinAndTan.d.ts.map +1 -0
- package/lib/exercises/math/trigonometry/calculateCosSinAndTan.js +71 -0
- package/lib/exercises/math/trigonometry/index.d.ts +2 -0
- package/lib/exercises/math/trigonometry/index.d.ts.map +1 -1
- package/lib/exercises/math/trigonometry/index.js +2 -0
- package/lib/exercises/pc/chemicalElements/atomicStructureOfNucleus.js +1 -1
- package/lib/exercises/pc/chemicalElements/identifyRightElectronicConfiguration.js +1 -1
- package/lib/exercises/pc/chemicalReactions/identifyLimitingReagent.js +1 -1
- package/lib/exercises/pc/chemicalReactions/identifyStoichiometricMixture.js +1 -1
- package/lib/exercises/pc/sound/frequencyComparison.js +1 -1
- package/lib/index.d.ts +70 -0
- package/lib/index.d.ts.map +1 -1
- package/lib/math/trigonometry/remarkableValue.d.ts.map +1 -1
- package/lib/math/trigonometry/remarkableValue.js +1 -0
- package/lib/math/trigonometry/remarkableValues.d.ts +1 -0
- package/lib/math/trigonometry/remarkableValues.d.ts.map +1 -1
- package/lib/math/trigonometry/remarkableValues.js +30 -29
- package/lib/math/utils/combinatorics/combination.d.ts +2 -0
- package/lib/math/utils/combinatorics/combination.d.ts.map +1 -0
- package/lib/math/utils/combinatorics/combination.js +8 -0
- package/lib/tree/nodes/algebraicNode.d.ts +1 -0
- package/lib/tree/nodes/algebraicNode.d.ts.map +1 -1
- package/lib/tree/nodes/functions/arcSinNode.d.ts +19 -0
- package/lib/tree/nodes/functions/arcSinNode.d.ts.map +1 -0
- package/lib/tree/nodes/functions/arcSinNode.js +59 -0
- package/lib/tree/nodes/functions/arccosNode.d.ts +19 -0
- package/lib/tree/nodes/functions/arccosNode.d.ts.map +1 -0
- package/lib/tree/nodes/functions/arccosNode.js +60 -0
- package/lib/tree/nodes/functions/arctanNode.d.ts +19 -0
- package/lib/tree/nodes/functions/arctanNode.d.ts.map +1 -0
- package/lib/tree/nodes/functions/arctanNode.js +60 -0
- package/lib/tree/nodes/functions/cosNode.d.ts +3 -3
- package/lib/tree/nodes/functions/cosNode.d.ts.map +1 -1
- package/lib/tree/nodes/functions/cosNode.js +14 -15
- package/lib/tree/nodes/functions/expNode.d.ts +1 -1
- package/lib/tree/nodes/functions/expNode.d.ts.map +1 -1
- package/lib/tree/nodes/functions/expNode.js +11 -1
- package/lib/tree/nodes/functions/functionNode.d.ts +8 -4
- package/lib/tree/nodes/functions/functionNode.d.ts.map +1 -1
- package/lib/tree/nodes/functions/functionNode.js +8 -4
- package/lib/tree/nodes/functions/integralNode.d.ts +12 -0
- package/lib/tree/nodes/functions/integralNode.d.ts.map +1 -0
- package/lib/tree/nodes/functions/integralNode.js +16 -0
- package/lib/tree/nodes/functions/sinNode.d.ts +2 -2
- package/lib/tree/nodes/functions/sinNode.d.ts.map +1 -1
- package/lib/tree/nodes/functions/sinNode.js +13 -14
- package/lib/tree/nodes/functions/tanNode.d.ts +19 -0
- package/lib/tree/nodes/functions/tanNode.d.ts.map +1 -0
- package/lib/tree/nodes/functions/tanNode.js +64 -0
- package/lib/tree/nodes/geometry/degree.d.ts +20 -0
- package/lib/tree/nodes/geometry/degree.d.ts.map +1 -0
- package/lib/tree/nodes/geometry/degree.js +48 -0
- package/lib/tree/nodes/operators/operatorNode.d.ts +2 -1
- package/lib/tree/nodes/operators/operatorNode.d.ts.map +1 -1
- package/lib/tree/nodes/operators/operatorNode.js +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.IntegralNode = void 0;
|
|
4
|
+
const variableNode_1 = require("../variables/variableNode");
|
|
5
|
+
class IntegralNode {
|
|
6
|
+
constructor(functionNode, lowerBound, upperBound, variable) {
|
|
7
|
+
(this.functionNode = functionNode),
|
|
8
|
+
(this.lowerBound = lowerBound),
|
|
9
|
+
(this.upperBound = upperBound),
|
|
10
|
+
(this.variable = new variableNode_1.VariableNode(variable));
|
|
11
|
+
}
|
|
12
|
+
toTex(opts) {
|
|
13
|
+
return `\\int_{${this.lowerBound.toTex()}}^{${this.upperBound.toTex()}} ${this.functionNode.toTex()} \\, \\mathrm{d}${this.variable.toTex()}`;
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
exports.IntegralNode = IntegralNode;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Node, NodeType } from "../node";
|
|
2
2
|
import { FunctionNode, FunctionsIds } from "./functionNode";
|
|
3
|
-
import { AlgebraicNode } from "../algebraicNode";
|
|
3
|
+
import { AlgebraicNode, SimplifyOptions } from "../algebraicNode";
|
|
4
4
|
export declare function isSinNode(a: Node): a is SinNode;
|
|
5
5
|
export declare class SinNode implements FunctionNode {
|
|
6
6
|
id: FunctionsIds;
|
|
@@ -12,7 +12,7 @@ export declare class SinNode implements FunctionNode {
|
|
|
12
12
|
toTex(): string;
|
|
13
13
|
toEquivalentNodes(): AlgebraicNode[];
|
|
14
14
|
toAllValidTexs(): string[];
|
|
15
|
-
simplify(): AlgebraicNode;
|
|
15
|
+
simplify(opts?: SimplifyOptions): AlgebraicNode;
|
|
16
16
|
evaluate(vars: Record<string, number>): number;
|
|
17
17
|
equals(node: AlgebraicNode): boolean;
|
|
18
18
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sinNode.d.ts","sourceRoot":"","sources":["../../../../src/tree/nodes/functions/sinNode.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"sinNode.d.ts","sourceRoot":"","sources":["../../../../src/tree/nodes/functions/sinNode.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAmB,MAAM,SAAS,CAAC;AAC1D,OAAO,EAAE,YAAY,EAAE,YAAY,EAAkB,MAAM,gBAAgB,CAAC;AAC5E,OAAO,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAGlE,wBAAgB,SAAS,CAAC,CAAC,EAAE,IAAI,GAAG,CAAC,IAAI,OAAO,CAE/C;AAED,qBAAa,OAAQ,YAAW,YAAY;IAC1C,EAAE,EAAE,YAAY,CAAC;IACjB,KAAK,EAAE,aAAa,CAAC;IACrB,IAAI,EAAE,QAAQ,CAAC;IACf,SAAS,EAAE,OAAO,CAAC;gBAEP,KAAK,EAAE,aAAa;IAOhC,YAAY,IAAI,MAAM;IAItB,KAAK,IAAI,MAAM;IAIf,iBAAiB,IAAI,aAAa,EAAE;IASpC,cAAc,IAAI,MAAM,EAAE;IAI1B,QAAQ,CAAC,IAAI,GAAE,eAAoB,GAAG,aAAa;IAsBnD,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC;IAIrC,MAAM,CAAC,IAAI,EAAE,aAAa,GAAG,OAAO;CAGrC"}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.SinNode = exports.isSinNode = void 0;
|
|
4
|
-
// import { sin } from "mathjs";
|
|
5
4
|
const node_1 = require("../node");
|
|
6
5
|
const functionNode_1 = require("./functionNode");
|
|
7
6
|
const remarkableValues_1 = require("../../../math/trigonometry/remarkableValues");
|
|
@@ -22,9 +21,6 @@ class SinNode {
|
|
|
22
21
|
toTex() {
|
|
23
22
|
return `\\sin\\left(${this.child.toTex()}\\right)`;
|
|
24
23
|
}
|
|
25
|
-
// toMathjs() {
|
|
26
|
-
// return sin(this.child.toMathjs());
|
|
27
|
-
// }
|
|
28
24
|
toEquivalentNodes() {
|
|
29
25
|
const res = [];
|
|
30
26
|
const childNodes = this.child.toEquivalentNodes();
|
|
@@ -36,24 +32,27 @@ class SinNode {
|
|
|
36
32
|
toAllValidTexs() {
|
|
37
33
|
return this.toEquivalentNodes().map((node) => node.toTex());
|
|
38
34
|
}
|
|
39
|
-
simplify() {
|
|
35
|
+
simplify(opts = {}) {
|
|
40
36
|
const simplifiedChild = this.child.simplify();
|
|
41
37
|
if (!(0, node_1.hasVariableNode)(simplifiedChild)) {
|
|
42
|
-
|
|
38
|
+
let value = simplifiedChild.evaluate({});
|
|
39
|
+
if (opts.isDegree) {
|
|
40
|
+
value = (value * Math.PI) / 180;
|
|
41
|
+
}
|
|
43
42
|
const moduled = Math.abs(value % (2 * Math.PI));
|
|
44
|
-
const trigoPoint = remarkableValues_1.remarkableTrigoValues.find((
|
|
43
|
+
const trigoPoint = remarkableValues_1.remarkableTrigoValues.find((val) => val.angle.evaluate({}) === moduled);
|
|
45
44
|
if (!trigoPoint)
|
|
46
|
-
return
|
|
45
|
+
return new SinNode(simplifiedChild);
|
|
47
46
|
else
|
|
48
|
-
return trigoPoint.
|
|
47
|
+
return trigoPoint.sin;
|
|
49
48
|
}
|
|
50
49
|
else {
|
|
51
|
-
|
|
52
|
-
//
|
|
53
|
-
//
|
|
54
|
-
//
|
|
50
|
+
// Écrire les règles algébriques spécifiques à sin ici
|
|
51
|
+
// Exemples :
|
|
52
|
+
// sin(x + 2π) -> sin(x)
|
|
53
|
+
// sin(-x) -> -sin(x)
|
|
55
54
|
}
|
|
56
|
-
return
|
|
55
|
+
return new SinNode(simplifiedChild);
|
|
57
56
|
}
|
|
58
57
|
evaluate(vars) {
|
|
59
58
|
return Math.sin(this.child.evaluate(vars));
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { Node, NodeType } from "../node";
|
|
2
|
+
import { FunctionNode, FunctionsIds } from "./functionNode";
|
|
3
|
+
import { AlgebraicNode, SimplifyOptions } from "../algebraicNode";
|
|
4
|
+
export declare function isTanNode(a: Node): a is TanNode;
|
|
5
|
+
export declare class TanNode implements FunctionNode {
|
|
6
|
+
id: FunctionsIds;
|
|
7
|
+
child: AlgebraicNode;
|
|
8
|
+
type: NodeType;
|
|
9
|
+
isNumeric: boolean;
|
|
10
|
+
constructor(child: AlgebraicNode);
|
|
11
|
+
toMathString(): string;
|
|
12
|
+
toTex(): string;
|
|
13
|
+
toEquivalentNodes(): AlgebraicNode[];
|
|
14
|
+
toAllValidTexs(): string[];
|
|
15
|
+
simplify(opts?: SimplifyOptions): AlgebraicNode;
|
|
16
|
+
evaluate(vars: Record<string, number>): number;
|
|
17
|
+
equals(node: AlgebraicNode): boolean;
|
|
18
|
+
}
|
|
19
|
+
//# sourceMappingURL=tanNode.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tanNode.d.ts","sourceRoot":"","sources":["../../../../src/tree/nodes/functions/tanNode.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAmB,MAAM,SAAS,CAAC;AAC1D,OAAO,EAAE,YAAY,EAAE,YAAY,EAAkB,MAAM,gBAAgB,CAAC;AAC5E,OAAO,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAGlE,wBAAgB,SAAS,CAAC,CAAC,EAAE,IAAI,GAAG,CAAC,IAAI,OAAO,CAE/C;AAED,qBAAa,OAAQ,YAAW,YAAY;IAC1C,EAAE,EAAE,YAAY,CAAC;IACjB,KAAK,EAAE,aAAa,CAAC;IACrB,IAAI,EAAE,QAAQ,CAAC;IACf,SAAS,EAAE,OAAO,CAAC;gBAEP,KAAK,EAAE,aAAa;IAOhC,YAAY,IAAI,MAAM;IAItB,KAAK,IAAI,MAAM;IAIf,iBAAiB,IAAI,aAAa,EAAE;IASpC,cAAc,IAAI,MAAM,EAAE;IAI1B,QAAQ,CAAC,IAAI,GAAE,eAAoB,GAAG,aAAa;IAsBnD,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC;IAIrC,MAAM,CAAC,IAAI,EAAE,aAAa,GAAG,OAAO;CAGrC"}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.TanNode = exports.isTanNode = void 0;
|
|
4
|
+
const node_1 = require("../node");
|
|
5
|
+
const functionNode_1 = require("./functionNode");
|
|
6
|
+
const remarkableValues_1 = require("../../../math/trigonometry/remarkableValues");
|
|
7
|
+
function isTanNode(a) {
|
|
8
|
+
return (0, functionNode_1.isFunctionNode)(a) && a.id === functionNode_1.FunctionsIds.tan;
|
|
9
|
+
}
|
|
10
|
+
exports.isTanNode = isTanNode;
|
|
11
|
+
class TanNode {
|
|
12
|
+
constructor(child) {
|
|
13
|
+
this.id = functionNode_1.FunctionsIds.tan;
|
|
14
|
+
this.child = child;
|
|
15
|
+
this.type = node_1.NodeType.function;
|
|
16
|
+
this.isNumeric = child.isNumeric;
|
|
17
|
+
}
|
|
18
|
+
toMathString() {
|
|
19
|
+
return `tan(${this.child.toMathString()})`;
|
|
20
|
+
}
|
|
21
|
+
toTex() {
|
|
22
|
+
return `\\tan\\left(${this.child.toTex()}\\right)`;
|
|
23
|
+
}
|
|
24
|
+
toEquivalentNodes() {
|
|
25
|
+
const res = [];
|
|
26
|
+
const childNodes = this.child.toEquivalentNodes();
|
|
27
|
+
childNodes.forEach((childNode) => {
|
|
28
|
+
res.push(new TanNode(childNode));
|
|
29
|
+
});
|
|
30
|
+
return res;
|
|
31
|
+
}
|
|
32
|
+
toAllValidTexs() {
|
|
33
|
+
return this.toEquivalentNodes().map((node) => node.toTex());
|
|
34
|
+
}
|
|
35
|
+
simplify(opts = {}) {
|
|
36
|
+
const simplifiedChild = this.child.simplify();
|
|
37
|
+
if (!(0, node_1.hasVariableNode)(simplifiedChild)) {
|
|
38
|
+
let value = simplifiedChild.evaluate({});
|
|
39
|
+
if (opts.isDegree) {
|
|
40
|
+
value = (value * Math.PI) / 180;
|
|
41
|
+
}
|
|
42
|
+
const moduled = Math.abs(value % Math.PI);
|
|
43
|
+
const trigoPoint = remarkableValues_1.remarkableTrigoValues.find((val) => val.angle.evaluate({}) === moduled);
|
|
44
|
+
if (!trigoPoint)
|
|
45
|
+
return new TanNode(simplifiedChild);
|
|
46
|
+
else
|
|
47
|
+
return trigoPoint.tan;
|
|
48
|
+
}
|
|
49
|
+
else {
|
|
50
|
+
// Écrire les règles algébriques spécifiques à tan ici
|
|
51
|
+
// Exemples :
|
|
52
|
+
// tan(x + π) -> tan(x)
|
|
53
|
+
// tan(-x) -> -tan(x)
|
|
54
|
+
}
|
|
55
|
+
return new TanNode(simplifiedChild);
|
|
56
|
+
}
|
|
57
|
+
evaluate(vars) {
|
|
58
|
+
return Math.tan(this.child.evaluate(vars));
|
|
59
|
+
}
|
|
60
|
+
equals(node) {
|
|
61
|
+
return isTanNode(node) && node.child.equals(this.child);
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
exports.TanNode = TanNode;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { Node, NodeType } from "../node";
|
|
2
|
+
import { AlgebraicNode } from "../algebraicNode";
|
|
3
|
+
export declare function isDegreeNode(a: Node): a is DegreeNode;
|
|
4
|
+
export declare class DegreeNode implements AlgebraicNode {
|
|
5
|
+
tex: string;
|
|
6
|
+
mathString: string;
|
|
7
|
+
value: number;
|
|
8
|
+
type: NodeType;
|
|
9
|
+
isNumeric: boolean;
|
|
10
|
+
constructor(value: number, tex?: string, mathString?: string);
|
|
11
|
+
toMathString(): string;
|
|
12
|
+
toTex(): string;
|
|
13
|
+
toMathjs(): string;
|
|
14
|
+
toAllValidTexs(): string[];
|
|
15
|
+
toEquivalentNodes(): this[];
|
|
16
|
+
evaluate(vars: Record<string, number>): number;
|
|
17
|
+
simplify(): this;
|
|
18
|
+
equals(node: AlgebraicNode): boolean;
|
|
19
|
+
}
|
|
20
|
+
//# sourceMappingURL=degree.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"degree.d.ts","sourceRoot":"","sources":["../../../../src/tree/nodes/geometry/degree.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AACzC,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAEjD,wBAAgB,YAAY,CAAC,CAAC,EAAE,IAAI,GAAG,CAAC,IAAI,UAAU,CAErD;AAED,qBAAa,UAAW,YAAW,aAAa;IAC9C,GAAG,EAAE,MAAM,CAAC;IACZ,UAAU,EAAE,MAAM,CAAC;IACnB,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,QAAQ,CAAmB;IACjC,SAAS,EAAE,OAAO,CAAC;gBACP,KAAK,EAAE,MAAM,EAAE,GAAG,CAAC,EAAE,MAAM,EAAE,UAAU,CAAC,EAAE,MAAM;IAQ5D,YAAY,IAAI,MAAM;IAGtB,KAAK,IAAI,MAAM;IAGf,QAAQ;IAGR,cAAc;IAOd,iBAAiB;IAGjB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC;IAGrC,QAAQ;IAGR,MAAM,CAAC,IAAI,EAAE,aAAa;CAG3B"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DegreeNode = exports.isDegreeNode = void 0;
|
|
4
|
+
const node_1 = require("../node");
|
|
5
|
+
function isDegreeNode(a) {
|
|
6
|
+
return a.type === node_1.NodeType.number;
|
|
7
|
+
}
|
|
8
|
+
exports.isDegreeNode = isDegreeNode;
|
|
9
|
+
class DegreeNode {
|
|
10
|
+
constructor(value, tex, mathString) {
|
|
11
|
+
this.type = node_1.NodeType.number;
|
|
12
|
+
this.value = value;
|
|
13
|
+
this.tex =
|
|
14
|
+
(tex?.replace(".", ",") || (value + "").replace(".", ",")) + `^\\circ`;
|
|
15
|
+
this.mathString = mathString || this.value + "^\\circ";
|
|
16
|
+
this.isNumeric = true;
|
|
17
|
+
}
|
|
18
|
+
toMathString() {
|
|
19
|
+
return `${this.mathString}`;
|
|
20
|
+
}
|
|
21
|
+
toTex() {
|
|
22
|
+
return `${this.tex}`;
|
|
23
|
+
}
|
|
24
|
+
toMathjs() {
|
|
25
|
+
return this.toMathString();
|
|
26
|
+
}
|
|
27
|
+
toAllValidTexs() {
|
|
28
|
+
const res = [];
|
|
29
|
+
res.push(this.tex);
|
|
30
|
+
//!est-ce vraiment nécessaire sachant que les inputs students n'auront en théorie jamais de "."
|
|
31
|
+
if (this.tex.includes(","))
|
|
32
|
+
res.push(this.tex.replace(",", "."));
|
|
33
|
+
return res;
|
|
34
|
+
}
|
|
35
|
+
toEquivalentNodes() {
|
|
36
|
+
return [this];
|
|
37
|
+
}
|
|
38
|
+
evaluate(vars) {
|
|
39
|
+
return this.value;
|
|
40
|
+
}
|
|
41
|
+
simplify() {
|
|
42
|
+
return this;
|
|
43
|
+
}
|
|
44
|
+
equals(node) {
|
|
45
|
+
return isDegreeNode(node) && node.value === this.value;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
exports.DegreeNode = DegreeNode;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"operatorNode.d.ts","sourceRoot":"","sources":["../../../../src/tree/nodes/operators/operatorNode.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,EAAE,IAAI,EAAY,MAAM,SAAS,CAAC;AAEzC,oBAAY,WAAW;IACrB,GAAG,IAAA;IACH,SAAS,IAAA;IACT,QAAQ,IAAA;IACR,QAAQ,IAAA;IACR,MAAM,IAAA;IACN,KAAK,IAAA;IACL,KAAK,IAAA;
|
|
1
|
+
{"version":3,"file":"operatorNode.d.ts","sourceRoot":"","sources":["../../../../src/tree/nodes/operators/operatorNode.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,EAAE,IAAI,EAAY,MAAM,SAAS,CAAC;AAEzC,oBAAY,WAAW;IACrB,GAAG,IAAA;IACH,SAAS,IAAA;IACT,QAAQ,IAAA;IACR,QAAQ,IAAA;IACR,MAAM,IAAA;IACN,KAAK,IAAA;IACL,KAAK,IAAA;IACL,QAAQ,IAAA;CACT;AAED,MAAM,WAAW,YAAa,SAAQ,aAAa;IACjD,EAAE,EAAE,WAAW,CAAC;IAChB,SAAS,EAAE,aAAa,CAAC;IACzB,UAAU,EAAE,aAAa,CAAC;CAC3B;AACD,wBAAgB,cAAc,CAAC,CAAC,EAAE,IAAI,GAAG,CAAC,IAAI,YAAY,CAEzD;AAED,MAAM,WAAW,uBAAwB,SAAQ,YAAY;IAC3D,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,SAAS,EAAE,MAAM,MAAM,EAAE,CAAC;CAC3B"}
|
|
@@ -11,6 +11,7 @@ var OperatorIds;
|
|
|
11
11
|
OperatorIds[OperatorIds["divide"] = 4] = "divide";
|
|
12
12
|
OperatorIds[OperatorIds["power"] = 5] = "power";
|
|
13
13
|
OperatorIds[OperatorIds["limit"] = 6] = "limit";
|
|
14
|
+
OperatorIds[OperatorIds["integral"] = 7] = "integral";
|
|
14
15
|
})(OperatorIds || (exports.OperatorIds = OperatorIds = {}));
|
|
15
16
|
function isOperatorNode(a) {
|
|
16
17
|
return a.type === node_1.NodeType.operator;
|