math-exercises 3.0.87 → 3.0.89

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 (93) hide show
  1. package/lib/exercises/exercise.d.ts +1 -1
  2. package/lib/exercises/exercise.d.ts.map +1 -1
  3. package/lib/exercises/math/calcul/arithmetics/findZeroesProductQuotient.d.ts +11 -0
  4. package/lib/exercises/math/calcul/arithmetics/findZeroesProductQuotient.d.ts.map +1 -0
  5. package/lib/exercises/math/calcul/arithmetics/findZeroesProductQuotient.js +213 -0
  6. package/lib/exercises/math/calcul/arithmetics/index.d.ts +1 -0
  7. package/lib/exercises/math/calcul/arithmetics/index.d.ts.map +1 -1
  8. package/lib/exercises/math/calcul/arithmetics/index.js +1 -0
  9. package/lib/exercises/math/functions/basics/index.d.ts +2 -0
  10. package/lib/exercises/math/functions/basics/index.d.ts.map +1 -1
  11. package/lib/exercises/math/functions/basics/index.js +3 -0
  12. package/lib/exercises/math/functions/basics/signOfFunction.d.ts +8 -0
  13. package/lib/exercises/math/functions/basics/signOfFunction.d.ts.map +1 -0
  14. package/lib/exercises/math/functions/basics/signOfFunction.js +122 -0
  15. package/lib/exercises/math/functions/basics/valueTableFromGraph.d.ts +8 -0
  16. package/lib/exercises/math/functions/basics/valueTableFromGraph.d.ts.map +1 -0
  17. package/lib/exercises/math/functions/basics/valueTableFromGraph.js +139 -0
  18. package/lib/exercises/math/functions/square/squareImageInterval.d.ts.map +1 -1
  19. package/lib/exercises/math/functions/square/squareImageInterval.js +7 -1
  20. package/lib/exercises/math/geometry/vectors/colinearity/alignementViaColinearity.d.ts +12 -0
  21. package/lib/exercises/math/geometry/vectors/colinearity/alignementViaColinearity.d.ts.map +1 -0
  22. package/lib/exercises/math/geometry/vectors/colinearity/alignementViaColinearity.js +127 -0
  23. package/lib/exercises/math/geometry/vectors/colinearity/colinearity.d.ts +11 -0
  24. package/lib/exercises/math/geometry/vectors/colinearity/colinearity.d.ts.map +1 -0
  25. package/lib/exercises/math/geometry/vectors/colinearity/colinearity.js +118 -0
  26. package/lib/exercises/math/geometry/vectors/colinearity/colinearityFromBasis.d.ts +11 -0
  27. package/lib/exercises/math/geometry/vectors/colinearity/colinearityFromBasis.d.ts.map +1 -0
  28. package/lib/exercises/math/geometry/vectors/colinearity/colinearityFromBasis.js +158 -0
  29. package/lib/exercises/math/geometry/vectors/colinearity/index.d.ts +4 -0
  30. package/lib/exercises/math/geometry/vectors/colinearity/index.d.ts.map +1 -0
  31. package/lib/exercises/math/geometry/vectors/colinearity/index.js +3 -0
  32. package/lib/exercises/math/geometry/vectors/distributeAndReduceVectors.d.ts +9 -0
  33. package/lib/exercises/math/geometry/vectors/distributeAndReduceVectors.d.ts.map +1 -0
  34. package/lib/exercises/math/geometry/vectors/distributeAndReduceVectors.js +155 -0
  35. package/lib/exercises/math/geometry/vectors/index.d.ts +1 -2
  36. package/lib/exercises/math/geometry/vectors/index.d.ts.map +1 -1
  37. package/lib/exercises/math/geometry/vectors/index.js +2 -2
  38. package/lib/exercises/math/index.d.ts +1 -0
  39. package/lib/exercises/math/index.d.ts.map +1 -1
  40. package/lib/exercises/math/index.js +1 -0
  41. package/lib/exercises/math/percent/evolutions/globalCM.d.ts +7 -0
  42. package/lib/exercises/math/percent/evolutions/globalCM.d.ts.map +1 -0
  43. package/lib/exercises/math/percent/evolutions/globalCM.js +89 -0
  44. package/lib/exercises/math/percent/evolutions/index.d.ts +1 -0
  45. package/lib/exercises/math/percent/evolutions/index.d.ts.map +1 -1
  46. package/lib/exercises/math/percent/evolutions/index.js +1 -0
  47. package/lib/exercises/math/percent/index.d.ts +1 -0
  48. package/lib/exercises/math/percent/index.d.ts.map +1 -1
  49. package/lib/exercises/math/percent/index.js +1 -0
  50. package/lib/exercises/math/percent/percentOfPercent.d.ts +8 -0
  51. package/lib/exercises/math/percent/percentOfPercent.d.ts.map +1 -0
  52. package/lib/exercises/math/percent/percentOfPercent.js +89 -0
  53. package/lib/exercises/math/primitive/polynomialPrimitive.d.ts.map +1 -1
  54. package/lib/exercises/math/primitive/polynomialPrimitive.js +10 -1
  55. package/lib/exercises/math/probaStat/basicProbas/rouletteProbas.js +1 -1
  56. package/lib/exercises/math/python/variableAffectation.js +2 -2
  57. package/lib/exercises/math/tests/index.d.ts +4 -0
  58. package/lib/exercises/math/tests/index.d.ts.map +1 -0
  59. package/lib/exercises/math/tests/index.js +3 -0
  60. package/lib/exercises/math/tests/testMultiLineSignTable.d.ts +9 -0
  61. package/lib/exercises/math/tests/testMultiLineSignTable.d.ts.map +1 -0
  62. package/lib/exercises/math/tests/testMultiLineSignTable.js +156 -0
  63. package/lib/exercises/math/tests/testSignTable.d.ts +8 -0
  64. package/lib/exercises/math/tests/testSignTable.d.ts.map +1 -0
  65. package/lib/exercises/math/tests/testSignTable.js +90 -0
  66. package/lib/exercises/math/tests/testVarTable.d.ts +11 -0
  67. package/lib/exercises/math/tests/testVarTable.d.ts.map +1 -0
  68. package/lib/exercises/math/tests/testVarTable.js +147 -0
  69. package/lib/exercises/math/trigonometry/index.d.ts +1 -0
  70. package/lib/exercises/math/trigonometry/index.d.ts.map +1 -1
  71. package/lib/exercises/math/trigonometry/index.js +1 -0
  72. package/lib/exercises/math/trigonometry/trigoFundamentalEquation.d.ts +9 -0
  73. package/lib/exercises/math/trigonometry/trigoFundamentalEquation.d.ts.map +1 -0
  74. package/lib/exercises/math/trigonometry/trigoFundamentalEquation.js +151 -0
  75. package/lib/geogebra/spline.d.ts +2 -1
  76. package/lib/geogebra/spline.d.ts.map +1 -1
  77. package/lib/geogebra/spline.js +39 -1
  78. package/lib/index.d.ts +50 -12
  79. package/lib/index.d.ts.map +1 -1
  80. package/lib/latexTester.js +2 -0
  81. package/lib/math/numbers/reals/real.d.ts.map +1 -1
  82. package/lib/math/numbers/reals/real.js +7 -2
  83. package/lib/tests/exoTest.d.ts.map +1 -1
  84. package/lib/tests/exoTest.js +9 -3
  85. package/lib/tests/questionTest.d.ts.map +1 -1
  86. package/lib/tests/questionTest.js +19 -10
  87. package/lib/tree/nodes/operators/addNode.d.ts.map +1 -1
  88. package/lib/tree/nodes/operators/addNode.js +3 -1
  89. package/lib/tree/parsers/latexParser.d.ts.map +1 -1
  90. package/lib/tree/parsers/latexParser.js +10 -0
  91. package/lib/types/keyIds.d.ts +1 -1
  92. package/lib/types/keyIds.d.ts.map +1 -1
  93. package/package.json +1 -1
@@ -0,0 +1,147 @@
1
+ import { addValidProp, shuffleProps, } from "../../../exercises/exercise.js";
2
+ import { getDistinctQuestions } from "../../../exercises/utils/getDistinctQuestions.js";
3
+ import { GeogebraConstructor } from "../../../geogebra/geogebraConstructor.js";
4
+ import { randint } from "../../../math/utils/random/randint.js";
5
+ import { handleVEAError } from "../../../utils/errors/handleVEAError.js";
6
+ const getFunc = (identifiers) => {
7
+ const { k, x1, x2, C } = identifiers;
8
+ return (x) => 2 * k * x ** 3 - 3 * k * (x1 + x2) * x ** 2 + 6 * x1 * x2 * k * x + C;
9
+ };
10
+ const getPropositions = (n, { answer }) => {
11
+ const propositions = [];
12
+ addValidProp(propositions, answer);
13
+ while (propositions.length < n) {
14
+ throw Error("QCM not implemented");
15
+ }
16
+ return shuffleProps(propositions, n);
17
+ };
18
+ const getGGBOptions = (identifiers) => {
19
+ const { k, x1, x2, C } = identifiers;
20
+ const commands = [
21
+ `f(x) = 2*${k}*x^3 - 3*${k}*(${x1}+(${x2}))*x^2 + 6*${x1}*${x2}*${k}*x + ${C}`,
22
+ ];
23
+ const ggb = new GeogebraConstructor({
24
+ commands,
25
+ });
26
+ return ggb.getOptions({
27
+ coords: [-10, 10, -10, 10],
28
+ });
29
+ };
30
+ const getAnswerTable = (identifiers) => {
31
+ const { k, x1, x2, C } = identifiers;
32
+ const fct = getFunc(identifiers);
33
+ const fx1 = fct(x1);
34
+ const fx2 = fct(x2);
35
+ const vars = k > 0
36
+ ? ["\\nearrow", "\\searrow", "\\nearrow"]
37
+ : ["\\searrow", "\\nearrow", "\\searrow"];
38
+ return [
39
+ [
40
+ "$x$",
41
+ "-\\infty",
42
+ "\\ ",
43
+ x1.toTree().toTex(),
44
+ "\\ ",
45
+ x2.toTree().toTex(),
46
+ "\\ ",
47
+ "+\\infty",
48
+ ],
49
+ [
50
+ "\\ ",
51
+ "\\ ",
52
+ "\\ ",
53
+ k > 0 ? fx1.toTree().toTex() : "\\ ",
54
+ "\\ ",
55
+ k > 0 ? "\\ " : fx2.toTree().toTex(),
56
+ "\\ ",
57
+ "\\ ",
58
+ ],
59
+ ["$f(x)$", "\\ ", vars[0], "\\ ", vars[1], "\\ ", vars[2], "\\ "],
60
+ [
61
+ "\\ ",
62
+ "\\ ",
63
+ "\\ ",
64
+ k > 0 ? fx2.toTree().toTex() : "\\ ",
65
+ "\\ ",
66
+ k > 0 ? "\\ " : fx1.toTree().toTex(),
67
+ "\\ ",
68
+ "\\ ",
69
+ ],
70
+ ];
71
+ };
72
+ const getInstruction = (identifiers) => {
73
+ return `Dresser le tableau de variations de la fonction $f$ définie sur $\\mathbb{R}$ dont la courbe représentative est donnée ci-dessous :`;
74
+ };
75
+ const getHint = (identifiers) => {
76
+ return `indice`;
77
+ };
78
+ const getCorrection = (identifiers) => {
79
+ return `correction : le tableau attendu est donc :
80
+
81
+ `;
82
+ };
83
+ const getKeys = (identifiers) => {
84
+ return ["inf"];
85
+ };
86
+ const isAnswerTableValid = (ans, { answerTable }) => {
87
+ try {
88
+ return ans.every((row, i) => row.every((cell, j) => cell === answerTable[i][j]));
89
+ }
90
+ catch (err) {
91
+ return handleVEAError(err);
92
+ }
93
+ };
94
+ const getTestSignTableQuestion = (ops) => {
95
+ const k = randint(-4, 5, [0]);
96
+ let x1 = randint(-9, 10);
97
+ let x2 = randint(-9, 10, [x1]);
98
+ if (x1 > x2)
99
+ [x1, x2] = [x2, x1];
100
+ const C = randint(-9, 10);
101
+ const initTable = [
102
+ ["$x$", "", "\\ ", "", "\\ ", "", "\\ ", ""],
103
+ ["\\ ", "\\ ", "\\ ", "\\ ", "\\ ", "\\ ", "\\ ", "\\ "],
104
+ ["$f(x)$", "\\ ", "", "", "", "", "", "\\ "],
105
+ ["\\ ", "\\ ", "\\ ", "\\ ", "\\ ", "\\ ", "\\ ", "\\ "],
106
+ ];
107
+ const identifiers = {
108
+ k,
109
+ x1,
110
+ x2,
111
+ C,
112
+ initTable,
113
+ };
114
+ return getQuestionFromIdentifiers(identifiers);
115
+ };
116
+ const getQuestionFromIdentifiers = (identifiers) => {
117
+ return {
118
+ answerTable: getAnswerTable(identifiers),
119
+ instruction: getInstruction(identifiers),
120
+ keys: getKeys(identifiers),
121
+ answerFormat: "tex",
122
+ identifiers,
123
+ hint: getHint(identifiers),
124
+ correction: getCorrection(identifiers),
125
+ initTable: identifiers.initTable,
126
+ ggbOptions: getGGBOptions(identifiers),
127
+ };
128
+ };
129
+ export const testVarTable = {
130
+ id: "testVarTable",
131
+ label: "Test Tableau Variations basique",
132
+ isSingleStep: true,
133
+ generator: (nb, opts) => getDistinctQuestions(() => getTestSignTableQuestion(opts), nb),
134
+ qcmTimer: 60,
135
+ freeTimer: 60,
136
+ getPropositions,
137
+ isAnswerTableValid,
138
+ subject: "Mathématiques",
139
+ getInstruction,
140
+ getHint,
141
+ getCorrection,
142
+ getAnswerTable,
143
+ getQuestionFromIdentifiers,
144
+ hasHintAndCorrection: true,
145
+ answerType: "varTable",
146
+ hasGeogebra: true,
147
+ };
@@ -13,4 +13,5 @@ export * from "./mainAngleMeasure.js";
13
13
  export * from "./degreeToRadians.js";
14
14
  export * from "./arcLength.js";
15
15
  export * from "./equationCosOnRandomInterval.js";
16
+ export * from "./trigoFundamentalEquation.js";
16
17
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/trigonometry/index.ts"],"names":[],"mappings":"AAAA,cAAc,2BAA2B,CAAC;AAC1C,cAAc,uBAAuB,CAAC;AACtC,cAAc,mBAAmB,CAAC;AAClC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,qBAAqB,CAAC;AACpC,cAAc,eAAe,CAAC;AAC9B,cAAc,4BAA4B,CAAC;AAC3C,cAAc,uBAAuB,CAAC;AACtC,cAAc,uBAAuB,CAAC;AACtC,cAAc,+BAA+B,CAAC;AAC9C,cAAc,uBAAuB,CAAC;AACtC,cAAc,sBAAsB,CAAC;AACrC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,kCAAkC,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/trigonometry/index.ts"],"names":[],"mappings":"AAAA,cAAc,2BAA2B,CAAC;AAC1C,cAAc,uBAAuB,CAAC;AACtC,cAAc,mBAAmB,CAAC;AAClC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,qBAAqB,CAAC;AACpC,cAAc,eAAe,CAAC;AAC9B,cAAc,4BAA4B,CAAC;AAC3C,cAAc,uBAAuB,CAAC;AACtC,cAAc,uBAAuB,CAAC;AACtC,cAAc,+BAA+B,CAAC;AAC9C,cAAc,uBAAuB,CAAC;AACtC,cAAc,sBAAsB,CAAC;AACrC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,kCAAkC,CAAC;AACjD,cAAc,+BAA+B,CAAC"}
@@ -13,3 +13,4 @@ export * from "./mainAngleMeasure.js";
13
13
  export * from "./degreeToRadians.js";
14
14
  export * from "./arcLength.js";
15
15
  export * from "./equationCosOnRandomInterval.js";
16
+ export * from "./trigoFundamentalEquation.js";
@@ -0,0 +1,9 @@
1
+ import { Exercise } from "../../../exercises/exercise.js";
2
+ import { NodeIdentifiers } from "../../../tree/nodes/nodeConstructor.js";
3
+ type Identifiers = {
4
+ givenValue: NodeIdentifiers;
5
+ isCosGiven: boolean;
6
+ };
7
+ export declare const trigoFundamentalEquation: Exercise<Identifiers>;
8
+ export {};
9
+ //# sourceMappingURL=trigoFundamentalEquation.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"trigoFundamentalEquation.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/trigonometry/trigoFundamentalEquation.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAeT,MAAM,6BAA6B,CAAC;AAOrC,OAAO,EACL,eAAe,EAEhB,MAAM,qCAAqC,CAAC;AAW7C,KAAK,WAAW,GAAG;IACjB,UAAU,EAAE,eAAe,CAAC;IAC5B,UAAU,EAAE,OAAO,CAAC;CACrB,CAAC;AAwIF,eAAO,MAAM,wBAAwB,EAAE,QAAQ,CAAC,WAAW,CAmB1D,CAAC"}
@@ -0,0 +1,151 @@
1
+ import { addValidProp, shuffleProps, tryToAddWrongProp, } from "../../../exercises/exercise.js";
2
+ import { getDistinctQuestions } from "../../../exercises/utils/getDistinctQuestions.js";
3
+ import { RationalConstructor } from "../../../math/numbers/rationals/rational.js";
4
+ import { randfloat } from "../../../math/utils/random/randfloat.js";
5
+ import { sqrt } from "../../../tree/nodes/functions/sqrtNode.js";
6
+ import { reifyAlgebraic, } from "../../../tree/nodes/nodeConstructor.js";
7
+ import { frac } from "../../../tree/nodes/operators/fractionNode.js";
8
+ import { square } from "../../../tree/nodes/operators/powerNode.js";
9
+ import { substract } from "../../../tree/nodes/operators/substractNode.js";
10
+ import { parseAlgebraic } from "../../../tree/parsers/latexParser.js";
11
+ import { coinFlip } from "../../../utils/alea/coinFlip.js";
12
+ import { probaFlip } from "../../../utils/alea/probaFlip.js";
13
+ import { random } from "../../../utils/alea/random.js";
14
+ import { handleVEAError } from "../../../utils/errors/handleVEAError.js";
15
+ const getPropositions = (n, { answer, givenValue }) => {
16
+ const propositions = [];
17
+ addValidProp(propositions, answer);
18
+ const value = reifyAlgebraic(givenValue);
19
+ tryToAddWrongProp(propositions, substract(1, value).simplify().toTex());
20
+ while (propositions.length < n) {
21
+ tryToAddWrongProp(propositions, randfloat(0, 1, 1).frenchify());
22
+ }
23
+ return shuffleProps(propositions, n);
24
+ };
25
+ const getAnswerNode = (identifiers) => {
26
+ const { givenValue, isCosGiven } = identifiers;
27
+ const squared = substract(1, square(reifyAlgebraic(givenValue))).simplify();
28
+ return sqrt(squared).simplify();
29
+ };
30
+ const getAnswer = (identifiers) => {
31
+ return getAnswerNode(identifiers).toTex();
32
+ };
33
+ const getInstruction = (identifiers) => {
34
+ const { givenValue, isCosGiven } = identifiers;
35
+ const node = isCosGiven
36
+ ? `\\cos(\\alpha) = ${reifyAlgebraic(givenValue).toTex()}`
37
+ : `\\sin(\\alpha) = ${reifyAlgebraic(givenValue).toTex()}`;
38
+ return `$\\alpha$ est la mesure en degrés d'un angle aigu dans un triangle rectangle.
39
+
40
+ Calculer $${isCosGiven ? "\\sin" : "\\cos"}(\\alpha)$ sachant que :
41
+
42
+ $$
43
+ ${node}
44
+ $$
45
+
46
+ Donner la valeur exacte ou une valeur arrondie au centième.`;
47
+ };
48
+ const getHint = (identifiers) => {
49
+ return `Utilise la relation :
50
+
51
+ $$
52
+ \\cos^2(\\alpha) + \\sin^2(\\alpha) = 1
53
+ $$`;
54
+ };
55
+ const getCorrection = (identifiers) => {
56
+ const { givenValue, isCosGiven } = identifiers;
57
+ const valueNode = reifyAlgebraic(givenValue);
58
+ const squareValue = square(valueNode).simplify();
59
+ const node = isCosGiven
60
+ ? `\\cos(\\alpha) = ${valueNode.toTex()}`
61
+ : `\\sin(\\alpha) = ${valueNode.toTex()}`;
62
+ const squareNode = isCosGiven
63
+ ? `\\cos^2(\\alpha) = ${squareValue.toTex()}`
64
+ : `\\sin^2(\\alpha) = ${squareValue.toTex()}`;
65
+ const fct = isCosGiven ? "\\sin" : "\\cos";
66
+ return `On utilise la relation suivante :
67
+
68
+ $$
69
+ \\cos^2(\\alpha) + \\sin^2(\\alpha) = 1
70
+ $$
71
+
72
+ Puisque $${node}$, on a donc :
73
+
74
+ $$
75
+ ${squareNode}
76
+ $$
77
+
78
+ Donc :
79
+
80
+ $$
81
+ ${fct}^2(\\alpha) = 1 - ${squareValue.toTex()} = ${substract(1, squareValue)
82
+ .simplify()
83
+ .toTex()}
84
+ $$
85
+
86
+ Puisque l'angle est aigu, on cherche une valeur positive.
87
+
88
+ On en déduit donc :
89
+
90
+ $$
91
+ ${fct}(\\alpha) = ${getAnswer(identifiers)}
92
+ $$
93
+ `;
94
+ };
95
+ const getKeys = (identifiers) => {
96
+ return [];
97
+ };
98
+ const isAnswerValid = (ans, { answer, ...identifiers }) => {
99
+ try {
100
+ const parsed = parseAlgebraic(ans);
101
+ const answerNode = getAnswerNode(identifiers);
102
+ const simp = parsed.simplify().toTex();
103
+ return (simp === answer ||
104
+ Math.abs(parsed.evaluate() - answerNode.evaluate()) < 0.01);
105
+ }
106
+ catch (err) {
107
+ return handleVEAError(err);
108
+ }
109
+ };
110
+ const getTrigoFundamentalEquationQuestion = (ops) => {
111
+ const isCosGiven = coinFlip();
112
+ const givenValue = probaFlip(0.3)
113
+ ? randfloat(0, 1, 1).toTree()
114
+ : coinFlip()
115
+ ? RationalConstructor.randomIrreductibleProba().toTree()
116
+ : frac(sqrt(random([2, 3])), 2);
117
+ const identifiers = {
118
+ isCosGiven,
119
+ givenValue: givenValue.toIdentifiers(),
120
+ };
121
+ return getQuestionFromIdentifiers(identifiers);
122
+ };
123
+ const getQuestionFromIdentifiers = (identifiers) => {
124
+ return {
125
+ answer: getAnswer(identifiers),
126
+ instruction: getInstruction(identifiers),
127
+ keys: getKeys(identifiers),
128
+ answerFormat: "tex",
129
+ identifiers,
130
+ hint: getHint(identifiers),
131
+ correction: getCorrection(identifiers),
132
+ };
133
+ };
134
+ export const trigoFundamentalEquation = {
135
+ id: "trigoFundamentalEquation",
136
+ connector: "=",
137
+ label: "Calculer le cosinus d'un angle à partir de son sinus (ou inversement)",
138
+ isSingleStep: true,
139
+ generator: (nb, opts) => getDistinctQuestions(() => getTrigoFundamentalEquationQuestion(opts), nb),
140
+ qcmTimer: 60,
141
+ freeTimer: 60,
142
+ getPropositions,
143
+ isAnswerValid,
144
+ subject: "Mathématiques",
145
+ getInstruction,
146
+ getHint,
147
+ getCorrection,
148
+ getAnswer,
149
+ getQuestionFromIdentifiers,
150
+ hasHintAndCorrection: true,
151
+ };
@@ -1,7 +1,8 @@
1
1
  import { Point } from "../math/geometry/point.js";
2
2
  import { IntervalNode } from "../tree/nodes/sets/intervalNode.js";
3
3
  export declare abstract class SplineConstructor {
4
- random(): Spline;
4
+ static random(): Spline;
5
+ static getAdequatePoints(nbOfPoints?: number): [number, number][];
5
6
  }
6
7
  export declare class Spline {
7
8
  points: number[][];
@@ -1 +1 @@
1
- {"version":3,"file":"spline.d.ts","sourceRoot":"","sources":["../../src/geogebra/spline.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,8BAA8B,CAAC;AAIrD,OAAO,EAAE,YAAY,EAAE,MAAM,uCAAuC,CAAC;AAKrE,8BAAsB,iBAAiB;IACrC,MAAM;CAQP;AACD,qBAAa,MAAM;IACjB,MAAM,EAAE,MAAM,EAAE,EAAE,CAAC;gBAEP,QAAQ,EAAE,YAAY,EAAE,MAAM,CAAC,EAAE,KAAK,EAAE;IAuDpD,WAAW;CAUZ"}
1
+ {"version":3,"file":"spline.d.ts","sourceRoot":"","sources":["../../src/geogebra/spline.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,8BAA8B,CAAC;AAIrD,OAAO,EAAE,YAAY,EAAE,MAAM,uCAAuC,CAAC;AAKrE,8BAAsB,iBAAiB;IACrC,MAAM,CAAC,MAAM;IASb,MAAM,CAAC,iBAAiB,CAAC,UAAU,SAAI;CAsCxC;AACD,qBAAa,MAAM;IACjB,MAAM,EAAE,MAAM,EAAE,EAAE,CAAC;gBAEP,QAAQ,EAAE,YAAY,EAAE,MAAM,CAAC,EAAE,KAAK,EAAE;IAuDpD,WAAW;CAUZ"}
@@ -2,14 +2,52 @@ import { randfloat } from "../math/utils/random/randfloat.js";
2
2
  import { randint } from "../math/utils/random/randint.js";
3
3
  import { ClosureType } from "../tree/nodes/sets/closure.js";
4
4
  import { IntervalNode } from "../tree/nodes/sets/intervalNode.js";
5
+ import { coinFlip } from "../utils/alea/coinFlip.js";
5
6
  import { doWhile } from "../utils/doWhile.js";
6
7
  import { randomColor } from "./colors.js";
7
8
  export class SplineConstructor {
8
- random() {
9
+ static random() {
9
10
  const a = randint(-10, 0);
10
11
  const b = doWhile(() => randint(0, 10), (x) => Math.abs(x - a) < 5);
11
12
  return new Spline(new IntervalNode(a.toTree(), b.toTree(), ClosureType.FF));
12
13
  }
14
+ static getAdequatePoints(nbOfPoints = 4) {
15
+ let xSolutions = [];
16
+ const nb = nbOfPoints;
17
+ // const nb = 2;
18
+ for (let i = 0; i < nb; i++) {
19
+ xSolutions.push(randint(-9, 10, xSolutions));
20
+ }
21
+ xSolutions.sort((a, b) => a - b);
22
+ const yValue = randint(-5, 6);
23
+ const splinePoints = [];
24
+ let prevYWasAbove = coinFlip();
25
+ if (coinFlip()) {
26
+ const y = prevYWasAbove ? randint(-2, 0) : randint(1, 3);
27
+ prevYWasAbove = y > 0;
28
+ splinePoints.push([xSolutions[0] - (1 + Math.random() * 3), yValue + y]);
29
+ }
30
+ for (let i = 0; i < xSolutions.length; i++) {
31
+ splinePoints.push([xSolutions[i], yValue]);
32
+ if (i < xSolutions.length - 1) {
33
+ const mid = (xSolutions[i] + xSolutions[i + 1]) / 2;
34
+ const distance = xSolutions[i + 1] - xSolutions[i];
35
+ const x = mid + ((Math.random() * 2) / 5) * (distance / 2);
36
+ const y = prevYWasAbove ? randint(-2, 0) : randint(1, 3);
37
+ prevYWasAbove = y > 0;
38
+ splinePoints.push([x, yValue + y]);
39
+ }
40
+ }
41
+ if (coinFlip() || splinePoints.length < 4) {
42
+ const y = prevYWasAbove ? randint(-2, 0) : randint(1, 3);
43
+ prevYWasAbove = y > 0;
44
+ splinePoints.push([
45
+ xSolutions[xSolutions.length - 1] + (1 + Math.random() * 3),
46
+ yValue + y,
47
+ ]);
48
+ }
49
+ return splinePoints;
50
+ }
13
51
  }
14
52
  export class Spline {
15
53
  points;
package/lib/index.d.ts CHANGED
@@ -72,6 +72,12 @@ declare const mathExercises: (Exercise<{
72
72
  }, {}> | Exercise<{
73
73
  point: import("./math/geometry/point.js").PointIdentifiers;
74
74
  bounding: number;
75
+ }, {}> | Exercise<{
76
+ type: number;
77
+ a: number;
78
+ b?: number;
79
+ c?: number;
80
+ d?: number;
75
81
  }, {}> | Exercise<{
76
82
  integerFirst: boolean;
77
83
  integer: number;
@@ -897,9 +903,15 @@ declare const mathExercises: (Exercise<{
897
903
  inegalitySymbol: import("./math/inequations/inequation.js").InegalitySymbols;
898
904
  a: number;
899
905
  b: number;
906
+ }, {}> | Exercise<{
907
+ a: number;
908
+ type: number;
900
909
  }, {}> | Exercise<{
901
910
  coeffs: number[];
902
911
  initTable: string[][];
912
+ }, {}> | Exercise<{
913
+ points: number[][];
914
+ initTable: string[][];
903
915
  }, {}> | Exercise<{
904
916
  k: number;
905
917
  }, {}> | Exercise<{
@@ -1283,18 +1295,6 @@ declare const mathExercises: (Exercise<{
1283
1295
  B: number[];
1284
1296
  startLetter: string;
1285
1297
  endLetter: string;
1286
- }, {}> | Exercise<{
1287
- xu: import("./tree/nodes/nodeConstructor.js").NodeIdentifiers;
1288
- yu: import("./tree/nodes/nodeConstructor.js").NodeIdentifiers;
1289
- xv: import("./tree/nodes/nodeConstructor.js").NodeIdentifiers;
1290
- yv: import("./tree/nodes/nodeConstructor.js").NodeIdentifiers;
1291
- }, {}> | Exercise<{
1292
- xA: number;
1293
- xB: number;
1294
- xC: number;
1295
- yA: number;
1296
- yB: number;
1297
- yC: number;
1298
1298
  }, {}> | Exercise<{
1299
1299
  xA: number;
1300
1300
  xB: number;
@@ -1398,6 +1398,23 @@ declare const mathExercises: (Exercise<{
1398
1398
  coeff: number;
1399
1399
  }, {}> | Exercise<{
1400
1400
  pointsIdentifiers: import("./math/geometry/point.js").PointIdentifiers[];
1401
+ }, {}> | Exercise<{
1402
+ xu: import("./tree/nodes/nodeConstructor.js").NodeIdentifiers;
1403
+ yu: import("./tree/nodes/nodeConstructor.js").NodeIdentifiers;
1404
+ xv: import("./tree/nodes/nodeConstructor.js").NodeIdentifiers;
1405
+ yv: import("./tree/nodes/nodeConstructor.js").NodeIdentifiers;
1406
+ }, {}> | Exercise<{
1407
+ xA: number;
1408
+ xB: number;
1409
+ xC: number;
1410
+ yA: number;
1411
+ yB: number;
1412
+ yC: number;
1413
+ }, {}> | Exercise<{
1414
+ a: import("./tree/nodes/nodeConstructor.js").NodeIdentifiers;
1415
+ b: import("./tree/nodes/nodeConstructor.js").NodeIdentifiers;
1416
+ c: import("./tree/nodes/nodeConstructor.js").NodeIdentifiers;
1417
+ d: import("./tree/nodes/nodeConstructor.js").NodeIdentifiers;
1401
1418
  }, {}> | Exercise<{
1402
1419
  trinom: number[];
1403
1420
  }, {}> | Exercise<{
@@ -1681,6 +1698,8 @@ declare const mathExercises: (Exercise<{
1681
1698
  price: number;
1682
1699
  evolution: number;
1683
1700
  askingFinalPrice: boolean;
1701
+ }, {}> | Exercise<{
1702
+ evolutions: number[];
1684
1703
  }, {}> | Exercise<{
1685
1704
  initialCapital: number;
1686
1705
  rate: number;
@@ -1694,6 +1713,9 @@ declare const mathExercises: (Exercise<{
1694
1713
  }, {
1695
1714
  withFormula?: boolean;
1696
1715
  }> | Exercise<{
1716
+ x: number;
1717
+ y: number;
1718
+ }, {}> | Exercise<{
1697
1719
  int: number;
1698
1720
  power: number;
1699
1721
  }, {}> | Exercise<{
@@ -2252,6 +2274,9 @@ declare const mathExercises: (Exercise<{
2252
2274
  }, {}> | Exercise<{
2253
2275
  degree: number;
2254
2276
  leftBoundPiMultiple: number;
2277
+ }, {}> | Exercise<{
2278
+ givenValue: import("./tree/nodes/nodeConstructor.js").NodeIdentifiers;
2279
+ isCosGiven: boolean;
2255
2280
  }, {}> | Exercise<{
2256
2281
  initialValue: number;
2257
2282
  step: number;
@@ -2350,6 +2375,19 @@ declare const mathExercises: (Exercise<{
2350
2375
  }, {}> | Exercise<{
2351
2376
  points: number[][];
2352
2377
  labels: string[];
2378
+ }, {}> | Exercise<{
2379
+ affineCoeffs: number[];
2380
+ initTable: string[][];
2381
+ }, {}> | Exercise<{
2382
+ k: number;
2383
+ x1: number;
2384
+ x2: number;
2385
+ C: number;
2386
+ initTable: string[][];
2387
+ }, {}> | Exercise<{
2388
+ affine1Coeffs: number[];
2389
+ affine2Coeffs: number[];
2390
+ initTable: string[][];
2353
2391
  }, {}>)[];
2354
2392
  declare const pcExercises: (Exercise<{
2355
2393
  atomicMass: 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,yBAAyB,CAAC;AAC7D,OAAO,KAAK,aAAa,MAAM,2BAA2B,CAAC;AAE3D,OAAO,4BAA4B,CAAC;AACpC,OAAO,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AAE/D,QAAA,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;SAA6B,CAAC;AAE/C,OAAO,EAAE,aAAa,EAAE,WAAW,EAAE,QAAQ,EAAE,QAAQ,EAAE,cAAc,EAAE,CAAC"}
@@ -255,4 +255,6 @@ const validCmds = [
255
255
  "\\lstinline",
256
256
  "\\subset",
257
257
  "\\not",
258
+ "\\nearrow",
259
+ "\\searrow",
258
260
  ];
@@ -1 +1 @@
1
- {"version":3,"file":"real.d.ts","sourceRoot":"","sources":["../../../../src/math/numbers/reals/real.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,aAAa,EAAE,MAAM,mCAAmC,CAAC;AAClE,OAAO,EAAE,QAAQ,EAAE,MAAM,wCAAwC,CAAC;AASlE,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAClD,8BAAsB,eAAe;IACnC,MAAM,CAAC,MAAM;CAUd;AACD,qBAAa,IAAK,YAAW,MAAM;IACjC,KAAK,EAAE,MAAM,CAAC;IACd,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,UAAU,CAAC;gBACL,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM;IAKtC,MAAM,CAAC,CAAC,E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AAQ,IAAI;IAClC,OAAO,EAAE,MAAM,CAAC;gBACJ,OAAO,EAAE,MAAM;IAK3B,cAAc;IAMd,mBAAmB,IAAI,CAAC,MAAM,EAAE,MAAM,CAAC;IAkBvC,sDAAsD;IACtD,aAAa,IAAI,MAAM;IAMvB,QAAQ,IAAI,MAAM;IA+BlB,KAAK,IAAI,MAAM;IAIf,MAAM;CAGP"}
@@ -1,6 +1,7 @@
1
1
  import { isSquare } from "../../../math/utils/arithmetic/isSquare.js";
2
2
  import { primeFactors } from "../../../math/utils/arithmetic/primeFactors.js";
3
3
  import { randint } from "../../../math/utils/random/randint.js";
4
+ import { round } from "../../../math/utils/round.js";
4
5
  import { SqrtNode } from "../../../tree/nodes/functions/sqrtNode.js";
5
6
  import { NumberNode } from "../../../tree/nodes/numbers/numberNode.js";
6
7
  import { PiNode } from "../../../tree/nodes/numbers/piNode.js";
@@ -100,8 +101,12 @@ export class SquareRoot extends Real {
100
101
  return new Integer(0);
101
102
  if (this.operand === 1)
102
103
  return new Integer(1);
103
- if (Math.floor(this.operand) !== this.operand)
104
- return new Decimal(Math.sqrt(this.operand));
104
+ if (Math.floor(this.operand) !== this.operand) {
105
+ const ev = Math.sqrt(this.operand);
106
+ if (round(ev, 8) === ev)
107
+ return new Decimal(ev);
108
+ return this;
109
+ }
105
110
  const [outsideSqrt, insideSqrt] = this.getSimplifiedCoeffs();
106
111
  const simplified = insideSqrt !== 1
107
112
  ? new Real(outsideSqrt * Math.sqrt(insideSqrt), `${outsideSqrt === 1 ? "" : `${outsideSqrt}`}\\sqrt{${insideSqrt}}`)
@@ -1 +1 @@
1
- {"version":3,"file":"exoTest.d.ts","sourceRoot":"","sources":["../../src/tests/exoTest.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,6BAA6B,CAAC;AAIvD,eAAO,MAAM,OAAO,QAAS,QAAQ;;;;CAuFpC,CAAC"}
1
+ {"version":3,"file":"exoTest.d.ts","sourceRoot":"","sources":["../../src/tests/exoTest.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,6BAA6B,CAAC;AAIvD,eAAO,MAAM,OAAO,QAAS,QAAQ;;;;CA+FpC,CAAC"}
@@ -21,14 +21,18 @@ export const exoTest = (exo) => {
21
21
  generatorTime = after - before;
22
22
  if (exo.answerType !== "free" &&
23
23
  exo.answerType !== "GGB" &&
24
- exo.answerType !== "valueTable") {
24
+ exo.answerType !== "valueTable" &&
25
+ exo.answerType !== "varTable" &&
26
+ exo.answerType !== "signTable") {
25
27
  if (!exo.getPropositions)
26
28
  throw new Error(`exo ${exo.id} has no getPropositions`);
27
29
  }
28
30
  if (exo.answerType !== "QCM" &&
29
31
  exo.answerType !== "QCU" &&
30
32
  exo.answerType !== "GGB" &&
31
- exo.answerType !== "valueTable") {
33
+ exo.answerType !== "valueTable" &&
34
+ exo.answerType !== "varTable" &&
35
+ exo.answerType !== "signTable") {
32
36
  if (!exo.isAnswerValid)
33
37
  throw new Error(`exo ${exo.id} has no isAnswerValid`);
34
38
  }
@@ -36,7 +40,9 @@ export const exoTest = (exo) => {
36
40
  if (!exo.isGGBAnswerValid)
37
41
  throw new Error(`exo ${exo.id} has no isGGBAnswerValid`);
38
42
  }
39
- if (exo.answerType === "valueTable") {
43
+ if (exo.answerType === "valueTable" ||
44
+ exo.answerType === "varTable" ||
45
+ exo.answerType === "signTable") {
40
46
  if (!exo.isAnswerTableValid)
41
47
  throw new Error(`exo ${exo.id} has no isAnswerTableValid`);
42
48
  }
@@ -1 +1 @@
1
- {"version":3,"file":"questionTest.d.ts","sourceRoot":"","sources":["../../src/tests/questionTest.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,6BAA6B,CAAC;AAIjE,eAAO,MAAM,YAAY,QAAS,QAAQ,YAAY,QAAQ;;;CAuM7D,CAAC"}
1
+ {"version":3,"file":"questionTest.d.ts","sourceRoot":"","sources":["../../src/tests/questionTest.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,6BAA6B,CAAC;AAIjE,eAAO,MAAM,YAAY,QAAS,QAAQ,YAAY,QAAQ;;;CAkN7D,CAAC"}