math-exercises 3.0.181 → 3.0.183
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/probaStat/independancy/independancyFromEffectifTable.d.ts +10 -0
- package/lib/exercises/math/probaStat/independancy/independancyFromEffectifTable.d.ts.map +1 -0
- package/lib/exercises/math/probaStat/independancy/independancyFromEffectifTable.js +154 -0
- package/lib/exercises/math/probaStat/independancy/independancyFromProbaTree.d.ts +10 -0
- package/lib/exercises/math/probaStat/independancy/independancyFromProbaTree.d.ts.map +1 -0
- package/lib/exercises/math/probaStat/independancy/independancyFromProbaTree.js +152 -0
- package/lib/exercises/math/probaStat/independancy/index.d.ts +2 -0
- package/lib/exercises/math/probaStat/independancy/index.d.ts.map +1 -1
- package/lib/exercises/math/probaStat/independancy/index.js +2 -0
- package/lib/exercises/math/probaStat/trees/index.js +1 -0
- package/lib/exercises/math/probaStat/trees/probaTreeSituationTotalProbaFormula.d.ts +6 -0
- package/lib/exercises/math/probaStat/trees/probaTreeSituationTotalProbaFormula.d.ts.map +1 -1
- package/lib/exercises/math/probaStat/trees/probaTreeSituationTotalProbaFormula.js +125 -80
- package/lib/exercises/math/sequences/geometric/index.d.ts +3 -3
- package/lib/exercises/math/sequences/geometric/index.d.ts.map +1 -1
- package/lib/exercises/math/sequences/geometric/index.js +3 -3
- package/lib/exercises/math/sequences/geometric/situations/index.d.ts +1 -1
- package/lib/exercises/math/sequences/geometric/situations/index.d.ts.map +1 -1
- package/lib/exercises/math/sequences/geometric/situations/index.js +1 -1
- package/lib/index.d.ts +32 -23
- package/lib/index.d.ts.map +1 -1
- package/lib/tree/parsers/rationalParser.d.ts.map +1 -1
- package/lib/tree/parsers/rationalParser.js +7 -1
- package/package.json +1 -1
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Exercise } from "../../../../exercises/exercise.js";
|
|
2
|
+
type Identifiers = {
|
|
3
|
+
aCapB: number;
|
|
4
|
+
aCapBBarre: number;
|
|
5
|
+
aBarreCapB: number;
|
|
6
|
+
aBarreCapBBarre: number;
|
|
7
|
+
};
|
|
8
|
+
export declare const independancyFromEffectifTable: Exercise<Identifiers>;
|
|
9
|
+
export {};
|
|
10
|
+
//# sourceMappingURL=independancyFromEffectifTable.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"independancyFromEffectifTable.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/probaStat/independancy/independancyFromEffectifTable.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAYT,MAAM,6BAA6B,CAAC;AASrC,KAAK,WAAW,GAAG;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;IACnB,eAAe,EAAE,MAAM,CAAC;CACzB,CAAC;AAwJF,eAAO,MAAM,6BAA6B,EAAE,QAAQ,CAAC,WAAW,CAqB/D,CAAC"}
|
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
import { addValidProp, shuffleProps, tryToAddWrongProp, } from "../../../../exercises/exercise.js";
|
|
2
|
+
import { getDistinctQuestions } from "../../../../exercises/utils/getDistinctQuestions.js";
|
|
3
|
+
import { randint } from "../../../../math/utils/random/randint.js";
|
|
4
|
+
import { frac } from "../../../../tree/nodes/operators/fractionNode.js";
|
|
5
|
+
import { multiply } from "../../../../tree/nodes/operators/multiplyNode.js";
|
|
6
|
+
import { coinFlip } from "../../../../utils/alea/coinFlip.js";
|
|
7
|
+
import { dollarize } from "../../../../utils/latex/dollarize.js";
|
|
8
|
+
import { mdTable } from "../../../../utils/markdown/mdTable.js";
|
|
9
|
+
const getPropositions = (n, { answer }) => {
|
|
10
|
+
const propositions = [];
|
|
11
|
+
addValidProp(propositions, answer, "raw");
|
|
12
|
+
["Oui", "Non", "On ne peut pas savoir"].forEach((prop) => tryToAddWrongProp(propositions, prop, "raw"));
|
|
13
|
+
return shuffleProps(propositions, n);
|
|
14
|
+
};
|
|
15
|
+
const getAnswer = (identifiers) => {
|
|
16
|
+
const { aBarreCapB, aBarreCapBBarre, aCapB, aCapBBarre } = identifiers;
|
|
17
|
+
return aCapB * aBarreCapBBarre === aCapBBarre * aBarreCapB ? "Oui" : "Non";
|
|
18
|
+
};
|
|
19
|
+
const getInstruction = (identifiers) => {
|
|
20
|
+
const { aBarreCapB, aBarreCapBBarre, aCapB, aCapBBarre } = identifiers;
|
|
21
|
+
const total = aBarreCapB + aBarreCapBBarre + aCapB + aCapBBarre;
|
|
22
|
+
const aTotal = aCapB + aCapBBarre;
|
|
23
|
+
const bTotal = aCapB + aBarreCapB;
|
|
24
|
+
const aBarreTotal = aBarreCapB + aBarreCapBBarre;
|
|
25
|
+
const bBarreTotal = aBarreCapBBarre + aCapBBarre;
|
|
26
|
+
return `On considère deux événements $A$ et $B$.
|
|
27
|
+
|
|
28
|
+
Le tableau suivant donne le nombre d'issues pour chacun des événements $A\\cap B$, $\\overline A\\cap B$, $A\\cap \\overline B$ et $\\overline A \\cap \\overline B$.
|
|
29
|
+
|
|
30
|
+
${mdTable([
|
|
31
|
+
[" ", "$B$", "$\\overline{B}$", "Total"],
|
|
32
|
+
["$A$", dollarize(aCapB), `$${aCapBBarre}$`, `$${aTotal}$`],
|
|
33
|
+
[
|
|
34
|
+
"$\\overline{A}$",
|
|
35
|
+
dollarize(aBarreCapB),
|
|
36
|
+
dollarize(aBarreCapBBarre),
|
|
37
|
+
dollarize(aBarreTotal),
|
|
38
|
+
],
|
|
39
|
+
["Total", dollarize(bTotal), dollarize(bBarreTotal), dollarize(total)],
|
|
40
|
+
])}
|
|
41
|
+
|
|
42
|
+
Les événements $A$ et $B$ sont-ils indépendants ?
|
|
43
|
+
`;
|
|
44
|
+
};
|
|
45
|
+
const getHint = () => {
|
|
46
|
+
return `Deux évènements $A$ et $B$ sont indépendants lorsque :
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
$$
|
|
50
|
+
P(A\\cap B) = P(A)\\times P(B)
|
|
51
|
+
$$
|
|
52
|
+
|
|
53
|
+
Une autre façon de vérifier si deux évènements sont indépendants utilise les probabilités conditionnelles : $A$ et $B$ sont indépendants si et seulement si :
|
|
54
|
+
|
|
55
|
+
$$
|
|
56
|
+
P_B(A) = P(A)
|
|
57
|
+
$$
|
|
58
|
+
|
|
59
|
+
Choisis une de ces deux méthodes, puis vérifie si l'égalité est vraie.`;
|
|
60
|
+
};
|
|
61
|
+
const getCorrection = (identifiers) => {
|
|
62
|
+
const { aBarreCapB, aBarreCapBBarre, aCapB, aCapBBarre } = identifiers;
|
|
63
|
+
const total = aBarreCapB + aBarreCapBBarre + aCapB + aCapBBarre;
|
|
64
|
+
const aTotal = aCapB + aCapBBarre;
|
|
65
|
+
const bTotal = aCapB + aBarreCapB;
|
|
66
|
+
const pA = frac(aTotal, total);
|
|
67
|
+
const pB = frac(bTotal, total);
|
|
68
|
+
const pANB = frac(aCapB, total);
|
|
69
|
+
const isInde = getAnswer(identifiers) === "Oui";
|
|
70
|
+
return `On vérifie si $P(A\\cap B) = P(A)\\times P(B)$.
|
|
71
|
+
|
|
72
|
+
On a :
|
|
73
|
+
|
|
74
|
+
$$
|
|
75
|
+
P(A\\cap B) = ${pANB.toSimplificationTex()}
|
|
76
|
+
$$
|
|
77
|
+
|
|
78
|
+
$$
|
|
79
|
+
P(A) = ${pA.toSimplificationTex()}
|
|
80
|
+
$$
|
|
81
|
+
|
|
82
|
+
$$
|
|
83
|
+
P(B) = ${pB.toSimplificationTex()}
|
|
84
|
+
$$
|
|
85
|
+
|
|
86
|
+
donc :
|
|
87
|
+
|
|
88
|
+
$$
|
|
89
|
+
P(A) \\times P(B) = ${multiply(pA.simplify(), pB.simplify()).toSimplificationTex()}
|
|
90
|
+
$$
|
|
91
|
+
|
|
92
|
+
Puisque $P(A\\cap B) ${isInde ? "=" : "\\neq"} P(A)\\times P(B)$, les évènements $A$ et $B$ ${isInde ? "sont" : "ne sont pas"} indépendants.`;
|
|
93
|
+
};
|
|
94
|
+
const getIndependancyFromEffectifTableQuestion = () => {
|
|
95
|
+
const isInde = coinFlip();
|
|
96
|
+
let aCapB;
|
|
97
|
+
let aCapBBarre;
|
|
98
|
+
let aBarreCapB;
|
|
99
|
+
let aBarreCapBBarre;
|
|
100
|
+
if (isInde) {
|
|
101
|
+
const r = randint(1, 7);
|
|
102
|
+
const u = randint(1, 7, [r]);
|
|
103
|
+
const s = randint(1, 7);
|
|
104
|
+
const t = randint(1, 7, [s]);
|
|
105
|
+
console.log(r, u, s, t);
|
|
106
|
+
aCapB = r * s;
|
|
107
|
+
aCapBBarre = r * t;
|
|
108
|
+
aBarreCapB = u * s;
|
|
109
|
+
aBarreCapBBarre = u * t;
|
|
110
|
+
}
|
|
111
|
+
else {
|
|
112
|
+
do {
|
|
113
|
+
aCapB = randint(1, 20);
|
|
114
|
+
aCapBBarre = randint(1, 20, [aCapB]);
|
|
115
|
+
aBarreCapB = randint(1, 20, [aCapB, aCapBBarre]);
|
|
116
|
+
aBarreCapBBarre = randint(1, 20, [aCapB, aCapBBarre, aBarreCapB]);
|
|
117
|
+
} while (aCapB * aBarreCapBBarre === aCapBBarre * aBarreCapB);
|
|
118
|
+
}
|
|
119
|
+
const identifiers = {
|
|
120
|
+
aBarreCapB,
|
|
121
|
+
aBarreCapBBarre,
|
|
122
|
+
aCapB,
|
|
123
|
+
aCapBBarre,
|
|
124
|
+
};
|
|
125
|
+
return getQuestionFromIdentifiers(identifiers);
|
|
126
|
+
};
|
|
127
|
+
const getQuestionFromIdentifiers = (identifiers) => {
|
|
128
|
+
return {
|
|
129
|
+
answer: getAnswer(identifiers),
|
|
130
|
+
instruction: getInstruction(identifiers),
|
|
131
|
+
keys: [],
|
|
132
|
+
answerFormat: "raw",
|
|
133
|
+
identifiers,
|
|
134
|
+
hint: getHint(identifiers),
|
|
135
|
+
correction: getCorrection(identifiers),
|
|
136
|
+
};
|
|
137
|
+
};
|
|
138
|
+
export const independancyFromEffectifTable = {
|
|
139
|
+
id: "independancyFromEffectifTable",
|
|
140
|
+
label: "Déterminer si deux évènements sont indépendants à partir d'un tableau d'effectifs",
|
|
141
|
+
isSingleStep: true,
|
|
142
|
+
generator: (nb, opts) => getDistinctQuestions(() => getIndependancyFromEffectifTableQuestion(opts), nb),
|
|
143
|
+
qcmTimer: 60,
|
|
144
|
+
freeTimer: 60,
|
|
145
|
+
getPropositions,
|
|
146
|
+
answerType: "QCU",
|
|
147
|
+
subject: "Mathématiques",
|
|
148
|
+
getInstruction,
|
|
149
|
+
getHint,
|
|
150
|
+
getCorrection,
|
|
151
|
+
getAnswer,
|
|
152
|
+
getQuestionFromIdentifiers,
|
|
153
|
+
hasHintAndCorrection: true,
|
|
154
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Exercise } from "../../../../exercises/exercise.js";
|
|
2
|
+
import { NodeIdentifiers } from "../../../../tree/nodes/nodeConstructor.js";
|
|
3
|
+
type Identifiers = {
|
|
4
|
+
pAIds: NodeIdentifiers;
|
|
5
|
+
p_ABIds: NodeIdentifiers;
|
|
6
|
+
p_ABarreBIds: NodeIdentifiers;
|
|
7
|
+
};
|
|
8
|
+
export declare const independancyFromProbaTree: Exercise<Identifiers>;
|
|
9
|
+
export {};
|
|
10
|
+
//# sourceMappingURL=independancyFromProbaTree.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"independancyFromProbaTree.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/probaStat/independancy/independancyFromProbaTree.ts"],"names":[],"mappings":"AACA,OAAO,EACL,QAAQ,EAYT,MAAM,6BAA6B,CAAC;AAIrC,OAAO,EACL,eAAe,EAEhB,MAAM,qCAAqC,CAAC;AAO7C,KAAK,WAAW,GAAG;IACjB,KAAK,EAAE,eAAe,CAAC;IACvB,OAAO,EAAE,eAAe,CAAC;IACzB,YAAY,EAAE,eAAe,CAAC;CAC/B,CAAC;AAoJF,eAAO,MAAM,yBAAyB,EAAE,QAAQ,CAAC,WAAW,CAiB3D,CAAC"}
|
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
/* eslint-disable @typescript-eslint/naming-convention */
|
|
2
|
+
import { addValidProp, shuffleProps, tryToAddWrongProp, } from "../../../../exercises/exercise.js";
|
|
3
|
+
import { getDistinctQuestions } from "../../../../exercises/utils/getDistinctQuestions.js";
|
|
4
|
+
import { RationalConstructor } from "../../../../math/numbers/rationals/rational.js";
|
|
5
|
+
import { randfloat } from "../../../../math/utils/random/randfloat.js";
|
|
6
|
+
import { reifyAlgebraic, } from "../../../../tree/nodes/nodeConstructor.js";
|
|
7
|
+
import { add } from "../../../../tree/nodes/operators/addNode.js";
|
|
8
|
+
import { multiply } from "../../../../tree/nodes/operators/multiplyNode.js";
|
|
9
|
+
import { substract } from "../../../../tree/nodes/operators/substractNode.js";
|
|
10
|
+
import { coinFlip } from "../../../../utils/alea/coinFlip.js";
|
|
11
|
+
import { alignTex } from "../../../../utils/latex/alignTex.js";
|
|
12
|
+
const getPropositions = (n, { answer }) => {
|
|
13
|
+
const propositions = [];
|
|
14
|
+
addValidProp(propositions, answer, "raw");
|
|
15
|
+
["Oui", "Non", "On ne peut pas savoir"].forEach((prop) => tryToAddWrongProp(propositions, prop, "raw"));
|
|
16
|
+
return shuffleProps(propositions, n);
|
|
17
|
+
};
|
|
18
|
+
const getAnswer = (identifiers) => {
|
|
19
|
+
const { p_ABIds, p_ABarreBIds } = identifiers;
|
|
20
|
+
const p_AB = reifyAlgebraic(p_ABIds);
|
|
21
|
+
const p_ABarreB = reifyAlgebraic(p_ABarreBIds);
|
|
22
|
+
return p_AB.simplify().toTex() === p_ABarreB.simplify().toTex()
|
|
23
|
+
? "Oui"
|
|
24
|
+
: "Non";
|
|
25
|
+
};
|
|
26
|
+
const getInstruction = (identifiers) => {
|
|
27
|
+
const { pAIds, p_ABIds, p_ABarreBIds } = identifiers;
|
|
28
|
+
const pA = reifyAlgebraic(pAIds);
|
|
29
|
+
const pABarre = substract(1, pA).simplify();
|
|
30
|
+
const p_AB = reifyAlgebraic(p_ABIds);
|
|
31
|
+
const p_ABBarre = substract(1, p_AB).simplify();
|
|
32
|
+
const p_ABarreB = reifyAlgebraic(p_ABarreBIds);
|
|
33
|
+
const p_ABarreBBarre = substract(1, p_ABarreB).simplify();
|
|
34
|
+
const tree = [
|
|
35
|
+
[
|
|
36
|
+
[
|
|
37
|
+
[`£${pA.toTex()}£`, "£A£"],
|
|
38
|
+
[`£${pABarre.toTex()}£`, "£\\overline{A}£"],
|
|
39
|
+
],
|
|
40
|
+
],
|
|
41
|
+
[
|
|
42
|
+
[
|
|
43
|
+
[`£${p_AB.toTex()}£`, "£B£"],
|
|
44
|
+
[`£${p_ABBarre.toTex()}£`, "£\\overline{B}£"],
|
|
45
|
+
],
|
|
46
|
+
[
|
|
47
|
+
[`£${p_ABarreB.toTex()}£`, "£B£"],
|
|
48
|
+
[`£${p_ABarreBBarre.toTex()}£`, "£\\overline{B}£"],
|
|
49
|
+
],
|
|
50
|
+
],
|
|
51
|
+
];
|
|
52
|
+
return `On considère l'arbre de probabilités ci-dessous :
|
|
53
|
+
|
|
54
|
+
<svg id="treeDiagram">${JSON.stringify(tree)}</svg>
|
|
55
|
+
|
|
56
|
+
Les événements $A$ et $B$ sont-ils indépendants ?`;
|
|
57
|
+
};
|
|
58
|
+
const getHint = () => {
|
|
59
|
+
return `Deux évènements $A$ et $B$ sont indépendants lorsque :
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
$$
|
|
63
|
+
P(A\\cap B) = P(A)\\times P(B)
|
|
64
|
+
$$
|
|
65
|
+
|
|
66
|
+
Une autre façon de vérifier si deux évènements sont indépendants utilise les probabilités conditionnelles : $A$ et $B$ sont indépendants si et seulement si :
|
|
67
|
+
|
|
68
|
+
$$
|
|
69
|
+
P_A(B) = P(B)
|
|
70
|
+
$$
|
|
71
|
+
|
|
72
|
+
Choisis une de ces deux méthodes, puis vérifie si l'égalité est vraie.`;
|
|
73
|
+
};
|
|
74
|
+
const getCorrection = (identifiers) => {
|
|
75
|
+
const { pAIds, p_ABIds, p_ABarreBIds } = identifiers;
|
|
76
|
+
const pA = reifyAlgebraic(pAIds);
|
|
77
|
+
const p_AB = reifyAlgebraic(p_ABIds);
|
|
78
|
+
const p_ABarreB = reifyAlgebraic(p_ABarreBIds);
|
|
79
|
+
const pB = add(multiply(pA, p_AB), multiply(substract(1, pA), p_ABarreB));
|
|
80
|
+
const isInde = p_AB.simplify().toTex() === pB.simplify().toTex();
|
|
81
|
+
return `Deux évènements $A$ et $B$ sont indépendants si et seulement si :
|
|
82
|
+
|
|
83
|
+
$$
|
|
84
|
+
P_A(B) = P(B)
|
|
85
|
+
$$
|
|
86
|
+
|
|
87
|
+
Ici, $P_A(B)$ se lit dans l'arbre :
|
|
88
|
+
|
|
89
|
+
$$
|
|
90
|
+
P_A(B) = ${p_AB.simplify().toTex()}
|
|
91
|
+
$$
|
|
92
|
+
|
|
93
|
+
Il reste donc à calculer $P(B)$, en utilisant la formule des probabilités totales :
|
|
94
|
+
|
|
95
|
+
${alignTex([
|
|
96
|
+
["P(B)", "=", "P(A\\cap B)+P(\\overline{A}\\cap B)"],
|
|
97
|
+
["", "=", pB.toTex()],
|
|
98
|
+
["", "=", pB.simplify().toTex()],
|
|
99
|
+
])}
|
|
100
|
+
|
|
101
|
+
Puisque $P_A(B) ${isInde ? "=" : "\\neq"} P(B)$, les évènements $A$ et $B$ ${isInde ? "sont" : "ne sont pas"} indépendants.
|
|
102
|
+
|
|
103
|
+
|
|
104
|
+
**Remarque** : en fait, on peut voir directement si $A$ et $B$ sont indépendants ou non, en comparant $P_A(B)$ et $P_{\\overline{A}}(B)$. En effet, ces deux probabilités sont égales si et seulement si $A$ et $B$ sont indépendants. L'idée est que si $A$ et $B$ sont indépendants, le fait que $A$ soit réalisé ou non ne change pas la probabilité de $B$.
|
|
105
|
+
`;
|
|
106
|
+
};
|
|
107
|
+
const getIndependancyFromProbaTreeQuestion = () => {
|
|
108
|
+
const getProba = (isFrac = false) => {
|
|
109
|
+
return isFrac
|
|
110
|
+
? RationalConstructor.randomIrreductibleProba().toTree()
|
|
111
|
+
: randfloat(0.1, 0.91, 1).toTree();
|
|
112
|
+
};
|
|
113
|
+
const isInde = coinFlip();
|
|
114
|
+
const isFrac = coinFlip();
|
|
115
|
+
const pAIds = getProba(isFrac);
|
|
116
|
+
const p_ABIds = getProba(isFrac);
|
|
117
|
+
const p_ABarreBIds = isInde ? p_ABIds : getProba(isFrac);
|
|
118
|
+
const identifiers = {
|
|
119
|
+
p_ABarreBIds: p_ABarreBIds.toIdentifiers(),
|
|
120
|
+
p_ABIds: p_ABIds.toIdentifiers(),
|
|
121
|
+
pAIds: pAIds.toIdentifiers(),
|
|
122
|
+
};
|
|
123
|
+
return getQuestionFromIdentifiers(identifiers);
|
|
124
|
+
};
|
|
125
|
+
const getQuestionFromIdentifiers = (identifiers) => {
|
|
126
|
+
return {
|
|
127
|
+
answer: getAnswer(identifiers),
|
|
128
|
+
instruction: getInstruction(identifiers),
|
|
129
|
+
keys: [],
|
|
130
|
+
answerFormat: "raw",
|
|
131
|
+
identifiers,
|
|
132
|
+
hint: getHint(identifiers),
|
|
133
|
+
correction: getCorrection(identifiers),
|
|
134
|
+
};
|
|
135
|
+
};
|
|
136
|
+
export const independancyFromProbaTree = {
|
|
137
|
+
id: "independancyFromProbaTree",
|
|
138
|
+
label: "Déterminer si deux évènements sont indépendants à partir d'un arbre",
|
|
139
|
+
isSingleStep: true,
|
|
140
|
+
generator: (nb, opts) => getDistinctQuestions(() => getIndependancyFromProbaTreeQuestion(opts), nb),
|
|
141
|
+
qcmTimer: 60,
|
|
142
|
+
freeTimer: 60,
|
|
143
|
+
getPropositions,
|
|
144
|
+
subject: "Mathématiques",
|
|
145
|
+
getInstruction,
|
|
146
|
+
getHint,
|
|
147
|
+
getCorrection,
|
|
148
|
+
getAnswer,
|
|
149
|
+
getQuestionFromIdentifiers,
|
|
150
|
+
hasHintAndCorrection: true,
|
|
151
|
+
answerType: "QCU",
|
|
152
|
+
};
|
|
@@ -2,4 +2,6 @@ export * from "./independancy.js";
|
|
|
2
2
|
export * from "./isIndependantFromDefinition.js";
|
|
3
3
|
export * from "./independancyFindCap.js";
|
|
4
4
|
export * from "./independancyFindCup.js";
|
|
5
|
+
export * from "./independancyFromEffectifTable.js";
|
|
6
|
+
export * from "./independancyFromProbaTree.js";
|
|
5
7
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/probaStat/independancy/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAC;AAClC,cAAc,kCAAkC,CAAC;AACjD,cAAc,0BAA0B,CAAC;AACzC,cAAc,0BAA0B,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/probaStat/independancy/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAC;AAClC,cAAc,kCAAkC,CAAC;AACjD,cAAc,0BAA0B,CAAC;AACzC,cAAc,0BAA0B,CAAC;AACzC,cAAc,oCAAoC,CAAC;AACnD,cAAc,gCAAgC,CAAC"}
|
|
@@ -2,3 +2,5 @@ export * from "./independancy.js";
|
|
|
2
2
|
export * from "./isIndependantFromDefinition.js";
|
|
3
3
|
export * from "./independancyFindCap.js";
|
|
4
4
|
export * from "./independancyFindCup.js";
|
|
5
|
+
export * from "./independancyFromEffectifTable.js";
|
|
6
|
+
export * from "./independancyFromProbaTree.js";
|
|
@@ -1,2 +1,8 @@
|
|
|
1
|
+
import { Exercise } from "../../../../exercises/exercise.js";
|
|
2
|
+
import { ProbaTreeSituationParams } from "./probaTreeSituations.js";
|
|
3
|
+
type Identifiers = {
|
|
4
|
+
params: ProbaTreeSituationParams;
|
|
5
|
+
};
|
|
6
|
+
export declare const probaTreeSituationTotalProbaFormula: Exercise<Identifiers>;
|
|
1
7
|
export {};
|
|
2
8
|
//# sourceMappingURL=probaTreeSituationTotalProbaFormula.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"probaTreeSituationTotalProbaFormula.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/probaStat/trees/probaTreeSituationTotalProbaFormula.ts"],"names":[],"mappings":""}
|
|
1
|
+
{"version":3,"file":"probaTreeSituationTotalProbaFormula.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/probaStat/trees/probaTreeSituationTotalProbaFormula.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAeT,MAAM,6BAA6B,CAAC;AAWrC,OAAO,EAGL,wBAAwB,EACzB,MAAM,0BAA0B,CAAC;AAElC,KAAK,WAAW,GAAG;IACjB,MAAM,EAAE,wBAAwB,CAAC;CAClC,CAAC;AA2HF,eAAO,MAAM,mCAAmC,EAAE,QAAQ,CAAC,WAAW,CAqBrE,CAAC"}
|
|
@@ -1,80 +1,125 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
1
|
+
import { addValidProp, shuffleProps, propWhile, tryToAddWrongProp, } from "../../../../exercises/exercise.js";
|
|
2
|
+
import { getDistinctQuestions } from "../../../../exercises/utils/getDistinctQuestions.js";
|
|
3
|
+
import { rationalVEA } from "../../../../exercises/vea/rationalVEA.js";
|
|
4
|
+
import { randfloat } from "../../../../math/utils/random/randfloat.js";
|
|
5
|
+
import { round } from "../../../../math/utils/round.js";
|
|
6
|
+
import { add } from "../../../../tree/nodes/operators/addNode.js";
|
|
7
|
+
import { frac } from "../../../../tree/nodes/operators/fractionNode.js";
|
|
8
|
+
import { multiply } from "../../../../tree/nodes/operators/multiplyNode.js";
|
|
9
|
+
import { substract } from "../../../../tree/nodes/operators/substractNode.js";
|
|
10
|
+
import { handleVEAError } from "../../../../utils/errors/handleVEAError.js";
|
|
11
|
+
import { alignTex } from "../../../../utils/latex/alignTex.js";
|
|
12
|
+
import { buildProbaTreeSituation, getProbaTreeSituation, } from "./probaTreeSituations.js";
|
|
13
|
+
const getPropositions = (n, { answer }) => {
|
|
14
|
+
const propositions = [];
|
|
15
|
+
addValidProp(propositions, answer);
|
|
16
|
+
propWhile(propositions, n, () => {
|
|
17
|
+
tryToAddWrongProp(propositions, round(randfloat(0, 1, 4), 4).frenchify());
|
|
18
|
+
});
|
|
19
|
+
return shuffleProps(propositions, n);
|
|
20
|
+
};
|
|
21
|
+
const getAnswer = (identifiers) => {
|
|
22
|
+
const { params } = identifiers;
|
|
23
|
+
const situation = getProbaTreeSituation(params);
|
|
24
|
+
const { firstCondProba, mainEventProba, secondCondProba } = situation;
|
|
25
|
+
const firstCondProbaDec = frac(firstCondProba, 100).evaluate();
|
|
26
|
+
const mainEventProbaDec = frac(mainEventProba, 100).evaluate();
|
|
27
|
+
const secondCondProbaDec = frac(secondCondProba, 100).evaluate();
|
|
28
|
+
const aNb = multiply(mainEventProbaDec, firstCondProbaDec).evaluate();
|
|
29
|
+
const abarreNb = multiply(substract(1, mainEventProbaDec), secondCondProbaDec).evaluate();
|
|
30
|
+
const pb = round(add(aNb, abarreNb).evaluate(), 6);
|
|
31
|
+
return pb.frenchify();
|
|
32
|
+
};
|
|
33
|
+
const getInstruction = (identifiers) => {
|
|
34
|
+
const { params } = identifiers;
|
|
35
|
+
const situation = getProbaTreeSituation(params);
|
|
36
|
+
return (situation.context +
|
|
37
|
+
`
|
|
38
|
+
|
|
39
|
+
Calculer $P(${situation.secondEvent})$.`);
|
|
40
|
+
};
|
|
41
|
+
const getHint = () => {
|
|
42
|
+
return `Modélise la situation par un arbre pondéré.
|
|
43
|
+
|
|
44
|
+
Puis, utilise la formule des probabilités totales : pour deux évènements $A$ et $B$, on a :
|
|
45
|
+
|
|
46
|
+
$$
|
|
47
|
+
P(B) = P(A\\cap B)+P(\\overline{A}\\cap B)
|
|
48
|
+
$$`;
|
|
49
|
+
};
|
|
50
|
+
const getCorrection = (identifiers) => {
|
|
51
|
+
const { params } = identifiers;
|
|
52
|
+
const situation = getProbaTreeSituation(params);
|
|
53
|
+
const { mainEvent, mainEventProba, firstCondProba, secondCondProba, secondEvent, tree, } = situation;
|
|
54
|
+
const firstCondProbaDec = frac(firstCondProba, 100).evaluate();
|
|
55
|
+
const mainEventProbaDec = frac(mainEventProba, 100).evaluate();
|
|
56
|
+
const secondCondProbaDec = frac(secondCondProba, 100).evaluate();
|
|
57
|
+
return `On commence par modéliser la situation par un arbre :
|
|
58
|
+
|
|
59
|
+
<svg id="treeDiagram">${JSON.stringify(tree)}</svg>
|
|
60
|
+
|
|
61
|
+
On utilise ensuite la formule des probabilités totales :
|
|
62
|
+
|
|
63
|
+
$$
|
|
64
|
+
P(${secondEvent}) = P(${mainEvent}\\cap ${secondEvent})+P(\\overline{${mainEvent}}\\cap ${secondEvent})
|
|
65
|
+
$$
|
|
66
|
+
|
|
67
|
+
On a donc :
|
|
68
|
+
|
|
69
|
+
${alignTex([
|
|
70
|
+
[
|
|
71
|
+
`P(${secondEvent})`,
|
|
72
|
+
"=",
|
|
73
|
+
add(multiply(mainEventProbaDec, firstCondProbaDec), multiply(substract(1, mainEventProbaDec).simplify(), secondCondProbaDec)).toTex(),
|
|
74
|
+
],
|
|
75
|
+
["", "=", getAnswer(identifiers)],
|
|
76
|
+
])}
|
|
77
|
+
`;
|
|
78
|
+
};
|
|
79
|
+
const getKeys = () => {
|
|
80
|
+
return ["percent"];
|
|
81
|
+
};
|
|
82
|
+
const isAnswerValid = (ans, { answer }) => {
|
|
83
|
+
try {
|
|
84
|
+
return rationalVEA(ans, answer);
|
|
85
|
+
}
|
|
86
|
+
catch (err) {
|
|
87
|
+
return handleVEAError(err);
|
|
88
|
+
}
|
|
89
|
+
};
|
|
90
|
+
const getProbaTreeSituationTotalProbaFormulaQuestion = () => {
|
|
91
|
+
const params = buildProbaTreeSituation();
|
|
92
|
+
const identifiers = {
|
|
93
|
+
params,
|
|
94
|
+
};
|
|
95
|
+
return getQuestionFromIdentifiers(identifiers);
|
|
96
|
+
};
|
|
97
|
+
const getQuestionFromIdentifiers = (identifiers) => {
|
|
98
|
+
return {
|
|
99
|
+
answer: getAnswer(identifiers),
|
|
100
|
+
instruction: getInstruction(identifiers),
|
|
101
|
+
keys: getKeys(identifiers),
|
|
102
|
+
answerFormat: "tex",
|
|
103
|
+
identifiers,
|
|
104
|
+
hint: getHint(identifiers),
|
|
105
|
+
correction: getCorrection(identifiers),
|
|
106
|
+
};
|
|
107
|
+
};
|
|
108
|
+
export const probaTreeSituationTotalProbaFormula = {
|
|
109
|
+
id: "probaTreeSituationTotalProbaFormula",
|
|
110
|
+
connector: "=",
|
|
111
|
+
label: "Utiliser la formule des probabilités totales dans un contexte",
|
|
112
|
+
isSingleStep: true,
|
|
113
|
+
generator: (nb, opts) => getDistinctQuestions(() => getProbaTreeSituationTotalProbaFormulaQuestion(opts), nb),
|
|
114
|
+
qcmTimer: 60,
|
|
115
|
+
freeTimer: 60,
|
|
116
|
+
getPropositions,
|
|
117
|
+
isAnswerValid,
|
|
118
|
+
subject: "Mathématiques",
|
|
119
|
+
getInstruction,
|
|
120
|
+
getHint,
|
|
121
|
+
getCorrection,
|
|
122
|
+
getAnswer,
|
|
123
|
+
getQuestionFromIdentifiers,
|
|
124
|
+
hasHintAndCorrection: true,
|
|
125
|
+
};
|
|
@@ -9,10 +9,10 @@ export * from "./geometricFindTerm.js";
|
|
|
9
9
|
export * from "./geometricFindTermFirstRankOne.js";
|
|
10
10
|
export * from "./geometricRecognizeReasonFromFirstTerms.js";
|
|
11
11
|
export * from "./geometricVariations.js";
|
|
12
|
-
export * from "./geometricFindExplicitFormulaFromTwoTerms.js";
|
|
13
|
-
export * from "./geometricFindExplicitFormulaFromTwoConsecutiveTerms.js";
|
|
14
12
|
export * from "./geometricFindRandomTermFromTwoTerms.js";
|
|
15
|
-
export * from "./geometricFindRandomTermFromTwoConsecutiveTerms.js";
|
|
16
13
|
export * from "./sum/index.js";
|
|
17
14
|
export * from "./situations/index.js";
|
|
15
|
+
export * from "./geometricFindExplicitFormulaFromTwoTerms.js";
|
|
16
|
+
export * from "./geometricFindExplicitFormulaFromTwoConsecutiveTerms.js";
|
|
17
|
+
export * from "./geometricFindRandomTermFromTwoConsecutiveTerms.js";
|
|
18
18
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/sequences/geometric/index.ts"],"names":[],"mappings":"AAAA,cAAc,oCAAoC,CAAC;AACnD,cAAc,mCAAmC,CAAC;AAClD,cAAc,+CAA+C,CAAC;AAE9D,cAAc,0BAA0B,CAAC;AACzC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,sCAAsC,CAAC;AACrD,cAAc,kDAAkD,CAAC;AACjE,cAAc,wBAAwB,CAAC;AACvC,cAAc,oCAAoC,CAAC;AAEnD,cAAc,6CAA6C,CAAC;AAC5D,cAAc,0BAA0B,CAAC;AAEzC,cAAc
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/sequences/geometric/index.ts"],"names":[],"mappings":"AAAA,cAAc,oCAAoC,CAAC;AACnD,cAAc,mCAAmC,CAAC;AAClD,cAAc,+CAA+C,CAAC;AAE9D,cAAc,0BAA0B,CAAC;AACzC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,sCAAsC,CAAC;AACrD,cAAc,kDAAkD,CAAC;AACjE,cAAc,wBAAwB,CAAC;AACvC,cAAc,oCAAoC,CAAC;AAEnD,cAAc,6CAA6C,CAAC;AAC5D,cAAc,0BAA0B,CAAC;AAEzC,cAAc,0CAA0C,CAAC;AAEzD,cAAc,gBAAgB,CAAC;AAE/B,cAAc,uBAAuB,CAAC;AAEtC,cAAc,+CAA+C,CAAC;AAC9D,cAAc,0DAA0D,CAAC;AACzE,cAAc,qDAAqD,CAAC"}
|
|
@@ -9,9 +9,9 @@ export * from "./geometricFindTerm.js";
|
|
|
9
9
|
export * from "./geometricFindTermFirstRankOne.js";
|
|
10
10
|
export * from "./geometricRecognizeReasonFromFirstTerms.js";
|
|
11
11
|
export * from "./geometricVariations.js";
|
|
12
|
-
export * from "./geometricFindExplicitFormulaFromTwoTerms.js";
|
|
13
|
-
export * from "./geometricFindExplicitFormulaFromTwoConsecutiveTerms.js";
|
|
14
12
|
export * from "./geometricFindRandomTermFromTwoTerms.js";
|
|
15
|
-
export * from "./geometricFindRandomTermFromTwoConsecutiveTerms.js";
|
|
16
13
|
export * from "./sum/index.js";
|
|
17
14
|
export * from "./situations/index.js";
|
|
15
|
+
export * from "./geometricFindExplicitFormulaFromTwoTerms.js";
|
|
16
|
+
export * from "./geometricFindExplicitFormulaFromTwoConsecutiveTerms.js";
|
|
17
|
+
export * from "./geometricFindRandomTermFromTwoConsecutiveTerms.js";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export * from "./geometricFindExplicitFormulaFromSituation.js";
|
|
2
1
|
export * from "./geometricFindRecurrenceFormulaFromSituation.js";
|
|
3
2
|
export * from "./geometricFindTermFromSituation.js";
|
|
3
|
+
export * from "./geometricFindExplicitFormulaFromSituation.js";
|
|
4
4
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/exercises/math/sequences/geometric/situations/index.ts"],"names":[],"mappings":"AAAA,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/exercises/math/sequences/geometric/situations/index.ts"],"names":[],"mappings":"AAAA,cAAc,kDAAkD,CAAC;AACjE,cAAc,qCAAqC,CAAC;AAGpD,cAAc,gDAAgD,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export * from "./geometricFindExplicitFormulaFromSituation.js";
|
|
2
1
|
export * from "./geometricFindRecurrenceFormulaFromSituation.js";
|
|
3
2
|
export * from "./geometricFindTermFromSituation.js";
|
|
4
3
|
// export * from "./geometricFindRankFromSituation.js";
|
|
5
4
|
// export * from "./geometricFindThresholdFromSituation.js";
|
|
5
|
+
export * from "./geometricFindExplicitFormulaFromSituation.js";
|
package/lib/index.d.ts
CHANGED
|
@@ -2987,6 +2987,15 @@ declare const mathExercises: (Exercise<{
|
|
|
2987
2987
|
}, Record<string, string | boolean | string[]>> | Exercise<{
|
|
2988
2988
|
pAIds: import("./tree/nodes/nodeConstructor.js").NodeIdentifiers;
|
|
2989
2989
|
pBIds: import("./tree/nodes/nodeConstructor.js").NodeIdentifiers;
|
|
2990
|
+
}, Record<string, string | boolean | string[]>> | Exercise<{
|
|
2991
|
+
aCapB: number;
|
|
2992
|
+
aCapBBarre: number;
|
|
2993
|
+
aBarreCapB: number;
|
|
2994
|
+
aBarreCapBBarre: number;
|
|
2995
|
+
}, Record<string, string | boolean | string[]>> | Exercise<{
|
|
2996
|
+
pAIds: import("./tree/nodes/nodeConstructor.js").NodeIdentifiers;
|
|
2997
|
+
p_ABIds: import("./tree/nodes/nodeConstructor.js").NodeIdentifiers;
|
|
2998
|
+
p_ABarreBIds: import("./tree/nodes/nodeConstructor.js").NodeIdentifiers;
|
|
2990
2999
|
}, Record<string, string | boolean | string[]>> | Exercise<{
|
|
2991
3000
|
questionType: string;
|
|
2992
3001
|
value?: string;
|
|
@@ -3417,28 +3426,6 @@ declare const mathExercises: (Exercise<{
|
|
|
3417
3426
|
value2: number;
|
|
3418
3427
|
precisionInitial: number;
|
|
3419
3428
|
precisionReason: number;
|
|
3420
|
-
}, import("./exercises/options/optionFirstTermRankOne.js").OptionFirstTermRankOne> | Exercise<{
|
|
3421
|
-
rank1: number;
|
|
3422
|
-
value1: number;
|
|
3423
|
-
rank2: number;
|
|
3424
|
-
value2: number;
|
|
3425
|
-
precisionInitial: number;
|
|
3426
|
-
precisionReason: number;
|
|
3427
|
-
}, import("./exercises/options/optionFirstTermRankOne.js").OptionFirstTermRankOne> | Exercise<{
|
|
3428
|
-
rank1: number;
|
|
3429
|
-
value1: number;
|
|
3430
|
-
rank2: number;
|
|
3431
|
-
value2: number;
|
|
3432
|
-
precisionInitial: number;
|
|
3433
|
-
precisionReason: number;
|
|
3434
|
-
rankAsked: number;
|
|
3435
|
-
}, import("./exercises/options/optionFirstTermRankOne.js").OptionFirstTermRankOne> | Exercise<{
|
|
3436
|
-
rank1: number;
|
|
3437
|
-
value1: number;
|
|
3438
|
-
rank2: number;
|
|
3439
|
-
value2: number;
|
|
3440
|
-
precisionInitial: number;
|
|
3441
|
-
precisionReason: number;
|
|
3442
3429
|
rankAsked: number;
|
|
3443
3430
|
}, import("./exercises/options/optionFirstTermRankOne.js").OptionFirstTermRankOne> | Exercise<{
|
|
3444
3431
|
raison: number;
|
|
@@ -3469,13 +3456,35 @@ declare const mathExercises: (Exercise<{
|
|
|
3469
3456
|
initial: number;
|
|
3470
3457
|
reason: number;
|
|
3471
3458
|
superfluousData?: import("./math/utils/sequences/situations/seqGeometricSituations.js").SituationGeometricSuperfluousData;
|
|
3459
|
+
rankAsked: number;
|
|
3472
3460
|
}, import("./exercises/options/optionFirstTermRankOne.js").OptionFirstTermRankOne & import("./exercises/options/optionIsWithSuperfluousData.js").OptionIsWithSuperfluousData> | Exercise<{
|
|
3473
3461
|
situationIndex: number;
|
|
3474
3462
|
initial: number;
|
|
3475
3463
|
reason: number;
|
|
3476
3464
|
superfluousData?: import("./math/utils/sequences/situations/seqGeometricSituations.js").SituationGeometricSuperfluousData;
|
|
3477
|
-
rankAsked: number;
|
|
3478
3465
|
}, import("./exercises/options/optionFirstTermRankOne.js").OptionFirstTermRankOne & import("./exercises/options/optionIsWithSuperfluousData.js").OptionIsWithSuperfluousData> | Exercise<{
|
|
3466
|
+
rank1: number;
|
|
3467
|
+
value1: number;
|
|
3468
|
+
rank2: number;
|
|
3469
|
+
value2: number;
|
|
3470
|
+
precisionInitial: number;
|
|
3471
|
+
precisionReason: number;
|
|
3472
|
+
}, import("./exercises/options/optionFirstTermRankOne.js").OptionFirstTermRankOne> | Exercise<{
|
|
3473
|
+
rank1: number;
|
|
3474
|
+
value1: number;
|
|
3475
|
+
rank2: number;
|
|
3476
|
+
value2: number;
|
|
3477
|
+
precisionInitial: number;
|
|
3478
|
+
precisionReason: number;
|
|
3479
|
+
}, import("./exercises/options/optionFirstTermRankOne.js").OptionFirstTermRankOne> | Exercise<{
|
|
3480
|
+
rank1: number;
|
|
3481
|
+
value1: number;
|
|
3482
|
+
rank2: number;
|
|
3483
|
+
value2: number;
|
|
3484
|
+
precisionInitial: number;
|
|
3485
|
+
precisionReason: number;
|
|
3486
|
+
rankAsked: number;
|
|
3487
|
+
}, import("./exercises/options/optionFirstTermRankOne.js").OptionFirstTermRankOne> | Exercise<{
|
|
3479
3488
|
rank: number;
|
|
3480
3489
|
coeffs: number[];
|
|
3481
3490
|
}, {
|
package/lib/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AAC7D,OAAO,KAAK,aAAa,MAAM,2BAA2B,CAAC;AAE3D,OAAO,4BAA4B,CAAC;AACpC,OAAO,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AAC/D,QAAA,MAAM,aAAa
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AAC7D,OAAO,KAAK,aAAa,MAAM,2BAA2B,CAAC;AAE3D,OAAO,4BAA4B,CAAC;AACpC,OAAO,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AAC/D,QAAA,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;kDAA+B,CAAC;AACnD,QAAA,MAAM,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;kDAA6B,CAAC;AAE/C,OAAO,EAAE,aAAa,EAAE,WAAW,EAAE,QAAQ,EAAE,QAAQ,EAAE,cAAc,EAAE,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rationalParser.d.ts","sourceRoot":"","sources":["../../../src/tree/parsers/rationalParser.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"rationalParser.d.ts","sourceRoot":"","sources":["../../../src/tree/parsers/rationalParser.ts"],"names":[],"mappings":"AAQA,eAAO,MAAM,cAAc,GAAI,KAAK,MAAM,qSAiDzC,CAAC"}
|
|
@@ -1,13 +1,19 @@
|
|
|
1
|
+
import { round } from "../../math/utils/round.js";
|
|
1
2
|
import { isOppositeNode } from "../nodes/functions/oppositeNode.js";
|
|
2
3
|
import { isNumberOrOppositeNumberNode } from "../nodes/numbers/numberNode.js";
|
|
3
|
-
import { isFractionNode } from "../nodes/operators/fractionNode.js";
|
|
4
|
+
import { frac, isFractionNode } from "../nodes/operators/fractionNode.js";
|
|
4
5
|
import { parseAlgebraic } from "./latexParser.js";
|
|
5
6
|
import { numberParser } from "./numberParser.js";
|
|
7
|
+
import { percentParser } from "./percentParser.js";
|
|
6
8
|
export const rationalParser = (ans) => {
|
|
7
9
|
const nb = numberParser(ans);
|
|
8
10
|
if (nb !== false) {
|
|
9
11
|
return nb.unfrenchify().toTree();
|
|
10
12
|
}
|
|
13
|
+
const percent = percentParser(ans, false);
|
|
14
|
+
if (percent !== false) {
|
|
15
|
+
return round(frac(percent.replace("\\%", "").unfrenchify(), 100).evaluate(), 8).toTree();
|
|
16
|
+
}
|
|
11
17
|
const parsed = parseAlgebraic(ans);
|
|
12
18
|
if (!parsed)
|
|
13
19
|
return false;
|