math-exercises 3.0.136 → 3.0.137

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 (47) hide show
  1. package/lib/exercises/math/calcul/decimals/decimalFractionToDecimal.d.ts.map +1 -1
  2. package/lib/exercises/math/calcul/decimals/decimalFractionToDecimal.js +0 -2
  3. package/lib/exercises/math/calculLitteral/equation/equationFromProblem.d.ts.map +1 -1
  4. package/lib/exercises/math/calculLitteral/equation/equationFromProblem.js +0 -14
  5. package/lib/exercises/math/calculLitteral/factorisation/factoType3.d.ts +12 -0
  6. package/lib/exercises/math/calculLitteral/factorisation/factoType3.d.ts.map +1 -0
  7. package/lib/exercises/math/calculLitteral/factorisation/factoType3.js +115 -0
  8. package/lib/exercises/math/calculLitteral/factorisation/factoType4.d.ts +12 -0
  9. package/lib/exercises/math/calculLitteral/factorisation/factoType4.d.ts.map +1 -0
  10. package/lib/exercises/math/calculLitteral/factorisation/factoType4.js +112 -0
  11. package/lib/exercises/math/calculLitteral/factorisation/index.d.ts +2 -0
  12. package/lib/exercises/math/calculLitteral/factorisation/index.d.ts.map +1 -1
  13. package/lib/exercises/math/calculLitteral/factorisation/index.js +2 -0
  14. package/lib/exercises/math/derivation/derivative/sqrt/index.d.ts +1 -0
  15. package/lib/exercises/math/derivation/derivative/sqrt/index.d.ts.map +1 -1
  16. package/lib/exercises/math/derivation/derivative/sqrt/index.js +1 -1
  17. package/lib/exercises/math/derivation/derivative/sqrt/sqrtProductDerivative.d.ts.map +1 -1
  18. package/lib/exercises/math/derivation/derivative/sqrt/sqrtProductDerivative.js +83 -26
  19. package/lib/exercises/math/geometry/cartesian/index.d.ts +0 -1
  20. package/lib/exercises/math/geometry/cartesian/index.d.ts.map +1 -1
  21. package/lib/exercises/math/geometry/cartesian/index.js +1 -1
  22. package/lib/exercises/math/geometry/cartesian/placeAbscissOnSemiLineV2.d.ts.map +1 -1
  23. package/lib/exercises/math/geometry/cartesian/placeAbscissOnSemiLineV2.js +0 -1
  24. package/lib/exercises/math/geometry/euclidianConstructions/index.js +2 -0
  25. package/lib/exercises/math/geometry/euclidianConstructions/pointImageFromHomothety.d.ts +16 -0
  26. package/lib/exercises/math/geometry/euclidianConstructions/pointImageFromHomothety.d.ts.map +1 -0
  27. package/lib/exercises/math/geometry/euclidianConstructions/pointImageFromHomothety.js +241 -0
  28. package/lib/exercises/math/geometry/euclidianConstructions/segmentImageFromHomothety.d.ts +16 -0
  29. package/lib/exercises/math/geometry/euclidianConstructions/segmentImageFromHomothety.d.ts.map +1 -0
  30. package/lib/exercises/math/geometry/euclidianConstructions/segmentImageFromHomothety.js +258 -0
  31. package/lib/geogebra/parsers/geogebraParser.d.ts +1 -0
  32. package/lib/geogebra/parsers/geogebraParser.d.ts.map +1 -1
  33. package/lib/geogebra/parsers/geogebraParser.js +38 -0
  34. package/lib/index.d.ts +17 -8
  35. package/lib/index.d.ts.map +1 -1
  36. package/lib/latexTester.d.ts.map +1 -1
  37. package/lib/latexTester.js +1 -0
  38. package/lib/math/utils/functions/functionComparison.d.ts.map +1 -1
  39. package/lib/math/utils/functions/functionComparison.js +0 -4
  40. package/lib/math/utils/functions/functionComposition.d.ts.map +1 -1
  41. package/lib/math/utils/functions/functionComposition.js +0 -10
  42. package/lib/math/utils/functions/functionDecomposition.d.ts.map +1 -1
  43. package/lib/math/utils/functions/functionDecomposition.js +0 -42
  44. package/lib/utils/arrays/arrayIntersection.d.ts +2 -0
  45. package/lib/utils/arrays/arrayIntersection.d.ts.map +1 -0
  46. package/lib/utils/arrays/arrayIntersection.js +8 -0
  47. package/package.json +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"decimalFractionToDecimal.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calcul/decimals/decimalFractionToDecimal.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAiBT,MAAM,6BAA6B,CAAC;AAoBrC,KAAK,WAAW,GAAG;IACjB,mBAAmB,EAAE,OAAO,CAAC;IAC7B,EAAE,EAAE,MAAM,CAAC;CACZ,CAAC;AAkQF,KAAK,OAAO,GAAG;IACb,cAAc,EAAE,MAAM,CAAC;CACxB,CAAC;AA4BF,eAAO,MAAM,wBAAwB,EAAE,QAAQ,CAAC,WAAW,EAAE,OAAO,CAgBnE,CAAC"}
1
+ {"version":3,"file":"decimalFractionToDecimal.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calcul/decimals/decimalFractionToDecimal.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAiBT,MAAM,6BAA6B,CAAC;AAoBrC,KAAK,WAAW,GAAG;IACjB,mBAAmB,EAAE,OAAO,CAAC;IAC7B,EAAE,EAAE,MAAM,CAAC;CACZ,CAAC;AAgQF,KAAK,OAAO,GAAG;IACb,cAAc,EAAE,MAAM,CAAC;CACxB,CAAC;AA4BF,eAAO,MAAM,wBAAwB,EAAE,QAAQ,CAAC,WAAW,EAAE,OAAO,CAgBnE,CAAC"}
@@ -102,7 +102,6 @@ Si on continue à décaler et diviser, on obtient d'autres fractions décimales
102
102
  `;
103
103
  };
104
104
  const getPropositions = (n, { answer, isFractionToDigital, nb }) => {
105
- console.log("getPropositions", nb);
106
105
  const propositions = [];
107
106
  addValidProp(propositions, answer);
108
107
  const dec = new Decimal(nb);
@@ -110,7 +109,6 @@ const getPropositions = (n, { answer, isFractionToDigital, nb }) => {
110
109
  const denNodeSrc = fractionNode.rightChild;
111
110
  const log10OfDen = Math.log10(denNodeSrc.evaluate());
112
111
  const maxExponentExcluded = log10OfDen;
113
- console.log("maxExponentExcluded", maxExponentExcluded);
114
112
  const mandatoryExponents = [-1, ...(maxExponentExcluded > 1 ? [1] : [])];
115
113
  const fillerExponents = [
116
114
  -3,
@@ -1 +1 @@
1
- {"version":3,"file":"equationFromProblem.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calculLitteral/equation/equationFromProblem.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAcT,MAAM,6BAA6B,CAAC;AAKrC,OAAO,EAAE,aAAa,EAAE,MAAM,mCAAmC,CAAC;AAKlE,OAAO,EAAE,eAAe,EAAE,MAAM,qCAAqC,CAAC;AAatE,KAAK,WAAW,GAAG;IACjB,oBAAoB,EAAE,MAAM,CAAC;IAC7B,yBAAyB,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,aAAa,CAAC,CAAC,CAAC;IACzE,cAAc,EAAE,MAAM,CAAC;IACvB,aAAa,EAAE,MAAM,EAAE,EAAE,CAAC;IAC1B,YAAY,EAAE,eAAe,CAAC;CAC/B,CAAC;AAsrBF,eAAO,MAAM,mBAAmB,EAAE,QAAQ,CAAC,WAAW,CAcrD,CAAC"}
1
+ {"version":3,"file":"equationFromProblem.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calculLitteral/equation/equationFromProblem.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAcT,MAAM,6BAA6B,CAAC;AAKrC,OAAO,EAAE,aAAa,EAAE,MAAM,mCAAmC,CAAC;AAKlE,OAAO,EAAE,eAAe,EAAE,MAAM,qCAAqC,CAAC;AAatE,KAAK,WAAW,GAAG;IACjB,oBAAoB,EAAE,MAAM,CAAC;IAC7B,yBAAyB,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,aAAa,CAAC,CAAC,CAAC;IACzE,cAAc,EAAE,MAAM,CAAC;IACvB,aAAa,EAAE,MAAM,EAAE,EAAE,CAAC;IAC1B,YAAY,EAAE,eAAe,CAAC;CAC/B,CAAC;AAqqBF,eAAO,MAAM,mBAAmB,EAAE,QAAQ,CAAC,WAAW,CAcrD,CAAC"}
@@ -267,20 +267,6 @@ Quel est le prix, noté a, d'un pot de sauce ?`, (_group, mysteryVar, groups, sh
267
267
  }, (_group, _mysteryVar, groups, shuffleFuncs) => {
268
268
  const { total, ...groupsWithoutTotal } = groups;
269
269
  const orderedNodes = shuffleFuncs[0](Object.values(groupsWithoutTotal)).map((group) => group.getNode());
270
- // console.log(
271
- // "orderedNodes[0].leftChild",
272
- // (orderedNodes[0] as MultiplyNode).leftChild,
273
- // );
274
- // console.log(
275
- // "isAlgebraicNode((orderedNodes[0] as MultiplyNode).leftChild)",
276
- // isAlgebraicNode((orderedNodes[0] as MultiplyNode).leftChild),
277
- // );
278
- // console.log(
279
- // "orderedNodes[0].leftChild.evaluate",
280
- // (orderedNodes[0] as MultiplyNode).leftChild.evaluate,
281
- // );
282
- // console.log("orderedNodes[0].evaluate()", orderedNodes[0].evaluate());
283
- // console.log("orderedNodes[1].evaluate()", orderedNodes[1].evaluate());
284
270
  return round(add(orderedNodes[0], orderedNodes[1]).evaluate(), 2).toTree();
285
271
  }, false, true),
286
272
  }, [["pizza", "sauce"]]),
@@ -0,0 +1,12 @@
1
+ import { Exercise } from "../../../../exercises/exercise.js";
2
+ type Identifiers = {
3
+ a: number;
4
+ b: number;
5
+ c: number;
6
+ d: number;
7
+ k: number;
8
+ isSubstract: boolean;
9
+ };
10
+ export declare const factoType3: Exercise<Identifiers>;
11
+ export {};
12
+ //# sourceMappingURL=factoType3.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"factoType3.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calculLitteral/factorisation/factoType3.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAgBT,MAAM,6BAA6B,CAAC;AAiBrC,KAAK,WAAW,GAAG;IACjB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,WAAW,EAAE,OAAO,CAAC;CACtB,CAAC;AAyJF,eAAO,MAAM,UAAU,EAAE,QAAQ,CAAC,WAAW,CAe5C,CAAC"}
@@ -0,0 +1,115 @@
1
+ import { addValidProp, shuffleProps, tryToAddWrongProp, propWhile, } from "../../../../exercises/exercise.js";
2
+ import { getDistinctQuestions } from "../../../../exercises/utils/getDistinctQuestions.js";
3
+ import { Affine, AffineConstructor } from "../../../../math/polynomials/affine.js";
4
+ import { randint } from "../../../../math/utils/random/randint.js";
5
+ import { add, AddNode } from "../../../../tree/nodes/operators/addNode.js";
6
+ import { multiply, MultiplyNode, } from "../../../../tree/nodes/operators/multiplyNode.js";
7
+ import { SubstractNode } from "../../../../tree/nodes/operators/substractNode.js";
8
+ import { alignTex } from "../../../../utils/latex/alignTex.js";
9
+ import { coinFlip } from "../../../../utils/alea/coinFlip.js";
10
+ const getPropositions = (n, { answer, a, b, c, d, k, isSubstract }) => {
11
+ const propositions = [];
12
+ const affine1 = new Affine(a, b);
13
+ const affine2 = new Affine(c, d);
14
+ addValidProp(propositions, answer);
15
+ //erreur de signe
16
+ tryToAddWrongProp(propositions, getAnswer({ a, b, c, d, k, isSubstract: !isSubstract }));
17
+ //k(ax+b) -> kx(ax+b)
18
+ tryToAddWrongProp(propositions, new MultiplyNode(affine1.toTree(), add(affine2.toTree(), multiply(isSubstract ? -k : k, "x")).simplify({
19
+ towardsDistribute: true,
20
+ })).toTex());
21
+ //(ax+b)(cx+d)+-k(ax+b) -> (ax+b)(cx+d+-k(ax+b))
22
+ tryToAddWrongProp(propositions, new MultiplyNode(affine1.toTree(), add(affine2.toTree(), multiply(isSubstract ? -k : k, affine1.toTree())).simplify({ towardsDistribute: true })).toTex());
23
+ propWhile(propositions, n, () => {
24
+ tryToAddWrongProp(propositions, new MultiplyNode(affine1.toTree(), AffineConstructor.random().toTree()).toTex());
25
+ });
26
+ return shuffleProps(propositions, n);
27
+ };
28
+ const getAnswerTree = (identifiers) => {
29
+ const affine1 = new Affine(identifiers.a, identifiers.b);
30
+ const affine2 = new Affine(identifiers.c, identifiers.d);
31
+ return new MultiplyNode(affine1.toTree(), affine2
32
+ .add(identifiers.isSubstract ? -identifiers.k : identifiers.k)
33
+ .toTree());
34
+ };
35
+ const getAnswer = (identifiers) => {
36
+ return getAnswerTree(identifiers).toTex();
37
+ };
38
+ const getInstruction = (identifiers) => {
39
+ const affine1 = new Affine(identifiers.a, identifiers.b);
40
+ const affine2 = new Affine(identifiers.c, identifiers.d);
41
+ const statement = new (identifiers.isSubstract ? SubstractNode : AddNode)(new MultiplyNode(affine1.toTree(), affine2.toTree()), multiply(identifiers.k, affine1.toTree()));
42
+ return `Factoriser et réduire :
43
+
44
+ $$
45
+ ${statement.toTex()}
46
+ $$`;
47
+ };
48
+ const getHint = () => {
49
+ return `Repère d'abord le facteur commun dans cette expression. Puis multiplie ce facteur commun par les autres termes de l'expression.`;
50
+ };
51
+ const getCorrection = (identifiers) => {
52
+ const affine1 = new Affine(identifiers.a, identifiers.b);
53
+ const affine2 = new Affine(identifiers.c, identifiers.d);
54
+ const answer = getAnswer(identifiers);
55
+ const statement = new (identifiers.isSubstract ? SubstractNode : AddNode)(new MultiplyNode(affine1.toTree(), affine2.toTree()), multiply(identifiers.k, affine1.toTree()));
56
+ const corr = `
57
+ ${alignTex([
58
+ ["", statement.toTex()],
59
+ [
60
+ "=",
61
+ new AddNode(new MultiplyNode(affine1.toTree(), affine2.toTree()), multiply(affine1.toTree(), (identifiers.isSubstract ? -1 : 1) * identifiers.k)).toTex(),
62
+ ],
63
+ [
64
+ "=",
65
+ new MultiplyNode(affine1.toTree(), add(affine2.toTree(), (identifiers.isSubstract ? -1 : 1) * identifiers.k)).toTex(),
66
+ ],
67
+ ["=", answer],
68
+ ])}
69
+ `;
70
+ return corr;
71
+ };
72
+ const getKeys = () => {
73
+ return ["x"];
74
+ };
75
+ const isAnswerValid = (ans, { answer, a, b, c, d, k, isSubstract }) => {
76
+ const tree = getAnswerTree({ a, b, c, d, k, isSubstract });
77
+ return ans === answer || tree.toAllValidTexs().includes(ans);
78
+ };
79
+ const getFactoType3Question = () => {
80
+ const b = randint(-10, 11);
81
+ const a = randint(-10, 11, [0, b, -b]);
82
+ const c = randint(-10, 11, [0]);
83
+ const d = randint(-10, 11, b === 0 ? [0, -1] : [0, c, -c]);
84
+ const k = randint(-10, 11, [0]);
85
+ const isSubstract = coinFlip();
86
+ const identifiers = { a, b, c, d, k, isSubstract };
87
+ return getQuestionFromIdentifiers(identifiers);
88
+ };
89
+ const getQuestionFromIdentifiers = (identifiers) => {
90
+ const question = {
91
+ answer: getAnswer(identifiers),
92
+ instruction: getInstruction(identifiers),
93
+ keys: getKeys(identifiers),
94
+ answerFormat: "tex",
95
+ identifiers,
96
+ hint: getHint(identifiers),
97
+ correction: getCorrection(identifiers),
98
+ };
99
+ return question;
100
+ };
101
+ export const factoType3 = {
102
+ id: "factoType3",
103
+ connector: "=",
104
+ label: "Factorisation du type $\\left(ax+b\\right)\\left(cx+d\\right)\\pm k \\left(ax+b\\right)$",
105
+ isSingleStep: true,
106
+ generator: (nb) => getDistinctQuestions(getFactoType3Question, nb),
107
+ qcmTimer: 60,
108
+ freeTimer: 60,
109
+ ggbTimer: 60,
110
+ getPropositions,
111
+ isAnswerValid,
112
+ subject: "Mathématiques",
113
+ getQuestionFromIdentifiers,
114
+ hasHintAndCorrection: true,
115
+ };
@@ -0,0 +1,12 @@
1
+ import { Exercise } from "../../../../exercises/exercise.js";
2
+ type Identifiers = {
3
+ a: number;
4
+ b: number;
5
+ c: number;
6
+ d: number;
7
+ k: number;
8
+ isSubstract: boolean;
9
+ };
10
+ export declare const factoType4: Exercise<Identifiers>;
11
+ export {};
12
+ //# sourceMappingURL=factoType4.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"factoType4.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calculLitteral/factorisation/factoType4.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAgBT,MAAM,6BAA6B,CAAC;AAkBrC,KAAK,WAAW,GAAG;IACjB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,WAAW,EAAE,OAAO,CAAC;CACtB,CAAC;AAoKF,eAAO,MAAM,UAAU,EAAE,QAAQ,CAAC,WAAW,CAe5C,CAAC"}
@@ -0,0 +1,112 @@
1
+ import { addValidProp, shuffleProps, tryToAddWrongProp, propWhile, } from "../../../../exercises/exercise.js";
2
+ import { getDistinctQuestions } from "../../../../exercises/utils/getDistinctQuestions.js";
3
+ import { Affine, AffineConstructor } from "../../../../math/polynomials/affine.js";
4
+ import { randint } from "../../../../math/utils/random/randint.js";
5
+ import { add, AddNode } from "../../../../tree/nodes/operators/addNode.js";
6
+ import { multiply, MultiplyNode, } from "../../../../tree/nodes/operators/multiplyNode.js";
7
+ import { SubstractNode } from "../../../../tree/nodes/operators/substractNode.js";
8
+ import { alignTex } from "../../../../utils/latex/alignTex.js";
9
+ import { coinFlip } from "../../../../utils/alea/coinFlip.js";
10
+ import { power } from "../../../../tree/nodes/operators/powerNode.js";
11
+ const getPropositions = (n, { answer, a, b, c, d, k, isSubstract }) => {
12
+ const propositions = [];
13
+ const affine1 = new Affine(a, b);
14
+ const affine2 = new Affine(c, d);
15
+ addValidProp(propositions, answer);
16
+ //erreur de signe
17
+ tryToAddWrongProp(propositions, getAnswer({ a, b, c, d, k, isSubstract: !isSubstract }));
18
+ //k(ax+b)^2 -> k(ax+b)
19
+ tryToAddWrongProp(propositions, new MultiplyNode(affine1.toTree(), affine2.add(isSubstract ? -k : k).toTree()).toTex());
20
+ //(ax+b)(cx+d)+-k(ax+b)^2 -> (ax+b)(cx+d+-kx)
21
+ tryToAddWrongProp(propositions, new MultiplyNode(affine1.toTree(), add(affine2.toTree(), multiply(isSubstract ? -k : k, "x".toTree())).simplify({ towardsDistribute: true })).toTex());
22
+ propWhile(propositions, n, () => {
23
+ tryToAddWrongProp(propositions, new MultiplyNode(affine1.toTree(), AffineConstructor.random().toTree()).toTex());
24
+ });
25
+ return shuffleProps(propositions, n);
26
+ };
27
+ const getAnswerTree = (identifiers) => {
28
+ const affine1 = new Affine(identifiers.a, identifiers.b);
29
+ const affine2 = new Affine(identifiers.c, identifiers.d);
30
+ return new MultiplyNode(affine1.toTree(), add(affine2.toTree(), multiply(identifiers.isSubstract ? -identifiers.k : identifiers.k, affine1.toTree()).simplify({ towardsDistribute: true })).simplify({ towardsDistribute: true }));
31
+ };
32
+ const getAnswer = (identifiers) => {
33
+ return getAnswerTree(identifiers).toTex();
34
+ };
35
+ const getInstruction = (identifiers) => {
36
+ const affine1 = new Affine(identifiers.a, identifiers.b);
37
+ const affine2 = new Affine(identifiers.c, identifiers.d);
38
+ const statement = new (identifiers.isSubstract ? SubstractNode : AddNode)(new MultiplyNode(affine1.toTree(), affine2.toTree()), multiply(identifiers.k, power(affine1.toTree(), 2)));
39
+ return `Factoriser et réduire :
40
+
41
+ $$
42
+ ${statement.toTex()}
43
+ $$`;
44
+ };
45
+ const getHint = () => {
46
+ return `Repère d'abord le facteur commun dans cette expression. Puis multiplie ce facteur commun par les autres termes de l'expression.`;
47
+ };
48
+ const getCorrection = (identifiers) => {
49
+ const affine1 = new Affine(identifiers.a, identifiers.b);
50
+ const affine2 = new Affine(identifiers.c, identifiers.d);
51
+ const answer = getAnswer(identifiers);
52
+ const statement = new (identifiers.isSubstract ? SubstractNode : AddNode)(new MultiplyNode(affine1.toTree(), affine2.toTree()), multiply(identifiers.k, power(affine1.toTree(), 2)));
53
+ const corr = `
54
+ ${alignTex([
55
+ ["", statement.toTex()],
56
+ [
57
+ "=",
58
+ new AddNode(new MultiplyNode(affine1.toTree(), affine2.toTree()), new MultiplyNode(affine1.toTree(), multiply((identifiers.isSubstract ? -1 : 1) * identifiers.k, affine1.toTree()))).toTex(),
59
+ ],
60
+ [
61
+ "=",
62
+ new MultiplyNode(affine1.toTree(), add(affine2.toTree(), multiply((identifiers.isSubstract ? -1 : 1) * identifiers.k, affine1.toTree()).simplify({ towardsDistribute: true }))).toTex(),
63
+ ],
64
+ ["=", answer],
65
+ ])}
66
+ `;
67
+ return corr;
68
+ };
69
+ const getKeys = () => {
70
+ return ["x"];
71
+ };
72
+ const isAnswerValid = (ans, { answer, a, b, c, d, k, isSubstract }) => {
73
+ const tree = getAnswerTree({ a, b, c, d, k, isSubstract });
74
+ return ans === answer || tree.toAllValidTexs().includes(ans);
75
+ };
76
+ const getFactoType4Question = () => {
77
+ const b = randint(-10, 11);
78
+ const a = randint(-10, 11, [0, b, -b]);
79
+ const c = randint(-10, 11, [0]);
80
+ const d = randint(-10, 11, b === 0 ? [0, -1] : [0, c, -c]);
81
+ const k = randint(-10, 11, [0]);
82
+ const isSubstract = coinFlip();
83
+ const identifiers = { a, b, c, d, k, isSubstract };
84
+ return getQuestionFromIdentifiers(identifiers);
85
+ };
86
+ const getQuestionFromIdentifiers = (identifiers) => {
87
+ const question = {
88
+ answer: getAnswer(identifiers),
89
+ instruction: getInstruction(identifiers),
90
+ keys: getKeys(identifiers),
91
+ answerFormat: "tex",
92
+ identifiers,
93
+ hint: getHint(identifiers),
94
+ correction: getCorrection(identifiers),
95
+ };
96
+ return question;
97
+ };
98
+ export const factoType4 = {
99
+ id: "factoType4",
100
+ connector: "=",
101
+ label: "Factorisation du type $\\left(ax+b\\right)\\left(cx+d\\right)\\pm k {\\left(ax+b\\right)}^2$",
102
+ isSingleStep: true,
103
+ generator: (nb) => getDistinctQuestions(getFactoType4Question, nb),
104
+ qcmTimer: 60,
105
+ freeTimer: 60,
106
+ ggbTimer: 60,
107
+ getPropositions,
108
+ isAnswerValid,
109
+ subject: "Mathématiques",
110
+ getQuestionFromIdentifiers,
111
+ hasHintAndCorrection: true,
112
+ };
@@ -6,4 +6,6 @@ export * from "./factorizeCanonicalForm.js";
6
6
  export * from "./factorizeCanonicalFormWithSqrt.js";
7
7
  export * from "./factoType2.js";
8
8
  export * from "./factoByX.js";
9
+ export * from "./factoType3.js";
10
+ export * from "./factoType4.js";
9
11
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calculLitteral/factorisation/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAC;AACjC,cAAc,kBAAkB,CAAC;AACjC,cAAc,kBAAkB,CAAC;AACjC,cAAc,aAAa,CAAC;AAC5B,cAAc,6BAA6B,CAAC;AAC5C,cAAc,qCAAqC,CAAC;AACpD,cAAc,iBAAiB,CAAC;AAChC,cAAc,eAAe,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calculLitteral/factorisation/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAC;AACjC,cAAc,kBAAkB,CAAC;AACjC,cAAc,kBAAkB,CAAC;AACjC,cAAc,aAAa,CAAC;AAC5B,cAAc,6BAA6B,CAAC;AAC5C,cAAc,qCAAqC,CAAC;AACpD,cAAc,iBAAiB,CAAC;AAChC,cAAc,eAAe,CAAC;AAE9B,cAAc,iBAAiB,CAAC;AAChC,cAAc,iBAAiB,CAAC"}
@@ -7,3 +7,5 @@ export * from "./factorizeCanonicalFormWithSqrt.js";
7
7
  export * from "./factoType2.js";
8
8
  export * from "./factoByX.js";
9
9
  // export * from "./factorizeAX2PlusBX.js"; //! existe déjà
10
+ export * from "./factoType3.js";
11
+ export * from "./factoType4.js";
@@ -1,3 +1,4 @@
1
1
  export * from "./sqrtCompositionDerivation.js";
2
2
  export * from "./rootFunctionDerivative.js";
3
+ export * from "./sqrtProductDerivative.js";
3
4
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/exercises/math/derivation/derivative/sqrt/index.ts"],"names":[],"mappings":"AACA,cAAc,gCAAgC,CAAC;AAC/C,cAAc,6BAA6B,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/exercises/math/derivation/derivative/sqrt/index.ts"],"names":[],"mappings":"AAAA,cAAc,gCAAgC,CAAC;AAC/C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,4BAA4B,CAAC"}
@@ -1,3 +1,3 @@
1
- // export * from "./sqrtProductDerivative.js";
2
1
  export * from "./sqrtCompositionDerivation.js";
3
2
  export * from "./rootFunctionDerivative.js";
3
+ export * from "./sqrtProductDerivative.js";
@@ -1 +1 @@
1
- {"version":3,"file":"sqrtProductDerivative.d.ts","sourceRoot":"","sources":["../../../../../../src/exercises/math/derivation/derivative/sqrt/sqrtProductDerivative.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAYT,MAAM,6BAA6B,CAAC;AAWrC,KAAK,WAAW,GAAG;IACjB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;CACX,CAAC;AAmFF,eAAO,MAAM,qBAAqB,EAAE,QAAQ,CAAC,WAAW,CAavD,CAAC"}
1
+ {"version":3,"file":"sqrtProductDerivative.d.ts","sourceRoot":"","sources":["../../../../../../src/exercises/math/derivation/derivative/sqrt/sqrtProductDerivative.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAcT,MAAM,6BAA6B,CAAC;AAkBrC,KAAK,WAAW,GAAG;IACjB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;CACX,CAAC;AAoKF,eAAO,MAAM,qBAAqB,EAAE,QAAQ,CAAC,WAAW,CAcvD,CAAC"}
@@ -1,26 +1,52 @@
1
- import { addValidProp, shuffleProps, propWhile, } from "../../../../../exercises/exercise.js";
1
+ import { addValidProp, shuffleProps, tryToAddWrongProp, } from "../../../../../exercises/exercise.js";
2
2
  import { getDistinctQuestions } from "../../../../../exercises/utils/getDistinctQuestions.js";
3
3
  import { randint } from "../../../../../math/utils/random/randint.js";
4
4
  import { sqrt } from "../../../../../tree/nodes/functions/sqrtNode.js";
5
5
  import { add } from "../../../../../tree/nodes/operators/addNode.js";
6
6
  import { frac } from "../../../../../tree/nodes/operators/fractionNode.js";
7
7
  import { multiply } from "../../../../../tree/nodes/operators/multiplyNode.js";
8
+ import { substract } from "../../../../../tree/nodes/operators/substractNode.js";
8
9
  import { parseAlgebraic } from "../../../../../tree/parsers/latexParser.js";
9
10
  import { handleVEAError } from "../../../../../utils/errors/handleVEAError.js";
10
- const getPropositions = (n, { answer }) => {
11
+ import { alignTex } from "../../../../../utils/latex/alignTex.js";
12
+ const getPolyFunction = (identifiers) => {
13
+ const { a, b } = identifiers;
14
+ return add(multiply(a, "x"), b).simplify({ forbidFactorize: true });
15
+ };
16
+ const getPropositions = (n, { answer, ...identifiers }) => {
17
+ const { a, b } = identifiers;
11
18
  const propositions = [];
12
19
  addValidProp(propositions, answer);
13
- propWhile(propositions, n, () => {
14
- throw Error("QCM not implemented");
15
- });
20
+ //mistake: den is sqrt{x} instead of 2sqrt{x}
21
+ //asqrt{x} + (ax+b)/sqrt{x} = (ax+ ax+b)/sqrt{x} = (4ax+2b)/2sqrt{x}
22
+ const nodeWrong1 = frac(add(multiply(4 * a, "x"), multiply(2, b)), multiply(2, sqrt("x"))).simplify();
23
+ tryToAddWrongProp(propositions, nodeWrong1.toTex());
24
+ //mistake: den is -2sqrt{x} instead of 2sqrt{x}
25
+ //asqrt{x} - (ax+b)/2sqrt{x} = (-ax+b)/2sqrt{x}
26
+ const nodeWrong2 = frac(add(multiply(2 * a, "x"), b), multiply(2, sqrt("x"))).simplify();
27
+ tryToAddWrongProp(propositions, nodeWrong2.toTex());
28
+ //mistake: den is (1/2)sqrt{x} instead of 2sqrt{x}
29
+ //asqrt{x} - 2(ax+b)/sqrt{x} = (-ax+b)/sqrt{x} = (-2ax+2b)/2sqrt{x}
30
+ const nodeWrong3 = frac(add(multiply(2 * a, "x"), multiply(2, b)), multiply(2, sqrt("x"))).simplify();
31
+ tryToAddWrongProp(propositions, nodeWrong3.toTex());
32
+ //mistake: student remembers (-3ax+b)/2sqrt{x} instead of (3ax+b)/2sqrt{x}
33
+ const nodeWrong4 = frac(add(multiply(-3 * a, "x"), b), multiply(2, sqrt("x"))).simplify();
34
+ tryToAddWrongProp(propositions, nodeWrong4.toTex());
35
+ //mistake: (uv)'=uv'
36
+ const nodeWrong5 = frac(add(multiply(a, "x"), b), multiply(2, sqrt("x"))).simplify();
37
+ tryToAddWrongProp(propositions, nodeWrong5.toTex());
38
+ //mistake: student remembers it has something to do with "\\times 3"
39
+ const nodeWrong6 = frac(add(multiply(3 * a, "x"), multiply(3, b)), multiply(2, sqrt("x"))).simplify();
40
+ tryToAddWrongProp(propositions, nodeWrong6.toTex());
16
41
  return shuffleProps(propositions, n);
17
42
  };
18
- const getAnswer = (identifiers) => {
43
+ const getAnswerNode = (identifiers) => {
19
44
  const { a, b } = identifiers;
20
- //asqrt(x) + (ax+b)/2sqrt(x) = (2ax+ ax+b)/2sqrt(x)
21
- return frac(add(multiply(3 * a, "x"), b), multiply(2, sqrt("x")))
22
- .simplify()
23
- .toTex();
45
+ //asqrt{x} + (ax+b)/2sqrt{x} = (2ax+ ax+b)/2sqrt{x} = (3ax+b)/2sqrt{x}
46
+ return frac(add(multiply(3 * a, "x"), b), multiply(2, sqrt("x"))).simplify();
47
+ };
48
+ const getAnswer = (identifiers) => {
49
+ return getAnswerNode(identifiers).toTex();
24
50
  };
25
51
  const getFunction = (identifiers) => {
26
52
  const { a, b } = identifiers;
@@ -33,24 +59,54 @@ $$
33
59
  f(x) = ${getFunction(identifiers).toTex()}
34
60
  $$`;
35
61
  };
36
- // const getHint: GetHint<Identifiers> = (identifiers) => {
37
- // return ``;
38
- // };
39
- // const getCorrection: GetCorrection<Identifiers> = (identifiers) => {
40
- // return ``;
41
- // };
62
+ const getHint = (identifiers) => {
63
+ return `Il s'agit de calculer la dérivée d'un produit.
64
+
65
+ Quelle est la dérivée de $x \\mapsto ${getPolyFunction(identifiers).toTex()}$ ?
66
+
67
+ Quelle est la dérivée de $x \\mapsto \\sqrt{x}$ ?`;
68
+ };
69
+ const getCorrection = (identifiers) => {
70
+ const { a } = identifiers;
71
+ const texAnswer = getAnswer(identifiers);
72
+ const texPoly = getPolyFunction(identifiers).toTex();
73
+ return `Pour $u$ et $v$ deux fonctions dérivables sur $[0; +\\infty[$ :
74
+
75
+ $$
76
+ (uv)'(x) = u'(x)v(x) + u(x)v'(x)
77
+ $$
78
+
79
+ Ici :
80
+
81
+ $$
82
+ u(x) = ${texPoly}
83
+ $$
84
+
85
+ $$
86
+ v(x) = \\sqrt{x}
87
+ $$
88
+
89
+ Donc :
90
+
91
+ ${alignTex([
92
+ ["f'(x)", "=", `${a}\\sqrt{x} + \\frac{${texPoly}}{2\\sqrt{x}}`],
93
+ ["", "=", `\\frac{${2 * a}x}{2\\sqrt{x}} + \\frac{${texPoly}}{2\\sqrt{x}}`],
94
+ ["", "=", texAnswer],
95
+ ])}
96
+
97
+ `;
98
+ };
42
99
  const getKeys = () => {
43
100
  return ["x"];
44
101
  };
45
- const isAnswerValid = (ans, { answer }) => {
102
+ const isAnswerValid = (ans, { answer, ...identifiers }) => {
46
103
  try {
47
- const parsed = parseAlgebraic(ans);
48
- return (parsed
49
- .simplify({
50
- towardsDistribute: true,
51
- forceDistributeFractions: true,
52
- })
53
- .toTex() === answer);
104
+ const nodeAns = parseAlgebraic(ans);
105
+ const nodeAnswer = getAnswerNode(identifiers);
106
+ const nodeSub = substract(nodeAns, nodeAnswer);
107
+ return [3, 7, 67, 100].every((x) => {
108
+ return nodeSub.evaluate({ x }) === 0;
109
+ });
54
110
  }
55
111
  catch (err) {
56
112
  return handleVEAError(err);
@@ -69,8 +125,8 @@ const getQuestionFromIdentifiers = (identifiers) => {
69
125
  keys: getKeys(identifiers),
70
126
  answerFormat: "tex",
71
127
  identifiers,
72
- // hint: getHint(identifiers),
73
- // correction: getCorrection(identifiers)
128
+ hint: getHint(identifiers),
129
+ correction: getCorrection(identifiers),
74
130
  };
75
131
  };
76
132
  export const sqrtProductDerivative = {
@@ -85,4 +141,5 @@ export const sqrtProductDerivative = {
85
141
  isAnswerValid,
86
142
  subject: "Mathématiques",
87
143
  getQuestionFromIdentifiers,
144
+ hasHintAndCorrection: true,
88
145
  };
@@ -11,7 +11,6 @@ export * from "./readAbscissOnLine.js";
11
11
  export * from "./readAbscissOnSemiLine.js";
12
12
  export * from "./placeAbscissOnLine.js";
13
13
  export * from "./placeAbscissOnSemiLine.js";
14
- export * from "./placeAbscissOnSemiLineV2.js";
15
14
  export * from "./cartesianFromVectorAndPoint.js";
16
15
  export * from "./cartesianFromTwoPoints.js";
17
16
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/geometry/cartesian/index.ts"],"names":[],"mappings":"AAAA,cAAc,+BAA+B,CAAC;AAC9C,cAAc,eAAe,CAAC;AAC9B,cAAc,8BAA8B,CAAC;AAC7C,cAAc,uBAAuB,CAAC;AACtC,cAAc,sBAAsB,CAAC;AACrC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,qBAAqB,CAAC;AACpC,cAAc,kBAAkB,CAAC;AACjC,cAAc,oCAAoC,CAAC;AAEnD,cAAc,wBAAwB,CAAC;AACvC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,yBAAyB,CAAC;AACxC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,+BAA+B,CAAC;AAC9C,cAAc,kCAAkC,CAAC;AACjD,cAAc,6BAA6B,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/geometry/cartesian/index.ts"],"names":[],"mappings":"AAAA,cAAc,+BAA+B,CAAC;AAC9C,cAAc,eAAe,CAAC;AAC9B,cAAc,8BAA8B,CAAC;AAC7C,cAAc,uBAAuB,CAAC;AACtC,cAAc,sBAAsB,CAAC;AACrC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,qBAAqB,CAAC;AACpC,cAAc,kBAAkB,CAAC;AACjC,cAAc,oCAAoC,CAAC;AAEnD,cAAc,wBAAwB,CAAC;AACvC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,yBAAyB,CAAC;AACxC,cAAc,6BAA6B,CAAC;AAE5C,cAAc,kCAAkC,CAAC;AACjD,cAAc,6BAA6B,CAAC"}
@@ -12,6 +12,6 @@ export * from "./readAbscissOnLine.js";
12
12
  export * from "./readAbscissOnSemiLine.js";
13
13
  export * from "./placeAbscissOnLine.js";
14
14
  export * from "./placeAbscissOnSemiLine.js";
15
- export * from "./placeAbscissOnSemiLineV2.js";
15
+ // export * from "./placeAbscissOnSemiLineV2.js";
16
16
  export * from "./cartesianFromVectorAndPoint.js";
17
17
  export * from "./cartesianFromTwoPoints.js";
@@ -1 +1 @@
1
- {"version":3,"file":"placeAbscissOnSemiLineV2.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/geometry/cartesian/placeAbscissOnSemiLineV2.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAWT,MAAM,6BAA6B,CAAC;AAQrC,OAAO,EAAE,UAAU,EAAE,MAAM,8BAA8B,CAAC;AAK1D,OAAO,EAEL,eAAe,EAChB,MAAM,qCAAqC,CAAC;AAK7C,KAAK,WAAW,GAAG;IACjB,WAAW,EAAE,UAAU,CAAC;IACxB,QAAQ,EAAE,eAAe,CAAC;IAC1B,QAAQ,EAAE,eAAe,CAAC;IAC1B,QAAQ,EAAE,eAAe,CAAC;CAC3B,CAAC;AAkOF,KAAK,OAAO,GAAG;IACb,YAAY,EAAE,UAAU,GAAG,oBAAoB,CAAC;IAChD,UAAU,EAAE,SAAS,GAAG,YAAY,GAAG,UAAU,CAAC;CACnD,CAAC;AA6BF,eAAO,MAAM,wBAAwB,EAAE,QAAQ,CAAC,WAAW,EAAE,OAAO,CAanE,CAAC"}
1
+ {"version":3,"file":"placeAbscissOnSemiLineV2.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/geometry/cartesian/placeAbscissOnSemiLineV2.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAWT,MAAM,6BAA6B,CAAC;AAQrC,OAAO,EAAE,UAAU,EAAE,MAAM,8BAA8B,CAAC;AAK1D,OAAO,EAEL,eAAe,EAChB,MAAM,qCAAqC,CAAC;AAK7C,KAAK,WAAW,GAAG;IACjB,WAAW,EAAE,UAAU,CAAC;IACxB,QAAQ,EAAE,eAAe,CAAC;IAC1B,QAAQ,EAAE,eAAe,CAAC;IAC1B,QAAQ,EAAE,eAAe,CAAC;CAC3B,CAAC;AAiOF,KAAK,OAAO,GAAG;IACb,YAAY,EAAE,UAAU,GAAG,oBAAoB,CAAC;IAChD,UAAU,EAAE,SAAS,GAAG,YAAY,GAAG,UAAU,CAAC;CACnD,CAAC;AA6BF,eAAO,MAAM,wBAAwB,EAAE,QAAQ,CAAC,WAAW,EAAE,OAAO,CAanE,CAAC"}
@@ -83,7 +83,6 @@ const isGGBAnswerValid = (ans, { absciss2, axisUnit }) => {
83
83
  const [absciss2Node, axisUnitNode] = [absciss2, axisUnit].map((nodeIds) => NodeConstructor.fromIdentifiers(nodeIds));
84
84
  const commands = ans;
85
85
  const dictObj = new GeogebraParser(commands).objectDict();
86
- console.log("dictObj:", dictObj);
87
86
  const strPointA = dictObj["A"];
88
87
  if (!strPointA) {
89
88
  return false;
@@ -2,3 +2,5 @@ export * from "./buildMediatriceWithCompass.js";
2
2
  export * from "./buildTriangleWithSizes.js";
3
3
  export * from "./pointImageFromTranslation.js";
4
4
  export * from "./buildPointFromAxialSymetry.js";
5
+ // export * from "./pointImageFromHomothety.js";
6
+ // export * from "./segmentImageFromHomothety.js";
@@ -0,0 +1,16 @@
1
+ import { Exercise } from "../../../../exercises/exercise.js";
2
+ import { PointIdentifiers } from "../../../../math/geometry/point.js";
3
+ import { NodeIdentifiers } from "../../../../tree/nodes/nodeConstructor.js";
4
+ type Identifiers = {
5
+ pointsDict: Record<string, PointIdentifiers>;
6
+ nameTargetPoint: string;
7
+ nameCenterPoint: string;
8
+ factor: NodeIdentifiers;
9
+ };
10
+ type Options = {
11
+ isPositiveFactorOnly: boolean;
12
+ factorTypes: string[];
13
+ };
14
+ export declare const pointImageFromHomothety: Exercise<Identifiers, Options>;
15
+ export {};
16
+ //# sourceMappingURL=pointImageFromHomothety.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pointImageFromHomothety.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/geometry/euclidianConstructions/pointImageFromHomothety.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAaT,MAAM,6BAA6B,CAAC;AAQrC,OAAO,EAGL,gBAAgB,EACjB,MAAM,8BAA8B,CAAC;AAKtC,OAAO,EAEL,eAAe,EAChB,MAAM,qCAAqC,CAAC;AA0D7C,KAAK,WAAW,GAAG;IACjB,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,gBAAgB,CAAC,CAAC;IAC7C,eAAe,EAAE,MAAM,CAAC;IACxB,eAAe,EAAE,MAAM,CAAC;IACxB,MAAM,EAAE,eAAe,CAAC;CACzB,CAAC;AA2LF,KAAK,OAAO,GAAG;IACb,oBAAoB,EAAE,OAAO,CAAC;IAC9B,WAAW,EAAE,MAAM,EAAE,CAAC;CACvB,CAAC;AAyBF,eAAO,MAAM,uBAAuB,EAAE,QAAQ,CAAC,WAAW,EAAE,OAAO,CAiBlE,CAAC"}