math-exercises 3.0.131 → 3.0.132
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/exercise.d.ts +37 -30
- package/lib/exercises/exercise.d.ts.map +1 -1
- package/lib/exercises/math/calcul/mentalCaluls/mentalProgramSolve.d.ts +3 -3
- package/lib/exercises/math/calcul/mentalCaluls/mentalProgramSolve.d.ts.map +1 -1
- package/lib/exercises/math/calcul/mentalCaluls/mentalProgramSolve.js +48 -44
- package/lib/exercises/math/calcul/ordering/compareA10N.d.ts +1 -1
- package/lib/exercises/math/calcul/ordering/compareA10N.js +3 -3
- package/lib/exercises/math/calcul/ordering/compareFracABWithFracAPlusCBPlusC.d.ts.map +1 -1
- package/lib/exercises/math/calcul/ordering/compareFracABWithFracAPlusCBPlusC.js +0 -1
- package/lib/exercises/math/calcul/ordering/compareFracAndDec.d.ts +1 -1
- package/lib/exercises/math/calcul/ordering/compareFracAndDec.js +1 -1
- package/lib/exercises/math/calcul/proportionality/findCoeffInProportionalTableNonIntegers.js +1 -1
- package/lib/exercises/math/calcul/proportionality/isTableProportionalNonInteger.d.ts.map +1 -1
- package/lib/exercises/math/calcul/proportionality/isTableProportionalNonInteger.js +2 -0
- package/lib/exercises/math/calcul/rounding/rounding.d.ts +1 -1
- package/lib/exercises/math/calcul/rounding/rounding.d.ts.map +1 -1
- package/lib/exercises/math/calcul/rounding/rounding.js +7 -6
- package/lib/exercises/math/calculLitteral/writing/writeLitExpFromFrenchExp.d.ts.map +1 -1
- package/lib/exercises/math/calculLitteral/writing/writeLitExpFromFrenchExp.js +15 -60
- package/lib/exercises/math/conversion/kmPerMinToKmPerHourConversion.js +14 -10
- package/lib/exercises/math/conversion/lengthConversion.d.ts.map +1 -1
- package/lib/exercises/math/conversion/lengthConversion.js +1 -0
- package/lib/exercises/math/conversion/prefixToNumber.d.ts.map +1 -1
- package/lib/exercises/math/conversion/prefixToNumber.js +10 -8
- package/lib/exercises/math/conversion/secondsToHours.js +1 -1
- package/lib/exercises/math/functions/affines/drawAffineFromPointAndLeadingCoeff.d.ts.map +1 -1
- package/lib/exercises/math/functions/affines/drawAffineFromPointAndLeadingCoeff.js +2 -1
- package/lib/exercises/math/functions/affines/drawAffineFromProgCalc.d.ts +1 -1
- package/lib/exercises/math/functions/affines/drawAffineFromProgCalc.d.ts.map +1 -1
- package/lib/exercises/math/functions/affines/drawAffineFromProgCalc.js +4 -5
- package/lib/exercises/math/functions/affines/leadingCoefficient.js +1 -1
- package/lib/exercises/math/geometry/angles/anglesUsingIsParallel.d.ts +1 -1
- package/lib/exercises/math/geometry/angles/anglesUsingIsParallel.d.ts.map +1 -1
- package/lib/exercises/math/geometry/angles/anglesUsingIsParallel.js +10 -11
- package/lib/exercises/math/geometry/angles/isParallelUsingAngles.d.ts +1 -1
- package/lib/exercises/math/geometry/angles/isParallelUsingAngles.d.ts.map +1 -1
- package/lib/exercises/math/geometry/angles/isParallelUsingAngles.js +8 -8
- package/lib/exercises/math/percent/evolutions/globalPercent.d.ts +4 -1
- package/lib/exercises/math/percent/evolutions/globalPercent.d.ts.map +1 -1
- package/lib/exercises/math/percent/evolutions/globalPercent.js +37 -21
- package/lib/exercises/math/percent/findProportion.d.ts.map +1 -1
- package/lib/exercises/math/percent/findProportion.js +24 -26
- package/lib/exercises/math/percent/percentToDecimal.d.ts +4 -1
- package/lib/exercises/math/percent/percentToDecimal.d.ts.map +1 -1
- package/lib/exercises/math/percent/percentToDecimal.js +55 -35
- package/lib/exercises/math/powers/calculateNegativePower.d.ts +1 -1
- package/lib/exercises/math/powers/calculateNegativePower.d.ts.map +1 -1
- package/lib/exercises/math/powers/calculateNegativePower.js +17 -10
- package/lib/exercises/math/probaStat/basicStats/calculateFrequencyInList.d.ts +5 -1
- package/lib/exercises/math/probaStat/basicStats/calculateFrequencyInList.d.ts.map +1 -1
- package/lib/exercises/math/probaStat/basicStats/calculateFrequencyInList.js +76 -12
- package/lib/exercises/math/probaStat/conditionalProbaWriteFromFrench.js +1 -1
- package/lib/exercises/math/probaStat/probaAsSumOfProbas.d.ts +3 -3
- package/lib/exercises/math/probaStat/probaAsSumOfProbas.d.ts.map +1 -1
- package/lib/exercises/math/probaStat/probaAsSumOfProbas.js +17 -45
- package/lib/exercises/math/probaStat/probaFromTableWithContext.d.ts +12 -5
- package/lib/exercises/math/probaStat/probaFromTableWithContext.d.ts.map +1 -1
- package/lib/exercises/math/probaStat/probaFromTableWithContext.js +354 -94
- package/lib/exercises/math/probaStat/stats1var/medianWithList.d.ts +4 -1
- package/lib/exercises/math/probaStat/stats1var/medianWithList.d.ts.map +1 -1
- package/lib/exercises/math/probaStat/stats1var/medianWithList.js +43 -23
- package/lib/exercises/math/probaStat/stats1var/quartilesList.d.ts +1 -1
- package/lib/exercises/math/probaStat/stats1var/quartilesList.d.ts.map +1 -1
- package/lib/exercises/math/probaStat/stats1var/quartilesList.js +4 -4
- package/lib/exercises/pc/motion/averageSpeed.d.ts.map +1 -1
- package/lib/exercises/pc/motion/averageSpeed.js +13 -10
- package/lib/exercises/pc/optics/lensFormula.d.ts +1 -2
- package/lib/exercises/pc/optics/lensFormula.d.ts.map +1 -1
- package/lib/exercises/pc/optics/lensFormula.js +7 -10
- package/lib/exercises/pc/weight/calculateWeight.d.ts +1 -2
- package/lib/exercises/pc/weight/calculateWeight.d.ts.map +1 -1
- package/lib/exercises/pc/weight/calculateWeight.js +15 -14
- package/lib/index.d.ts +932 -919
- package/lib/index.d.ts.map +1 -1
- package/lib/math/progCalc/progCalc.d.ts +2 -2
- package/lib/math/progCalc/progCalc.d.ts.map +1 -1
- package/lib/math/progCalc/progCalc.js +4 -11
- package/lib/tests/exoTest.d.ts.map +1 -1
- package/lib/tests/exoTest.js +13 -0
- package/lib/types/keyIds.d.ts +1 -1
- package/lib/types/keyIds.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -21,22 +21,29 @@ export declare enum GeneratorOptionType {
|
|
|
21
21
|
select = "select",
|
|
22
22
|
multiselect = "multiselect"
|
|
23
23
|
}
|
|
24
|
-
export type GeneratorOption
|
|
24
|
+
export type GeneratorOption = {
|
|
25
25
|
id: string;
|
|
26
26
|
label: string;
|
|
27
|
-
type: GeneratorOptionType.checkbox
|
|
27
|
+
type: GeneratorOptionType.checkbox;
|
|
28
28
|
target: GeneratorOptionTarget;
|
|
29
29
|
tooltipText?: string;
|
|
30
|
-
|
|
31
|
-
|
|
30
|
+
defaultValue?: boolean;
|
|
31
|
+
} | {
|
|
32
|
+
id: string;
|
|
33
|
+
label: string;
|
|
34
|
+
type: GeneratorOptionType.select;
|
|
35
|
+
target: GeneratorOptionTarget;
|
|
36
|
+
tooltipText?: string;
|
|
37
|
+
values: string[];
|
|
38
|
+
defaultValue: string;
|
|
32
39
|
} | {
|
|
33
40
|
id: string;
|
|
34
41
|
label: string;
|
|
35
42
|
type: GeneratorOptionType.multiselect;
|
|
36
43
|
target: GeneratorOptionTarget;
|
|
37
44
|
tooltipText?: string;
|
|
38
|
-
values
|
|
39
|
-
defaultValue
|
|
45
|
+
values: string[];
|
|
46
|
+
defaultValue: string[];
|
|
40
47
|
};
|
|
41
48
|
export type Proposition = {
|
|
42
49
|
id: string;
|
|
@@ -76,7 +83,7 @@ export type GeogebraOptions = {
|
|
|
76
83
|
export type KeyboardOptions = {
|
|
77
84
|
parenthesisShouldNotProduceLeftRight?: boolean;
|
|
78
85
|
};
|
|
79
|
-
export interface Question<TIdentifiers, TOptions =
|
|
86
|
+
export interface Question<TIdentifiers, TOptions = Record<string, string | string[] | boolean>> {
|
|
80
87
|
instruction: string;
|
|
81
88
|
hint?: string;
|
|
82
89
|
correction?: string;
|
|
@@ -99,52 +106,52 @@ export interface Question<TIdentifiers, TOptions = object> {
|
|
|
99
106
|
answerTable?: string[][];
|
|
100
107
|
initTable?: string[][];
|
|
101
108
|
}
|
|
102
|
-
export type QCMGenerator<TIdentifiers, TOptions =
|
|
109
|
+
export type QCMGenerator<TIdentifiers, TOptions = Record<string, string | string[] | boolean>> = (n: number, args: {
|
|
103
110
|
answer: string;
|
|
104
111
|
} & TIdentifiers, options?: TOptions) => Proposition[];
|
|
105
|
-
export type VEA<TIdentifiers, TOptions =
|
|
112
|
+
export type VEA<TIdentifiers, TOptions = Record<string, string | string[] | boolean>> = (studentAnswer: string, args: {
|
|
106
113
|
answer: string;
|
|
107
114
|
} & TIdentifiers, options?: TOptions) => boolean;
|
|
108
|
-
export type TableVEA<TIdentifiers, TOptions =
|
|
115
|
+
export type TableVEA<TIdentifiers, TOptions = Record<string, string | string[] | boolean>> = (studentAnswer: string[][], args: {
|
|
109
116
|
answerTable: string[][];
|
|
110
117
|
} & TIdentifiers, options?: TOptions) => boolean;
|
|
111
|
-
export type GGBVEA<TIdentifiers, TOptions =
|
|
118
|
+
export type GGBVEA<TIdentifiers, TOptions = Record<string, string | string[] | boolean>> = (studentAnswer: string[], args: {
|
|
112
119
|
ggbAnswer: string[];
|
|
113
120
|
} & TIdentifiers, options?: TOptions) => boolean;
|
|
114
|
-
export type QuestionGenerator<TIdentifiers, TOptions =
|
|
115
|
-
export type GetHint<TIdentifiers, TOptions =
|
|
116
|
-
export type GetCorrection<TIdentifiers, TOptions =
|
|
117
|
-
export type GetInstruction<TIdentifiers, TOptions =
|
|
118
|
-
export type GetStartStatement<TIdentifiers, TOptions =
|
|
119
|
-
export type GetAnswer<TIdentifiers, TOptions =
|
|
120
|
-
export type GetAnswerTable<TIdentifiers, TOptions =
|
|
121
|
-
export type GetKeys<TIdentifiers, TOptions =
|
|
122
|
-
export type GetGGBAnswer<TIdentifiers, TOptions =
|
|
123
|
-
export type GetGGBOptions<TIdentifiers, TOptions =
|
|
124
|
-
export type GetStudentGGBOptions<TIdentifiers, TOptions =
|
|
125
|
-
export type RebuildIdentifiers<TIdentifiers, TOptions =
|
|
126
|
-
export type GetQuestionFromIdentifiers<TIdentifiers, TOptions =
|
|
127
|
-
export type QuestionHotFix<TIdentifiers, TOptions =
|
|
128
|
-
export type ValidateOptions<TOptions =
|
|
121
|
+
export type QuestionGenerator<TIdentifiers, TOptions = Record<string, string | string[] | boolean>> = (opts?: TOptions) => Question<TIdentifiers, TOptions>;
|
|
122
|
+
export type GetHint<TIdentifiers, TOptions = Record<string, string | string[] | boolean>> = (args: TIdentifiers, options?: TOptions) => string;
|
|
123
|
+
export type GetCorrection<TIdentifiers, TOptions = Record<string, string | string[] | boolean>> = (args: TIdentifiers, options?: TOptions) => string;
|
|
124
|
+
export type GetInstruction<TIdentifiers, TOptions = Record<string, string | string[] | boolean>> = (args: TIdentifiers, options?: TOptions) => string;
|
|
125
|
+
export type GetStartStatement<TIdentifiers, TOptions = Record<string, string | string[] | boolean>> = (args: TIdentifiers, options?: TOptions) => string;
|
|
126
|
+
export type GetAnswer<TIdentifiers, TOptions = Record<string, string | string[] | boolean>> = (args: TIdentifiers, options?: TOptions) => string;
|
|
127
|
+
export type GetAnswerTable<TIdentifiers, TOptions = Record<string, string | string[] | boolean>> = (args: TIdentifiers, options?: TOptions) => string[][];
|
|
128
|
+
export type GetKeys<TIdentifiers, TOptions = Record<string, string | string[] | boolean>> = (args: TIdentifiers, options?: TOptions) => (KeyId | KeyProps)[];
|
|
129
|
+
export type GetGGBAnswer<TIdentifiers, TOptions = Record<string, string | string[] | boolean>> = (args: TIdentifiers, options?: TOptions) => string[];
|
|
130
|
+
export type GetGGBOptions<TIdentifiers, TOptions = Record<string, string | string[] | boolean>> = (args: TIdentifiers, options?: TOptions) => GeogebraOptions;
|
|
131
|
+
export type GetStudentGGBOptions<TIdentifiers, TOptions = Record<string, string | string[] | boolean>> = (args: TIdentifiers, options?: TOptions) => GeogebraOptions;
|
|
132
|
+
export type RebuildIdentifiers<TIdentifiers, TOptions = Record<string, string | string[] | boolean>, TOldIdentifiers = object> = (oldIdentifiers: TOldIdentifiers, options?: TOptions) => TIdentifiers;
|
|
133
|
+
export type GetQuestionFromIdentifiers<TIdentifiers, TOptions = Record<string, string | string[] | boolean>> = (identifiers: TIdentifiers, options?: TOptions) => Question<TIdentifiers, TOptions>;
|
|
134
|
+
export type QuestionHotFix<TIdentifiers, TOptions = Record<string, string | string[] | boolean>> = (q: Question<TIdentifiers, TOptions>, options?: TOptions) => Question<TIdentifiers, TOptions>;
|
|
135
|
+
export type ValidateOptions<TOptions = Record<string, string | string[] | boolean>> = (options: TOptions) => {
|
|
129
136
|
valid: boolean;
|
|
130
137
|
message: string;
|
|
131
138
|
};
|
|
132
|
-
export type TestData<TIdentifiers, TOptions =
|
|
139
|
+
export type TestData<TIdentifiers, TOptions = Record<string, string | string[] | boolean>> = {
|
|
133
140
|
identifiers: TIdentifiers;
|
|
134
141
|
options?: TOptions;
|
|
135
142
|
answer: string;
|
|
136
143
|
valids?: string[];
|
|
137
144
|
};
|
|
138
|
-
export type GetTests<TIdentifiers, TOptions =
|
|
145
|
+
export type GetTests<TIdentifiers, TOptions = Record<string, string | string[] | boolean>> = () => TestData<TIdentifiers, TOptions>[];
|
|
139
146
|
type PDFOptions = {
|
|
140
147
|
shouldSpreadPropositions?: boolean;
|
|
141
148
|
};
|
|
142
|
-
export interface Exercise<TIdentifiers, TOptions =
|
|
149
|
+
export interface Exercise<TIdentifiers, TOptions = Record<string, string | string[] | boolean>> {
|
|
143
150
|
id: string;
|
|
144
151
|
isSingleStep: boolean;
|
|
145
152
|
label: string;
|
|
146
153
|
pdfOptions?: PDFOptions;
|
|
147
|
-
options?: GeneratorOption
|
|
154
|
+
options?: GeneratorOption[];
|
|
148
155
|
connector?: "=" | "\\iff" | "\\approx";
|
|
149
156
|
generator: (n: number, opts?: TOptions) => Question<TIdentifiers, TOptions>[];
|
|
150
157
|
maxAllowedQuestions?: number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"exercise.d.ts","sourceRoot":"","sources":["../../src/exercises/exercise.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;AAC9C,OAAO,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AAInD,eA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er" | "Decimal";
|
|
10
|
+
nbSteps: string;
|
|
11
|
+
nbDigits: string;
|
|
12
12
|
};
|
|
13
13
|
export declare const mentalProgramSolve: Exercise<Identifiers, Options>;
|
|
14
14
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mentalProgramSolve.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calcul/mentalCaluls/mentalProgramSolve.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAiBT,MAAM,6BAA6B,CAAC;AAIrC,OAAO,EAEL,eAAe,EAChB,MAAM,qCAAqC,CAAC;
|
|
1
|
+
{"version":3,"file":"mentalProgramSolve.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calcul/mentalCaluls/mentalProgramSolve.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAiBT,MAAM,6BAA6B,CAAC;AAIrC,OAAO,EAEL,eAAe,EAChB,MAAM,qCAAqC,CAAC;AAI7C,OAAO,EAGL,mBAAmB,EACpB,MAAM,iCAAiC,CAAC;AA4BzC,KAAK,WAAW,GAAG;IACjB,qBAAqB,EAAE,eAAe,CAAC;IACvC,WAAW,EAAE,mBAAmB,CAAC;CAClC,CAAC;AAqOF,KAAK,OAAO,GAAG;IACb,UAAU,EAAE,SAAS,GAAG,SAAS,CAAC;IAClC,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,MAAM,CAAC;CAClB,CAAC;AAiCF,eAAO,MAAM,kBAAkB,EAAE,QAAQ,CAAC,WAAW,EAAE,OAAO,CAyB7D,CAAC"}
|
|
@@ -2,27 +2,23 @@ import { addValidProp, shuffleProps, GeneratorOptionTarget, GeneratorOptionType,
|
|
|
2
2
|
import { getDistinctQuestions } from "../../../../exercises/utils/getDistinctQuestions.js";
|
|
3
3
|
import { randint } from "../../../../math/utils/random/randint.js";
|
|
4
4
|
import { NodeConstructor, } from "../../../../tree/nodes/nodeConstructor.js";
|
|
5
|
+
import { randomMany } from "../../../../utils/alea/random.js";
|
|
5
6
|
import { handleVEAError } from "../../../../utils/errors/handleVEAError.js";
|
|
6
7
|
import { parseAlgebraic } from "../../../../tree/parsers/latexParser.js";
|
|
7
8
|
import { ProgCalc, ProgCalcConstructor, } from "../../../../math/progCalc/progCalc.js";
|
|
8
|
-
import {
|
|
9
|
+
import { add, AddNode } from "../../../../tree/nodes/operators/addNode.js";
|
|
9
10
|
import { abs } from "../../../../tree/nodes/functions/absNode.js";
|
|
10
11
|
import { shuffle } from "../../../../utils/alea/shuffle.js";
|
|
11
|
-
import { isOppositeNode } from "../../../../tree/nodes/functions/oppositeNode.js";
|
|
12
|
-
import { alignTex } from "../../../../utils/latex/alignTex.js";
|
|
13
12
|
const getStrSolvingStep = (nodeStep) => {
|
|
14
13
|
//write 10 + (-8) instead of 10 - 8
|
|
15
14
|
function isNegative(node) {
|
|
16
15
|
return !abs(node).simplify().equals(node.simplify());
|
|
17
16
|
}
|
|
18
|
-
if (
|
|
17
|
+
if (nodeStep instanceof AddNode && isNegative(nodeStep.rightChild)) {
|
|
19
18
|
return `${nodeStep.leftChild.toTex()} + (${nodeStep.rightChild.toTex()}) = ${nodeStep
|
|
20
19
|
.simplify()
|
|
21
20
|
.toTex()}`;
|
|
22
21
|
}
|
|
23
|
-
else if (isOppositeNode(nodeStep)) {
|
|
24
|
-
return `-(${nodeStep.child.toTex()}) = ${nodeStep.simplify().toTex()}`;
|
|
25
|
-
}
|
|
26
22
|
else {
|
|
27
23
|
const texL = nodeStep.toTex({
|
|
28
24
|
allowDoubleMinus: true,
|
|
@@ -35,16 +31,16 @@ const getStrSolvingStep = (nodeStep) => {
|
|
|
35
31
|
return `${texL} = ${texR}`;
|
|
36
32
|
}
|
|
37
33
|
};
|
|
38
|
-
const getPropositions = (n, { answer,
|
|
34
|
+
const getPropositions = (n, { answer, ...identifiers }) => {
|
|
39
35
|
const propositions = [];
|
|
40
36
|
addValidProp(propositions, answer);
|
|
41
|
-
const
|
|
42
|
-
const
|
|
43
|
-
const
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
tryToAddWrongProp(propositions,
|
|
37
|
+
const progCalc = ProgCalcConstructor.fromIdentifiers(identifiers.progCalcIds);
|
|
38
|
+
const nodeFinalNumber = answer.toTree();
|
|
39
|
+
const nbWrong = n - 1;
|
|
40
|
+
const arrOffset = randomMany([-10, -5, -4, -3, -2, -1, 1, 2, 3, 4, 5, 10], nbWrong);
|
|
41
|
+
for (let i = 0; i < arrOffset.length; i++) {
|
|
42
|
+
const offset = arrOffset[i];
|
|
43
|
+
tryToAddWrongProp(propositions, add(nodeFinalNumber, offset).simplify().toTex());
|
|
48
44
|
}
|
|
49
45
|
//applies progCalc operations in reverse to finalNumber
|
|
50
46
|
const progCalcReversed = new ProgCalc(progCalc.operations.toReversed());
|
|
@@ -74,33 +70,40 @@ const getPropositions = (n, { answer, progCalcIds, nodeIdsStartingNumber }) => {
|
|
|
74
70
|
});
|
|
75
71
|
return shuffleProps(propositions, n);
|
|
76
72
|
};
|
|
77
|
-
const getAnswerNode = (identifiers) => {
|
|
78
|
-
const { nodeIdsStartingNumber } = identifiers;
|
|
79
|
-
return NodeConstructor.fromIdentifiers(nodeIdsStartingNumber);
|
|
80
|
-
};
|
|
81
73
|
const getAnswer = (identifiers) => {
|
|
82
|
-
|
|
74
|
+
const { nodeIdsStartingNumber } = identifiers;
|
|
75
|
+
const nodeStartingNumber = NodeConstructor.fromIdentifiers(nodeIdsStartingNumber);
|
|
76
|
+
return nodeStartingNumber.toTex();
|
|
83
77
|
};
|
|
84
78
|
const getInstruction = (identifiers, opts) => {
|
|
85
79
|
const { nodeIdsStartingNumber, progCalcIds } = identifiers;
|
|
86
80
|
const nodeStartingNumber = NodeConstructor.fromIdentifiers(nodeIdsStartingNumber);
|
|
87
81
|
const progCalc = ProgCalcConstructor.fromIdentifiers(progCalcIds);
|
|
88
82
|
const nodeFinalNumber = progCalc.apply(nodeStartingNumber).simplify();
|
|
89
|
-
const
|
|
83
|
+
const strOpening = `Voici un programme de calcul :`;
|
|
84
|
+
const strChooseANumber = `Choisir un nombre
|
|
85
|
+
|
|
86
|
+
`;
|
|
87
|
+
const arrStrProgCalc = progCalc.getArrOfFrenchStrings().map((str) => `
|
|
88
|
+
|
|
89
|
+
${str}`);
|
|
90
|
+
const strProgCalc = arrStrProgCalc.reduce((acc, str) => acc + str);
|
|
91
|
+
const strFinalNumber = opts?.numberType == "Integer"
|
|
90
92
|
? nodeFinalNumber.evaluate().frenchify()
|
|
91
93
|
: nodeFinalNumber
|
|
92
94
|
.evaluate()
|
|
93
|
-
.toFixed(opts?.nbDigits
|
|
95
|
+
.toFixed(Number(opts?.nbDigits))
|
|
94
96
|
.replace(".", ",");
|
|
95
|
-
|
|
97
|
+
const strQuestion = `Quel nombre faut-il choisir au départ pour obtenir $ ${strFinalNumber} $ à la fin ?`;
|
|
98
|
+
return `
|
|
99
|
+
${strOpening}
|
|
96
100
|
|
|
97
|
-
|
|
101
|
+
${strChooseANumber}
|
|
98
102
|
|
|
99
|
-
${
|
|
100
|
-
|
|
101
|
-
`)}
|
|
103
|
+
${strProgCalc}
|
|
102
104
|
|
|
103
|
-
|
|
105
|
+
${strQuestion}
|
|
106
|
+
`;
|
|
104
107
|
};
|
|
105
108
|
const getHint = () => {
|
|
106
109
|
return `Pars du résultat obtenu à la fin et remonte à l'envers en inversant chaque étape.`;
|
|
@@ -131,10 +134,12 @@ const getCorrection = (identifiers) => {
|
|
|
131
134
|
return `
|
|
132
135
|
On part de la fin et on remonte à l'envers en inversant chaque étape.
|
|
133
136
|
|
|
134
|
-
${
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
137
|
+
${arrStrSolvingSteps.map((str) => `
|
|
138
|
+
|
|
139
|
+
$$
|
|
140
|
+
${str}
|
|
141
|
+
$$
|
|
142
|
+
`)}
|
|
138
143
|
|
|
139
144
|
Le nombre choisi au départ était donc $ ${nodeStartingNumber.toTex()} $.`;
|
|
140
145
|
};
|
|
@@ -154,19 +159,18 @@ const getMentalProgramSolveQuestion = (optsIn) => {
|
|
|
154
159
|
const opts = optsIn ? Object.assign(optsDefault, optsIn) : optsDefault;
|
|
155
160
|
let nbDigits = 0;
|
|
156
161
|
switch (opts.numberType) {
|
|
157
|
-
case "
|
|
158
|
-
nbDigits = opts.nbDigits ?? 2;
|
|
159
|
-
break;
|
|
160
|
-
default:
|
|
161
|
-
case "Entier":
|
|
162
|
+
case "Integer":
|
|
162
163
|
nbDigits = 0;
|
|
163
164
|
break;
|
|
165
|
+
case "Decimal":
|
|
166
|
+
nbDigits = Number(opts.nbDigits);
|
|
167
|
+
break;
|
|
164
168
|
}
|
|
165
169
|
const powerOf10 = Math.pow(10, nbDigits);
|
|
166
170
|
const valueStart = randint(0, 33 * powerOf10, []) / powerOf10;
|
|
167
171
|
const nodeStartingNumber = valueStart.toTree();
|
|
168
172
|
const isSingleUseOperators = false;
|
|
169
|
-
const progCalc = ProgCalcConstructor.randomMental(opts.nbSteps, nodeStartingNumber, nbDigits, isSingleUseOperators);
|
|
173
|
+
const progCalc = ProgCalcConstructor.randomMental(Number(opts.nbSteps), nodeStartingNumber, nbDigits, isSingleUseOperators);
|
|
170
174
|
const identifiers = {
|
|
171
175
|
nodeIdsStartingNumber: valueStart.toTree().toIdentifiers(),
|
|
172
176
|
progCalcIds: progCalc.toIdentifiers(),
|
|
@@ -185,16 +189,16 @@ const getQuestionFromIdentifiers = (identifiers, opts) => {
|
|
|
185
189
|
};
|
|
186
190
|
};
|
|
187
191
|
const optsDefault = {
|
|
188
|
-
numberType: "
|
|
189
|
-
nbSteps: 4,
|
|
190
|
-
nbDigits: 0,
|
|
192
|
+
numberType: "Integer",
|
|
193
|
+
nbSteps: "4",
|
|
194
|
+
nbDigits: "0",
|
|
191
195
|
};
|
|
192
196
|
const options = [
|
|
193
197
|
{
|
|
194
198
|
id: "numberType",
|
|
195
199
|
label: "Type de nombres utilisés",
|
|
196
200
|
defaultValue: optsDefault.numberType,
|
|
197
|
-
values: ["
|
|
201
|
+
values: ["Integer", "Decimal"],
|
|
198
202
|
target: GeneratorOptionTarget.generation,
|
|
199
203
|
type: GeneratorOptionType.select,
|
|
200
204
|
},
|
|
@@ -202,7 +206,7 @@ const options = [
|
|
|
202
206
|
id: "nbSteps",
|
|
203
207
|
label: "Nombre d'étapes de transformation",
|
|
204
208
|
defaultValue: optsDefault.nbSteps,
|
|
205
|
-
values: [2, 3, 4, 5, 6],
|
|
209
|
+
values: ["2", "3", "4", "5", "6"],
|
|
206
210
|
target: GeneratorOptionTarget.generation,
|
|
207
211
|
type: GeneratorOptionType.select,
|
|
208
212
|
},
|
|
@@ -210,7 +214,7 @@ const options = [
|
|
|
210
214
|
id: "nbDigits",
|
|
211
215
|
label: "Nombre de décimales",
|
|
212
216
|
defaultValue: optsDefault.nbDigits,
|
|
213
|
-
values: [0, 1, 2],
|
|
217
|
+
values: ["0", "1", "2"],
|
|
214
218
|
target: GeneratorOptionTarget.generation,
|
|
215
219
|
type: GeneratorOptionType.select,
|
|
216
220
|
},
|
|
@@ -207,7 +207,7 @@ const getKeys = (identifiers) => {
|
|
|
207
207
|
const getCompareA10NQuestion = (optsIn) => {
|
|
208
208
|
const opts = optsIn ? Object.assign(optsIn, optsDefault) : optsDefault;
|
|
209
209
|
const signType = random(opts.signTypes);
|
|
210
|
-
const nbCollisions = random(opts.nbCollisions);
|
|
210
|
+
const nbCollisions = Number(random(opts.nbCollisions));
|
|
211
211
|
const nbItems = 4;
|
|
212
212
|
let arrayOfA = [...Array(nbItems).keys()].map(() => {
|
|
213
213
|
const pow10 = random([0, 1, 2]);
|
|
@@ -283,7 +283,7 @@ const getCompareA10NQuestion = (optsIn) => {
|
|
|
283
283
|
};
|
|
284
284
|
const optsDefault = {
|
|
285
285
|
signTypes: ["positifs", "négatifs", "mélange"],
|
|
286
|
-
nbCollisions: [0, 1, 2, 3],
|
|
286
|
+
nbCollisions: ["0", "1", "2", "3"],
|
|
287
287
|
};
|
|
288
288
|
const options = [
|
|
289
289
|
{
|
|
@@ -299,7 +299,7 @@ const options = [
|
|
|
299
299
|
label: "Nombre de collisions",
|
|
300
300
|
type: GeneratorOptionType.multiselect,
|
|
301
301
|
target: GeneratorOptionTarget.generation,
|
|
302
|
-
values: [0, 1, 2, 3],
|
|
302
|
+
values: ["0", "1", "2", "3"],
|
|
303
303
|
defaultValue: optsDefault.nbCollisions,
|
|
304
304
|
},
|
|
305
305
|
];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"compareFracABWithFracAPlusCBPlusC.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calcul/ordering/compareFracABWithFracAPlusCBPlusC.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAeT,MAAM,6BAA6B,CAAC;AAIrC,OAAO,EAEL,eAAe,EAChB,MAAM,qCAAqC,CAAC;AAY7C,KAAK,WAAW,GAAG;IACjB,OAAO,EAAE,eAAe,EAAE,CAAC;IAC3B,UAAU,EAAE,MAAM,EAAE,CAAC;CACtB,CAAC;AA0MF,KAAK,OAAO,GAAG;IACb,YAAY,EAAE,OAAO,CAAC;CACvB,CAAC;
|
|
1
|
+
{"version":3,"file":"compareFracABWithFracAPlusCBPlusC.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calcul/ordering/compareFracABWithFracAPlusCBPlusC.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAeT,MAAM,6BAA6B,CAAC;AAIrC,OAAO,EAEL,eAAe,EAChB,MAAM,qCAAqC,CAAC;AAY7C,KAAK,WAAW,GAAG;IACjB,OAAO,EAAE,eAAe,EAAE,CAAC;IAC3B,UAAU,EAAE,MAAM,EAAE,CAAC;CACtB,CAAC;AA0MF,KAAK,OAAO,GAAG;IACb,YAAY,EAAE,OAAO,CAAC;CACvB,CAAC;AAeF,eAAO,MAAM,iCAAiC,EAAE,QAAQ,CAAC,WAAW,EAAE,OAAO,CAqB1E,CAAC"}
|
package/lib/exercises/math/calcul/proportionality/findCoeffInProportionalTableNonIntegers.js
CHANGED
|
@@ -124,7 +124,7 @@ const options = [
|
|
|
124
124
|
type: GeneratorOptionType.multiselect,
|
|
125
125
|
target: GeneratorOptionTarget.generation,
|
|
126
126
|
values: ["Entières", "Décimales", "Fractions"],
|
|
127
|
-
defaultValue: ["
|
|
127
|
+
defaultValue: ["Entières", "Décimales", "Fractions"],
|
|
128
128
|
},
|
|
129
129
|
];
|
|
130
130
|
export const findCoeffInProportionalTableNonIntegers = {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"isTableProportionalNonInteger.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calcul/proportionality/isTableProportionalNonInteger.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAeT,MAAM,6BAA6B,CAAC;AAMrC,OAAO,EAEL,eAAe,EAChB,MAAM,qCAAqC,CAAC;AAS7C,KAAK,WAAW,GAAG;IACjB,QAAQ,EAAE,eAAe,CAAC;IAC1B,OAAO,EAAE,eAAe,EAAE,CAAC;IAC3B,OAAO,EAAE,eAAe,EAAE,CAAC;IAC3B,eAAe,EAAE,OAAO,CAAC;IACzB,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,MAAM,CAAC;CACpB,CAAC;AAkCF,KAAK,OAAO,GAAG;IACb,gBAAgB,EAAE,MAAM,EAAE,CAAC;IAC3B,iBAAiB,EAAE,MAAM,EAAE,CAAC;CAC7B,CAAC;
|
|
1
|
+
{"version":3,"file":"isTableProportionalNonInteger.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calcul/proportionality/isTableProportionalNonInteger.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAeT,MAAM,6BAA6B,CAAC;AAMrC,OAAO,EAEL,eAAe,EAChB,MAAM,qCAAqC,CAAC;AAS7C,KAAK,WAAW,GAAG;IACjB,QAAQ,EAAE,eAAe,CAAC;IAC1B,OAAO,EAAE,eAAe,EAAE,CAAC;IAC3B,OAAO,EAAE,eAAe,EAAE,CAAC;IAC3B,eAAe,EAAE,OAAO,CAAC;IACzB,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,MAAM,CAAC;CACpB,CAAC;AAkCF,KAAK,OAAO,GAAG;IACb,gBAAgB,EAAE,MAAM,EAAE,CAAC;IAC3B,iBAAiB,EAAE,MAAM,EAAE,CAAC;CAC7B,CAAC;AAqGF,eAAO,MAAM,6BAA6B,EAAE,QAAQ,CAAC,WAAW,EAAE,OAAO,CAoBxE,CAAC"}
|
|
@@ -107,6 +107,7 @@ const options = [
|
|
|
107
107
|
type: GeneratorOptionType.multiselect,
|
|
108
108
|
target: GeneratorOptionTarget.generation,
|
|
109
109
|
values: ["Entier", "Décimal", "Fraction"],
|
|
110
|
+
defaultValue: ["Entier", "Décimal", "Fraction"],
|
|
110
111
|
},
|
|
111
112
|
{
|
|
112
113
|
id: "valuesNumberTypes",
|
|
@@ -114,6 +115,7 @@ const options = [
|
|
|
114
115
|
type: GeneratorOptionType.multiselect,
|
|
115
116
|
target: GeneratorOptionTarget.generation,
|
|
116
117
|
values: ["Entières", "Décimales", "Fractions"],
|
|
118
|
+
defaultValue: ["Entières", "Décimales", "Fractions"],
|
|
117
119
|
},
|
|
118
120
|
];
|
|
119
121
|
export const isTableProportionalNonInteger = {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rounding.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calcul/rounding/rounding.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAeT,MAAM,6BAA6B,CAAC;
|
|
1
|
+
{"version":3,"file":"rounding.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calcul/rounding/rounding.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAeT,MAAM,6BAA6B,CAAC;AAyBrC,KAAK,OAAO,GAAG;IACb,cAAc,EAAE,MAAM,CAAC;CACxB,CAAC;AACF,KAAK,WAAW,GAAG;IACjB,cAAc,EAAE,MAAM,CAAC;IACvB,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;CACnB,CAAC;AAgIF,eAAO,MAAM,WAAW,EAAE,QAAQ,CAAC,WAAW,EAAE,OAAO,CActD,CAAC;AACF;;GAEG;AACH,eAAO,MAAM,cAAc,EAAE,QAAQ,CAAC,WAAW,EAAE,OAAO,CAczD,CAAC;AACF;;GAEG;AACH,eAAO,MAAM,eAAe,EAAE,QAAQ,CAAC,WAAW,EAAE,OAAO,CAc1D,CAAC;AACF;;GAEG;AACH,eAAO,MAAM,eAAe,EAAE,QAAQ,CAAC,WAAW,EAAE,OAAO,CAc1D,CAAC;AAEF,eAAO,MAAM,YAAY,EAAE,QAAQ,CAAC,WAAW,EAAE,OAAO,CAiBvD,CAAC"}
|
|
@@ -4,6 +4,7 @@ import { Decimal, DecimalConstructor, } from "../../../../math/numbers/decimals/
|
|
|
4
4
|
import { randint } from "../../../../math/utils/random/randint.js";
|
|
5
5
|
import { round } from "../../../../math/utils/round.js";
|
|
6
6
|
import { numberParser } from "../../../../tree/parsers/numberParser.js";
|
|
7
|
+
import { random } from "../../../../utils/alea/random.js";
|
|
7
8
|
import { shuffle } from "../../../../utils/alea/shuffle.js";
|
|
8
9
|
/**
|
|
9
10
|
* arrondi à l'unité
|
|
@@ -57,7 +58,7 @@ ${decTex} \\approx ${answer}
|
|
|
57
58
|
$$`}`;
|
|
58
59
|
};
|
|
59
60
|
const getRoundQuestions = (opts) => {
|
|
60
|
-
const precisionAsked = opts?.precisionAsked || 0;
|
|
61
|
+
const precisionAsked = Number(opts?.precisionAsked) || 0;
|
|
61
62
|
const precision = randint(precisionAsked + 1, precisionAsked + 5);
|
|
62
63
|
const dec = DecimalConstructor.random(0, 1000, precision);
|
|
63
64
|
const identifiers = {
|
|
@@ -111,7 +112,7 @@ export const roundToUnit = {
|
|
|
111
112
|
connector: "\\approx",
|
|
112
113
|
label: "Arrondir à l'unité",
|
|
113
114
|
isSingleStep: true,
|
|
114
|
-
generator: (nb) => getDistinctQuestions(() => getRoundQuestions({ precisionAsked: 0 }), nb),
|
|
115
|
+
generator: (nb) => getDistinctQuestions(() => getRoundQuestions({ precisionAsked: "0" }), nb),
|
|
115
116
|
qcmTimer: 60,
|
|
116
117
|
freeTimer: 60,
|
|
117
118
|
getPropositions,
|
|
@@ -128,7 +129,7 @@ export const roundToDixieme = {
|
|
|
128
129
|
connector: "\\approx",
|
|
129
130
|
label: "Arrondir au dixième",
|
|
130
131
|
isSingleStep: true,
|
|
131
|
-
generator: (nb) => getDistinctQuestions(() => getRoundQuestions({ precisionAsked: 1 }), nb),
|
|
132
|
+
generator: (nb) => getDistinctQuestions(() => getRoundQuestions({ precisionAsked: "1" }), nb),
|
|
132
133
|
qcmTimer: 60,
|
|
133
134
|
freeTimer: 60,
|
|
134
135
|
getPropositions,
|
|
@@ -145,7 +146,7 @@ export const roundToCentieme = {
|
|
|
145
146
|
connector: "\\approx",
|
|
146
147
|
label: "Arrondir au centième",
|
|
147
148
|
isSingleStep: true,
|
|
148
|
-
generator: (nb) => getDistinctQuestions(() => getRoundQuestions({ precisionAsked: 2 }), nb),
|
|
149
|
+
generator: (nb) => getDistinctQuestions(() => getRoundQuestions({ precisionAsked: "2" }), nb),
|
|
149
150
|
qcmTimer: 60,
|
|
150
151
|
freeTimer: 60,
|
|
151
152
|
getPropositions,
|
|
@@ -162,7 +163,7 @@ export const roundToMillieme = {
|
|
|
162
163
|
connector: "\\approx",
|
|
163
164
|
label: "Arrondir au millième",
|
|
164
165
|
isSingleStep: true,
|
|
165
|
-
generator: (nb) => getDistinctQuestions(() => getRoundQuestions({ precisionAsked: 3 }), nb),
|
|
166
|
+
generator: (nb) => getDistinctQuestions(() => getRoundQuestions({ precisionAsked: "3" }), nb),
|
|
166
167
|
qcmTimer: 60,
|
|
167
168
|
freeTimer: 60,
|
|
168
169
|
getPropositions,
|
|
@@ -176,7 +177,7 @@ export const allRoundings = {
|
|
|
176
177
|
connector: "\\approx",
|
|
177
178
|
label: "Arrondir un nombre décimal",
|
|
178
179
|
isSingleStep: true,
|
|
179
|
-
generator: (nb) => getDistinctQuestions(() => getRoundQuestions({ precisionAsked:
|
|
180
|
+
generator: (nb) => getDistinctQuestions(() => getRoundQuestions({ precisionAsked: random(["0", "1", "2", "3"]) }), nb),
|
|
180
181
|
qcmTimer: 60,
|
|
181
182
|
freeTimer: 60,
|
|
182
183
|
getPropositions,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"writeLitExpFromFrenchExp.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calculLitteral/writing/writeLitExpFromFrenchExp.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAcT,MAAM,6BAA6B,CAAC;AAmCrC,KAAK,QAAQ,GACT,UAAU,GACV,SAAS,GACT,KAAK,GACL,UAAU,GACV,UAAU,GACV,QAAQ,CAAC;AAoEb,KAAK,WAAW,GAAG;IACjB,YAAY,EAAE,QAAQ,CAAC;IACvB,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACnB,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAAC;IAC/B,wBAAwB,EAAE,OAAO,CAAC;CACnC,CAAC;
|
|
1
|
+
{"version":3,"file":"writeLitExpFromFrenchExp.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calculLitteral/writing/writeLitExpFromFrenchExp.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAcT,MAAM,6BAA6B,CAAC;AAmCrC,KAAK,QAAQ,GACT,UAAU,GACV,SAAS,GACT,KAAK,GACL,UAAU,GACV,UAAU,GACV,QAAQ,CAAC;AAoEb,KAAK,WAAW,GAAG;IACjB,YAAY,EAAE,QAAQ,CAAC;IACvB,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACnB,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAAC;IAC/B,wBAAwB,EAAE,OAAO,CAAC;CACnC,CAAC;AAyNF,eAAO,MAAM,sBAAsB,EAAE,QAAQ,CAAC,WAAW,CAkBxD,CAAC"}
|