math-exercises 2.2.52 → 2.2.54
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/exercises/math/calcul/fractions/simplifyFraction.d.ts.map +1 -1
- package/lib/exercises/math/calcul/fractions/simplifyFraction.js +12 -2
- package/lib/exercises/math/calcul/proportionality/findCoeffInProportionalTableNonIntegers.d.ts +10 -0
- package/lib/exercises/math/calcul/proportionality/findCoeffInProportionalTableNonIntegers.d.ts.map +1 -0
- package/lib/exercises/math/calcul/proportionality/findCoeffInProportionalTableNonIntegers.js +134 -0
- package/lib/exercises/math/calcul/proportionality/index.d.ts +2 -0
- package/lib/exercises/math/calcul/proportionality/index.d.ts.map +1 -1
- package/lib/exercises/math/calcul/proportionality/index.js +2 -0
- package/lib/exercises/math/calcul/proportionality/isTableProportionalNonInteger.d.ts +11 -0
- package/lib/exercises/math/calcul/proportionality/isTableProportionalNonInteger.d.ts.map +1 -0
- package/lib/exercises/math/calcul/proportionality/isTableProportionalNonInteger.js +125 -0
- package/lib/exercises/math/calculLitteral/equation/equationWithDistributivity.d.ts +16 -0
- package/lib/exercises/math/calculLitteral/equation/equationWithDistributivity.d.ts.map +1 -0
- package/lib/exercises/math/calculLitteral/equation/equationWithDistributivity.js +128 -0
- package/lib/exercises/math/calculLitteral/equation/index.d.ts +1 -0
- package/lib/exercises/math/calculLitteral/equation/index.d.ts.map +1 -1
- package/lib/exercises/math/calculLitteral/equation/index.js +1 -0
- package/lib/exercises/math/calculLitteral/factorisation/factoType1Exercise.d.ts.map +1 -1
- package/lib/exercises/math/calculLitteral/factorisation/factoType1Exercise.js +5 -1
- package/lib/exercises/math/functions/basics/imageFunctionGeogebra.d.ts +5 -4
- package/lib/exercises/math/functions/basics/imageFunctionGeogebra.d.ts.map +1 -1
- package/lib/exercises/math/functions/basics/imageFunctionGeogebra.js +44 -42
- package/lib/exercises/math/functions/parity/parityFromGraph.js +1 -1
- package/lib/exercises/math/functions/trinoms/secondDegreeInequation.d.ts.map +1 -1
- package/lib/exercises/math/probaStat/probaFromTableWithContext.d.ts +4 -1
- package/lib/exercises/math/probaStat/probaFromTableWithContext.d.ts.map +1 -1
- package/lib/exercises/math/probaStat/probaFromTableWithContext.js +18 -6
- package/lib/exercises/math/probaStat/probabilityTree.d.ts.map +1 -1
- package/lib/exercises/math/probaStat/probabilityTree.js +0 -1
- package/lib/exercises/math/probaStat/stats1var/averageWithTable.d.ts.map +1 -1
- package/lib/exercises/math/probaStat/stats1var/averageWithTable.js +2 -1
- package/lib/exercises/math/squareRoots/index.d.ts +1 -0
- package/lib/exercises/math/squareRoots/index.d.ts.map +1 -1
- package/lib/exercises/math/squareRoots/index.js +1 -0
- package/lib/exercises/math/squareRoots/squareRootsProducts.d.ts +10 -0
- package/lib/exercises/math/squareRoots/squareRootsProducts.d.ts.map +1 -0
- package/lib/exercises/math/squareRoots/squareRootsProducts.js +83 -0
- package/lib/exercises/options/allowNonIrreductibleFractions.d.ts +3 -0
- package/lib/exercises/options/allowNonIrreductibleFractions.d.ts.map +1 -0
- package/lib/exercises/options/allowNonIrreductibleFractions.js +10 -0
- package/lib/geogebra/geogebraConstructor.js +11 -10
- package/lib/geogebra/lagrange.d.ts +8 -0
- package/lib/geogebra/lagrange.d.ts.map +1 -0
- package/lib/geogebra/lagrange.js +73 -0
- package/lib/geogebra/spline.d.ts +11 -0
- package/lib/geogebra/spline.d.ts.map +1 -0
- package/lib/geogebra/spline.js +74 -0
- package/lib/index.d.ts +33 -5
- package/lib/index.d.ts.map +1 -1
- package/lib/playground.d.ts.map +1 -1
- package/lib/playground.js +2 -5
- package/lib/tree/nodes/algebraicNode.d.ts +1 -0
- package/lib/tree/nodes/algebraicNode.d.ts.map +1 -1
- package/lib/tree/nodes/equations/equalNode.d.ts +2 -0
- package/lib/tree/nodes/equations/equalNode.d.ts.map +1 -1
- package/lib/tree/nodes/equations/equalNode.js +7 -1
- package/lib/tree/nodes/inequations/inequationNode.d.ts +3 -2
- package/lib/tree/nodes/inequations/inequationNode.d.ts.map +1 -1
- package/lib/tree/nodes/nodeConstructor.d.ts.map +1 -1
- package/lib/tree/nodes/operators/multiplyNode.d.ts +1 -1
- package/lib/tree/nodes/operators/multiplyNode.d.ts.map +1 -1
- package/lib/tree/nodes/operators/multiplyNode.js +46 -26
- package/lib/tree/nodes/sets/intervalNode.d.ts +5 -4
- package/lib/tree/nodes/sets/intervalNode.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"simplifyFraction.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calcul/fractions/simplifyFraction.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,
|
|
1
|
+
{"version":3,"file":"simplifyFraction.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calcul/fractions/simplifyFraction.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAST,MAAM,0BAA0B,CAAC;AASlC,KAAK,WAAW,GAAG;IACjB,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,CAAC;CACf,CAAC;AAqDF,eAAO,MAAM,gBAAgB,EAAE,QAAQ,CAAC,WAAW,CAalD,CAAC"}
|
|
@@ -4,18 +4,28 @@ exports.simplifyFraction = void 0;
|
|
|
4
4
|
const exercise_1 = require("../../../../exercises/exercise");
|
|
5
5
|
const getDistinctQuestions_1 = require("../../../../exercises/utils/getDistinctQuestions");
|
|
6
6
|
const rational_1 = require("../../../../math/numbers/rationals/rational");
|
|
7
|
+
const fractionNode_1 = require("../../../../tree/nodes/operators/fractionNode");
|
|
7
8
|
const shuffle_1 = require("../../../../utils/alea/shuffle");
|
|
9
|
+
const getInstruction = (identifiers) => {
|
|
10
|
+
const rational = (0, fractionNode_1.frac)(identifiers.num, identifiers.denum);
|
|
11
|
+
return `Simplifier le plus possible :
|
|
12
|
+
|
|
13
|
+
$$
|
|
14
|
+
${rational.toTex()}
|
|
15
|
+
$$`;
|
|
16
|
+
};
|
|
8
17
|
const getSimplifyFraction = () => {
|
|
9
18
|
const rational = rational_1.RationalConstructor.randomSimplifiable(10);
|
|
10
19
|
const rationalTex = rational.toTree().toTex();
|
|
11
20
|
const answer = rational.simplify().toTree().toTex();
|
|
21
|
+
const identifiers = { num: rational.num, denum: rational.denum };
|
|
12
22
|
const question = {
|
|
13
|
-
instruction:
|
|
23
|
+
instruction: getInstruction(identifiers),
|
|
14
24
|
startStatement: rationalTex,
|
|
15
25
|
answer,
|
|
16
26
|
keys: [],
|
|
17
27
|
answerFormat: "tex",
|
|
18
|
-
identifiers
|
|
28
|
+
identifiers,
|
|
19
29
|
};
|
|
20
30
|
return question;
|
|
21
31
|
};
|
package/lib/exercises/math/calcul/proportionality/findCoeffInProportionalTableNonIntegers.d.ts
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Exercise } from "../../../../exercises/exercise";
|
|
2
|
+
type Identifiers = {
|
|
3
|
+
coeffIds: any;
|
|
4
|
+
xValues: any[];
|
|
5
|
+
yValues: any[];
|
|
6
|
+
type: number;
|
|
7
|
+
};
|
|
8
|
+
export declare const findCoeffInProportionalTableNonIntegers: Exercise<Identifiers>;
|
|
9
|
+
export {};
|
|
10
|
+
//# sourceMappingURL=findCoeffInProportionalTableNonIntegers.d.ts.map
|
package/lib/exercises/math/calcul/proportionality/findCoeffInProportionalTableNonIntegers.d.ts.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"findCoeffInProportionalTableNonIntegers.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calcul/proportionality/findCoeffInProportionalTableNonIntegers.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAcT,MAAM,0BAA0B,CAAC;AAiBlC,KAAK,WAAW,GAAG;IACjB,QAAQ,EAAE,GAAG,CAAC;IACd,OAAO,EAAE,GAAG,EAAE,CAAC;IACf,OAAO,EAAE,GAAG,EAAE,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;CACd,CAAC;AAkIF,eAAO,MAAM,uCAAuC,EAAE,QAAQ,CAAC,WAAW,CAoBzE,CAAC"}
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.findCoeffInProportionalTableNonIntegers = void 0;
|
|
4
|
+
const exercise_1 = require("../../../../exercises/exercise");
|
|
5
|
+
const getDistinctQuestions_1 = require("../../../../exercises/utils/getDistinctQuestions");
|
|
6
|
+
const rational_1 = require("../../../../math/numbers/rationals/rational");
|
|
7
|
+
const randfloat_1 = require("../../../../math/utils/random/randfloat");
|
|
8
|
+
const randint_1 = require("../../../../math/utils/random/randint");
|
|
9
|
+
const nodeConstructor_1 = require("../../../../tree/nodes/nodeConstructor");
|
|
10
|
+
const multiplyNode_1 = require("../../../../tree/nodes/operators/multiplyNode");
|
|
11
|
+
const latexParser_1 = require("../../../../tree/parsers/latexParser");
|
|
12
|
+
const coinFlip_1 = require("../../../../utils/alea/coinFlip");
|
|
13
|
+
const doWhile_1 = require("../../../../utils/doWhile");
|
|
14
|
+
const dollarize_1 = require("../../../../utils/latex/dollarize");
|
|
15
|
+
const mdTable_1 = require("../../../../utils/markdown/mdTable");
|
|
16
|
+
const getPropositions = (n, { answer, type }) => {
|
|
17
|
+
const propositions = [];
|
|
18
|
+
(0, exercise_1.addValidProp)(propositions, answer);
|
|
19
|
+
while (propositions.length < n) {
|
|
20
|
+
switch (type) {
|
|
21
|
+
case 1:
|
|
22
|
+
(0, exercise_1.tryToAddWrongProp)(propositions, (0, randint_1.randint)(1, 10) + "");
|
|
23
|
+
break;
|
|
24
|
+
case 2:
|
|
25
|
+
(0, exercise_1.tryToAddWrongProp)(propositions, (0, randfloat_1.randfloat)(1, 10, 1).frenchify());
|
|
26
|
+
break;
|
|
27
|
+
case 3:
|
|
28
|
+
(0, exercise_1.tryToAddWrongProp)(propositions, rational_1.RationalConstructor.randomIrreductible().toTree().toTex());
|
|
29
|
+
break;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
return (0, exercise_1.shuffleProps)(propositions, n);
|
|
33
|
+
};
|
|
34
|
+
const getAnswer = (identifiers) => {
|
|
35
|
+
return nodeConstructor_1.NodeConstructor.fromIdentifiers(identifiers.coeffIds).toTex();
|
|
36
|
+
};
|
|
37
|
+
const getInstruction = (identifiers) => {
|
|
38
|
+
const { xValues, yValues } = identifiers;
|
|
39
|
+
const xTexs = xValues.map((x) => nodeConstructor_1.NodeConstructor.fromIdentifiers(x).toTex());
|
|
40
|
+
const yTexs = yValues.map((y) => nodeConstructor_1.NodeConstructor.fromIdentifiers(y).toTex());
|
|
41
|
+
return `On considère le tableau de proportionnalité suivant :
|
|
42
|
+
|
|
43
|
+
${(0, mdTable_1.mdTable)([xTexs.map((v) => (0, dollarize_1.dollarize)(v)), yTexs.map((v) => (0, dollarize_1.dollarize)(v))])}
|
|
44
|
+
|
|
45
|
+
Quel est le coefficient de proportionnalité ?
|
|
46
|
+
`;
|
|
47
|
+
};
|
|
48
|
+
// const getHint: GetHint<Identifiers> = (identifiers) => {};
|
|
49
|
+
// const getCorrection: GetCorrection<Identifiers> = (identifiers) => {};
|
|
50
|
+
const getKeys = (identifiers) => {
|
|
51
|
+
return [];
|
|
52
|
+
};
|
|
53
|
+
const isAnswerValid = (ans, { answer }) => {
|
|
54
|
+
const parsed = (0, latexParser_1.parseAlgebraic)(ans);
|
|
55
|
+
if (!parsed)
|
|
56
|
+
return false;
|
|
57
|
+
return parsed.simplify().toTex() === answer;
|
|
58
|
+
};
|
|
59
|
+
const getFindCoeffInProportionalTableNonIntegersQuestion = () => {
|
|
60
|
+
const type = (0, randint_1.randint)(1, 4);
|
|
61
|
+
let coeff;
|
|
62
|
+
let xValues = [];
|
|
63
|
+
switch (type) {
|
|
64
|
+
case 1:
|
|
65
|
+
//coeff entier, valeurs décimal/frac
|
|
66
|
+
coeff = (0, randint_1.randint)(2, 10).toTree();
|
|
67
|
+
for (let i = 0; i < 3; i++) {
|
|
68
|
+
let x = (0, doWhile_1.doWhile)(() => (0, coinFlip_1.coinFlip)()
|
|
69
|
+
? (0, randfloat_1.randfloat)(1.1, 10, 1).toTree()
|
|
70
|
+
: rational_1.RationalConstructor.randomIrreductible().toTree(), (y) => y.equals(x));
|
|
71
|
+
xValues.push(x);
|
|
72
|
+
}
|
|
73
|
+
xValues.sort((a, b) => a.evaluate() - b.evaluate());
|
|
74
|
+
break;
|
|
75
|
+
case 2:
|
|
76
|
+
//coeff décimal, valeurs entieres/décimal
|
|
77
|
+
coeff = (0, randfloat_1.randfloat)(1.1, 10, 1).toTree();
|
|
78
|
+
for (let i = 0; i < 3; i++) {
|
|
79
|
+
let x = (0, doWhile_1.doWhile)(() => (0, coinFlip_1.coinFlip)()
|
|
80
|
+
? (0, randint_1.randint)(1, 10).toTree()
|
|
81
|
+
: (0, randfloat_1.randfloat)(1.1, 10, 1).toTree(), (y) => y.equals(x));
|
|
82
|
+
xValues.push(x);
|
|
83
|
+
}
|
|
84
|
+
xValues.sort((a, b) => a.evaluate() - b.evaluate());
|
|
85
|
+
break;
|
|
86
|
+
case 3:
|
|
87
|
+
//coeff frac, valeurs frac / entieres
|
|
88
|
+
default:
|
|
89
|
+
coeff = rational_1.RationalConstructor.randomPureRational().toTree();
|
|
90
|
+
for (let i = 0; i < 3; i++) {
|
|
91
|
+
let x = (0, doWhile_1.doWhile)(() => (0, coinFlip_1.coinFlip)()
|
|
92
|
+
? (0, randint_1.randint)(1, 10).toTree()
|
|
93
|
+
: rational_1.RationalConstructor.randomIrreductible().toTree(), (y) => y.equals(x));
|
|
94
|
+
xValues.push(x);
|
|
95
|
+
}
|
|
96
|
+
xValues.sort((a, b) => a.evaluate() - b.evaluate());
|
|
97
|
+
}
|
|
98
|
+
const yValues = xValues.map((x) => (0, multiplyNode_1.multiply)(x, coeff).simplify());
|
|
99
|
+
const identifiers = {
|
|
100
|
+
coeffIds: coeff.toIdentifiers(),
|
|
101
|
+
xValues: xValues.map((e) => e.toIdentifiers()),
|
|
102
|
+
yValues: yValues.map((e) => e.toIdentifiers()),
|
|
103
|
+
type,
|
|
104
|
+
};
|
|
105
|
+
const question = {
|
|
106
|
+
answer: getAnswer(identifiers),
|
|
107
|
+
instruction: getInstruction(identifiers),
|
|
108
|
+
keys: getKeys(identifiers),
|
|
109
|
+
answerFormat: "tex",
|
|
110
|
+
identifiers,
|
|
111
|
+
// hint: getHint(identifiers),
|
|
112
|
+
// correction: getCorrection(identifiers),
|
|
113
|
+
style: {
|
|
114
|
+
tableHasNoHeader: true,
|
|
115
|
+
},
|
|
116
|
+
};
|
|
117
|
+
return question;
|
|
118
|
+
};
|
|
119
|
+
exports.findCoeffInProportionalTableNonIntegers = {
|
|
120
|
+
id: "findCoeffInProportionalTableNonIntegers",
|
|
121
|
+
connector: "=",
|
|
122
|
+
label: "Calculer un coefficient de proportionnalité à partir d'un tableau (valeurs non entières)",
|
|
123
|
+
isSingleStep: true,
|
|
124
|
+
generator: (nb) => (0, getDistinctQuestions_1.getDistinctQuestions)(getFindCoeffInProportionalTableNonIntegersQuestion, nb),
|
|
125
|
+
qcmTimer: 60,
|
|
126
|
+
freeTimer: 60,
|
|
127
|
+
getPropositions,
|
|
128
|
+
isAnswerValid,
|
|
129
|
+
subject: "Mathématiques",
|
|
130
|
+
// getHint,
|
|
131
|
+
// getCorrection,
|
|
132
|
+
getAnswer,
|
|
133
|
+
answerType: "QCU",
|
|
134
|
+
};
|
|
@@ -2,4 +2,6 @@ export * from "./proportionalityTable";
|
|
|
2
2
|
export * from "./proportionalityTableCoefficient";
|
|
3
3
|
export * from "./scaleCalculation";
|
|
4
4
|
export * from "./scaleUsage";
|
|
5
|
+
export * from "./isTableProportionalNonInteger";
|
|
6
|
+
export * from "./findCoeffInProportionalTableNonIntegers";
|
|
5
7
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calcul/proportionality/index.ts"],"names":[],"mappings":"AAAA,cAAc,wBAAwB,CAAC;AACvC,cAAc,mCAAmC,CAAC;AAClD,cAAc,oBAAoB,CAAC;AACnC,cAAc,cAAc,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calcul/proportionality/index.ts"],"names":[],"mappings":"AAAA,cAAc,wBAAwB,CAAC;AACvC,cAAc,mCAAmC,CAAC;AAClD,cAAc,oBAAoB,CAAC;AACnC,cAAc,cAAc,CAAC;AAC7B,cAAc,iCAAiC,CAAC;AAChD,cAAc,2CAA2C,CAAC"}
|
|
@@ -18,3 +18,5 @@ __exportStar(require("./proportionalityTable"), exports);
|
|
|
18
18
|
__exportStar(require("./proportionalityTableCoefficient"), exports);
|
|
19
19
|
__exportStar(require("./scaleCalculation"), exports);
|
|
20
20
|
__exportStar(require("./scaleUsage"), exports);
|
|
21
|
+
__exportStar(require("./isTableProportionalNonInteger"), exports);
|
|
22
|
+
__exportStar(require("./findCoeffInProportionalTableNonIntegers"), exports);
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Exercise } from "../../../../exercises/exercise";
|
|
2
|
+
type Identifiers = {
|
|
3
|
+
coeffIds: any;
|
|
4
|
+
xValues: any[];
|
|
5
|
+
yValues: any[];
|
|
6
|
+
isProportionnal: boolean;
|
|
7
|
+
type: number;
|
|
8
|
+
};
|
|
9
|
+
export declare const isTableProportionalNonInteger: Exercise<Identifiers>;
|
|
10
|
+
export {};
|
|
11
|
+
//# sourceMappingURL=isTableProportionalNonInteger.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"isTableProportionalNonInteger.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calcul/proportionality/isTableProportionalNonInteger.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAcT,MAAM,0BAA0B,CAAC;AAgBlC,KAAK,WAAW,GAAG;IACjB,QAAQ,EAAE,GAAG,CAAC;IACd,OAAO,EAAE,GAAG,EAAE,CAAC;IACf,OAAO,EAAE,GAAG,EAAE,CAAC;IACf,eAAe,EAAE,OAAO,CAAC;IACzB,IAAI,EAAE,MAAM,CAAC;CACd,CAAC;AA0HF,eAAO,MAAM,6BAA6B,EAAE,QAAQ,CAAC,WAAW,CAgB/D,CAAC"}
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.isTableProportionalNonInteger = void 0;
|
|
4
|
+
const exercise_1 = require("../../../../exercises/exercise");
|
|
5
|
+
const getDistinctQuestions_1 = require("../../../../exercises/utils/getDistinctQuestions");
|
|
6
|
+
const rational_1 = require("../../../../math/numbers/rationals/rational");
|
|
7
|
+
const randfloat_1 = require("../../../../math/utils/random/randfloat");
|
|
8
|
+
const randint_1 = require("../../../../math/utils/random/randint");
|
|
9
|
+
const nodeConstructor_1 = require("../../../../tree/nodes/nodeConstructor");
|
|
10
|
+
const addNode_1 = require("../../../../tree/nodes/operators/addNode");
|
|
11
|
+
const multiplyNode_1 = require("../../../../tree/nodes/operators/multiplyNode");
|
|
12
|
+
const coinFlip_1 = require("../../../../utils/alea/coinFlip");
|
|
13
|
+
const random_1 = require("../../../../utils/alea/random");
|
|
14
|
+
const doWhile_1 = require("../../../../utils/doWhile");
|
|
15
|
+
const dollarize_1 = require("../../../../utils/latex/dollarize");
|
|
16
|
+
const mdTable_1 = require("../../../../utils/markdown/mdTable");
|
|
17
|
+
const getPropositions = (n, { answer }) => {
|
|
18
|
+
const propositions = [];
|
|
19
|
+
(0, exercise_1.addValidProp)(propositions, answer, "raw");
|
|
20
|
+
(0, exercise_1.tryToAddWrongProp)(propositions, "Non", "raw");
|
|
21
|
+
(0, exercise_1.tryToAddWrongProp)(propositions, "On ne peut pas savoir", "raw");
|
|
22
|
+
(0, exercise_1.tryToAddWrongProp)(propositions, "Oui", "raw");
|
|
23
|
+
return (0, exercise_1.shuffleProps)(propositions, n);
|
|
24
|
+
};
|
|
25
|
+
const getAnswer = (identifiers) => {
|
|
26
|
+
return identifiers.isProportionnal ? "Oui" : "Non";
|
|
27
|
+
};
|
|
28
|
+
const getInstruction = (identifiers) => {
|
|
29
|
+
const { xValues, yValues } = identifiers;
|
|
30
|
+
const xTexs = xValues.map((x) => nodeConstructor_1.NodeConstructor.fromIdentifiers(x).toTex());
|
|
31
|
+
const yTexs = yValues.map((y) => nodeConstructor_1.NodeConstructor.fromIdentifiers(y).toTex());
|
|
32
|
+
return `Le tableau ci-dessous est-il un tableau de proportionnalité ?
|
|
33
|
+
|
|
34
|
+
${(0, mdTable_1.mdTable)([xTexs.map((v) => (0, dollarize_1.dollarize)(v)), yTexs.map((v) => (0, dollarize_1.dollarize)(v))])}
|
|
35
|
+
|
|
36
|
+
`;
|
|
37
|
+
};
|
|
38
|
+
// const getHint: GetHint<Identifiers> = (identifiers) => {};
|
|
39
|
+
// const getCorrection: GetCorrection<Identifiers> = (identifiers) => {};
|
|
40
|
+
const getKeys = (identifiers) => {
|
|
41
|
+
return [];
|
|
42
|
+
};
|
|
43
|
+
const isAnswerValid = (ans, { answer }) => {
|
|
44
|
+
throw Error("VEA not implemented");
|
|
45
|
+
};
|
|
46
|
+
const getIsTableProportionalNonIntegerQuestion = () => {
|
|
47
|
+
const type = (0, randint_1.randint)(1, 4);
|
|
48
|
+
let coeff;
|
|
49
|
+
let xValues = [];
|
|
50
|
+
const isProportionnal = (0, coinFlip_1.coinFlip)();
|
|
51
|
+
switch (type) {
|
|
52
|
+
case 1:
|
|
53
|
+
//coeff entier, valeurs décimal/frac
|
|
54
|
+
coeff = (0, randint_1.randint)(2, 10).toTree();
|
|
55
|
+
for (let i = 0; i < 3; i++) {
|
|
56
|
+
let x = (0, doWhile_1.doWhile)(() => (0, coinFlip_1.coinFlip)()
|
|
57
|
+
? (0, randfloat_1.randfloat)(1.1, 10, 1).toTree()
|
|
58
|
+
: rational_1.RationalConstructor.randomIrreductible().toTree(), (y) => y.equals(x));
|
|
59
|
+
xValues.push(x);
|
|
60
|
+
}
|
|
61
|
+
xValues.sort((a, b) => a.evaluate() - b.evaluate());
|
|
62
|
+
break;
|
|
63
|
+
case 2:
|
|
64
|
+
//coeff décimal, valeurs entieres/décimal
|
|
65
|
+
coeff = (0, randfloat_1.randfloat)(1.1, 10, 1).toTree();
|
|
66
|
+
for (let i = 0; i < 3; i++) {
|
|
67
|
+
let x = (0, doWhile_1.doWhile)(() => (0, coinFlip_1.coinFlip)()
|
|
68
|
+
? (0, randint_1.randint)(1, 10).toTree()
|
|
69
|
+
: (0, randfloat_1.randfloat)(1.1, 10, 1).toTree(), (y) => y.equals(x));
|
|
70
|
+
xValues.push(x);
|
|
71
|
+
}
|
|
72
|
+
xValues.sort((a, b) => a.evaluate() - b.evaluate());
|
|
73
|
+
break;
|
|
74
|
+
case 3:
|
|
75
|
+
//coeff frac, valeurs frac / entieres
|
|
76
|
+
default:
|
|
77
|
+
coeff = rational_1.RationalConstructor.randomPureRational().toTree();
|
|
78
|
+
for (let i = 0; i < 3; i++) {
|
|
79
|
+
let x = (0, doWhile_1.doWhile)(() => (0, coinFlip_1.coinFlip)()
|
|
80
|
+
? (0, randint_1.randint)(1, 10).toTree()
|
|
81
|
+
: rational_1.RationalConstructor.randomIrreductible().toTree(), (y) => y.equals(x));
|
|
82
|
+
xValues.push(x);
|
|
83
|
+
}
|
|
84
|
+
xValues.sort((a, b) => a.evaluate() - b.evaluate());
|
|
85
|
+
}
|
|
86
|
+
const yValues = isProportionnal
|
|
87
|
+
? xValues.map((x) => (0, multiplyNode_1.multiply)(x, coeff).simplify())
|
|
88
|
+
: xValues.map((x) => (0, multiplyNode_1.multiply)((0, addNode_1.add)(x, (0, random_1.random)([-1, 1])), coeff).simplify());
|
|
89
|
+
const identifiers = {
|
|
90
|
+
coeffIds: coeff.toIdentifiers(),
|
|
91
|
+
xValues: xValues.map((e) => e.toIdentifiers()),
|
|
92
|
+
yValues: yValues.map((e) => e.toIdentifiers()),
|
|
93
|
+
isProportionnal: isProportionnal,
|
|
94
|
+
type,
|
|
95
|
+
};
|
|
96
|
+
const question = {
|
|
97
|
+
answer: getAnswer(identifiers),
|
|
98
|
+
instruction: getInstruction(identifiers),
|
|
99
|
+
keys: getKeys(identifiers),
|
|
100
|
+
answerFormat: "raw",
|
|
101
|
+
identifiers,
|
|
102
|
+
// hint: getHint(identifiers),
|
|
103
|
+
// correction: getCorrection(identifiers),
|
|
104
|
+
style: {
|
|
105
|
+
tableHasNoHeader: true,
|
|
106
|
+
},
|
|
107
|
+
};
|
|
108
|
+
return question;
|
|
109
|
+
};
|
|
110
|
+
exports.isTableProportionalNonInteger = {
|
|
111
|
+
id: "isTableProportionalNonInteger",
|
|
112
|
+
connector: "=",
|
|
113
|
+
label: "Reconnaître un tableau de proportionnalité (valeurs non entières)",
|
|
114
|
+
isSingleStep: true,
|
|
115
|
+
generator: (nb) => (0, getDistinctQuestions_1.getDistinctQuestions)(getIsTableProportionalNonIntegerQuestion, nb),
|
|
116
|
+
qcmTimer: 60,
|
|
117
|
+
freeTimer: 60,
|
|
118
|
+
getPropositions,
|
|
119
|
+
isAnswerValid,
|
|
120
|
+
subject: "Mathématiques",
|
|
121
|
+
// getHint,
|
|
122
|
+
// getCorrection,
|
|
123
|
+
getAnswer,
|
|
124
|
+
answerType: "QCU",
|
|
125
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { Exercise } from "../../../../exercises/exercise";
|
|
2
|
+
type Identifiers = {
|
|
3
|
+
type: number;
|
|
4
|
+
a: number;
|
|
5
|
+
b: number;
|
|
6
|
+
c: number;
|
|
7
|
+
d: number;
|
|
8
|
+
e: number;
|
|
9
|
+
f: number;
|
|
10
|
+
};
|
|
11
|
+
type Options = {
|
|
12
|
+
integerSolutions: boolean;
|
|
13
|
+
};
|
|
14
|
+
export declare const equationWithDistributivity: Exercise<Identifiers, Options>;
|
|
15
|
+
export {};
|
|
16
|
+
//# sourceMappingURL=equationWithDistributivity.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"equationWithDistributivity.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calculLitteral/equation/equationWithDistributivity.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAiBT,MAAM,0BAA0B,CAAC;AAiBlC,KAAK,WAAW,GAAG;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,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,CAAC,EAAE,MAAM,CAAC;CACX,CAAC;AAuEF,KAAK,OAAO,GAAG;IACb,gBAAgB,EAAE,OAAO,CAAC;CAC3B,CAAC;AA0DF,eAAO,MAAM,0BAA0B,EAAE,QAAQ,CAAC,WAAW,EAAE,OAAO,CAgBrE,CAAC"}
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.equationWithDistributivity = void 0;
|
|
4
|
+
const exercise_1 = require("../../../../exercises/exercise");
|
|
5
|
+
const getDistinctQuestions_1 = require("../../../../exercises/utils/getDistinctQuestions");
|
|
6
|
+
const dividersOf_1 = require("../../../../math/utils/arithmetic/dividersOf");
|
|
7
|
+
const randint_1 = require("../../../../math/utils/random/randint");
|
|
8
|
+
const equalNode_1 = require("../../../../tree/nodes/equations/equalNode");
|
|
9
|
+
const addNode_1 = require("../../../../tree/nodes/operators/addNode");
|
|
10
|
+
const fractionNode_1 = require("../../../../tree/nodes/operators/fractionNode");
|
|
11
|
+
const multiplyNode_1 = require("../../../../tree/nodes/operators/multiplyNode");
|
|
12
|
+
const substractNode_1 = require("../../../../tree/nodes/operators/substractNode");
|
|
13
|
+
const equationSolutionParser_1 = require("../../../../tree/parsers/equationSolutionParser");
|
|
14
|
+
const random_1 = require("../../../../utils/alea/random");
|
|
15
|
+
const getPropositions = (n, { answer }, opts) => {
|
|
16
|
+
const propositions = [];
|
|
17
|
+
(0, exercise_1.addValidProp)(propositions, answer);
|
|
18
|
+
while (propositions.length < n) {
|
|
19
|
+
if (opts?.integerSolutions) {
|
|
20
|
+
(0, exercise_1.tryToAddWrongProp)(propositions, `x=${(0, randint_1.randint)(-10, 11).toTree().toTex()}`);
|
|
21
|
+
}
|
|
22
|
+
else {
|
|
23
|
+
(0, exercise_1.tryToAddWrongProp)(propositions, `x=${(0, fractionNode_1.frac)((0, randint_1.randint)(-50, 50), (0, randint_1.randint)(-50, 50, [0]))
|
|
24
|
+
.simplify()
|
|
25
|
+
.toTex()}`);
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
return (0, exercise_1.shuffleProps)(propositions, n);
|
|
29
|
+
};
|
|
30
|
+
const getAnswer = (identifiers) => {
|
|
31
|
+
const { type, a, b, c, d, e, f } = identifiers;
|
|
32
|
+
const sol = type
|
|
33
|
+
? (0, fractionNode_1.frac)((0, substractNode_1.substract)((0, multiplyNode_1.multiply)(d, f), (0, multiplyNode_1.multiply)(a, c)), (0, substractNode_1.substract)((0, multiplyNode_1.multiply)(a, b), (0, multiplyNode_1.multiply)(d, e)))
|
|
34
|
+
.simplify()
|
|
35
|
+
.toTex()
|
|
36
|
+
: (0, fractionNode_1.frac)((0, substractNode_1.substract)(e, (0, multiplyNode_1.multiply)(a, c)), (0, substractNode_1.substract)((0, multiplyNode_1.multiply)(a, b), d))
|
|
37
|
+
.simplify()
|
|
38
|
+
.toTex();
|
|
39
|
+
return `x=${sol}`;
|
|
40
|
+
};
|
|
41
|
+
const getInstruction = (identifiers) => {
|
|
42
|
+
const { type, a, b, c, d, e, f } = identifiers;
|
|
43
|
+
const left = (0, multiplyNode_1.multiply)(a, (0, addNode_1.add)((0, multiplyNode_1.multiply)(b, "x"), c));
|
|
44
|
+
const right = type
|
|
45
|
+
? (0, multiplyNode_1.multiply)(d, (0, addNode_1.add)((0, multiplyNode_1.multiply)(e, "x"), f))
|
|
46
|
+
: (0, addNode_1.add)((0, multiplyNode_1.multiply)(d, "x"), e);
|
|
47
|
+
const equalNode = (0, equalNode_1.equal)(left, right);
|
|
48
|
+
return `Résoudre l'équation suivante :
|
|
49
|
+
|
|
50
|
+
$$
|
|
51
|
+
${equalNode.toTex()}
|
|
52
|
+
$$`;
|
|
53
|
+
};
|
|
54
|
+
// const getHint: GetHint<Identifiers> = (identifiers) => {
|
|
55
|
+
// return ``;
|
|
56
|
+
// };
|
|
57
|
+
// const getCorrection: GetCorrection<Identifiers> = (identifiers) => {
|
|
58
|
+
// return ``;
|
|
59
|
+
// };
|
|
60
|
+
const getKeys = (identifiers) => {
|
|
61
|
+
return ["x", "equal"];
|
|
62
|
+
};
|
|
63
|
+
const isAnswerValid = (ans, { answer }) => {
|
|
64
|
+
const parsed = (0, equationSolutionParser_1.equationSolutionParser)(ans);
|
|
65
|
+
if (!parsed)
|
|
66
|
+
return false;
|
|
67
|
+
return `x=${parsed.toTex()}` === answer;
|
|
68
|
+
};
|
|
69
|
+
const getEquationWithDistributivityQuestion = (opts) => {
|
|
70
|
+
const type = (0, random_1.random)([0, 1]);
|
|
71
|
+
const a = (0, randint_1.randint)(-9, 10, [0, 1]);
|
|
72
|
+
const b = (0, randint_1.randint)(-9, 10, [0]);
|
|
73
|
+
const c = (0, randint_1.randint)(-9, 10, [0]);
|
|
74
|
+
const x = opts?.integerSolutions ? (0, randint_1.randint)(-10, 11) : undefined;
|
|
75
|
+
const y = opts?.integerSolutions ? a * (b * x + c) : undefined;
|
|
76
|
+
const d = opts?.integerSolutions && type === 1 && y !== 0
|
|
77
|
+
? (0, random_1.random)((0, dividersOf_1.dividersOf)(Math.abs(y)))
|
|
78
|
+
: (0, randint_1.randint)(-9, 10, type ? [0] : [0, a * b]);
|
|
79
|
+
const e = opts?.integerSolutions && type === 0
|
|
80
|
+
? y - d * x
|
|
81
|
+
: (0, randint_1.randint)(-9, 10, type ? [0, (a * b) / d] : []);
|
|
82
|
+
const f = opts?.integerSolutions && type === 1
|
|
83
|
+
? (y - d * e * x) / d
|
|
84
|
+
: (0, randint_1.randint)(-9, 10);
|
|
85
|
+
const identifiers = {
|
|
86
|
+
type,
|
|
87
|
+
a,
|
|
88
|
+
b,
|
|
89
|
+
c,
|
|
90
|
+
d,
|
|
91
|
+
e,
|
|
92
|
+
f,
|
|
93
|
+
};
|
|
94
|
+
const question = {
|
|
95
|
+
answer: getAnswer(identifiers),
|
|
96
|
+
instruction: getInstruction(identifiers),
|
|
97
|
+
keys: getKeys(identifiers),
|
|
98
|
+
answerFormat: "tex",
|
|
99
|
+
identifiers,
|
|
100
|
+
// hint: getHint(identifiers),
|
|
101
|
+
// correction: getCorrection(identifiers),
|
|
102
|
+
};
|
|
103
|
+
return question;
|
|
104
|
+
};
|
|
105
|
+
const options = [
|
|
106
|
+
{
|
|
107
|
+
id: "integerSolutions",
|
|
108
|
+
label: "Solutions entières",
|
|
109
|
+
type: exercise_1.GeneratorOptionType.checkbox,
|
|
110
|
+
target: exercise_1.GeneratorOptionTarget.generation,
|
|
111
|
+
},
|
|
112
|
+
];
|
|
113
|
+
exports.equationWithDistributivity = {
|
|
114
|
+
id: "equationWithDistributivity",
|
|
115
|
+
connector: "\\iff",
|
|
116
|
+
label: "Résoudre une équation du premier degré après développement",
|
|
117
|
+
isSingleStep: true,
|
|
118
|
+
generator: (nb, opts) => (0, getDistinctQuestions_1.getDistinctQuestions)(() => getEquationWithDistributivityQuestion(opts), nb),
|
|
119
|
+
qcmTimer: 60,
|
|
120
|
+
freeTimer: 60,
|
|
121
|
+
getPropositions,
|
|
122
|
+
isAnswerValid,
|
|
123
|
+
subject: "Mathématiques",
|
|
124
|
+
// getHint,
|
|
125
|
+
// getCorrection,
|
|
126
|
+
getAnswer,
|
|
127
|
+
options,
|
|
128
|
+
};
|
|
@@ -11,4 +11,5 @@ export * from "./firstDegreeEquationIntType2";
|
|
|
11
11
|
export * from "./firstDegreeEquationIntType3";
|
|
12
12
|
export * from "./equationFromSentenceExercise";
|
|
13
13
|
export * from "./binomialsTrinomialsProposedSolutions";
|
|
14
|
+
export * from "./equationWithDistributivity";
|
|
14
15
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calculLitteral/equation/index.ts"],"names":[],"mappings":"AAAA,cAAc,wBAAwB,CAAC;AACvC,cAAc,yBAAyB,CAAC;AACxC,cAAc,yBAAyB,CAAC;AACxC,cAAc,yBAAyB,CAAC;AACxC,cAAc,yBAAyB,CAAC;AACxC,cAAc,oBAAoB,CAAC;AACnC,cAAc,0BAA0B,CAAC;AACzC,cAAc,uBAAuB,CAAC;AACtC,cAAc,+BAA+B,CAAC;AAC9C,cAAc,+BAA+B,CAAC;AAC9C,cAAc,+BAA+B,CAAC;AAC9C,cAAc,gCAAgC,CAAC;AAC/C,cAAc,wCAAwC,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calculLitteral/equation/index.ts"],"names":[],"mappings":"AAAA,cAAc,wBAAwB,CAAC;AACvC,cAAc,yBAAyB,CAAC;AACxC,cAAc,yBAAyB,CAAC;AACxC,cAAc,yBAAyB,CAAC;AACxC,cAAc,yBAAyB,CAAC;AACxC,cAAc,oBAAoB,CAAC;AACnC,cAAc,0BAA0B,CAAC;AACzC,cAAc,uBAAuB,CAAC;AACtC,cAAc,+BAA+B,CAAC;AAC9C,cAAc,+BAA+B,CAAC;AAC9C,cAAc,+BAA+B,CAAC;AAC9C,cAAc,gCAAgC,CAAC;AAC/C,cAAc,wCAAwC,CAAC;AACvD,cAAc,8BAA8B,CAAC"}
|
|
@@ -27,3 +27,4 @@ __exportStar(require("./firstDegreeEquationIntType2"), exports);
|
|
|
27
27
|
__exportStar(require("./firstDegreeEquationIntType3"), exports);
|
|
28
28
|
__exportStar(require("./equationFromSentenceExercise"), exports);
|
|
29
29
|
__exportStar(require("./binomialsTrinomialsProposedSolutions"), exports);
|
|
30
|
+
__exportStar(require("./equationWithDistributivity"), exports);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"factoType1Exercise.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calculLitteral/factorisation/factoType1Exercise.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EACL,QAAQ,EAQT,MAAM,0BAA0B,CAAC;AASlC,KAAK,WAAW,GAAG;IACjB,aAAa,EAAE,MAAM,EAAE,EAAE,CAAC;IAC1B,SAAS,EAAE,MAAM,CAAC;CACnB,CAAC;
|
|
1
|
+
{"version":3,"file":"factoType1Exercise.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calculLitteral/factorisation/factoType1Exercise.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EACL,QAAQ,EAQT,MAAM,0BAA0B,CAAC;AASlC,KAAK,WAAW,GAAG;IACjB,aAAa,EAAE,MAAM,EAAE,EAAE,CAAC;IAC1B,SAAS,EAAE,MAAM,CAAC;CACnB,CAAC;AA4HF,eAAO,MAAM,kBAAkB,EAAE,QAAQ,CAAC,WAAW,CAapD,CAAC"}
|
|
@@ -32,7 +32,11 @@ const getFactoType1Question = () => {
|
|
|
32
32
|
: new multiplyNode_1.MultiplyNode(affine1.toTree(), affine2.toTree());
|
|
33
33
|
const answer = answerTree.toTex();
|
|
34
34
|
const question = {
|
|
35
|
-
instruction: `Factoriser :
|
|
35
|
+
instruction: `Factoriser et réduire :
|
|
36
|
+
|
|
37
|
+
$$
|
|
38
|
+
${statementTree.toTex()}
|
|
39
|
+
$$`,
|
|
36
40
|
startStatement: statementTree.toTex(),
|
|
37
41
|
answer,
|
|
38
42
|
keys: ["x"],
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { Exercise } from "../../../../exercises/exercise";
|
|
2
2
|
type Identifiers = {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
3
|
+
/**old */
|
|
4
|
+
isSpline: boolean;
|
|
5
|
+
splinePoints: number[][];
|
|
6
|
+
x: number;
|
|
7
|
+
y: number;
|
|
7
8
|
};
|
|
8
9
|
export declare const imageFunctionGeogebra: Exercise<Identifiers>;
|
|
9
10
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"imageFunctionGeogebra.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/functions/basics/imageFunctionGeogebra.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,
|
|
1
|
+
{"version":3,"file":"imageFunctionGeogebra.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/functions/basics/imageFunctionGeogebra.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAST,MAAM,0BAA0B,CAAC;AAiBlC,KAAK,WAAW,GAAG;IACjB,SAAS;IAIT,QAAQ,EAAE,OAAO,CAAC;IAElB,YAAY,EAAE,MAAM,EAAE,EAAE,CAAC;IACzB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;CACX,CAAC;AAwEF,eAAO,MAAM,qBAAqB,EAAE,QAAQ,CAAC,WAAW,CAcvD,CAAC"}
|