math-exercises 2.2.61 → 2.2.62

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 (43) hide show
  1. package/lib/exercises/math/functions/basics/graphicInequationAffine.d.ts +12 -0
  2. package/lib/exercises/math/functions/basics/graphicInequationAffine.d.ts.map +1 -0
  3. package/lib/exercises/math/functions/basics/graphicInequationAffine.js +123 -0
  4. package/lib/exercises/math/functions/basics/index.d.ts +1 -0
  5. package/lib/exercises/math/functions/basics/index.d.ts.map +1 -1
  6. package/lib/exercises/math/functions/basics/index.js +1 -0
  7. package/lib/exercises/math/functions/trinoms/findSecondRoot.d.ts +10 -0
  8. package/lib/exercises/math/functions/trinoms/findSecondRoot.d.ts.map +1 -0
  9. package/lib/exercises/math/functions/trinoms/findSecondRoot.js +127 -0
  10. package/lib/exercises/math/functions/trinoms/index.d.ts +3 -0
  11. package/lib/exercises/math/functions/trinoms/index.d.ts.map +1 -1
  12. package/lib/exercises/math/functions/trinoms/index.js +3 -0
  13. package/lib/exercises/math/functions/trinoms/rootsProduct.d.ts +8 -0
  14. package/lib/exercises/math/functions/trinoms/rootsProduct.d.ts.map +1 -0
  15. package/lib/exercises/math/functions/trinoms/rootsProduct.js +112 -0
  16. package/lib/exercises/math/functions/trinoms/rootsSum.d.ts +8 -0
  17. package/lib/exercises/math/functions/trinoms/rootsSum.d.ts.map +1 -0
  18. package/lib/exercises/math/functions/trinoms/rootsSum.js +113 -0
  19. package/lib/exercises/math/geometry/euclidianConstructions/pointImageFromTranslation.d.ts +4 -1
  20. package/lib/exercises/math/geometry/euclidianConstructions/pointImageFromTranslation.d.ts.map +1 -1
  21. package/lib/exercises/math/geometry/euclidianConstructions/pointImageFromTranslation.js +17 -5
  22. package/lib/exercises/math/powers/powersProduct.d.ts.map +1 -1
  23. package/lib/exercises/math/powers/powersProduct.js +0 -8
  24. package/lib/exercises/vea/rationalVEA.d.ts +2 -0
  25. package/lib/exercises/vea/rationalVEA.d.ts.map +1 -0
  26. package/lib/exercises/vea/rationalVEA.js +14 -0
  27. package/lib/index.d.ts +16 -1
  28. package/lib/index.d.ts.map +1 -1
  29. package/lib/math/inequations/inequation.d.ts +1 -0
  30. package/lib/math/inequations/inequation.d.ts.map +1 -1
  31. package/lib/math/inequations/inequation.js +3 -0
  32. package/lib/math/polynomials/affine.d.ts +1 -0
  33. package/lib/math/polynomials/affine.d.ts.map +1 -1
  34. package/lib/math/polynomials/affine.js +4 -0
  35. package/lib/math/polynomials/generalTrinom.d.ts +10 -2
  36. package/lib/math/polynomials/generalTrinom.d.ts.map +1 -1
  37. package/lib/math/polynomials/generalTrinom.js +29 -1
  38. package/lib/tree/nodes/operators/fractionNode.d.ts +1 -0
  39. package/lib/tree/nodes/operators/fractionNode.d.ts.map +1 -1
  40. package/lib/tree/nodes/operators/fractionNode.js +10 -0
  41. package/lib/tree/parsers/rationalParser.d.ts.map +1 -1
  42. package/lib/tree/parsers/rationalParser.js +0 -3
  43. package/package.json +1 -1
@@ -0,0 +1,12 @@
1
+ import { Exercise } from "../../../../exercises/exercise";
2
+ import { InegalitySymbols } from "../../../../math/inequations/inequation";
3
+ type Identifiers = {
4
+ yValue: number;
5
+ xValue: number;
6
+ inegalitySymbol: InegalitySymbols;
7
+ a: number;
8
+ b: number;
9
+ };
10
+ export declare const graphicInequationAffine: Exercise<Identifiers>;
11
+ export {};
12
+ //# sourceMappingURL=graphicInequationAffine.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"graphicInequationAffine.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/functions/basics/graphicInequationAffine.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAkBT,MAAM,0BAA0B,CAAC;AAGlC,OAAO,EACL,gBAAgB,EAGjB,MAAM,mCAAmC,CAAC;AAa3C,KAAK,WAAW,GAAG;IACjB,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,eAAe,EAAE,gBAAgB,CAAC;IAClC,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;CACX,CAAC;AAsHF,eAAO,MAAM,uBAAuB,EAAE,QAAQ,CAAC,WAAW,CAiBzD,CAAC"}
@@ -0,0 +1,123 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.graphicInequationAffine = void 0;
4
+ const exercise_1 = require("../../../../exercises/exercise");
5
+ const getDistinctQuestions_1 = require("../../../../exercises/utils/getDistinctQuestions");
6
+ const geogebraConstructor_1 = require("../../../../geogebra/geogebraConstructor");
7
+ const inequation_1 = require("../../../../math/inequations/inequation");
8
+ const affine_1 = require("../../../../math/polynomials/affine");
9
+ const randfloat_1 = require("../../../../math/utils/random/randfloat");
10
+ const randint_1 = require("../../../../math/utils/random/randint");
11
+ const infiniteNode_1 = require("../../../../tree/nodes/numbers/infiniteNode");
12
+ const closure_1 = require("../../../../tree/nodes/sets/closure");
13
+ const intervalNode_1 = require("../../../../tree/nodes/sets/intervalNode");
14
+ const coinFlip_1 = require("../../../../utils/alea/coinFlip");
15
+ const random_1 = require("../../../../utils/alea/random");
16
+ const getPropositions = (n, { answer }) => {
17
+ const propositions = [];
18
+ (0, exercise_1.addValidProp)(propositions, answer);
19
+ while (propositions.length < n) {
20
+ const isTowardsLeft = (0, coinFlip_1.coinFlip)();
21
+ const k = (0, randint_1.randint)(-10, 10).toTree();
22
+ const bounds = isTowardsLeft
23
+ ? [infiniteNode_1.MinusInfinityNode, k]
24
+ : [k, infiniteNode_1.PlusInfinityNode];
25
+ const closure = closure_1.Closure.fromBrackets(isTowardsLeft ? "]" : "[", (0, random_1.random)(["]", "["]));
26
+ (0, exercise_1.tryToAddWrongProp)(propositions, new intervalNode_1.IntervalNode(bounds[0], bounds[1], closure).toTex());
27
+ }
28
+ return (0, exercise_1.shuffleProps)(propositions, n);
29
+ };
30
+ const getAnswer = (identifiers) => {
31
+ //ax+b ! y
32
+ const { a, inegalitySymbol, xValue } = identifiers;
33
+ const inequation = new inequation_1.InequationSymbol(inegalitySymbol);
34
+ const isStrict = inequation.isStrict;
35
+ const isAskingSup = inequation.isSup;
36
+ const isCroissante = a > 0;
37
+ const inter = new intervalNode_1.IntervalNode(isCroissante === isAskingSup ? xValue.toTree() : infiniteNode_1.MinusInfinityNode, isCroissante === isAskingSup ? infiniteNode_1.PlusInfinityNode : xValue.toTree(), isStrict
38
+ ? closure_1.ClosureType.OO
39
+ : isCroissante === isAskingSup
40
+ ? closure_1.ClosureType.FO
41
+ : closure_1.ClosureType.OF);
42
+ return inter.toTex();
43
+ };
44
+ const getInstruction = (identifiers) => {
45
+ const { yValue, inegalitySymbol, a, b } = identifiers;
46
+ const inequation = new inequation_1.InequationSymbol(inegalitySymbol);
47
+ const isStrict = inequation.isStrict;
48
+ const isAskingSup = inequation.isSup;
49
+ return `Ci-dessous est tracé la courbe représentative d'une fonction $f$. Déterminer graphiquement les solutions de l'inéquation $f(x)${isAskingSup ? (isStrict ? ">" : "\\geq") : isStrict ? "<" : "\\leq"}${yValue}$`;
50
+ };
51
+ // const getHint: GetHint<Identifiers> = (identifiers) => {};
52
+ // const getCorrection: GetCorrection<Identifiers> = (identifiers) => {};
53
+ const getGGBOptions = (identifiers) => {
54
+ const { a, b } = identifiers;
55
+ const affine = new affine_1.Affine(a, b);
56
+ const ggb = new geogebraConstructor_1.GeogebraConstructor({
57
+ commands: affine.toGGBCommands(),
58
+ });
59
+ return ggb.getOptions({
60
+ coords: [-10, 10, -10, 10],
61
+ });
62
+ };
63
+ const getKeys = (identifiers) => {
64
+ return [
65
+ "S",
66
+ "equal",
67
+ "lbracket",
68
+ "semicolon",
69
+ "rbracket",
70
+ "infty",
71
+ "cup",
72
+ "lbrace",
73
+ "rbrace",
74
+ "varnothing",
75
+ ];
76
+ };
77
+ const isAnswerValid = (ans, { answer }) => {
78
+ const inter = answer;
79
+ return ans === inter || ans === "S=" + inter;
80
+ throw Error("VEA not implemented");
81
+ };
82
+ const getGraphicInequationAffineQuestion = (opts) => {
83
+ const yValue = (0, randint_1.randint)(-5, 6);
84
+ const xValue = (0, randint_1.randint)(-5, 6);
85
+ const a = (0, randfloat_1.randfloat)(-3, 4, 1, [0]);
86
+ const b = yValue - a * xValue;
87
+ const inegalitySymbol = inequation_1.InequationSymbolConstructor.randomSymbol();
88
+ const identifiers = {
89
+ a,
90
+ b,
91
+ xValue,
92
+ yValue,
93
+ inegalitySymbol,
94
+ };
95
+ const question = {
96
+ answer: getAnswer(identifiers),
97
+ instruction: getInstruction(identifiers),
98
+ keys: getKeys(identifiers),
99
+ answerFormat: "tex",
100
+ identifiers,
101
+ // hint: getHint(identifiers),
102
+ // correction: getCorrection(identifiers),
103
+ ggbOptions: getGGBOptions(identifiers),
104
+ };
105
+ return question;
106
+ };
107
+ exports.graphicInequationAffine = {
108
+ id: "graphicInequationAffine",
109
+ connector: "=",
110
+ label: "Résoudre graphiquement une inéquation (fonctions affines)",
111
+ isSingleStep: true,
112
+ generator: (nb, opts) => (0, getDistinctQuestions_1.getDistinctQuestions)(() => getGraphicInequationAffineQuestion(opts), nb),
113
+ qcmTimer: 60,
114
+ freeTimer: 60,
115
+ getPropositions,
116
+ isAnswerValid,
117
+ subject: "Mathématiques",
118
+ // getHint,
119
+ // getCorrection,
120
+ getInstruction,
121
+ getAnswer,
122
+ getGGBOptions,
123
+ };
@@ -8,4 +8,5 @@ export * from "./twoFunctionsEquation";
8
8
  export * from "./twoFunctionsInequation";
9
9
  export * from "./inverseImageFunctionTable";
10
10
  export * from "./imageAntecedentFromSentence";
11
+ export * from "./graphicInequationAffine";
11
12
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/functions/basics/index.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAC;AAChC,cAAc,yBAAyB,CAAC;AACxC,cAAc,wBAAwB,CAAC;AACvC,cAAc,gCAAgC,CAAC;AAC/C,cAAc,mBAAmB,CAAC;AAClC,cAAc,qBAAqB,CAAC;AACpC,cAAc,wBAAwB,CAAC;AACvC,cAAc,0BAA0B,CAAC;AACzC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,+BAA+B,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/functions/basics/index.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAC;AAChC,cAAc,yBAAyB,CAAC;AACxC,cAAc,wBAAwB,CAAC;AACvC,cAAc,gCAAgC,CAAC;AAC/C,cAAc,mBAAmB,CAAC;AAClC,cAAc,qBAAqB,CAAC;AACpC,cAAc,wBAAwB,CAAC;AACvC,cAAc,0BAA0B,CAAC;AACzC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,+BAA+B,CAAC;AAC9C,cAAc,2BAA2B,CAAC"}
@@ -24,3 +24,4 @@ __exportStar(require("./twoFunctionsEquation"), exports);
24
24
  __exportStar(require("./twoFunctionsInequation"), exports);
25
25
  __exportStar(require("./inverseImageFunctionTable"), exports);
26
26
  __exportStar(require("./imageAntecedentFromSentence"), exports);
27
+ __exportStar(require("./graphicInequationAffine"), exports);
@@ -0,0 +1,10 @@
1
+ import { Exercise } from "../../../../exercises/exercise";
2
+ import { GeneralTrinomIdentifiers } from "../../../../math/polynomials/generalTrinom";
3
+ import { NodeIdentifiers } from "../../../../tree/nodes/nodeConstructor";
4
+ type Identifiers = {
5
+ trinomIdentifiers: GeneralTrinomIdentifiers;
6
+ firstRootIdentifiers: NodeIdentifiers;
7
+ };
8
+ export declare const findSecondRoot: Exercise<Identifiers>;
9
+ export {};
10
+ //# sourceMappingURL=findSecondRoot.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"findSecondRoot.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/functions/trinoms/findSecondRoot.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAcT,MAAM,0BAA0B,CAAC;AAIlC,OAAO,EAGL,wBAAwB,EACzB,MAAM,sCAAsC,CAAC;AAI9C,OAAO,EAEL,eAAe,EAChB,MAAM,kCAAkC,CAAC;AAO1C,KAAK,WAAW,GAAG;IACjB,iBAAiB,EAAE,wBAAwB,CAAC;IAC5C,oBAAoB,EAAE,eAAe,CAAC;CACvC,CAAC;AAiHF,eAAO,MAAM,cAAc,EAAE,QAAQ,CAAC,WAAW,CAiBhD,CAAC"}
@@ -0,0 +1,127 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.findSecondRoot = void 0;
4
+ const exercise_1 = require("../../../../exercises/exercise");
5
+ const getDistinctQuestions_1 = require("../../../../exercises/utils/getDistinctQuestions");
6
+ const rationalVEA_1 = require("../../../../exercises/vea/rationalVEA");
7
+ const generalTrinom_1 = require("../../../../math/polynomials/generalTrinom");
8
+ const randint_1 = require("../../../../math/utils/random/randint");
9
+ const oppositeNode_1 = require("../../../../tree/nodes/functions/oppositeNode");
10
+ const nodeConstructor_1 = require("../../../../tree/nodes/nodeConstructor");
11
+ const addNode_1 = require("../../../../tree/nodes/operators/addNode");
12
+ const fractionNode_1 = require("../../../../tree/nodes/operators/fractionNode");
13
+ const multiplyNode_1 = require("../../../../tree/nodes/operators/multiplyNode");
14
+ const getPropositions = (n, { answer }) => {
15
+ const propositions = [];
16
+ (0, exercise_1.addValidProp)(propositions, answer);
17
+ while (propositions.length < n) {
18
+ (0, exercise_1.tryToAddWrongProp)(propositions, (0, randint_1.randint)(-10, 10).frenchify());
19
+ }
20
+ return (0, exercise_1.shuffleProps)(propositions, n);
21
+ };
22
+ const getAnswer = (identifiers) => {
23
+ const { trinomIdentifiers, firstRootIdentifiers } = identifiers;
24
+ const trinom = generalTrinom_1.GeneralTrinomConstructor.fromIdentifiers(trinomIdentifiers);
25
+ const firstRoot = nodeConstructor_1.NodeConstructor.fromIdentifiers(firstRootIdentifiers);
26
+ const firstRootTex = firstRoot.toTex();
27
+ const roots = trinom.getRoots().map((e) => e.toTex());
28
+ return roots.find((r) => r !== firstRootTex);
29
+ };
30
+ const getInstruction = (identifiers) => {
31
+ const { trinomIdentifiers, firstRootIdentifiers } = identifiers;
32
+ const trinom = generalTrinom_1.GeneralTrinomConstructor.fromIdentifiers(trinomIdentifiers);
33
+ const firstRoot = nodeConstructor_1.NodeConstructor.fromIdentifiers(firstRootIdentifiers);
34
+ const firstRootTex = firstRoot.toTex();
35
+ return `Soit $f$ la fonction polynôme du second degré définie sur $\\mathbb{R}$ par :
36
+
37
+ $$
38
+ f(x) = ${trinom.toTree().toTex()}
39
+ $$
40
+
41
+ On admet que $f$ admet deux racines, dont une vaut $${firstRootTex}$.
42
+
43
+ Sans calculer $\\Delta$, déterminer la deuxième racine de $f$.`;
44
+ };
45
+ const getHint = (identifiers) => {
46
+ return `Si $f(x) = ax^2 + bx + c$ admet deux racines $x_1$ et $x_2$, alors leur produit vaut :
47
+
48
+ $$
49
+ x_1\\times x_2 = \\frac{c}{a}
50
+ $$
51
+
52
+ En remplaçant les valeurs par celles données dans l'énoncé, on peut déterminer la deuxième racine de $f$.
53
+ `;
54
+ };
55
+ const getCorrection = (identifiers) => {
56
+ const { trinomIdentifiers, firstRootIdentifiers } = identifiers;
57
+ const trinom = generalTrinom_1.GeneralTrinomConstructor.fromIdentifiers(trinomIdentifiers);
58
+ const firstRoot = nodeConstructor_1.NodeConstructor.fromIdentifiers(firstRootIdentifiers);
59
+ const cOverA = (0, fractionNode_1.frac)(trinom.c, trinom.a).simplify();
60
+ return `On sait que le produit des racines $x_1$ et $x_2$ de $f$ vaut :
61
+
62
+ $$
63
+ x_1\\times x_2 = \\frac{c}{a} = ${cOverA.toTex()}
64
+ $$
65
+
66
+ Or on sait que $x_1 = ${firstRoot.toTex()}$. On a donc :
67
+
68
+ $$
69
+ x_2 = ${(0, fractionNode_1.frac)(cOverA, firstRoot).toSimplificationString()}
70
+ $$
71
+ `;
72
+ };
73
+ const getKeys = (identifiers) => {
74
+ return [];
75
+ };
76
+ const isAnswerValid = (ans, { answer }) => {
77
+ return (0, rationalVEA_1.rationalVEA)(ans, answer);
78
+ };
79
+ const getFindSecondRootQuestion = (ops) => {
80
+ // const firstRoot = coinFlip()
81
+ // ? randint(-10, 10).toTree()
82
+ // : RationalConstructor.randomIrreductibleWithSign(5).toTree();
83
+ const firstRoot = (0, randint_1.randint)(-10, 10);
84
+ // const secondRoot = doWhile(
85
+ // () =>
86
+ // coinFlip()
87
+ // ? randint(-10, 10).toTree()
88
+ // : RationalConstructor.randomIrreductibleWithSign(5).toTree(),
89
+ // (x) => x.equals(firstRoot),
90
+ // );
91
+ const secondRoot = (0, randint_1.randint)(-10, 10, [firstRoot]);
92
+ const a = (0, randint_1.randint)(-10, 10, [0]);
93
+ const b = (0, oppositeNode_1.opposite)((0, multiplyNode_1.multiply)(a, (0, addNode_1.add)(firstRoot, secondRoot))).simplify();
94
+ const c = (0, multiplyNode_1.multiply)(a, (0, multiplyNode_1.multiply)(firstRoot, secondRoot)).simplify();
95
+ //first*second = c/a
96
+ const identifiers = {
97
+ firstRootIdentifiers: firstRoot.toTree().toIdentifiers(),
98
+ trinomIdentifiers: new generalTrinom_1.GeneralTrinom(a, b, c).toIdentifiers(),
99
+ };
100
+ const question = {
101
+ answer: getAnswer(identifiers),
102
+ instruction: getInstruction(identifiers),
103
+ keys: getKeys(identifiers),
104
+ answerFormat: "tex",
105
+ identifiers,
106
+ hint: getHint(identifiers),
107
+ correction: getCorrection(identifiers),
108
+ };
109
+ return question;
110
+ };
111
+ exports.findSecondRoot = {
112
+ id: "findSecondRoot",
113
+ connector: "=",
114
+ label: "Déterminer la deuxième racine d'un trinôme sans utiliser $\\Delta$",
115
+ isSingleStep: true,
116
+ generator: (nb, opts) => (0, getDistinctQuestions_1.getDistinctQuestions)(() => getFindSecondRootQuestion(opts), nb),
117
+ qcmTimer: 60,
118
+ freeTimer: 60,
119
+ getPropositions,
120
+ isAnswerValid,
121
+ subject: "Mathématiques",
122
+ getInstruction,
123
+ getHint,
124
+ getCorrection,
125
+ getAnswer,
126
+ hasHintAndCorrection: true,
127
+ };
@@ -19,4 +19,7 @@ export * from "./solveSecondDegreeEquationByFactorisation";
19
19
  export * from "./solveSecondDegreeEquationFromCano";
20
20
  export * from "./trinomSignFromRoots";
21
21
  export * from "./coefficientsIdentification";
22
+ export * from "./rootsSum";
23
+ export * from "./rootsProduct";
24
+ export * from "./findSecondRoot";
22
25
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/functions/trinoms/index.ts"],"names":[],"mappings":"AAAA,cAAc,wBAAwB,CAAC;AACvC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,wBAAwB,CAAC;AACvC,cAAc,eAAe,CAAC;AAC9B,cAAc,6BAA6B,CAAC;AAC5C,cAAc,gCAAgC,CAAC;AAC/C,cAAc,wBAAwB,CAAC;AACvC,cAAc,oBAAoB,CAAC;AACnC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,0BAA0B,CAAC;AACzC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,2BAA2B,CAAC;AAC1C,cAAc,iBAAiB,CAAC;AAChC,cAAc,0BAA0B,CAAC;AACzC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,sBAAsB,CAAC;AACrC,cAAc,4CAA4C,CAAC;AAC3D,cAAc,qCAAqC,CAAC;AACpD,cAAc,uBAAuB,CAAC;AACtC,cAAc,8BAA8B,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/functions/trinoms/index.ts"],"names":[],"mappings":"AAAA,cAAc,wBAAwB,CAAC;AACvC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,wBAAwB,CAAC;AACvC,cAAc,eAAe,CAAC;AAC9B,cAAc,6BAA6B,CAAC;AAC5C,cAAc,gCAAgC,CAAC;AAC/C,cAAc,wBAAwB,CAAC;AACvC,cAAc,oBAAoB,CAAC;AACnC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,0BAA0B,CAAC;AACzC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,2BAA2B,CAAC;AAC1C,cAAc,iBAAiB,CAAC;AAChC,cAAc,0BAA0B,CAAC;AACzC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,sBAAsB,CAAC;AACrC,cAAc,4CAA4C,CAAC;AAC3D,cAAc,qCAAqC,CAAC;AACpD,cAAc,uBAAuB,CAAC;AACtC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,YAAY,CAAC;AAC3B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,kBAAkB,CAAC"}
@@ -35,3 +35,6 @@ __exportStar(require("./solveSecondDegreeEquationByFactorisation"), exports);
35
35
  __exportStar(require("./solveSecondDegreeEquationFromCano"), exports);
36
36
  __exportStar(require("./trinomSignFromRoots"), exports);
37
37
  __exportStar(require("./coefficientsIdentification"), exports);
38
+ __exportStar(require("./rootsSum"), exports);
39
+ __exportStar(require("./rootsProduct"), exports);
40
+ __exportStar(require("./findSecondRoot"), exports);
@@ -0,0 +1,8 @@
1
+ import { Exercise } from "../../../../exercises/exercise";
2
+ import { GeneralTrinomIdentifiers } from "../../../../math/polynomials/generalTrinom";
3
+ type Identifiers = {
4
+ trinomIdentifiers: GeneralTrinomIdentifiers;
5
+ };
6
+ export declare const rootsProduct: Exercise<Identifiers>;
7
+ export {};
8
+ //# sourceMappingURL=rootsProduct.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"rootsProduct.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/functions/trinoms/rootsProduct.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAcT,MAAM,0BAA0B,CAAC;AAGlC,OAAO,EAGL,wBAAwB,EACzB,MAAM,sCAAsC,CAAC;AAO9C,KAAK,WAAW,GAAG;IACjB,iBAAiB,EAAE,wBAAwB,CAAC;CAC7C,CAAC;AA0GF,eAAO,MAAM,YAAY,EAAE,QAAQ,CAAC,WAAW,CAiB9C,CAAC"}
@@ -0,0 +1,112 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.rootsProduct = void 0;
4
+ const exercise_1 = require("../../../../exercises/exercise");
5
+ const getDistinctQuestions_1 = require("../../../../exercises/utils/getDistinctQuestions");
6
+ const rationalVEA_1 = require("../../../../exercises/vea/rationalVEA");
7
+ const generalTrinom_1 = require("../../../../math/polynomials/generalTrinom");
8
+ const randint_1 = require("../../../../math/utils/random/randint");
9
+ const oppositeNode_1 = require("../../../../tree/nodes/functions/oppositeNode");
10
+ const fractionNode_1 = require("../../../../tree/nodes/operators/fractionNode");
11
+ const multiplyNode_1 = require("../../../../tree/nodes/operators/multiplyNode");
12
+ const getPropositions = (n, { answer, trinomIdentifiers }) => {
13
+ const propositions = [];
14
+ (0, exercise_1.addValidProp)(propositions, answer);
15
+ const trinom = generalTrinom_1.GeneralTrinomConstructor.fromIdentifiers(trinomIdentifiers);
16
+ (0, exercise_1.tryToAddWrongProp)(propositions, (0, fractionNode_1.frac)((0, oppositeNode_1.opposite)(trinom.b), trinom.a).simplify().toTex());
17
+ (0, exercise_1.tryToAddWrongProp)(propositions, (0, fractionNode_1.frac)((0, oppositeNode_1.opposite)(trinom.c), trinom.a).simplify().toTex());
18
+ (0, exercise_1.tryToAddWrongProp)(propositions, (0, fractionNode_1.frac)((0, oppositeNode_1.opposite)(trinom.b), (0, multiplyNode_1.multiply)(2, trinom.a)).simplify().toTex());
19
+ while (propositions.length < n) {
20
+ (0, exercise_1.tryToAddWrongProp)(propositions, (0, randint_1.randint)(-10, 10).frenchify());
21
+ }
22
+ return (0, exercise_1.shuffleProps)(propositions, n);
23
+ };
24
+ const getAnswer = (identifiers) => {
25
+ const { trinomIdentifiers } = identifiers;
26
+ const trinom = generalTrinom_1.GeneralTrinomConstructor.fromIdentifiers(trinomIdentifiers);
27
+ const ans = (0, fractionNode_1.frac)(trinom.c, trinom.a).simplify().toTex();
28
+ return ans;
29
+ };
30
+ const getInstruction = (identifiers) => {
31
+ const { trinomIdentifiers } = identifiers;
32
+ const trinom = generalTrinom_1.GeneralTrinomConstructor.fromIdentifiers(trinomIdentifiers);
33
+ return `Soit $f$ la fonction définie sur $\\mathbb{R}$ par :
34
+
35
+ $$
36
+ f(x) = ${trinom.toTree().toTex()}
37
+ $$
38
+
39
+ On admet que $f$ possède deux racines.
40
+
41
+ Que vaut le produit des racines de $f$ ?`;
42
+ };
43
+ const getHint = (identifiers) => {
44
+ return `Si $f(x) = ax^2 + bx + c$ admet deux racines, alors leur produit $P$ vaut :
45
+
46
+ $$
47
+ P = \\frac{c}{a}
48
+ $$`;
49
+ };
50
+ const getCorrection = (identifiers) => {
51
+ const { trinomIdentifiers } = identifiers;
52
+ const trinom = generalTrinom_1.GeneralTrinomConstructor.fromIdentifiers(trinomIdentifiers);
53
+ const aTex = trinom.a.toTex();
54
+ const cTex = trinom.c.toTex();
55
+ const ans = (0, fractionNode_1.frac)(trinom.c, trinom.a);
56
+ return `Si $f(x) = ax^2 + bx + c$ admet deux racines, alors leur produit $P$ vaut :
57
+
58
+ $$
59
+ P = \\frac{c}{a}
60
+ $$
61
+
62
+ Ici, on a $a = ${aTex}$ et $c = ${cTex}$, donc :
63
+
64
+ $$
65
+ P = ${ans.toSimplificationString()}
66
+ $$
67
+ `;
68
+ };
69
+ const getKeys = (identifiers) => {
70
+ return [];
71
+ };
72
+ const isAnswerValid = (ans, { answer }) => {
73
+ return (0, rationalVEA_1.rationalVEA)(ans, answer);
74
+ };
75
+ const getRootsProductQuestion = (ops) => {
76
+ //(b,c) != 0
77
+ //ac <= 0
78
+ const a = (0, randint_1.randint)(-10, 10, [0]);
79
+ const b = (0, randint_1.randint)(-10, 10);
80
+ const c = (a / Math.abs(a)) * (0, randint_1.randint)(-10, 10, !b ? [0] : []);
81
+ const trinom = new generalTrinom_1.GeneralTrinom(a, b, c);
82
+ const identifiers = {
83
+ trinomIdentifiers: trinom.toIdentifiers(),
84
+ };
85
+ const question = {
86
+ answer: getAnswer(identifiers),
87
+ instruction: getInstruction(identifiers),
88
+ keys: getKeys(identifiers),
89
+ answerFormat: "tex",
90
+ identifiers,
91
+ hint: getHint(identifiers),
92
+ correction: getCorrection(identifiers),
93
+ };
94
+ return question;
95
+ };
96
+ exports.rootsProduct = {
97
+ id: "rootsProduct",
98
+ connector: "=",
99
+ label: "Produit des racines d'un trinôme",
100
+ isSingleStep: true,
101
+ generator: (nb, opts) => (0, getDistinctQuestions_1.getDistinctQuestions)(() => getRootsProductQuestion(opts), nb),
102
+ qcmTimer: 60,
103
+ freeTimer: 60,
104
+ getPropositions,
105
+ isAnswerValid,
106
+ subject: "Mathématiques",
107
+ getInstruction,
108
+ getHint,
109
+ getCorrection,
110
+ getAnswer,
111
+ hasHintAndCorrection: true,
112
+ };
@@ -0,0 +1,8 @@
1
+ import { Exercise } from "../../../../exercises/exercise";
2
+ import { GeneralTrinomIdentifiers } from "../../../../math/polynomials/generalTrinom";
3
+ type Identifiers = {
4
+ trinomIdentifiers: GeneralTrinomIdentifiers;
5
+ };
6
+ export declare const rootsSum: Exercise<Identifiers>;
7
+ export {};
8
+ //# sourceMappingURL=rootsSum.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"rootsSum.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/functions/trinoms/rootsSum.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAcT,MAAM,0BAA0B,CAAC;AAGlC,OAAO,EAGL,wBAAwB,EACzB,MAAM,sCAAsC,CAAC;AAO9C,KAAK,WAAW,GAAG;IACjB,iBAAiB,EAAE,wBAAwB,CAAC;CAC7C,CAAC;AAqGF,eAAO,MAAM,QAAQ,EAAE,QAAQ,CAAC,WAAW,CAiB1C,CAAC"}
@@ -0,0 +1,113 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.rootsSum = void 0;
4
+ const exercise_1 = require("../../../../exercises/exercise");
5
+ const getDistinctQuestions_1 = require("../../../../exercises/utils/getDistinctQuestions");
6
+ const rationalVEA_1 = require("../../../../exercises/vea/rationalVEA");
7
+ const generalTrinom_1 = require("../../../../math/polynomials/generalTrinom");
8
+ const randint_1 = require("../../../../math/utils/random/randint");
9
+ const oppositeNode_1 = require("../../../../tree/nodes/functions/oppositeNode");
10
+ const fractionNode_1 = require("../../../../tree/nodes/operators/fractionNode");
11
+ const multiplyNode_1 = require("../../../../tree/nodes/operators/multiplyNode");
12
+ const getPropositions = (n, { answer, trinomIdentifiers }) => {
13
+ const propositions = [];
14
+ (0, exercise_1.addValidProp)(propositions, answer);
15
+ const trinom = generalTrinom_1.GeneralTrinomConstructor.fromIdentifiers(trinomIdentifiers);
16
+ (0, exercise_1.tryToAddWrongProp)(propositions, (0, fractionNode_1.frac)(trinom.b, trinom.a).simplify().toTex());
17
+ (0, exercise_1.tryToAddWrongProp)(propositions, (0, fractionNode_1.frac)(trinom.c, trinom.a).simplify().toTex());
18
+ (0, exercise_1.tryToAddWrongProp)(propositions, (0, fractionNode_1.frac)((0, oppositeNode_1.opposite)(trinom.b), (0, multiplyNode_1.multiply)(2, trinom.a)).simplify().toTex());
19
+ while (propositions.length < n) {
20
+ (0, exercise_1.tryToAddWrongProp)(propositions, (0, randint_1.randint)(-10, 10).frenchify());
21
+ }
22
+ return (0, exercise_1.shuffleProps)(propositions, n);
23
+ };
24
+ const getAnswer = (identifiers) => {
25
+ const { trinomIdentifiers } = identifiers;
26
+ const trinom = generalTrinom_1.GeneralTrinomConstructor.fromIdentifiers(trinomIdentifiers);
27
+ const ans = (0, fractionNode_1.frac)((0, oppositeNode_1.opposite)(trinom.b), trinom.a).simplify().toTex();
28
+ return ans;
29
+ };
30
+ const getInstruction = (identifiers) => {
31
+ const { trinomIdentifiers } = identifiers;
32
+ const trinom = generalTrinom_1.GeneralTrinomConstructor.fromIdentifiers(trinomIdentifiers);
33
+ return `Soit $f$ la fonction définie sur $\\mathbb{R}$ par :
34
+
35
+ $$
36
+ f(x) = ${trinom.toTree().toTex()}
37
+ $$
38
+
39
+ On admet que $f$ possède deux racines.
40
+
41
+ Que vaut la somme des racines de $f$ ?`;
42
+ };
43
+ const getHint = (identifiers) => {
44
+ return `Si $f(x) = ax^2 + bx + c$ admet deux racines, alors leur produit vaut :
45
+
46
+ $$
47
+ S = -\\frac{b}{a}
48
+ $$`;
49
+ };
50
+ const getCorrection = (identifiers) => {
51
+ const { trinomIdentifiers } = identifiers;
52
+ const trinom = generalTrinom_1.GeneralTrinomConstructor.fromIdentifiers(trinomIdentifiers);
53
+ const aTex = trinom.a.toTex();
54
+ const bTex = trinom.b.toTex();
55
+ const ans = (0, fractionNode_1.frac)((0, oppositeNode_1.opposite)(trinom.b), trinom.a);
56
+ return `Si $f(x) = ax^2 + bx + c$ admet deux racines, alors leur smomme $S$ vaut :
57
+
58
+ $$
59
+ S = \\frac{c}{a}
60
+ $$
61
+
62
+ Ici, on a $a = ${aTex}$ et $b = ${bTex}$, donc :
63
+
64
+ $$
65
+ S = ${ans.toSimplificationString()}
66
+ $$
67
+ `;
68
+ };
69
+ const getKeys = (identifiers) => {
70
+ return [];
71
+ };
72
+ const isAnswerValid = (ans, { answer }) => {
73
+ return (0, rationalVEA_1.rationalVEA)(ans, answer);
74
+ };
75
+ const getRootsSumQuestion = (ops) => {
76
+ //(b,c) != 0
77
+ //ac <= 0
78
+ const a = (0, randint_1.randint)(-10, 10, [0]);
79
+ const b = (0, randint_1.randint)(-10, 10);
80
+ const c = (a / Math.abs(a)) * (0, randint_1.randint)(-10, 10, !b ? [0] : []);
81
+ // const trinom = GeneralTrinomConstructor.randomNiceRoots(2);
82
+ const trinom = new generalTrinom_1.GeneralTrinom(a, b, c);
83
+ const identifiers = {
84
+ trinomIdentifiers: trinom.toIdentifiers(),
85
+ };
86
+ const question = {
87
+ answer: getAnswer(identifiers),
88
+ instruction: getInstruction(identifiers),
89
+ keys: getKeys(identifiers),
90
+ answerFormat: "tex",
91
+ identifiers,
92
+ hint: getHint(identifiers),
93
+ correction: getCorrection(identifiers),
94
+ };
95
+ return question;
96
+ };
97
+ exports.rootsSum = {
98
+ id: "rootsSum",
99
+ connector: "=",
100
+ label: "Somme des racines d'un trinôme",
101
+ isSingleStep: true,
102
+ generator: (nb, opts) => (0, getDistinctQuestions_1.getDistinctQuestions)(() => getRootsSumQuestion(opts), nb),
103
+ qcmTimer: 60,
104
+ freeTimer: 60,
105
+ getPropositions,
106
+ isAnswerValid,
107
+ subject: "Mathématiques",
108
+ getInstruction,
109
+ getHint,
110
+ getCorrection,
111
+ getAnswer,
112
+ hasHintAndCorrection: true,
113
+ };
@@ -5,6 +5,9 @@ type Identifiers = {
5
5
  startPoint: string;
6
6
  translationPoints: string[];
7
7
  };
8
- export declare const pointImageFromTranslation: Exercise<Identifiers>;
8
+ type Options = {
9
+ useVector: boolean;
10
+ };
11
+ export declare const pointImageFromTranslation: Exercise<Identifiers, Options>;
9
12
  export {};
10
13
  //# sourceMappingURL=pointImageFromTranslation.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"pointImageFromTranslation.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/geometry/euclidianConstructions/pointImageFromTranslation.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAST,MAAM,0BAA0B,CAAC;AAOlC,OAAO,EAGL,gBAAgB,EACjB,MAAM,2BAA2B,CAAC;AAMnC,KAAK,WAAW,GAAG;IACjB,MAAM,EAAE,gBAAgB,EAAE,CAAC;IAC3B,UAAU,EAAE,MAAM,CAAC;IACnB,iBAAiB,EAAE,MAAM,EAAE,CAAC;CAC7B,CAAC;AAgHF,eAAO,MAAM,yBAAyB,EAAE,QAAQ,CAAC,WAAW,CAc3D,CAAC"}
1
+ {"version":3,"file":"pointImageFromTranslation.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/geometry/euclidianConstructions/pointImageFromTranslation.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAYT,MAAM,0BAA0B,CAAC;AAOlC,OAAO,EAGL,gBAAgB,EACjB,MAAM,2BAA2B,CAAC;AAMnC,KAAK,WAAW,GAAG;IACjB,MAAM,EAAE,gBAAgB,EAAE,CAAC;IAC3B,UAAU,EAAE,MAAM,CAAC;IACnB,iBAAiB,EAAE,MAAM,EAAE,CAAC;CAC7B,CAAC;AAEF,KAAK,OAAO,GAAG;IACb,SAAS,EAAE,OAAO,CAAC;CACpB,CAAC;AAiIF,eAAO,MAAM,yBAAyB,EAAE,QAAQ,CAAC,WAAW,EAAE,OAAO,CAepE,CAAC"}
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.pointImageFromTranslation = void 0;
4
+ const exercise_1 = require("../../../../exercises/exercise");
4
5
  const toolBarConstructor_1 = require("../../../../exercises/utils/geogebra/toolBarConstructor");
5
6
  const getDistinctQuestions_1 = require("../../../../exercises/utils/getDistinctQuestions");
6
7
  const geogebraConstructor_1 = require("../../../../geogebra/geogebraConstructor");
@@ -10,8 +11,10 @@ const point_1 = require("../../../../math/geometry/point");
10
11
  const vector_1 = require("../../../../math/geometry/vector");
11
12
  const random_1 = require("../../../../utils/alea/random");
12
13
  const doWhile_1 = require("../../../../utils/doWhile");
13
- const getInstruction = (identifiers) => {
14
- return `Placer l'image du point $${identifiers.startPoint}$ par la translation qui transforme $${identifiers.translationPoints[0]}$ en $${identifiers.translationPoints[1]}$.`;
14
+ const getInstruction = (identifiers, opts) => {
15
+ return `Placer l'image du point $${identifiers.startPoint}$ par la translation ${opts?.useVector
16
+ ? `de vecteur $\\overrightarrow{${identifiers.translationPoints[0]}${identifiers.translationPoints[1]}}$.`
17
+ : `qui transforme $${identifiers.translationPoints[0]}$ en $${identifiers.translationPoints[1]}$.`}`;
15
18
  };
16
19
  const getEndPoint = (identifiers) => {
17
20
  const translationPoints = [
@@ -59,7 +62,7 @@ const isGGBAnswerValid = (ans, { ggbAnswer }) => {
59
62
  return ((0, approxEqual_1.approxEqual)(coords.x, coordsAns.x, 0.2) &&
60
63
  (0, approxEqual_1.approxEqual)(coords.y, coordsAns.y, 0.2));
61
64
  };
62
- const getPointImageFromTranslationQuestion = () => {
65
+ const getPointImageFromTranslationQuestion = (opts) => {
63
66
  const points = [];
64
67
  for (let i = 0; i < 4; i++) {
65
68
  const name = String.fromCharCode(65 + i);
@@ -78,7 +81,7 @@ const getPointImageFromTranslationQuestion = () => {
78
81
  };
79
82
  const question = {
80
83
  ggbAnswer: getGGBAnswer(identifiers),
81
- instruction: getInstruction(identifiers),
84
+ instruction: getInstruction(identifiers, opts),
82
85
  studentGgbOptions: getStudentGGBOptions(identifiers),
83
86
  identifiers,
84
87
  // hint: getHint(identifiers),
@@ -86,11 +89,19 @@ const getPointImageFromTranslationQuestion = () => {
86
89
  };
87
90
  return question;
88
91
  };
92
+ const options = [
93
+ {
94
+ id: "useVector",
95
+ label: 'Utiliser le terme "translation de vecteur"',
96
+ type: exercise_1.GeneratorOptionType.checkbox,
97
+ target: exercise_1.GeneratorOptionTarget.instruction,
98
+ },
99
+ ];
89
100
  exports.pointImageFromTranslation = {
90
101
  id: "pointImageFromTranslation",
91
102
  label: "Placer l'image d'un point par une translation",
92
103
  isSingleStep: true,
93
- generator: (nb) => (0, getDistinctQuestions_1.getDistinctQuestions)(getPointImageFromTranslationQuestion, nb),
104
+ generator: (nb, opts) => (0, getDistinctQuestions_1.getDistinctQuestions)(() => getPointImageFromTranslationQuestion(opts), nb),
94
105
  ggbTimer: 60,
95
106
  isGGBAnswerValid,
96
107
  subject: "Mathématiques",
@@ -99,4 +110,5 @@ exports.pointImageFromTranslation = {
99
110
  getGGBAnswer,
100
111
  getStudentGGBOptions,
101
112
  answerType: "GGB",
113
+ options,
102
114
  };
@@ -1 +1 @@
1
- {"version":3,"file":"powersProduct.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/powers/powersProduct.ts"],"names":[],"mappings":"AAAA;;GAEG;AAaH,OAAO,EACL,QAAQ,EAaT,MAAM,gBAAgB,CAAC;AAMxB,KAAK,WAAW,GAAG;IACjB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;CACX,CAAC;AAEF,KAAK,OAAO,GAAG;IACb,kBAAkB,EAAE,OAAO,CAAC;CAC7B,CAAC;AAoIF,eAAO,MAAM,kBAAkB,EAAE,QAAQ,CAAC,WAAW,CA8BpD,CAAC;AAEF,eAAO,MAAM,aAAa,EAAE,QAAQ,CAAC,WAAW,EAAE,OAAO,CAuBxD,CAAC"}
1
+ {"version":3,"file":"powersProduct.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/powers/powersProduct.ts"],"names":[],"mappings":"AAAA;;GAEG;AAaH,OAAO,EACL,QAAQ,EAaT,MAAM,gBAAgB,CAAC;AAMxB,KAAK,WAAW,GAAG;IACjB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;CACX,CAAC;AAEF,KAAK,OAAO,GAAG;IACb,kBAAkB,EAAE,OAAO,CAAC;CAC7B,CAAC;AA2HF,eAAO,MAAM,kBAAkB,EAAE,QAAQ,CAAC,WAAW,CA8BpD,CAAC;AAEF,eAAO,MAAM,aAAa,EAAE,QAAQ,CAAC,WAAW,EAAE,OAAO,CAuBxD,CAAC"}
@@ -95,23 +95,15 @@ const getPropositions = (n, { answer, a, b, c }) => {
95
95
  };
96
96
  const isAnswerValid = (ans, { a, b, c }) => {
97
97
  const powerNode = (0, powerNode_1.power)(a, b + c);
98
- //version frac ou number
99
- //version power absolute
100
- //version 1/power
101
98
  const answerTree = powerNode.simplify();
102
99
  const ev = answerTree.evaluate();
103
100
  const parsed = (0, rationalParser_1.rationalParser)(ans);
104
- console.log(parsed, ev);
105
101
  if (parsed && Math.abs(parsed.evaluate() - ev) < 0.000001)
106
102
  return true;
107
103
  const powerParsed = (0, powerParser_1.powerParser)(ans);
108
104
  if (powerParsed && Math.abs(powerParsed.evaluate() - ev) < 0.000001)
109
105
  return true;
110
106
  return false;
111
- // const texs = answerTree.toAllValidTexs();
112
- // const rawTex = powerNode.toTex();
113
- // if (!texs.includes(rawTex)) texs.push(rawTex);
114
- // return texs.includes(ans);
115
107
  };
116
108
  exports.powersOfTenProduct = {
117
109
  id: "powersOfTenProduct",
@@ -0,0 +1,2 @@
1
+ export declare const rationalVEA: (studentAns: string, answer: string) => boolean;
2
+ //# sourceMappingURL=rationalVEA.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"rationalVEA.d.ts","sourceRoot":"","sources":["../../../src/exercises/vea/rationalVEA.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,WAAW,eAAgB,MAAM,UAAU,MAAM,YAK7D,CAAC"}
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.rationalVEA = void 0;
4
+ const latexParser_1 = require("../../tree/parsers/latexParser");
5
+ const rationalParser_1 = require("../../tree/parsers/rationalParser");
6
+ //return true if studentAns is a number or rational, and if it evaluates to answer
7
+ const rationalVEA = (studentAns, answer) => {
8
+ const parsed = (0, rationalParser_1.rationalParser)(studentAns);
9
+ if (!parsed)
10
+ return false;
11
+ const parsedAnswer = (0, latexParser_1.parseAlgebraic)(answer);
12
+ return Math.abs(parsed.evaluate() - parsedAnswer.evaluate()) < 0.0000001;
13
+ };
14
+ exports.rationalVEA = rationalVEA;
package/lib/index.d.ts CHANGED
@@ -691,6 +691,12 @@ declare const mathExercises: (import("./exercises/exercise").Exercise<{
691
691
  isImage: boolean;
692
692
  x: number;
693
693
  y: number;
694
+ }, {}> | import("./exercises/exercise").Exercise<{
695
+ yValue: number;
696
+ xValue: number;
697
+ inegalitySymbol: import("./math/inequations/inequation").InegalitySymbols;
698
+ a: number;
699
+ b: number;
694
700
  }, {}> | import("./exercises/exercise").Exercise<{
695
701
  k: number;
696
702
  }, {}> | import("./exercises/exercise").Exercise<{
@@ -780,6 +786,13 @@ declare const mathExercises: (import("./exercises/exercise").Exercise<{
780
786
  bIdentifiers: import("./tree/nodes/nodeConstructor").NodeIdentifiers;
781
787
  cIdentifiers: import("./tree/nodes/nodeConstructor").NodeIdentifiers;
782
788
  isAsking: string;
789
+ }, {}> | import("./exercises/exercise").Exercise<{
790
+ trinomIdentifiers: import("./math/polynomials/generalTrinom").GeneralTrinomIdentifiers;
791
+ }, {}> | import("./exercises/exercise").Exercise<{
792
+ trinomIdentifiers: import("./math/polynomials/generalTrinom").GeneralTrinomIdentifiers;
793
+ }, {}> | import("./exercises/exercise").Exercise<{
794
+ trinomIdentifiers: import("./math/polynomials/generalTrinom").GeneralTrinomIdentifiers;
795
+ firstRootIdentifiers: import("./tree/nodes/nodeConstructor").NodeIdentifiers;
783
796
  }, {}> | import("./exercises/exercise").Exercise<{
784
797
  a: number;
785
798
  k: number;
@@ -1121,7 +1134,9 @@ declare const mathExercises: (import("./exercises/exercise").Exercise<{
1121
1134
  points: import("./math/geometry/point").PointIdentifiers[];
1122
1135
  startPoint: string;
1123
1136
  translationPoints: string[];
1124
- }, {}> | import("./exercises/exercise").Exercise<{
1137
+ }, {
1138
+ useVector: boolean;
1139
+ }> | import("./exercises/exercise").Exercise<{
1125
1140
  type: number;
1126
1141
  commands: string[];
1127
1142
  }, {}> | import("./exercises/exercise").Exercise<{
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAEA,OAAO,yBAAyB,CAAC;AAEjC,QAAA,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;SAA6B,CAAC;AAE/C,OAAO,EAAE,aAAa,EAAE,WAAW,EAAE,CAAC"}
@@ -1,6 +1,7 @@
1
1
  export type InegalitySymbols = "<" | ">" | "\\le" | "\\ge";
2
2
  export declare abstract class InequationSymbolConstructor {
3
3
  static random(): InequationSymbol;
4
+ static randomSymbol(): InegalitySymbols;
4
5
  }
5
6
  export declare class InequationSymbol {
6
7
  isStrict: boolean;
@@ -1 +1 @@
1
- {"version":3,"file":"inequation.d.ts","sourceRoot":"","sources":["../../../src/math/inequations/inequation.ts"],"names":[],"mappings":"AACA,MAAM,MAAM,gBAAgB,GAAG,GAAG,GAAG,GAAG,GAAG,MAAM,GAAG,MAAM,CAAC;AAE3D,8BAAsB,2BAA2B;IAC/C,MAAM,CAAC,MAAM;CAGd;AACD,qBAAa,gBAAgB;IAC3B,QAAQ,EAAE,OAAO,CAAC;IAClB,KAAK,EAAE,OAAO,CAAC;IACf,MAAM,EAAE,gBAAgB,CAAC;gBACb,MAAM,EAAE,gBAAgB;IAKpC,QAAQ,QAAO,gBAAgB,CAW7B;IACF,UAAU,yBAER;IACF,mBAAmB,yBAEjB;IACF,iBAAiB,oCAWf;CACH"}
1
+ {"version":3,"file":"inequation.d.ts","sourceRoot":"","sources":["../../../src/math/inequations/inequation.ts"],"names":[],"mappings":"AACA,MAAM,MAAM,gBAAgB,GAAG,GAAG,GAAG,GAAG,GAAG,MAAM,GAAG,MAAM,CAAC;AAE3D,8BAAsB,2BAA2B;IAC/C,MAAM,CAAC,MAAM;IAGb,MAAM,CAAC,YAAY;CAGpB;AACD,qBAAa,gBAAgB;IAC3B,QAAQ,EAAE,OAAO,CAAC;IAClB,KAAK,EAAE,OAAO,CAAC;IACf,MAAM,EAAE,gBAAgB,CAAC;gBACb,MAAM,EAAE,gBAAgB;IAKpC,QAAQ,QAAO,gBAAgB,CAW7B;IACF,UAAU,yBAER;IACF,mBAAmB,yBAEjB;IACF,iBAAiB,oCAWf;CACH"}
@@ -6,6 +6,9 @@ class InequationSymbolConstructor {
6
6
  static random() {
7
7
  return new InequationSymbol((0, random_1.random)(["<", ">", "\\le", "\\ge"]));
8
8
  }
9
+ static randomSymbol() {
10
+ return (0, random_1.random)(["<", ">", "\\le", "\\ge"]);
11
+ }
9
12
  }
10
13
  exports.InequationSymbolConstructor = InequationSymbolConstructor;
11
14
  class InequationSymbol {
@@ -32,5 +32,6 @@ export declare class Affine extends Polynomial {
32
32
  times(n: number): Affine;
33
33
  toString(): string;
34
34
  toReducedEquation(): string;
35
+ toGGBCommands(): string[];
35
36
  }
36
37
  //# sourceMappingURL=affine.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"affine.d.ts","sourceRoot":"","sources":["../../../src/math/polynomials/affine.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAG3C,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAElC,8BAAsB,iBAAiB;IACrC,MAAM,CAAC,UAAU,CAAC,MAAM,EAAE,MAAM,EAAE,GAAG,MAAM;IAG3C,MAAM,CAAC,MAAM,CACX,KAAK,CAAC,EAAE;QAAE,GAAG,CAAC,EAAE,MAAM,CAAC;QAAC,GAAG,CAAC,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAA;KAAE,EAC3D,KAAK,CAAC,EAAE;QAAE,GAAG,CAAC,EAAE,MAAM,CAAC;QAAC,GAAG,CAAC,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAA;KAAE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,EAAE;QAAE,GAAG,CAAC,EAAE,MAAM,CAAC;QAAC,GAAG,CAAC,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAA;KAAE,GAC1D,MAAM;IAcT,MAAM,CAAC,gBAAgB,CACrB,EAAE,EAAE,MAAM,EACV,KAAK,CAAC,EAAE;QAAE,GAAG,CAAC,EAAE,MAAM,CAAC;QAAC,GAAG,CAAC,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAA;KAAE,EAC3D,KAAK,CAAC,EAAE;QAAE,GAAG,CAAC,EAAE,MAAM,CAAC;QAAC,GAAG,CAAC,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAA;KAAE,GAC1D,MAAM,EAAE;CAWZ;AAED,qBAAa,MAAO,SAAQ,UAAU;IACpC,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,QAAQ,EAAE,MAAM,CAAC;gBAEL,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,QAAQ,GAAE,MAAY;IAOxD,OAAO,IAAI,MAAM;IAIjB,MAAM,IAAI,MAAM;IAMhB,KAAK,CAAC,CAAC,EAAE,MAAM;IAIf,QAAQ,IAAI,MAAM;IAIlB,iBAAiB,IAAI,MAAM;IAI3B,aAAa;CAGd"}
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.Affine = exports.AffineConstructor = void 0;
4
+ const colors_1 = require("../../geogebra/colors");
4
5
  const rational_1 = require("../numbers/rationals/rational");
5
6
  const randint_1 = require("../utils/random/randint");
6
7
  const polynomial_1 = require("./polynomial");
@@ -51,5 +52,8 @@ class Affine extends polynomial_1.Polynomial {
51
52
  toReducedEquation() {
52
53
  return `y=${this.toTex()}`;
53
54
  }
55
+ toGGBCommands() {
56
+ return [`f(x) = ${this.toString()}`, `SetColor(f, "${(0, colors_1.randomColor)()}")`];
57
+ }
54
58
  }
55
59
  exports.Affine = Affine;
@@ -1,6 +1,6 @@
1
- import { AddNode } from "../../tree/nodes/operators/addNode";
2
1
  import { AlgebraicNode } from "../../tree/nodes/algebraicNode";
3
2
  import { NodeType } from "../../tree/nodes/node";
3
+ import { NodeIdentifiers } from "../../tree/nodes/nodeConstructor";
4
4
  export declare abstract class GeneralTrinomConstructor {
5
5
  static random(aOpts?: {
6
6
  min?: number;
@@ -31,7 +31,14 @@ export declare abstract class GeneralTrinomConstructor {
31
31
  }): GeneralTrinom;
32
32
  static randomNiceRoots(nbOfRoots?: number): GeneralTrinom;
33
33
  static fromCoeffs(coeffs: number[]): GeneralTrinom;
34
+ static fromIdentifiers(identifiers: GeneralTrinomIdentifiers): GeneralTrinom;
34
35
  }
36
+ export type GeneralTrinomIdentifiers = {
37
+ a: number | NodeIdentifiers;
38
+ b: number | NodeIdentifiers;
39
+ c: number | NodeIdentifiers;
40
+ opts?: GeneralTrinomOptions;
41
+ };
35
42
  type GeneralTrinomOptions = {
36
43
  variable: string;
37
44
  };
@@ -44,9 +51,10 @@ export declare class GeneralTrinom {
44
51
  constructor(a: AlgebraicNode | number, b: AlgebraicNode | number, c: AlgebraicNode | number, opts?: GeneralTrinomOptions);
45
52
  getDelta(): AlgebraicNode;
46
53
  getRoots(): AlgebraicNode[];
47
- toTree(): AddNode;
54
+ toTree(): import("../../tree/nodes/operators/multiplyNode").MultiplyNode | import("../../tree/nodes/operators/addNode").AddNode;
48
55
  toTex(): string;
49
56
  getCoeffs(): number[];
57
+ toIdentifiers(): GeneralTrinomIdentifiers;
50
58
  }
51
59
  export {};
52
60
  //# sourceMappingURL=generalTrinom.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"generalTrinom.d.ts","sourceRoot":"","sources":["../../../src/math/polynomials/generalTrinom.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,OAAO,EAAO,MAAM,oCAAoC,CAAC;AA0BlE,OAAO,E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IAAI,CAAC,EAAE,oBAAoB;IAS7B,QAAQ;IAiBR,QAAQ,IAAI,aAAa,EAAE;IAgB3B,MAAM;IAYN,KAAK;IAGL,SAAS;IAIT,aAAa,IAAI,wBAAwB;CAQ1C"}
@@ -11,6 +11,7 @@ const oppositeNode_1 = require("../../tree/nodes/functions/oppositeNode");
11
11
  const randint_1 = require("../utils/random/randint");
12
12
  const random_1 = require("../../utils/alea/random");
13
13
  const node_1 = require("../../tree/nodes/node");
14
+ const nodeConstructor_1 = require("../../tree/nodes/nodeConstructor");
14
15
  class GeneralTrinomConstructor {
15
16
  static random(aOpts, bOpts, cOpts) {
16
17
  const a = (0, randint_1.randint)(aOpts?.min ?? -9, aOpts?.max ?? 10, aOpts?.excludes ?? [0]);
@@ -53,6 +54,15 @@ class GeneralTrinomConstructor {
53
54
  static fromCoeffs(coeffs) {
54
55
  return new GeneralTrinom(coeffs[2], coeffs[1], coeffs[0]);
55
56
  }
57
+ static fromIdentifiers(identifiers) {
58
+ return new GeneralTrinom(typeof identifiers.a === "number"
59
+ ? identifiers.a
60
+ : nodeConstructor_1.NodeConstructor.fromIdentifiers(identifiers.a), typeof identifiers.b === "number"
61
+ ? identifiers.b
62
+ : nodeConstructor_1.NodeConstructor.fromIdentifiers(identifiers.b), typeof identifiers.c === "number"
63
+ ? identifiers.c
64
+ : nodeConstructor_1.NodeConstructor.fromIdentifiers(identifiers.c), identifiers.opts);
65
+ }
56
66
  }
57
67
  exports.GeneralTrinomConstructor = GeneralTrinomConstructor;
58
68
  class GeneralTrinom {
@@ -90,7 +100,17 @@ class GeneralTrinom {
90
100
  ].sort((a, b) => a.evaluate() - b.evaluate());
91
101
  }
92
102
  toTree() {
93
- return (0, addNode_1.add)((0, multiplyNode_1.multiply)(this.a, (0, powerNode_1.square)(this.variable)), (0, addNode_1.add)((0, multiplyNode_1.multiply)(this.b, this.variable), this.c));
103
+ const bEv = this.b.evaluate();
104
+ const cEv = this.c.evaluate();
105
+ const highMonom = (0, multiplyNode_1.multiply)(this.a, (0, powerNode_1.square)(this.variable));
106
+ const middleMonom = (0, multiplyNode_1.multiply)(this.b, this.variable);
107
+ if (!bEv && !cEv)
108
+ return highMonom;
109
+ if (!cEv)
110
+ return (0, addNode_1.add)(highMonom, middleMonom);
111
+ if (!bEv)
112
+ return (0, addNode_1.add)(highMonom, this.c);
113
+ return (0, addNode_1.add)(highMonom, (0, addNode_1.add)(middleMonom, this.c));
94
114
  }
95
115
  toTex() {
96
116
  return this.toTree().toTex();
@@ -98,5 +118,13 @@ class GeneralTrinom {
98
118
  getCoeffs() {
99
119
  return [this.c.evaluate(), this.b.evaluate(), this.a.evaluate()];
100
120
  }
121
+ toIdentifiers() {
122
+ return {
123
+ a: this.a.toIdentifiers(),
124
+ b: this.b.toIdentifiers(),
125
+ c: this.c.toIdentifiers(),
126
+ opts: { variable: this.variable },
127
+ };
128
+ }
101
129
  }
102
130
  exports.GeneralTrinom = GeneralTrinom;
@@ -33,5 +33,6 @@ export declare class FractionNode implements OperatorNode {
33
33
  simplify(opts?: SimplifyOptions): AlgebraicNode;
34
34
  equals(node: AlgebraicNode): boolean;
35
35
  toDetailedEvaluation(vars: Record<string, AlgebraicNode>): FractionNode;
36
+ toSimplificationString(): string;
36
37
  }
37
38
  //# sourceMappingURL=fractionNode.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"fractionNode.d.ts","sourceRoot":"","sources":["../../../../src/tree/nodes/operators/fractionNode.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAC/D,OAAO,EAAE,WAAW,EAAE,YAAY,EAAkB,MAAM,gBAAgB,CAAC;AAK3E,OAAO,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAKlE,wBAAgB,cAAc,CAAC,CAAC,EAAE,IAAI,GAAG,CAAC,IAAI,YAAY,CAEzD;AAED,eAAO,MAAM,IAAI,MACZ,a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Y,CAEzD;AAED,eAAO,MAAM,IAAI,MACZ,aAAa,GAAG,MAAM,GAAG,MAAM,KAC/B,aAAa,GAAG,MAAM,GAAG,MAAM,SAC3B,WAAW,iBAOnB,CAAC;AAEF,qBAAa,YAAa,YAAW,YAAY;IAC/C,IAAI,CAAC,EAAE,WAAW,CAAC;IACnB;;;OAGG;IACH,EAAE,EAAE,WAAW,CAAC;IAChB,SAAS,EAAE,aAAa,CAAC;IACzB,UAAU,EAAE,aAAa,CAAC;IAC1B,IAAI,EAAE,QAAQ,CAAC;IACf,SAAS,EAAE,OAAO,CAAC;gBAEjB,SAAS,EAAE,aAAa,EACxB,UAAU,EAAE,aAAa,EACzB,IAAI,CAAC,EAAE,WAAW;IAUpB,YAAY,IAAI,MAAM;IAItB,aAAa;;;;;;;;;IAQb,UAAU;IAGV,iBAAiB,CAAC,IAAI,CAAC,EAAE,WAAW;IA+BpC,cAAc,CAAC,IAAI,CAAC,EAAE,WAAW,GAAG,MAAM,EAAE;IAI5C,KAAK,IAAI,MAAM;IAsBf,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC;IAMtC,QAAQ,CAAC,IAAI,CAAC,EAAE,eAAe,GAAG,aAAa;IAyJ/C,MAAM,CAAC,IAAI,EAAE,aAAa,GAAG,OAAO;IAOpC,oBAAoB,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,aAAa,CAAC;IAOxD,sBAAsB;CAQvB"}
@@ -236,5 +236,15 @@ class FractionNode {
236
236
  toDetailedEvaluation(vars) {
237
237
  return new FractionNode(this.leftChild.toDetailedEvaluation(vars), this.rightChild.toDetailedEvaluation(vars));
238
238
  }
239
+ toSimplificationString() {
240
+ const simplified = this.simplify();
241
+ const thisTex = this.toTex();
242
+ const simpTex = simplified.toTex();
243
+ const isSimplified = thisTex === simpTex;
244
+ if (isSimplified)
245
+ return thisTex;
246
+ else
247
+ return `${thisTex} = ${simpTex}`;
248
+ }
239
249
  }
240
250
  exports.FractionNode = FractionNode;
@@ -1 +1 @@
1
- {"version":3,"file":"rationalParser.d.ts","sourceRoot":"","sources":["../../../src/tree/parsers/rationalParser.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAQ,MAAM,iCAAiC,CAAC;AAGrE,eAAO,MAAM,cAAc,QAAS,MAAM,+IA2BzC,CAAC"}
1
+ {"version":3,"file":"rationalParser.d.ts","sourceRoot":"","sources":["../../../src/tree/parsers/rationalParser.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAQ,MAAM,iCAAiC,CAAC;AAGrE,eAAO,MAAM,cAAc,QAAS,MAAM,+IAwBzC,CAAC"}
@@ -32,8 +32,5 @@ const rationalParser = (ans) => {
32
32
  const nodeFracs = fracs.map((e) => e.unfrenchify().toTree());
33
33
  return (0, oppositeNode_1.opposite)((0, fractionNode_1.frac)(nodeFracs[0], nodeFracs[1]));
34
34
  }
35
- // const nb = ans.unfrenchify();
36
- // if (isNaN(nb)) return false;
37
- // return nb.frenchify();
38
35
  };
39
36
  exports.rationalParser = rationalParser;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "math-exercises",
3
- "version": "2.2.61",
3
+ "version": "2.2.62",
4
4
  "description": "Math exercises generator for middle school and high school",
5
5
  "main": "lib/index.js",
6
6
  "files": [