math-exercises 2.2.84 → 2.2.86

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.
Files changed (84) hide show
  1. package/lib/exercises/math/calcul/fractions/fractionToPercentToDecimal.js +2 -2
  2. package/lib/exercises/math/calculLitteral/equation/equationType3Exercise.d.ts.map +1 -1
  3. package/lib/exercises/math/calculLitteral/equation/equationType4Exercise.d.ts.map +1 -1
  4. package/lib/exercises/math/derivation/derivative/expDerivativeFour.d.ts.map +1 -1
  5. package/lib/exercises/math/derivation/derivative/expDerivativeFour.js +36 -16
  6. package/lib/exercises/math/derivation/derivative/expDerivativeThree.d.ts.map +1 -1
  7. package/lib/exercises/math/derivation/derivative/expDerivativeThree.js +34 -11
  8. package/lib/exercises/math/derivation/derivative/quotientDerivative.d.ts.map +1 -1
  9. package/lib/exercises/math/derivation/derivative/quotientDerivative.js +57 -26
  10. package/lib/exercises/math/functions/absolute/absolueValueAffineEquation.d.ts.map +1 -1
  11. package/lib/exercises/math/functions/absolute/absolueValueAffineEquation.js +1 -0
  12. package/lib/exercises/math/functions/affines/affineAdjustment.d.ts.map +1 -1
  13. package/lib/exercises/math/functions/affines/affineAdjustment.js +2 -0
  14. package/lib/exercises/math/functions/affines/affineAdjustmentComplete.js +1 -1
  15. package/lib/exercises/math/functions/affines/affineExpressionFromTwoImages.d.ts.map +1 -1
  16. package/lib/exercises/math/functions/affines/affineExpressionFromTwoImages.js +58 -22
  17. package/lib/exercises/math/functions/exponential/expEquation.d.ts.map +1 -1
  18. package/lib/exercises/math/functions/exponential/expEquation.js +55 -24
  19. package/lib/exercises/math/functions/index.d.ts +1 -0
  20. package/lib/exercises/math/functions/index.d.ts.map +1 -1
  21. package/lib/exercises/math/functions/index.js +1 -0
  22. package/lib/exercises/math/functions/logarithm/logPowerEquation.d.ts.map +1 -1
  23. package/lib/exercises/math/functions/logarithm/logPowerEquation.js +15 -12
  24. package/lib/exercises/math/functions/sign/affineProductSign.d.ts +13 -0
  25. package/lib/exercises/math/functions/sign/affineProductSign.d.ts.map +1 -0
  26. package/lib/exercises/math/functions/sign/affineProductSign.js +147 -0
  27. package/lib/exercises/math/functions/sign/index.d.ts +2 -0
  28. package/lib/exercises/math/functions/sign/index.d.ts.map +1 -0
  29. package/lib/exercises/math/functions/sign/index.js +17 -0
  30. package/lib/exercises/math/geometry/parametric/extractPointFromParametricLine.d.ts.map +1 -1
  31. package/lib/exercises/math/geometry/parametric/extractPointFromParametricLine.js +1 -2
  32. package/lib/exercises/math/percent/averageEvolutionRate.d.ts.map +1 -1
  33. package/lib/exercises/math/percent/averageEvolutionRate.js +40 -17
  34. package/lib/exercises/math/percent/cmToEvolution.js +1 -1
  35. package/lib/exercises/math/sets/intervals/inequalityToInterval.d.ts.map +1 -1
  36. package/lib/exercises/math/sets/intervals/inequalityToInterval.js +14 -5
  37. package/lib/exercises/math/sets/intervals/intervalToInequality.d.ts.map +1 -1
  38. package/lib/exercises/math/sets/intervals/intervalToInequality.js +2 -0
  39. package/lib/exercises/math/trigonometry/degreeToRadians.d.ts.map +1 -1
  40. package/lib/exercises/math/trigonometry/degreeToRadians.js +17 -6
  41. package/lib/index.d.ts +6 -0
  42. package/lib/index.d.ts.map +1 -1
  43. package/lib/math/geometry/parametricLine.d.ts.map +1 -1
  44. package/lib/math/geometry/parametricLine.js +2 -4
  45. package/lib/math/polynomials/generalAffine.d.ts +3 -0
  46. package/lib/math/polynomials/generalAffine.d.ts.map +1 -1
  47. package/lib/math/polynomials/generalAffine.js +21 -0
  48. package/lib/playground.d.ts.map +1 -1
  49. package/lib/playground.js +1 -6
  50. package/lib/tree/nodes/algebraicNode.d.ts +1 -0
  51. package/lib/tree/nodes/algebraicNode.d.ts.map +1 -1
  52. package/lib/tree/nodes/equations/equationSolutionNode.d.ts +1 -1
  53. package/lib/tree/nodes/equations/equationSolutionNode.js +1 -1
  54. package/lib/tree/nodes/functions/log10Node.d.ts.map +1 -1
  55. package/lib/tree/nodes/functions/log10Node.js +4 -3
  56. package/lib/tree/nodes/functions/logNode.d.ts +2 -2
  57. package/lib/tree/nodes/functions/logNode.d.ts.map +1 -1
  58. package/lib/tree/nodes/functions/logNode.js +8 -8
  59. package/lib/tree/nodes/functions/oppositeNode.d.ts.map +1 -1
  60. package/lib/tree/nodes/functions/oppositeNode.js +0 -1
  61. package/lib/tree/nodes/operators/fractionNode.d.ts.map +1 -1
  62. package/lib/tree/nodes/operators/fractionNode.js +30 -0
  63. package/lib/tree/nodes/operators/multiplyNode.d.ts.map +1 -1
  64. package/lib/tree/nodes/operators/multiplyNode.js +9 -3
  65. package/lib/tree/nodes/polynomials/monomNode.d.ts.map +1 -1
  66. package/lib/tree/nodes/sets/discreteSetNode.d.ts +1 -0
  67. package/lib/tree/nodes/sets/discreteSetNode.d.ts.map +1 -1
  68. package/lib/tree/nodes/sets/discreteSetNode.js +3 -0
  69. package/lib/tree/nodes/sets/intervalNode.d.ts +1 -0
  70. package/lib/tree/nodes/sets/intervalNode.d.ts.map +1 -1
  71. package/lib/tree/nodes/sets/intervalNode.js +3 -0
  72. package/lib/tree/nodes/sets/setNode.d.ts +1 -0
  73. package/lib/tree/nodes/sets/setNode.d.ts.map +1 -1
  74. package/lib/tree/nodes/sets/unionIntervalNode.d.ts +1 -0
  75. package/lib/tree/nodes/sets/unionIntervalNode.d.ts.map +1 -1
  76. package/lib/tree/nodes/sets/unionIntervalNode.js +3 -0
  77. package/lib/tree/parsers/degreeParser.d.ts +2 -0
  78. package/lib/tree/parsers/degreeParser.d.ts.map +1 -0
  79. package/lib/tree/parsers/degreeParser.js +12 -0
  80. package/lib/tree/parsers/discreteSetParser.d.ts.map +1 -1
  81. package/lib/tree/parsers/latexParser.d.ts.map +1 -1
  82. package/lib/tree/parsers/latexParser.js +14 -1
  83. package/lib/utils/latex/alignTex.js +1 -1
  84. package/package.json +1 -1
@@ -15,6 +15,8 @@ const multiplyNode_1 = require("../../../../tree/nodes/operators/multiplyNode");
15
15
  const powerNode_1 = require("../../../../tree/nodes/operators/powerNode");
16
16
  const discreteSetNode_1 = require("../../../../tree/nodes/sets/discreteSetNode");
17
17
  const variableNode_1 = require("../../../../tree/nodes/variables/variableNode");
18
+ const discreteSetParser_1 = require("../../../../tree/parsers/discreteSetParser");
19
+ const equationSolutionParser_1 = require("../../../../tree/parsers/equationSolutionParser");
18
20
  /**a*b^x+c=d */
19
21
  const getKeys = (identifiers, opts) => {
20
22
  const keys = ["x", "equal", "S", "lbrace", "semicolon", "rbrace"];
@@ -59,23 +61,24 @@ const getPropositions = (n, { answer, isLog10, a, c, k, powered }) => {
59
61
  }
60
62
  return (0, exercise_1.shuffleProps)(propositions, n);
61
63
  };
62
- const isAnswerValid = (ans, { a, c, k, powered, isLog10 }) => {
64
+ const isAnswerValid = (ans, { a, c, k, powered, isLog10, answer }) => {
63
65
  try {
64
- //!TODO parse equation solution
66
+ const eqParsed = (0, equationSolutionParser_1.equationSolutionParser)(ans);
67
+ if (eqParsed) {
68
+ const set = new equationSolutionNode_1.EquationSolutionNode(new discreteSetNode_1.DiscreteSetNode([eqParsed]));
69
+ return set.simplify().toTex() === answer;
70
+ }
71
+ else {
72
+ const setParsed = (0, discreteSetParser_1.discreteSetParser)(ans);
73
+ if (!setParsed) {
74
+ return false;
75
+ }
76
+ return "S=" + setParsed.simplify().toTex() === answer;
77
+ }
65
78
  }
66
79
  catch (err) {
67
80
  return false;
68
81
  }
69
- const LNode = isLog10 ? log10Node_1.Log10Node : logNode_1.LogNode;
70
- const poweredNode = new numberNode_1.NumberNode(powered);
71
- const answerSimp = new equationSolutionNode_1.EquationSolutionNode(new discreteSetNode_1.DiscreteSetNode([
72
- new fractionNode_1.FractionNode(new LNode(new numberNode_1.NumberNode(k)), new LNode(poweredNode)).simplify(),
73
- ]));
74
- const answer = new equationSolutionNode_1.EquationSolutionNode(new discreteSetNode_1.DiscreteSetNode([
75
- new fractionNode_1.FractionNode(new LNode(new numberNode_1.NumberNode(k)), new LNode(poweredNode)),
76
- ]));
77
- const texs = [...answerSimp.toAllValidTexs(), ...answer.toAllValidTexs()];
78
- return texs.includes(ans);
79
82
  };
80
83
  exports.logPowerEquation = {
81
84
  id: "logPowerEquation",
@@ -0,0 +1,13 @@
1
+ import { Exercise } from "../../../../exercises/exercise";
2
+ import { GeneralAffineIdentifiers } from "../../../../math/polynomials/generalAffine";
3
+ type Identifiers = {
4
+ affine1Ids: GeneralAffineIdentifiers;
5
+ affine2Ids: GeneralAffineIdentifiers;
6
+ isAskingPositive: boolean;
7
+ };
8
+ type Options = {
9
+ instructionType: string;
10
+ };
11
+ export declare const affineProductSign: Exercise<Identifiers, Options>;
12
+ export {};
13
+ //# sourceMappingURL=affineProductSign.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"affineProductSign.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/functions/sign/affineProductSign.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAiBT,MAAM,0BAA0B,CAAC;AAElC,OAAO,EAGL,wBAAwB,EACzB,MAAM,sCAAsC,CAAC;AAc9C,KAAK,WAAW,GAAG;IACjB,UAAU,EAAE,wBAAwB,CAAC;IACrC,UAAU,EAAE,wBAAwB,CAAC;IACrC,gBAAgB,EAAE,OAAO,CAAC;CAC3B,CAAC;AA8IF,KAAK,OAAO,GAAG;IACb,eAAe,EAAE,MAAM,CAAC;CACzB,CAAC;AAaF,eAAO,MAAM,iBAAiB,EAAE,QAAQ,CAAC,WAAW,EAAE,OAAO,CAiB5D,CAAC"}
@@ -0,0 +1,147 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.affineProductSign = void 0;
4
+ const exercise_1 = require("../../../../exercises/exercise");
5
+ const getDistinctQuestions_1 = require("../../../../exercises/utils/getDistinctQuestions");
6
+ const generalAffine_1 = require("../../../../math/polynomials/generalAffine");
7
+ const randint_1 = require("../../../../math/utils/random/randint");
8
+ const infiniteNode_1 = require("../../../../tree/nodes/numbers/infiniteNode");
9
+ const multiplyNode_1 = require("../../../../tree/nodes/operators/multiplyNode");
10
+ const closure_1 = require("../../../../tree/nodes/sets/closure");
11
+ const intervalNode_1 = require("../../../../tree/nodes/sets/intervalNode");
12
+ const unionIntervalNode_1 = require("../../../../tree/nodes/sets/unionIntervalNode");
13
+ const unionIntervalParser_1 = require("../../../../tree/parsers/unionIntervalParser");
14
+ const coinFlip_1 = require("../../../../utils/alea/coinFlip");
15
+ const doWhile_1 = require("../../../../utils/doWhile");
16
+ const getPropositions = (n, { answer, ...identifiers }, opts) => {
17
+ const propositions = [];
18
+ (0, exercise_1.addValidProp)(propositions, answer);
19
+ const { affine1Ids, affine2Ids, isAskingPositive } = identifiers;
20
+ const affine1 = generalAffine_1.GeneralAffineConstructor.fromIdentifiers(affine1Ids);
21
+ const affine2 = generalAffine_1.GeneralAffineConstructor.fromIdentifiers(affine2Ids);
22
+ let root1 = affine1.getRoot();
23
+ let root2 = affine2.getRoot();
24
+ if (root1.evaluate() > root2.evaluate()) {
25
+ [root1, root2] = [root2, root1];
26
+ }
27
+ const insideInt = new intervalNode_1.IntervalNode(root1, root2, closure_1.ClosureType.FF);
28
+ const outsideInt = new unionIntervalNode_1.UnionIntervalNode([
29
+ new intervalNode_1.IntervalNode(infiniteNode_1.MinusInfinityNode, root1, closure_1.ClosureType.OF),
30
+ new intervalNode_1.IntervalNode(root2, infiniteNode_1.PlusInfinityNode, closure_1.ClosureType.FO),
31
+ ]);
32
+ (0, exercise_1.tryToAddWrongProp)(propositions, insideInt.toTex());
33
+ (0, exercise_1.tryToAddWrongProp)(propositions, outsideInt.toTex());
34
+ (0, exercise_1.tryToAddWrongProp)(propositions, new intervalNode_1.IntervalNode(infiniteNode_1.MinusInfinityNode, root1, closure_1.ClosureType.OF).toTex());
35
+ (0, exercise_1.tryToAddWrongProp)(propositions, new intervalNode_1.IntervalNode(root2, infiniteNode_1.PlusInfinityNode, closure_1.ClosureType.FO).toTex());
36
+ return (0, exercise_1.shuffleProps)(propositions, n);
37
+ };
38
+ const getAnswerNode = (identifiers) => {
39
+ const { affine1Ids, affine2Ids, isAskingPositive } = identifiers;
40
+ const affine1 = generalAffine_1.GeneralAffineConstructor.fromIdentifiers(affine1Ids);
41
+ const affine2 = generalAffine_1.GeneralAffineConstructor.fromIdentifiers(affine2Ids);
42
+ let root1 = affine1.getRoot();
43
+ let root2 = affine2.getRoot();
44
+ if (root1.evaluate() > root2.evaluate()) {
45
+ [root1, root2] = [root2, root1];
46
+ }
47
+ const trinomA = (0, multiplyNode_1.multiply)(affine1.a, affine2.a).evaluate();
48
+ const insideInt = new intervalNode_1.IntervalNode(root1, root2, closure_1.ClosureType.FF);
49
+ const outsideInt = new unionIntervalNode_1.UnionIntervalNode([
50
+ new intervalNode_1.IntervalNode(infiniteNode_1.MinusInfinityNode, root1, closure_1.ClosureType.OF),
51
+ new intervalNode_1.IntervalNode(root2, infiniteNode_1.PlusInfinityNode, closure_1.ClosureType.FO),
52
+ ]);
53
+ if (trinomA > 0 === isAskingPositive)
54
+ return outsideInt;
55
+ else
56
+ return insideInt;
57
+ };
58
+ const getAnswer = (identifiers, opts) => {
59
+ return getAnswerNode(identifiers).toTex();
60
+ };
61
+ const getInstruction = (identifiers, opts) => {
62
+ const { affine1Ids, affine2Ids, isAskingPositive } = identifiers;
63
+ const affine1 = generalAffine_1.GeneralAffineConstructor.fromIdentifiers(affine1Ids);
64
+ const affine2 = generalAffine_1.GeneralAffineConstructor.fromIdentifiers(affine2Ids);
65
+ const isInequation = opts?.instructionType === "Résoudre l'inéquation";
66
+ return isInequation
67
+ ? `Résoudre l'inéquation :
68
+
69
+ $$
70
+ ${(0, multiplyNode_1.multiply)(affine1.toTree(), affine2.toTree()).toTex()} ${isAskingPositive ? "\\ge" : "\\le"}0
71
+ $$`
72
+ : `Soit $f$ la fonction définie sur $\\mathbb{R}$ par :
73
+
74
+ $$
75
+ f(x) = ${(0, multiplyNode_1.multiply)(affine1.toTree(), affine2.toTree()).toTex()}
76
+ $$
77
+
78
+ Sur quel(s) intervalle(s) $f$ est-elle ${isAskingPositive ? "positive" : "négative"} ?`;
79
+ };
80
+ // const getHint: GetHint<Identifiers, Options> = (identifiers, opts) => {};
81
+ // const getCorrection: GetCorrection<Identifiers, Options> = (identifiers) => {};
82
+ const getKeys = (identifiers, opts) => {
83
+ return ["lbracket", "semicolon", "rbracket", "cup", "infty"];
84
+ };
85
+ const isAnswerValid = (ans, { answer, ...identifiers }, opts) => {
86
+ try {
87
+ const parsed = (0, unionIntervalParser_1.unionIntervalParser)(ans, { allowNoBrackets: true });
88
+ if (!parsed)
89
+ return false;
90
+ const ansNode = getAnswerNode(identifiers);
91
+ return (parsed.simplify().toClosedForm().toTex() ===
92
+ ansNode.toClosedForm().toTex());
93
+ }
94
+ catch (err) {
95
+ return false;
96
+ }
97
+ };
98
+ const getAffineProductSignQuestion = (opts) => {
99
+ const a = (0, randint_1.randint)(-9, 10, [0]);
100
+ const b = (0, randint_1.randint)(-9, 10, [0]);
101
+ const c = (0, randint_1.randint)(-10, 10, [0]);
102
+ const d = (0, doWhile_1.doWhile)(() => (0, randint_1.randint)(-10, 10, [0]), (x) => c / a === x / b);
103
+ const affine1 = new generalAffine_1.GeneralAffine(a, b);
104
+ const affine2 = new generalAffine_1.GeneralAffine(c, d);
105
+ const identifiers = {
106
+ affine1Ids: affine1.toIdentifiers(),
107
+ affine2Ids: affine2.toIdentifiers(),
108
+ isAskingPositive: (0, coinFlip_1.coinFlip)(),
109
+ };
110
+ const question = {
111
+ answer: getAnswer(identifiers, opts),
112
+ instruction: getInstruction(identifiers, opts),
113
+ keys: getKeys(identifiers, opts),
114
+ answerFormat: "tex",
115
+ identifiers,
116
+ // hint: getHint(identifiers, opts),
117
+ // correction: getCorrection(identifiers, opts),
118
+ };
119
+ return question;
120
+ };
121
+ const options = [
122
+ {
123
+ id: "instructionType",
124
+ label: "Type de consigne",
125
+ target: exercise_1.GeneratorOptionTarget.instruction,
126
+ type: exercise_1.GeneratorOptionType.select,
127
+ defaultValue: "Déterminer le signe de la fonction",
128
+ values: ["Résoudre l'inéquation", "Déterminer le signe de la fonction"],
129
+ },
130
+ ];
131
+ exports.affineProductSign = {
132
+ id: "affineProductSign",
133
+ connector: "\\iff",
134
+ label: "Déterminer le signe de $(ax+b)(cx+d)$",
135
+ isSingleStep: true,
136
+ generator: (nb, opts) => (0, getDistinctQuestions_1.getDistinctQuestions)(() => getAffineProductSignQuestion(opts), nb),
137
+ qcmTimer: 60,
138
+ freeTimer: 60,
139
+ getPropositions,
140
+ isAnswerValid,
141
+ subject: "Mathématiques",
142
+ getInstruction,
143
+ // getHint,
144
+ // getCorrection,
145
+ getAnswer,
146
+ options,
147
+ };
@@ -0,0 +1,2 @@
1
+ export * from "./affineProductSign";
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/functions/sign/index.ts"],"names":[],"mappings":"AAAA,cAAc,qBAAqB,CAAC"}
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./affineProductSign"), exports);
@@ -1 +1 @@
1
- {"version":3,"file":"extractPointFromParametricLine.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/geometry/parametric/extractPointFromParametricLine.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAcT,MAAM,0BAA0B,CAAC;AASlC,KAAK,WAAW,GAAG;IACjB,UAAU,EAAE,MAAM,EAAE,CAAC;IACrB,MAAM,EAAE,MAAM,EAAE,CAAC;CAClB,CAAC;AAyHF,eAAO,MAAM,8BAA8B,EAAE,QAAQ,CAAC,WAAW,CAiBhE,CAAC"}
1
+ {"version":3,"file":"extractPointFromParametricLine.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/geometry/parametric/extractPointFromParametricLine.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAcT,MAAM,0BAA0B,CAAC;AASlC,KAAK,WAAW,GAAG;IACjB,UAAU,EAAE,MAAM,EAAE,CAAC;IACrB,MAAM,EAAE,MAAM,EAAE,CAAC;CAClB,CAAC;AAwHF,eAAO,MAAM,8BAA8B,EAAE,QAAQ,CAAC,WAAW,CAiBhE,CAAC"}
@@ -46,8 +46,7 @@ const getCorrection = (identifiers) => {
46
46
  const point = line.getPointCoords(new numberNode_1.NumberNode(0));
47
47
  return `Pour obtenir les coordonnées d'un point appartenant à la droite, il suffit de remplacer $t$ par n'importe quelle valeur dans les trois équations. Par simplicité, prenons $t = 0$. On obtient alors :
48
48
 
49
- $$
50
- \\left\\{\\begin{matrix}
49
+ $$\\left\\{\\begin{matrix}
51
50
  x=${detailedEquations[0].toTex()} \\\\
52
51
  y=${detailedEquations[1].toTex()} \\\\
53
52
  z=${detailedEquations[2].toTex()}
@@ -1 +1 @@
1
- {"version":3,"file":"averageEvolutionRate.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/percent/averageEvolutionRate.ts"],"names":[],"mappings":"AAGA,OAAO,EACL,QAAQ,EAQT,MAAM,gBAAgB,CAAC;AAGxB,KAAK,WAAW,GAAG;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC;AA0EF,eAAO,MAAM,oBAAoB,EAAE,QAAQ,CAAC,WAAW,CActD,CAAC"}
1
+ {"version":3,"file":"averageEvolutionRate.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/percent/averageEvolutionRate.ts"],"names":[],"mappings":"AAGA,OAAO,EACL,QAAQ,EAYT,MAAM,gBAAgB,CAAC;AAGxB,KAAK,WAAW,GAAG;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC;AAgGF,eAAO,MAAM,oBAAoB,EAAE,QAAQ,CAAC,WAAW,CAkBtD,CAAC"}
@@ -6,38 +6,57 @@ const round_1 = require("../../../math/utils/round");
6
6
  const shuffle_1 = require("../../../utils/alea/shuffle");
7
7
  const exercise_1 = require("../../exercise");
8
8
  const getDistinctQuestions_1 = require("../../utils/getDistinctQuestions");
9
- const getAverageEvolutionRate = () => {
10
- const rate = (0, randint_1.randint)(1, 100);
11
- const nbMois = (0, randint_1.randint)(2, 13);
12
- const instruction = `Un prix augmente de $${rate}\\%$ en $${nbMois}$ mois. Quel est le taux d'évolution mensuel moyen (arrondir au centième de pourcentage) ?`;
9
+ const getInstruction = (identifiers) => {
10
+ const { rate, nbMois } = identifiers;
11
+ return `Un prix augmente de $${rate}\\%$ en $${nbMois}$ mois. Quel est le taux d'évolution mensuel moyen ? Arrondir au centième de pourcentage.`;
12
+ };
13
+ const getAnswer = (identifiers) => {
14
+ const { rate, nbMois } = identifiers;
13
15
  const answer = (0, round_1.round)((Math.pow(1 + rate / 100, 1 / nbMois) - 1) * 100, 2);
14
16
  const answerTex = (answer + "").replace(".", ",") + `\\%`;
15
- const question = {
16
- instruction,
17
- answer: answerTex,
18
- keys: ["percent"],
19
- answerFormat: "tex",
20
- identifiers: { nbMois, rate },
21
- hint: `Commence par déterminer le coefficient multiplicateur assoicié à une hausse de $${rate}\\%$. Puis, élève ce coefficient à la puissance $\\frac{1}{${nbMois}}$. Enfin, transforme le coefficient multiplicateur obtenu en taux d'évolution.`,
22
- correction: `Le coefficient multiplicateur associé à une hausse de $${rate}\\%$ est :
17
+ return answerTex;
18
+ };
19
+ const getHint = (identifiers) => {
20
+ const { rate, nbMois } = identifiers;
21
+ return `Commence par déterminer le coefficient multiplicateur assoicié à une hausse de $${rate}\\%$. Puis, élève ce coefficient à la puissance $\\frac{1}{${nbMois}}$. Enfin, transforme le coefficient multiplicateur obtenu en taux d'évolution.`;
22
+ };
23
+ const getCorrection = (identifiers) => {
24
+ const { rate, nbMois } = identifiers;
25
+ const answer = getAnswer(identifiers);
26
+ const cm = (0, round_1.round)(1 + rate / 100, 2);
27
+ const answerNoPercent = answer.split("\\%")[0];
28
+ return `Le coefficient multiplicateur associé à une hausse de $${rate}\\%$ est :
23
29
 
24
30
  $$
25
- 1+\\frac{${rate}}{100} = ${(1 + rate / 100).frenchify()}
31
+ 1+\\frac{${rate}}{100} = ${cm.frenchify()}
26
32
  $$
27
33
 
28
34
  Le coefficient multiplicateur moyen pour chaque mois sur une période de $${nbMois}$ mois est donc de :
29
35
 
30
- $$\\left(${(1 +
31
- rate / 100).frenchify()}\\right)^{\\frac{1}{${nbMois}}} = ${(0, round_1.round)(Math.pow(1 + rate / 100, 1 / nbMois), 4).frenchify()}
36
+ $$
37
+ ${cm.frenchify()}^{\\frac{1}{${nbMois}}} = ${(0, round_1.round)(Math.pow(cm, 1 / nbMois), 4).frenchify()}
32
38
  $$
33
39
 
34
40
  On transforme alors ce coefficient multiplicateur en taux d'évolution :
35
41
 
36
42
  $$
37
- t = (${(0, round_1.round)(Math.pow(1 + rate / 100, 1 / nbMois), 4).frenchify()}-1)\\times 100 = ${answer.frenchify()}
43
+ t = (${(0, round_1.round)(Math.pow(cm, 1 / nbMois), 4).frenchify()}-1)\\times 100 = ${answerNoPercent}
38
44
  $$
39
45
 
40
- Le taux d'évoution mensuel moyen est donc de $${answerTex}$.`,
46
+ Le taux d'évoution mensuel moyen est donc de $${answer}$.`;
47
+ };
48
+ const getAverageEvolutionRate = () => {
49
+ const rate = (0, randint_1.randint)(1, 100);
50
+ const nbMois = (0, randint_1.randint)(2, 13);
51
+ const identifiers = { nbMois, rate };
52
+ const question = {
53
+ instruction: getInstruction(identifiers),
54
+ answer: getAnswer(identifiers),
55
+ keys: ["percent"],
56
+ answerFormat: "tex",
57
+ identifiers,
58
+ hint: getHint(identifiers),
59
+ correction: getCorrection(identifiers),
41
60
  };
42
61
  return question;
43
62
  };
@@ -73,4 +92,8 @@ exports.averageEvolutionRate = {
73
92
  isAnswerValid,
74
93
  subject: "Mathématiques",
75
94
  hasHintAndCorrection: true,
95
+ getCorrection,
96
+ getAnswer,
97
+ getInstruction,
98
+ getHint,
76
99
  };
@@ -40,7 +40,7 @@ Le taux d'évolution est donc de $${answer}$.
40
40
  const getPropositions = (n, { answer, evolution }) => {
41
41
  const propositions = [];
42
42
  (0, exercise_1.addValidProp)(propositions, answer);
43
- (0, exercise_1.tryToAddWrongProp)(propositions, "+" + ((0, round_1.round)(1 + evolution / 100, 2) * 100 + "\\%").replaceAll(".", ","));
43
+ (0, exercise_1.tryToAddWrongProp)(propositions, "+" + ((0, round_1.round)(100 + evolution, 2) + "\\%").replaceAll(".", ","));
44
44
  while (propositions.length < n) {
45
45
  const wrongAnswer = ((0, coinFlip_1.coinFlip)() ? "+" : "-") + (0, randint_1.randint)(1, 100) + "\\%";
46
46
  (0, exercise_1.tryToAddWrongProp)(propositions, wrongAnswer);
@@ -1 +1 @@
1
- {"version":3,"file":"inequalityToInterval.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/sets/intervals/inequalityToInterval.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAUT,MAAM,0BAA0B,CAAC;AAQlC,OAAO,EAGL,uBAAuB,EACxB,MAAM,oCAAoC,CAAC;AAI5C,KAAK,WAAW,GAAG;IAIjB,mBAAmB,EAAE,uBAAuB,CAAC;CAC9C,CAAC;AA2FF,eAAO,MAAM,oBAAoB,EAAE,QAAQ,CAAC,WAAW,CAetD,CAAC"}
1
+ {"version":3,"file":"inequalityToInterval.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/sets/intervals/inequalityToInterval.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAYT,MAAM,0BAA0B,CAAC;AAQlC,OAAO,EAGL,uBAAuB,EACxB,MAAM,oCAAoC,CAAC;AAI5C,KAAK,WAAW,GAAG;IAIjB,mBAAmB,EAAE,uBAAuB,CAAC;CAC9C,CAAC;AAwGF,eAAO,MAAM,oBAAoB,EAAE,QAAQ,CAAC,WAAW,CAiBtD,CAAC"}
@@ -26,17 +26,24 @@ const rebuildIdentifiers = (oldIds) => {
26
26
  const interval = new intervalNode_1.IntervalNode(a, b, closure);
27
27
  return { intervalIdentifiers: interval.toIdentifiers() };
28
28
  };
29
- const getInequalityToIntervalQuestion = () => {
30
- const interval = intervalNode_1.IntervalNodeConstructor.random();
29
+ const getInstruction = (identifiers) => {
30
+ const interval = intervalNode_1.IntervalNodeConstructor.fromIdentifiers(identifiers.intervalIdentifiers);
31
31
  const inequality = interval.toInequality();
32
+ return `Soit $${inequality.toTex()}$. Traduire cette inégalité en appartenance à un intervalle.`;
33
+ };
34
+ const getAnswer = (identifiers) => {
35
+ const interval = intervalNode_1.IntervalNodeConstructor.fromIdentifiers(identifiers.intervalIdentifiers);
32
36
  const answer = `x\\in\\ ${interval.toTex()}`;
33
- const instruction = `Soit $${inequality.toTex()}$. Traduire cette inégalité en appartenance à un intervalle.`;
37
+ return answer;
38
+ };
39
+ const getInequalityToIntervalQuestion = () => {
40
+ const interval = intervalNode_1.IntervalNodeConstructor.random();
34
41
  const identifiers = {
35
42
  intervalIdentifiers: interval.toIdentifiers(),
36
43
  };
37
44
  const question = {
38
- answer,
39
- instruction: instruction,
45
+ answer: getAnswer(identifiers),
46
+ instruction: getInstruction(identifiers),
40
47
  keys: [
41
48
  "x",
42
49
  "belongs",
@@ -89,4 +96,6 @@ exports.inequalityToInterval = {
89
96
  isAnswerValid,
90
97
  subject: "Mathématiques",
91
98
  rebuildIdentifiers,
99
+ getAnswer,
100
+ getInstruction,
92
101
  };
@@ -1 +1 @@
1
- {"version":3,"file":"intervalToInequality.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/sets/intervals/intervalToInequality.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAYT,MAAM,0BAA0B,CAAC;AAWlC,OAAO,EAGL,uBAAuB,EACxB,MAAM,oCAAoC,CAAC;AAK5C,KAAK,WAAW,GAAG;IAIjB,mBAAmB,EAAE,uBAAuB,CAAC;CAC9C,CAAC;AAsFF,eAAO,MAAM,oBAAoB,EAAE,QAAQ,CAAC,WAAW,CAetD,CAAC"}
1
+ {"version":3,"file":"intervalToInequality.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/sets/intervals/intervalToInequality.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAYT,MAAM,0BAA0B,CAAC;AAWlC,OAAO,EAGL,uBAAuB,EACxB,MAAM,oCAAoC,CAAC;AAK5C,KAAK,WAAW,GAAG;IAIjB,mBAAmB,EAAE,uBAAuB,CAAC;CAC9C,CAAC;AAsFF,eAAO,MAAM,oBAAoB,EAAE,QAAQ,CAAC,WAAW,CAiBtD,CAAC"}
@@ -79,4 +79,6 @@ exports.intervalToInequality = {
79
79
  isAnswerValid,
80
80
  subject: "Mathématiques",
81
81
  rebuildIdentifiers,
82
+ getAnswer,
83
+ getInstruction,
82
84
  };
@@ -1 +1 @@
1
- {"version":3,"file":"degreeToRadians.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/trigonometry/degreeToRadians.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAkBT,MAAM,0BAA0B,CAAC;AAclC,KAAK,WAAW,GAAG;IACjB,MAAM,EAAE,MAAM,CAAC;IACf,aAAa,EAAE,GAAG,CAAC;IACnB,gBAAgB,EAAE,OAAO,CAAC;CAC3B,CAAC;AAkJF,eAAO,MAAM,eAAe,EAAE,QAAQ,CAAC,WAAW,CAiBjD,CAAC"}
1
+ {"version":3,"file":"degreeToRadians.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/trigonometry/degreeToRadians.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAkBT,MAAM,0BAA0B,CAAC;AAgBlC,KAAK,WAAW,GAAG;IACjB,MAAM,EAAE,MAAM,CAAC;IACf,aAAa,EAAE,GAAG,CAAC;IACnB,gBAAgB,EAAE,OAAO,CAAC;CAC3B,CAAC;AAwJF,eAAO,MAAM,eAAe,EAAE,QAAQ,CAAC,WAAW,CAiBjD,CAAC"}
@@ -10,6 +10,8 @@ const nodeConstructor_1 = require("../../../tree/nodes/nodeConstructor");
10
10
  const piNode_1 = require("../../../tree/nodes/numbers/piNode");
11
11
  const fractionNode_1 = require("../../../tree/nodes/operators/fractionNode");
12
12
  const multiplyNode_1 = require("../../../tree/nodes/operators/multiplyNode");
13
+ const degreeParser_1 = require("../../../tree/parsers/degreeParser");
14
+ const latexParser_1 = require("../../../tree/parsers/latexParser");
13
15
  const coinFlip_1 = require("../../../utils/alea/coinFlip");
14
16
  const random_1 = require("../../../utils/alea/random");
15
17
  const getPropositions = (n, { answer, isDegreeToRadian }) => {
@@ -76,13 +78,22 @@ const getKeys = (identifiers) => {
76
78
  return ["pi", "degree"];
77
79
  };
78
80
  const isAnswerValid = (ans, { answer, degree, isDegreeToRadian, radianNodeIds }) => {
79
- if (isDegreeToRadian) {
80
- return nodeConstructor_1.NodeConstructor.fromIdentifiers(radianNodeIds)
81
- .toAllValidTexs()
82
- .includes(ans);
81
+ try {
82
+ if (isDegreeToRadian) {
83
+ const parsed = (0, latexParser_1.parseAlgebraic)(ans);
84
+ if (!parsed)
85
+ return false;
86
+ return parsed.simplify({ decimalToFractions: true }).toTex() === answer;
87
+ }
88
+ else {
89
+ const parsed = (0, degreeParser_1.degreeParser)(ans, true);
90
+ if (!parsed)
91
+ return false;
92
+ return parsed === answer;
93
+ }
83
94
  }
84
- else {
85
- return new degree_1.DegreeNode(degree).toAllValidTexs().includes(ans);
95
+ catch (err) {
96
+ return false;
86
97
  }
87
98
  };
88
99
  const getIdentifiers = (prevIds) => {
package/lib/index.d.ts CHANGED
@@ -919,6 +919,12 @@ declare const mathExercises: (Exercise<{
919
919
  q: import("./tree/nodes/nodeConstructor").NodeIdentifiers;
920
920
  a: number;
921
921
  }, {}> | Exercise<{
922
+ affine1Ids: import("./math/polynomials/generalAffine").GeneralAffineIdentifiers;
923
+ affine2Ids: import("./math/polynomials/generalAffine").GeneralAffineIdentifiers;
924
+ isAskingPositive: boolean;
925
+ }, {
926
+ instructionType: string;
927
+ }> | Exercise<{
922
928
  coin: boolean;
923
929
  radius: number;
924
930
  diametre: number;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAG1D,OAAO,yBAAyB,CAAC;AAEjC,QAAA,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;SAA6B,CAAC;AAE/C,OAAO,EAAE,aAAa,EAAE,WAAW,EAAE,QAAQ,EAAE,QAAQ,EAAE,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"parametricLine.d.ts","sourceRoot":"","sources":["../../../src/math/geometry/parametricLine.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,gCAAgC,CAAC;AAI/D,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,WAAW,EAA0B,MAAM,eAAe,CAAC;AAEpE,qBAAa,cAAc;IACzB,UAAU,EAAE,UAAU,CAAC;IACvB,MAAM,EAAE,WAAW,CAAC;IACpB,SAAS,EAAE,aAAa,EAAE,CAAC;gBACf,UAAU,EAAE,UAAU,EAAE,MAAM,EAAE,WAAW;IAavD,oBAAoB,CAAC,CAAC,EAAE,aAAa;IAIrC,cAAc,CAAC,CAAC,EAAE,aAAa;IAG/B,QAAQ,CAAC,CAAC,EAAE,aAAa;IAKzB,QAAQ,CAAC,CAAC,EAAE,UAAU;IAYtB,KAAK;CAUN"}
1
+ {"version":3,"file":"parametricLine.d.ts","sourceRoot":"","sources":["../../../src/math/geometry/parametricLine.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,gCAAgC,CAAC;AAI/D,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,WAAW,EAA0B,MAAM,eAAe,CAAC;AAEpE,qBAAa,cAAc;IACzB,UAAU,EAAE,UAAU,CAAC;IACvB,MAAM,EAAE,WAAW,CAAC;IACpB,SAAS,EAAE,aAAa,EAAE,CAAC;gBACf,UAAU,EAAE,UAAU,EAAE,MAAM,EAAE,WAAW;IAavD,oBAAoB,CAAC,CAAC,EAAE,aAAa;IAIrC,cAAc,CAAC,CAAC,EAAE,aAAa;IAG/B,QAAQ,CAAC,CAAC,EAAE,aAAa;IAKzB,QAAQ,CAAC,CAAC,EAAE,UAAU;IAYtB,KAAK;CAQN"}
@@ -33,14 +33,12 @@ class ParametricLine {
33
33
  return vector1.isColinear(vector2);
34
34
  }
35
35
  toTex() {
36
- return `
37
- \\left\\{\\begin{matrix}
36
+ return `\\left\\{\\begin{matrix}
38
37
  x=${this.equations[0].toTex()} \\\\
39
38
  y=${this.equations[1].toTex()} \\\\
40
39
  z=${this.equations[2].toTex()}
41
40
  \\end{matrix}
42
- \\right.
43
- `;
41
+ \\right.`;
44
42
  }
45
43
  }
46
44
  exports.ParametricLine = ParametricLine;
@@ -1,5 +1,6 @@
1
1
  import { AlgebraicNode } from "../../tree/nodes/algebraicNode";
2
2
  import { NodeIdentifiers } from "../../tree/nodes/nodeConstructor";
3
+ import { IntervalNode } from "../../tree/nodes/sets/intervalNode";
3
4
  export declare abstract class GeneralAffineConstructor {
4
5
  static fromIdentifiers(identifiers: GeneralAffineIdentifiers): GeneralAffine;
5
6
  static randomInts({ allowBNull }: {
@@ -19,6 +20,8 @@ export declare class GeneralAffine {
19
20
  constructor(a: number | AlgebraicNode, b: number | AlgebraicNode, variable?: string);
20
21
  toIdentifiers(): GeneralAffineIdentifiers;
21
22
  getRoot(): AlgebraicNode;
23
+ getPositiveInterval(): IntervalNode;
24
+ getNegativeInterval(): IntervalNode;
22
25
  toTree(): import("../../tree/nodes/operators/addNode").AddNode | import("../../tree/nodes/operators/multiplyNode").MultiplyNode;
23
26
  xIntersect(aff: GeneralAffine): AlgebraicNode | undefined;
24
27
  opposite(): GeneralAffine;
@@ -1 +1 @@
1
- {"version":3,"file":"generalAffine.d.ts","sourceRoot":"","sources":["../../../src/math/polynomials/generalAffine.ts"],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Q,CAAC;IACb,CAAC,EAAE,eAAe,CAAC;IACnB,CAAC,EAAE,eAAe,CAAC;IACnB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB,CAAC;AACF,qBAAa,aAAa;IACxB,CAAC,EAAE,aAAa,CAAC;IACjB,CAAC,EAAE,aAAa,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;gBAGf,CAAC,EAAE,MAAM,GAAG,aAAa,EACzB,CAAC,EAAE,MAAM,GAAG,aAAa,EACzB,QAAQ,GAAE,MAAY;IAUxB,aAAa,IAAI,wBAAwB;IAQzC,OAAO,IAAI,aAAa;IAGxB,mBAAmB,IAAI,YAAY;IAQnC,mBAAmB,IAAI,YAAY;IASnC,MAAM;IAMN,UAAU,CAAC,GAAG,EAAE,aAAa;IAI7B,QAAQ;CAMT"}
@@ -3,10 +3,13 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.GeneralAffine = exports.GeneralAffineConstructor = void 0;
4
4
  const oppositeNode_1 = require("../../tree/nodes/functions/oppositeNode");
5
5
  const nodeConstructor_1 = require("../../tree/nodes/nodeConstructor");
6
+ const infiniteNode_1 = require("../../tree/nodes/numbers/infiniteNode");
6
7
  const addNode_1 = require("../../tree/nodes/operators/addNode");
7
8
  const fractionNode_1 = require("../../tree/nodes/operators/fractionNode");
8
9
  const multiplyNode_1 = require("../../tree/nodes/operators/multiplyNode");
9
10
  const substractNode_1 = require("../../tree/nodes/operators/substractNode");
11
+ const closure_1 = require("../../tree/nodes/sets/closure");
12
+ const intervalNode_1 = require("../../tree/nodes/sets/intervalNode");
10
13
  const randint_1 = require("../utils/random/randint");
11
14
  class GeneralAffineConstructor {
12
15
  static fromIdentifiers(identifiers) {
@@ -42,6 +45,24 @@ class GeneralAffine {
42
45
  getRoot() {
43
46
  return (0, fractionNode_1.frac)((0, oppositeNode_1.opposite)(this.b), this.a).simplify();
44
47
  }
48
+ getPositiveInterval() {
49
+ const root = this.getRoot();
50
+ if (this.a.evaluate() > 0) {
51
+ return new intervalNode_1.IntervalNode(root, infiniteNode_1.PlusInfinityNode, closure_1.ClosureType.OO);
52
+ }
53
+ else {
54
+ return new intervalNode_1.IntervalNode(infiniteNode_1.MinusInfinityNode, root, closure_1.ClosureType.OO);
55
+ }
56
+ }
57
+ getNegativeInterval() {
58
+ const root = this.getRoot();
59
+ if (this.a.evaluate() < 0) {
60
+ return new intervalNode_1.IntervalNode(root, infiniteNode_1.PlusInfinityNode, closure_1.ClosureType.OO);
61
+ }
62
+ else {
63
+ return new intervalNode_1.IntervalNode(infiniteNode_1.MinusInfinityNode, root, closure_1.ClosureType.OO);
64
+ }
65
+ }
45
66
  toTree() {
46
67
  const monom = (0, multiplyNode_1.multiply)(this.a, this.variable);
47
68
  if (this.b.evaluate() === 0)
@@ -1 +1 @@
1
- {"version":3,"file":"playground.d.ts","sourceRoot":"","sources":["../src/playground.ts"],"names":[],"mappings":"AAsDA,eAAO,MAAM,UAAU,YAGtB,CAAC"}
1
+ {"version":3,"file":"playground.d.ts","sourceRoot":"","sources":["../src/playground.ts"],"names":[],"mappings":"AAwDA,eAAO,MAAM,UAAU,YAAW,CAAC"}
package/lib/playground.js CHANGED
@@ -1,13 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.playground = void 0;
4
- const sqrtNode_1 = require("./tree/nodes/functions/sqrtNode");
5
4
  const nodeConstructor_1 = require("./tree/nodes/nodeConstructor");
6
- const multiplyNode_1 = require("./tree/nodes/operators/multiplyNode");
7
- const playground = () => {
8
- const a = (0, multiplyNode_1.multiply)(3, (0, sqrtNode_1.sqrt)(2));
9
- console.log(a.simplify().toTex());
10
- };
5
+ const playground = () => { };
11
6
  exports.playground = playground;
12
7
  const logIdentifiers = () => {
13
8
  const ids = '{"xA":-3,"yA":-2,"yPrimeA":{"id":31,"child":{"id":3,"leftChild":{"id":7,"value":3},"rightChild":{"id":7,"value":2}}},"trinomCoeffs":[0.3888888888888889,0.833333333333333,-3]}';
@@ -7,6 +7,7 @@ export type SimplifyOptions = {
7
7
  isDegree?: boolean;
8
8
  towardsDistribute?: boolean;
9
9
  decimalToFractions?: boolean;
10
+ forceIsolateMonomCoeffs?: boolean;
10
11
  };
11
12
  export interface AlgebraicNode extends Node {
12
13
  evaluate: (vars?: Record<string, number>) => number;
@@ -1 +1 @@
1
- {"version":3,"file":"algebraicNode.d.ts","sourceRoot":"","sources":["../../../src/tree/nodes/algebraicNode.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,WAAW,EAAE,MAAM,QAAQ,CAAC;AAE3C,MAAM,MAAM,eAAe,GAAG;IAC5B,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,wBAAwB,CAAC,EAAE,OAAO,CAAC;IACnC,UAAU,CAAC,EAAE,OAAO,CAAC;IAErB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,kBAAkB,CAAC,EAAE,OAAO,CAAC;CAC9B,CAAC;AACF,MAAM,WAAW,aAAc,SAAQ,IAAI;IACzC,QAAQ,EAAE,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,KAAK,MAAM,CAAC;IACpD,oBAAoB,EAAE,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,aAAa,CAAC,KAAK,aAAa,CAAC;IAC7E,iBAAiB,EAAE,CAAC,IAAI,CAAC,EAAE,WAAW,KAAK,aAAa,EAAE,CAAC;IAC3D,QAAQ,EAAE,CAAC,IAAI,CAAC,EAAE,eAAe,KAAK,aAAa,CAAC;IACpD,MAAM,EAAE,CAAC,IAAI,EAAE,aAAa,KAAK,OAAO,CAAC;IACzC,SAAS,EAAE,OAAO,CAAC;IACnB,UAAU,EAAE,CAAC,OAAO,CAAC,EAAE,MAAM,KAAK,aAAa,CAAC;CACjD;AAED,eAAO,MAAM,eAAe,SAAU,IAAI,0BACA,CAAC"}
1
+ {"version":3,"file":"algebraicNode.d.ts","sourceRoot":"","sources":["../../../src/tree/nodes/algebraicNode.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,WAAW,EAAE,MAAM,QAAQ,CAAC;AAE3C,MAAM,MAAM,eAAe,GAAG;IAC5B,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,wBAAwB,CAAC,EAAE,OAAO,CAAC;IACnC,UAAU,CAAC,EAAE,OAAO,CAAC;IAErB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAC7B,uBAAuB,CAAC,EAAE,OAAO,CAAC;CACnC,CAAC;AACF,MAAM,WAAW,aAAc,SAAQ,IAAI;IACzC,QAAQ,EAAE,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,KAAK,MAAM,CAAC;IACpD,oBAAoB,EAAE,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,aAAa,CAAC,KAAK,aAAa,CAAC;IAC7E,iBAAiB,EAAE,CAAC,IAAI,CAAC,EAAE,WAAW,KAAK,aAAa,EAAE,CAAC;IAC3D,QAAQ,EAAE,CAAC,IAAI,CAAC,EAAE,eAAe,KAAK,aAAa,CAAC;IACpD,MAAM,EAAE,CAAC,IAAI,EAAE,aAAa,KAAK,OAAO,CAAC;IACzC,SAAS,EAAE,OAAO,CAAC;IACnB,UAAU,EAAE,CAAC,OAAO,CAAC,EAAE,MAAM,KAAK,aAAa,CAAC;CACjD;AAED,eAAO,MAAM,eAAe,SAAU,IAAI,0BACA,CAAC"}
@@ -24,7 +24,7 @@ export declare class EquationSolutionNode implements Node {
24
24
  toEquivalentNodes(opts?: NodeOptions): EquationSolutionNode[];
25
25
  toMathString(): string;
26
26
  toTex(): string;
27
- simplify(): this;
27
+ simplify(): EquationSolutionNode;
28
28
  }
29
29
  export {};
30
30
  //# sourceMappingURL=equationSolutionNode.d.ts.map