math-exercises 3.0.189 → 3.0.190

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (71) hide show
  1. package/lib/exercises/math/calcul/decimals/decimalFractionToDecimal.d.ts.map +1 -1
  2. package/lib/exercises/math/calcul/decimals/decimalFractionToDecimal.js +5 -4
  3. package/lib/exercises/math/calculLitteral/equation/factorizeEquation.d.ts.map +1 -1
  4. package/lib/exercises/math/calculLitteral/equation/factorizeEquation.js +9 -8
  5. package/lib/exercises/math/calculLitteral/equation/isEqualityTrue.d.ts.map +1 -1
  6. package/lib/exercises/math/calculLitteral/equation/isEqualityTrue.js +7 -6
  7. package/lib/exercises/math/dataRepresentations/barChartInterpreting.d.ts.map +1 -1
  8. package/lib/exercises/math/dataRepresentations/barChartInterpreting.js +5 -4
  9. package/lib/exercises/math/derivation/derivative/derivativeEquationSolving1.d.ts.map +1 -1
  10. package/lib/exercises/math/derivation/derivative/derivativeEquationSolving1.js +3 -2
  11. package/lib/exercises/math/derivation/derivative/derivativeEquationSolving3.d.ts.map +1 -1
  12. package/lib/exercises/math/derivation/derivative/derivativeEquationSolving3.js +3 -2
  13. package/lib/exercises/math/derivation/derivative/valueDerivativeFromFunctionExpression.d.ts.map +1 -1
  14. package/lib/exercises/math/derivation/derivative/valueDerivativeFromFunctionExpression.js +3 -2
  15. package/lib/exercises/math/derivation/problems/problemMaximizeProfitFindProduction.d.ts.map +1 -1
  16. package/lib/exercises/math/derivation/problems/problemMaximizeProfitFindProduction.js +3 -2
  17. package/lib/exercises/math/derivation/problems/problemMovementOnLineFindSpeedAtPoint.d.ts.map +1 -1
  18. package/lib/exercises/math/derivation/problems/problemMovementOnLineFindSpeedAtPoint.js +3 -2
  19. package/lib/exercises/math/derivation/tangent/tangentEquationFromFunctionExpression.d.ts.map +1 -1
  20. package/lib/exercises/math/derivation/tangent/tangentEquationFromFunctionExpression.js +3 -2
  21. package/lib/exercises/math/derivation/variations/findAbscissaOfExtremaFromFunctionExpression.d.ts.map +1 -1
  22. package/lib/exercises/math/derivation/variations/findAbscissaOfExtremaFromFunctionExpression.js +4 -3
  23. package/lib/exercises/math/derivation/variations/findExtremaFromFunctionExpression.d.ts.map +1 -1
  24. package/lib/exercises/math/derivation/variations/findExtremaFromFunctionExpression.js +4 -3
  25. package/lib/exercises/math/derivation/variations/plausibleDerivativeGraphFromFunctionGraphByManipulatingPolynomial.d.ts.map +1 -1
  26. package/lib/exercises/math/derivation/variations/plausibleDerivativeGraphFromFunctionGraphByManipulatingPolynomial.js +3 -2
  27. package/lib/exercises/math/derivation/variations/plausibleFunctionGraphFromDerivativeGraphByManipulatingPolynomial.d.ts.map +1 -1
  28. package/lib/exercises/math/derivation/variations/plausibleFunctionGraphFromDerivativeGraphByManipulatingPolynomial.js +3 -2
  29. package/lib/exercises/math/derivation/variations/signVarTableFromFunctionExpression.d.ts.map +1 -1
  30. package/lib/exercises/math/derivation/variations/signVarTableFromFunctionExpression.js +4 -3
  31. package/lib/exercises/math/functions/affines/coordsOfPointOnAffineFindX.d.ts.map +1 -1
  32. package/lib/exercises/math/functions/affines/coordsOfPointOnAffineFindX.js +8 -6
  33. package/lib/exercises/math/functions/exponentials/estimateExponentialFunctionImageFromGeometricScatterplot.d.ts +2 -0
  34. package/lib/exercises/math/functions/exponentials/estimateExponentialFunctionImageFromGeometricScatterplot.d.ts.map +1 -0
  35. package/lib/exercises/math/functions/exponentials/estimateExponentialFunctionImageFromGeometricScatterplot.js +155 -0
  36. package/lib/exercises/math/functions/exponentials/exponentialsRawVariations.d.ts +8 -0
  37. package/lib/exercises/math/functions/exponentials/exponentialsRawVariations.d.ts.map +1 -0
  38. package/lib/exercises/math/functions/exponentials/exponentialsRawVariations.js +99 -0
  39. package/lib/exercises/math/functions/exponentials/index.d.ts +3 -0
  40. package/lib/exercises/math/functions/exponentials/index.d.ts.map +1 -1
  41. package/lib/exercises/math/functions/exponentials/index.js +4 -0
  42. package/lib/exercises/math/functions/exponentials/plausibleExponentialFunctionExpressionFromGraph.d.ts +12 -0
  43. package/lib/exercises/math/functions/exponentials/plausibleExponentialFunctionExpressionFromGraph.d.ts.map +1 -0
  44. package/lib/exercises/math/functions/exponentials/plausibleExponentialFunctionExpressionFromGraph.js +138 -0
  45. package/lib/exercises/math/functions/exponentials/readExponentialFunctionParamsOnGraph.d.ts +8 -0
  46. package/lib/exercises/math/functions/exponentials/readExponentialFunctionParamsOnGraph.d.ts.map +1 -0
  47. package/lib/exercises/math/functions/exponentials/readExponentialFunctionParamsOnGraph.js +142 -0
  48. package/lib/exercises/math/geometry/cartesian/placeAbscissOnSemiLineV2.d.ts.map +1 -1
  49. package/lib/exercises/math/geometry/cartesian/placeAbscissOnSemiLineV2.js +7 -6
  50. package/lib/exercises/math/geometry/vectors/scalarProduct/alKashi/scalarProductAlKashiBH.d.ts.map +1 -1
  51. package/lib/exercises/math/geometry/vectors/scalarProduct/alKashi/scalarProductAlKashiBH.js +3 -2
  52. package/lib/exercises/math/geometry/vectors/scalarProduct/scalarProductComputeBH.d.ts.map +1 -1
  53. package/lib/exercises/math/geometry/vectors/scalarProduct/scalarProductComputeBH.js +7 -6
  54. package/lib/exercises/math/percent/percentToDecimal.d.ts.map +1 -1
  55. package/lib/exercises/math/percent/percentToDecimal.js +5 -4
  56. package/lib/exercises/math/probaStat/basicStats/calculateFrequencyInList.d.ts.map +1 -1
  57. package/lib/exercises/math/probaStat/basicStats/calculateFrequencyInList.js +5 -4
  58. package/lib/exercises/math/probaStat/probaFromTableWithContext.d.ts.map +1 -1
  59. package/lib/exercises/math/probaStat/probaFromTableWithContext.js +7 -8
  60. package/lib/exercises/math/probaStat/stats1var/medianWithList.d.ts.map +1 -1
  61. package/lib/exercises/math/probaStat/stats1var/medianWithList.js +5 -4
  62. package/lib/exercises/math/sequences/arithmetic/situations/arithmeticFindRankFromSituation.d.ts.map +1 -1
  63. package/lib/exercises/math/sequences/arithmetic/situations/arithmeticFindRankFromSituation.js +9 -9
  64. package/lib/exercises/utils/options/arrayedOptions.d.ts +2 -0
  65. package/lib/exercises/utils/options/arrayedOptions.d.ts.map +1 -0
  66. package/lib/exercises/utils/options/arrayedOptions.js +16 -0
  67. package/lib/index.d.ts +12 -0
  68. package/lib/index.d.ts.map +1 -1
  69. package/lib/math/utils/sequences/situations/seqArithmeticSituations.d.ts.map +1 -1
  70. package/lib/math/utils/sequences/situations/seqArithmeticSituations.js +20 -20
  71. package/package.json +1 -1
@@ -0,0 +1,155 @@
1
+ // import {
2
+ // Exercise,
3
+ // Proposition,
4
+ // QCMGenerator,
5
+ // QuestionGenerator,
6
+ // VEA,
7
+ // addValidProp,
8
+ // shuffleProps,
9
+ // GetAnswer,
10
+ // GetHint,
11
+ // GetCorrection,
12
+ // GetInstruction,
13
+ // GetGGBOptions,
14
+ // GetQuestionFromIdentifiers,
15
+ // propWhile,
16
+ // tryToAddWrongProp,
17
+ // } from "../../../../exercises/exercise.js";
18
+ // import { getDistinctQuestions } from "../../../../exercises/utils/getDistinctQuestions.js";
19
+ // import { GeogebraConstructor } from "../../../../geogebra/geogebraConstructor.js";
20
+ // import { randfloat } from "../../../../math/utils/random/randfloat.js";
21
+ // import { round } from "../../../../math/utils/round.js";
22
+ // import { multiply } from "../../../../tree/nodes/operators/multiplyNode.js";
23
+ // import { power } from "../../../../tree/nodes/operators/powerNode.js";
24
+ // import { parseAlgebraic } from "../../../../tree/parsers/latexParser.js";
25
+ // import { coinFlip } from "../../../../utils/alea/coinFlip.js";
26
+ // import { doWhile } from "../../../../utils/doWhile.js";
27
+ // import { handleVEAError } from "../../../../utils/errors/handleVEAError.js";
28
+ export {};
29
+ // type Identifiers = {
30
+ // x: number;
31
+ // u0: number;
32
+ // q: number;
33
+ // };
34
+ // const getPropositions: QCMGenerator<Identifiers> = (n, { answer }) => {
35
+ // const propositions: Proposition[] = [];
36
+ // addValidProp(propositions, answer);
37
+ // propWhile(propositions, n, () => {
38
+ // // tryToAddWrongProp(propositions);
39
+ // });
40
+ // return shuffleProps(propositions, n);
41
+ // };
42
+ // const getAnswer: GetAnswer<Identifiers> = (identifiers) => {
43
+ // const { q, u0, x } = identifiers;
44
+ // return round(multiply(u0, power(q, x)).evaluate(), 2).frenchify();
45
+ // };
46
+ // const getInstruction: GetInstruction<Identifiers> = (identifiers) => {
47
+ // const { x } = identifiers;
48
+ // return `On donne ci-dessous le nuage de points représentant une suite géométrique $u$ définie par :
49
+ // $$
50
+ // u_n = u_0\\times q^n
51
+ // $$
52
+ // où $u_0$ est le premier terme de la suite, et $q$ est sa raison.
53
+ // On définit la fonction $f$ sur $[0;+\\infty[$ par :
54
+ // $$
55
+ // f(x) = u_0\\times q^x
56
+ // $$
57
+ // Donner une valeur approchée de $f(${x.frenchify()})$.
58
+ // `;
59
+ // };
60
+ // const getHint: GetHint<Identifiers> = (identifiers) => {
61
+ // const { x } = identifiers;
62
+ // return `La fonction $f$ est le prolongement de la suite $u$.
63
+ // Pour donner une valeur approchée de $f(${x.frenchify()})$, on peut imaginer une courbe qui relie les points du nuage de points, et estimer ainsi l'image de ${x.frenchify()}.`;
64
+ // };
65
+ // const getCorrection: GetCorrection<Identifiers> = (identifiers) => {
66
+ // const { x } = identifiers;
67
+ // return `On relie mentalement les points par une courbe. On peut alors estimer la valeur de ${x.frenchify()} :
68
+ // $$
69
+ // f(${x.frenchify()}) \\approx ${getAnswer(identifiers)}
70
+ // $$`;
71
+ // };
72
+ // const getGGBOptions: GetGGBOptions<Identifiers> = (identifiers) => {
73
+ // const { u0, q, x } = identifiers;
74
+ // const ggb = new GeogebraConstructor({
75
+ // commands: [`Sequence((n, ${u0}*${q}^n), n, 0, 50)`],
76
+ // lockedAxesRatio: false,
77
+ // });
78
+ // const f = (x: number) => round(multiply(u0, power(q, x)).evaluate(), 2);
79
+ // const next = f(Math.ceil(x));
80
+ // return ggb.getOptions({
81
+ // coords: [-1, Math.max(x + 2, 5), -1, Math.max(next + 5, 5) + 1],
82
+ // });
83
+ // };
84
+ // const isAnswerValid: VEA<Identifiers> = (ans, { answer, q, u0, x }) => {
85
+ // try {
86
+ // const parsed = parseAlgebraic(ans);
87
+ // if (!parsed) return false;
88
+ // const f = (x: number) => round(multiply(u0, power(q, x)).evaluate(), 2);
89
+ // const nbAns = f(x);
90
+ // const prev = f(Math.floor(x));
91
+ // const next = f(Math.ceil(x));
92
+ // const delta = Math.abs(next - prev);
93
+ // return Math.abs(parsed.evaluate() - nbAns) < 0.2 * delta;
94
+ // } catch (err) {
95
+ // return handleVEAError(err);
96
+ // }
97
+ // };
98
+ // const getEstimateExponentialFunctionImageFromGeometriceScatterplotQuestion: QuestionGenerator<
99
+ // Identifiers
100
+ // > = () => {
101
+ // const u0 = randfloat(0.5, 4, 2);
102
+ // const q = coinFlip() ? randfloat(0.1, 1, 2, [1]) : randfloat(1.1, 5, 2);
103
+ // const x = doWhile(
104
+ // () => randfloat(0.5, 3, 2),
105
+ // (a) => Math.abs(round(a, 1) - a) < 0.025,
106
+ // );
107
+ // const identifiers: Identifiers = {
108
+ // q,
109
+ // u0,
110
+ // x,
111
+ // };
112
+ // return getQuestionFromIdentifiers(identifiers);
113
+ // };
114
+ // const getQuestionFromIdentifiers: GetQuestionFromIdentifiers<Identifiers> = (
115
+ // identifiers,
116
+ // ) => {
117
+ // return {
118
+ // answer: getAnswer(identifiers),
119
+ // instruction: getInstruction(identifiers),
120
+ // keys: [],
121
+ // answerFormat: "tex",
122
+ // identifiers,
123
+ // hint: getHint(identifiers),
124
+ // correction: getCorrection(identifiers),
125
+ // ggbOptions: getGGBOptions(identifiers),
126
+ // };
127
+ // };
128
+ // export const estimateExponentialFunctionImageFromGeometricScatterplot: Exercise<Identifiers> =
129
+ // {
130
+ // id: "estimateExponentialFunctionImageFromGeometricScatterplot",
131
+ // connector: "=",
132
+ // label:
133
+ // "Estimer une valeur approchée de $q^x$ à partir du nuage de points de $q^n$",
134
+ // isSingleStep: true,
135
+ // generator: (nb, opts) =>
136
+ // getDistinctQuestions(
137
+ // () =>
138
+ // getEstimateExponentialFunctionImageFromGeometriceScatterplotQuestion(
139
+ // opts,
140
+ // ),
141
+ // nb,
142
+ // ),
143
+ // qcmTimer: 60,
144
+ // freeTimer: 60,
145
+ // getPropositions,
146
+ // isAnswerValid,
147
+ // subject: "Mathématiques",
148
+ // getHint,
149
+ // getCorrection,
150
+ // getInstruction,
151
+ // getAnswer,
152
+ // getGGBOptions,
153
+ // hasGeogebra: true,
154
+ // getQuestionFromIdentifiers,
155
+ // };
@@ -0,0 +1,8 @@
1
+ import { Exercise } from "../../../../exercises/exercise.js";
2
+ import { NodeIdentifiers } from "../../../../tree/nodes/nodeConstructor.js";
3
+ type Identifiers = {
4
+ q: NodeIdentifiers;
5
+ };
6
+ export declare const exponentialsRawVariations: Exercise<Identifiers>;
7
+ export {};
8
+ //# sourceMappingURL=exponentialsRawVariations.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"exponentialsRawVariations.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/functions/exponentials/exponentialsRawVariations.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAcT,MAAM,6BAA6B,CAAC;AAKrC,OAAO,EACL,eAAe,EAEhB,MAAM,qCAAqC,CAAC;AAK7C,KAAK,WAAW,GAAG;IACjB,CAAC,EAAE,eAAe,CAAC;CACpB,CAAC;AA6FF,eAAO,MAAM,yBAAyB,EAAE,QAAQ,CAAC,WAAW,CAkB3D,CAAC"}
@@ -0,0 +1,99 @@
1
+ import { addValidProp, shuffleProps, tryToAddWrongProp, } from "../../../../exercises/exercise.js";
2
+ import { getDistinctQuestions } from "../../../../exercises/utils/getDistinctQuestions.js";
3
+ import { RationalConstructor } from "../../../../math/numbers/rationals/rational.js";
4
+ import { randfloat } from "../../../../math/utils/random/randfloat.js";
5
+ import { reifyAlgebraic, } from "../../../../tree/nodes/nodeConstructor.js";
6
+ import { power } from "../../../../tree/nodes/operators/powerNode.js";
7
+ import { coinFlip } from "../../../../utils/alea/coinFlip.js";
8
+ const getPropositions = (n, { answer }) => {
9
+ const propositions = [];
10
+ addValidProp(propositions, answer, "raw");
11
+ tryToAddWrongProp(propositions, "Strictement croissante", "raw");
12
+ tryToAddWrongProp(propositions, "Strictement décroissante", "raw");
13
+ tryToAddWrongProp(propositions, "Constante", "raw");
14
+ tryToAddWrongProp(propositions, "Non monotone", "raw");
15
+ return shuffleProps(propositions, n);
16
+ };
17
+ const getAnswer = (identifiers) => {
18
+ const qEv = reifyAlgebraic(identifiers.q).evaluate();
19
+ return qEv > 1 ? "Strictement croissante" : "Strictement décroissante";
20
+ };
21
+ const getInstruction = (identifiers) => {
22
+ const q = reifyAlgebraic(identifiers.q);
23
+ const statement = power(q, "x").simplify();
24
+ return `Soit $f$ la fonction définie sur $[0; +\\infty[$ par
25
+
26
+ $$
27
+ f(x) = ${statement.toTex()}
28
+ $$
29
+
30
+ Quel est le sens de variations de $f$ sur $[0; +\\infty[$ ?`;
31
+ };
32
+ const getHint = () => {
33
+ return `Sur $[0; +\\infty[$, la fonction $f(x) = a^x$ est :
34
+
35
+ - strictement croissante si $a>1$;
36
+ - strictement décroissante si $0<a<1$;
37
+ - constante si $a = 1$
38
+ `;
39
+ };
40
+ const getCorrection = (identifiers) => {
41
+ const q = reifyAlgebraic(identifiers.q);
42
+ const qEv = q.evaluate();
43
+ const qLessThanOne = qEv < 1;
44
+ return `Puisque $${qLessThanOne ? `0 < ${q.toTex()} < 1` : `${q.toTex()}>1`}$, la fonction $${power(q, "x").toTex()}$ est strictement ${qLessThanOne ? "décroissante" : " croissante"} sur $[0; +\\infty[$.
45
+
46
+ `;
47
+ };
48
+ const getKeys = () => {
49
+ return [];
50
+ };
51
+ const getExponentialsVariationsQuestion = () => {
52
+ const qLessThanOne = coinFlip();
53
+ let q;
54
+ if (qLessThanOne) {
55
+ q = coinFlip()
56
+ ? randfloat(0.1, 1, 2).toTree()
57
+ : RationalConstructor.randomIrreductibleProba().toTree();
58
+ }
59
+ else {
60
+ q = coinFlip()
61
+ ? randfloat(1.1, 10, 2).toTree()
62
+ : RationalConstructor.randomIrreductible(11, {
63
+ onlySupOne: true,
64
+ }).toTree();
65
+ }
66
+ const identifiers = {
67
+ q: q.toIdentifiers(),
68
+ };
69
+ return getQuestionFromIdentifiers(identifiers);
70
+ };
71
+ const getQuestionFromIdentifiers = (identifiers) => {
72
+ const question = {
73
+ answer: getAnswer(identifiers),
74
+ instruction: getInstruction(identifiers),
75
+ keys: getKeys(identifiers),
76
+ answerFormat: "raw",
77
+ identifiers,
78
+ hint: getHint(identifiers),
79
+ correction: getCorrection(identifiers),
80
+ };
81
+ return question;
82
+ };
83
+ export const exponentialsRawVariations = {
84
+ id: "exponentialsRawVariations",
85
+ label: "Déterminer le sens de variations d'une fonction exponentielle du type $f(x) = a^x$",
86
+ isSingleStep: true,
87
+ generator: (nb, opts) => getDistinctQuestions(() => getExponentialsVariationsQuestion(opts), nb),
88
+ qcmTimer: 60,
89
+ freeTimer: 60,
90
+ getPropositions,
91
+ subject: "Mathématiques",
92
+ getInstruction,
93
+ getHint,
94
+ getCorrection,
95
+ getAnswer,
96
+ answerType: "QCU",
97
+ hasHintAndCorrection: true,
98
+ getQuestionFromIdentifiers,
99
+ };
@@ -1,2 +1,5 @@
1
1
  export * from "./exponentialsVariations.js";
2
+ export * from "./exponentialsRawVariations.js";
3
+ export * from "./readExponentialFunctionParamsOnGraph.js";
4
+ export * from "./plausibleExponentialFunctionExpressionFromGraph.js";
2
5
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/functions/exponentials/index.ts"],"names":[],"mappings":"AAAA,cAAc,6BAA6B,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/functions/exponentials/index.ts"],"names":[],"mappings":"AAAA,cAAc,6BAA6B,CAAC;AAC5C,cAAc,gCAAgC,CAAC;AAC/C,cAAc,2CAA2C,CAAC;AAC1D,cAAc,sDAAsD,CAAC"}
@@ -1 +1,5 @@
1
1
  export * from "./exponentialsVariations.js";
2
+ export * from "./exponentialsRawVariations.js";
3
+ export * from "./readExponentialFunctionParamsOnGraph.js";
4
+ export * from "./plausibleExponentialFunctionExpressionFromGraph.js";
5
+ // export * from "./estimateExponentialFunctionImageFromGeometricScatterplot.js";
@@ -0,0 +1,12 @@
1
+ import { Exercise } from "../../../../exercises/exercise.js";
2
+ type Identifiers = {
3
+ k: number;
4
+ a: number;
5
+ fakeParams: {
6
+ a: number;
7
+ k: number;
8
+ }[];
9
+ };
10
+ export declare const plausibleExponentialFunctionExpressionFromGraph: Exercise<Identifiers>;
11
+ export {};
12
+ //# sourceMappingURL=plausibleExponentialFunctionExpressionFromGraph.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"plausibleExponentialFunctionExpressionFromGraph.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/functions/exponentials/plausibleExponentialFunctionExpressionFromGraph.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAaT,MAAM,6BAA6B,CAAC;AASrC,KAAK,WAAW,GAAG;IACjB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,UAAU,EAAE;QAAE,CAAC,EAAE,MAAM,CAAC;QAAC,CAAC,EAAE,MAAM,CAAA;KAAE,EAAE,CAAC;CACxC,CAAC;AAwIF,eAAO,MAAM,+CAA+C,EAAE,QAAQ,CAAC,WAAW,CAwB/E,CAAC"}
@@ -0,0 +1,138 @@
1
+ import { addValidProp, shuffleProps, tryToAddWrongProp, } from "../../../../exercises/exercise.js";
2
+ import { getDistinctQuestions } from "../../../../exercises/utils/getDistinctQuestions.js";
3
+ import { GeogebraConstructor } from "../../../../geogebra/geogebraConstructor.js";
4
+ import { randfloat } from "../../../../math/utils/random/randfloat.js";
5
+ import { round } from "../../../../math/utils/round.js";
6
+ import { multiply } from "../../../../tree/nodes/operators/multiplyNode.js";
7
+ import { power } from "../../../../tree/nodes/operators/powerNode.js";
8
+ import { coinFlip } from "../../../../utils/alea/coinFlip.js";
9
+ const getPropositions = (n, { answer, fakeParams }) => {
10
+ const propositions = [];
11
+ addValidProp(propositions, answer);
12
+ for (let i = 0; i < fakeParams.length; i++) {
13
+ tryToAddWrongProp(propositions, multiply(fakeParams[i].k, power(fakeParams[i].a, "x")).toTex());
14
+ }
15
+ return shuffleProps(propositions, n);
16
+ };
17
+ const getAnswer = (identifiers) => {
18
+ const { a, k } = identifiers;
19
+ return multiply(k, power(a, "x")).toTex();
20
+ };
21
+ const getInstruction = () => {
22
+ return `On donne ci-dessous la courbe représentative d'une fonction $f$ définie sur $[0; +\\infty[$ par :
23
+
24
+ $$
25
+ f(x) = ka^x
26
+ $$
27
+
28
+ où $k$ et $a$ sont des réels strictement positifs.
29
+
30
+ Parmi les propositions suivantes, laquelle peut être l'expression de la fonction $f$ ?`;
31
+ };
32
+ const getHint = () => {
33
+ return `Le sens de variation de la fonction peut t'aider : si $a>1$, la fonction est strictement croissante, et si $0<a<1$, la fonction est strictement décroissante.
34
+
35
+ D'autre part, tu peux lire l'image de $0$ pour obtenir une valeur approchée de $k$.`;
36
+ };
37
+ const getCorrection = (identifiers) => {
38
+ const { a, k } = identifiers;
39
+ const sens = a < 1 ? "décroissante" : "croissante";
40
+ return `On sait que l'expression de la fonction $f$ est de la forme :
41
+
42
+ $$
43
+ f(x) = ka^x
44
+ $$
45
+
46
+ D'après le graphique, la fonction $f$ est ${sens} sur $[0; +\\infty[$. On en déduit donc que $a ${a < 1 ? "<1" : ">1"}$. Cela permet donc d'exclure deux des propositions.
47
+
48
+ Ensuite, on lit l'image de $0$ par $f$ : on trouve $f(0) \\approx ${round(k, 1).frenchify()}$.
49
+
50
+ Or, $f(0) = ka^0 = k$. Donc $k \\approx ${round(k, 1).frenchify()}$.
51
+
52
+ On en conclut donc que la seule expression possible pour $f$ est :
53
+
54
+ $$
55
+ f(x) = ${getAnswer(identifiers)}
56
+ $$`;
57
+ };
58
+ const getGGBOptions = (identifiers) => {
59
+ const { a, k } = identifiers;
60
+ const ggb = new GeogebraConstructor({
61
+ commands: [`Function(${k}*${a}^x, 0, 10000)`],
62
+ lockedAxesRatio: false,
63
+ });
64
+ const f2 = multiply(k, power(a, 2)).evaluate();
65
+ return ggb.getOptions({
66
+ coords: [-1, 5, -1, Math.max(k, f2) + 1],
67
+ });
68
+ };
69
+ const getPlausibleExponentialFunctionExpressionFromGraphQuestion = () => {
70
+ const k = randfloat(0.5, 4, 2);
71
+ const a = coinFlip() ? randfloat(0.1, 1, 2, [1]) : randfloat(1.1, 5, 2);
72
+ let fakeParams = [];
73
+ if (a > 1) {
74
+ const firstDescA = randfloat(0.1, 1, 2, [1]);
75
+ const secondDescA = randfloat(0.1, 1, 2, [firstDescA]);
76
+ const thirdA = randfloat(1.1, 5, 2, [a]);
77
+ const firstK = k;
78
+ const secondK = randfloat(0.1, 4, 2);
79
+ const delta = randfloat(1, 3, 2);
80
+ const thirdK = k - delta > 0 ? k - delta : k + delta;
81
+ fakeParams = [
82
+ { a: firstDescA, k: firstK },
83
+ { a: secondDescA, k: secondK },
84
+ { a: thirdA, k: thirdK },
85
+ ];
86
+ }
87
+ else {
88
+ const firstAscA = randfloat(1.1, 5, 2);
89
+ const secondAscA = randfloat(1.1, 5, 2, [firstAscA]);
90
+ const thirdA = randfloat(0.1, 1, 2, [1, a]);
91
+ const firstK = k;
92
+ const secondK = randfloat(0.1, 4, 2);
93
+ const delta = randfloat(1, 3, 2);
94
+ const thirdK = k - delta > 0 ? k - delta : k + delta;
95
+ fakeParams = [
96
+ { a: firstAscA, k: firstK },
97
+ { a: secondAscA, k: secondK },
98
+ { a: thirdA, k: thirdK },
99
+ ];
100
+ }
101
+ const identifiers = {
102
+ a,
103
+ k,
104
+ fakeParams,
105
+ };
106
+ return getQuestionFromIdentifiers(identifiers);
107
+ };
108
+ const getQuestionFromIdentifiers = (identifiers) => {
109
+ return {
110
+ answer: getAnswer(identifiers),
111
+ instruction: getInstruction(identifiers),
112
+ keys: [],
113
+ answerFormat: "tex",
114
+ identifiers,
115
+ hint: getHint(identifiers),
116
+ correction: getCorrection(identifiers),
117
+ ggbOptions: getGGBOptions(identifiers),
118
+ };
119
+ };
120
+ export const plausibleExponentialFunctionExpressionFromGraph = {
121
+ id: "plausibleExponentialFunctionExpressionFromGraph",
122
+ label: "Donner l'expression possible d'une fonction exponentielle à partir de sa courbe représentative",
123
+ isSingleStep: true,
124
+ generator: (nb, opts) => getDistinctQuestions(() => getPlausibleExponentialFunctionExpressionFromGraphQuestion(opts), nb),
125
+ qcmTimer: 60,
126
+ freeTimer: 60,
127
+ getPropositions,
128
+ answerType: "QCU",
129
+ subject: "Mathématiques",
130
+ getHint,
131
+ getCorrection,
132
+ getInstruction,
133
+ getAnswer,
134
+ getGGBOptions,
135
+ hasGeogebra: true,
136
+ getQuestionFromIdentifiers,
137
+ hasHintAndCorrection: true,
138
+ };
@@ -0,0 +1,8 @@
1
+ import { Exercise } from "../../../../exercises/exercise.js";
2
+ type Identifiers = {
3
+ f0: number;
4
+ f1: number;
5
+ };
6
+ export declare const readExponentialFunctionParamsOnGraph: Exercise<Identifiers>;
7
+ export {};
8
+ //# sourceMappingURL=readExponentialFunctionParamsOnGraph.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"readExponentialFunctionParamsOnGraph.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/functions/exponentials/readExponentialFunctionParamsOnGraph.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAgBT,MAAM,6BAA6B,CAAC;AAWrC,KAAK,WAAW,GAAG;IACjB,EAAE,EAAE,MAAM,CAAC;IACX,EAAE,EAAE,MAAM,CAAC;CACZ,CAAC;AA6HF,eAAO,MAAM,oCAAoC,EAAE,QAAQ,CAAC,WAAW,CA0BtE,CAAC"}
@@ -0,0 +1,142 @@
1
+ import { addValidProp, shuffleProps, tryToAddWrongProp, propWhile, } from "../../../../exercises/exercise.js";
2
+ import { getDistinctQuestions } from "../../../../exercises/utils/getDistinctQuestions.js";
3
+ import { GeogebraConstructor } from "../../../../geogebra/geogebraConstructor.js";
4
+ import { randint } from "../../../../math/utils/random/randint.js";
5
+ import { frac } from "../../../../tree/nodes/operators/fractionNode.js";
6
+ import { multiply } from "../../../../tree/nodes/operators/multiplyNode.js";
7
+ import { power } from "../../../../tree/nodes/operators/powerNode.js";
8
+ import { parseAlgebraic } from "../../../../tree/parsers/latexParser.js";
9
+ import { handleVEAError } from "../../../../utils/errors/handleVEAError.js";
10
+ const getPropositions = (n, { answer }) => {
11
+ const propositions = [];
12
+ addValidProp(propositions, answer);
13
+ propWhile(propositions, n, () => {
14
+ const fakeK = randint(2, 10);
15
+ const fakeA = randint(2, 10);
16
+ tryToAddWrongProp(propositions, multiply(fakeK, power(fakeA, "x")).toTex());
17
+ });
18
+ return shuffleProps(propositions, n);
19
+ };
20
+ const getAnswer = (identifiers) => {
21
+ const { f0, f1 } = identifiers;
22
+ return multiply(f0, power(frac(f1, f0), "x"))
23
+ .simplify()
24
+ .toTex();
25
+ };
26
+ const getInstruction = () => {
27
+ return `On donne ci-dessous la courbe représentative d'une fonction $f$ définie sur $[0; +\\infty[$ par :
28
+
29
+ $$
30
+ f(x) = ka^x
31
+ $$
32
+
33
+ où $k$ et $a$ sont des réels strictement positifs.
34
+
35
+ En lisant les images par $f$ de $0$ et de $1$, déterminer l'expression de la fonction $f$.`;
36
+ };
37
+ const getHint = () => {
38
+ return `Lis les images par $f$ de $0$ et de $1$.
39
+
40
+ Puis, remarque que :
41
+
42
+ - $f(0) = ka^0 = k$
43
+ - $f(1) = ka^1 = ka$
44
+
45
+ Cela te permet de retrouver $k$ et $a$.`;
46
+ };
47
+ const getCorrection = (identifiers) => {
48
+ const { f0, f1 } = identifiers;
49
+ return `On lit les images par $f$ de $0$ et de $1$ :
50
+
51
+ - $f(0) = ${f0.frenchify()}$
52
+ - $f(1) = ${f1.frenchify()}$
53
+
54
+ Or, puisque $f(x) = ka^x$, on a :
55
+
56
+ $$
57
+ f(0) = ka^0 = k\\times 1 = k
58
+ $$
59
+
60
+ Donc $k = ${f0.frenchify()}$.
61
+
62
+ De même, on a :
63
+
64
+ $$
65
+ f(1) = ka^1 = ka = ${multiply(f0, "a").toTex()}
66
+ $$
67
+
68
+ Donc $a = ${frac(f1, f0).simplify().toTex()}$.
69
+
70
+ Ainsi, l'expression de $f$ est :
71
+
72
+ $$
73
+ f(x) = ${getAnswer(identifiers)}
74
+ $$
75
+ `;
76
+ };
77
+ const getGGBOptions = (identifiers) => {
78
+ const { f0, f1 } = identifiers;
79
+ const ggb = new GeogebraConstructor({
80
+ commands: [`Function(${f0}*${f1 / f0}^x, 0, 10000)`],
81
+ lockedAxesRatio: false,
82
+ });
83
+ return ggb.getOptions({
84
+ coords: [-1, 5, -1, 2 * Math.max(f0, f1)],
85
+ });
86
+ };
87
+ const getKeys = () => {
88
+ return ["x"];
89
+ };
90
+ const isAnswerValid = (ans, { answer }) => {
91
+ try {
92
+ const parsed = parseAlgebraic(ans);
93
+ if (!parsed)
94
+ return false;
95
+ return parsed.simplify().toTex() === answer;
96
+ }
97
+ catch (err) {
98
+ return handleVEAError(err);
99
+ }
100
+ };
101
+ const getReadExponentialFunctionParamsOnGraphQuestion = () => {
102
+ const k = randint(1, 6);
103
+ const a = randint(2, 6, [k]);
104
+ const identifiers = {
105
+ f0: k,
106
+ f1: a * k,
107
+ };
108
+ return getQuestionFromIdentifiers(identifiers);
109
+ };
110
+ const getQuestionFromIdentifiers = (identifiers) => {
111
+ return {
112
+ answer: getAnswer(identifiers),
113
+ instruction: getInstruction(identifiers),
114
+ keys: getKeys(identifiers),
115
+ answerFormat: "tex",
116
+ identifiers,
117
+ hint: getHint(identifiers),
118
+ correction: getCorrection(identifiers),
119
+ ggbOptions: getGGBOptions(identifiers),
120
+ };
121
+ };
122
+ export const readExponentialFunctionParamsOnGraph = {
123
+ id: "readExponentialFunctionParamsOnGraph",
124
+ connector: "=",
125
+ label: "Déterminer l'expression d'une fonction exponentielle à partir de sa courbe représentative",
126
+ isSingleStep: true,
127
+ generator: (nb, opts) => getDistinctQuestions(() => getReadExponentialFunctionParamsOnGraphQuestion(opts), nb, 10),
128
+ qcmTimer: 60,
129
+ freeTimer: 60,
130
+ getPropositions,
131
+ isAnswerValid,
132
+ subject: "Mathématiques",
133
+ getHint,
134
+ getCorrection,
135
+ getInstruction,
136
+ getAnswer,
137
+ getGGBOptions,
138
+ hasGeogebra: true,
139
+ getQuestionFromIdentifiers,
140
+ hasHintAndCorrection: true,
141
+ maxAllowedQuestions: 10,
142
+ };
@@ -1 +1 @@
1
- {"version":3,"file":"placeAbscissOnSemiLineV2.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/geometry/cartesian/placeAbscissOnSemiLineV2.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAWT,MAAM,6BAA6B,CAAC;AAOrC,OAAO,EAAE,UAAU,EAAE,MAAM,8BAA8B,CAAC;AAK1D,OAAO,EAEL,eAAe,EAChB,MAAM,qCAAqC,CAAC;AAK7C,KAAK,WAAW,GAAG;IACjB,WAAW,EAAE,UAAU,CAAC;IACxB,QAAQ,EAAE,eAAe,CAAC;IAC1B,QAAQ,EAAE,eAAe,CAAC;IAC1B,QAAQ,EAAE,eAAe,CAAC;CAC3B,CAAC;AAwNF,KAAK,OAAO,GAAG;IACb,YAAY,EAAE,UAAU,GAAG,oBAAoB,CAAC;IAChD,UAAU,EAAE,SAAS,GAAG,YAAY,GAAG,UAAU,CAAC;CACnD,CAAC;AA6BF,eAAO,MAAM,wBAAwB,EAAE,QAAQ,CAAC,WAAW,EAAE,OAAO,CAanE,CAAC"}
1
+ {"version":3,"file":"placeAbscissOnSemiLineV2.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/geometry/cartesian/placeAbscissOnSemiLineV2.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAWT,MAAM,6BAA6B,CAAC;AAQrC,OAAO,EAAE,UAAU,EAAE,MAAM,8BAA8B,CAAC;AAK1D,OAAO,EAEL,eAAe,EAChB,MAAM,qCAAqC,CAAC;AAK7C,KAAK,WAAW,GAAG;IACjB,WAAW,EAAE,UAAU,CAAC;IACxB,QAAQ,EAAE,eAAe,CAAC;IAC1B,QAAQ,EAAE,eAAe,CAAC;IAC1B,QAAQ,EAAE,eAAe,CAAC;CAC3B,CAAC;AAwNF,KAAK,OAAO,GAAG;IACb,YAAY,EAAE,UAAU,GAAG,oBAAoB,CAAC;IAChD,UAAU,EAAE,SAAS,GAAG,YAAY,GAAG,UAAU,CAAC;CACnD,CAAC;AA6BF,eAAO,MAAM,wBAAwB,EAAE,QAAQ,CAAC,WAAW,EAAE,OAAO,CAanE,CAAC"}
@@ -1,6 +1,7 @@
1
1
  import { GeneratorOptionTarget, GeneratorOptionType, } from "../../../../exercises/exercise.js";
2
2
  import { toolBarConstructor } from "../../../../exercises/utils/geogebra/toolBarConstructor.js";
3
3
  import { getDistinctQuestions } from "../../../../exercises/utils/getDistinctQuestions.js";
4
+ import { defaultArrayedOptsWhereNeeded } from "../../../../exercises/utils/options/arrayedOptions.js";
4
5
  import { GeogebraConstructor } from "../../../../geogebra/geogebraConstructor.js";
5
6
  import { ggbPointToCoords } from "../../../../geogebra/parsers/ggbPointToCoords.js";
6
7
  import { parseGGBPoints } from "../../../../geogebra/parsers/parseGGBPoints.js";
@@ -88,10 +89,10 @@ const isGGBAnswerValid = (ans, { absciss2, axisUnit }) => {
88
89
  0.2 * axisUnitNode.evaluate());
89
90
  };
90
91
  const getPlaceAbscissOnSemiLineV2Question = (optsIn) => {
91
- const arrayedOptions = optsIn ?? optsDefault;
92
+ const arrayedOpts = defaultArrayedOptsWhereNeeded(optsIn, arrayedOptsDefault);
92
93
  const opts = {
93
- questionType: random(arrayedOptions.questionType),
94
- numberType: random(arrayedOptions.numberType),
94
+ questionType: random(arrayedOpts.questionType),
95
+ numberType: random(arrayedOpts.numberType),
95
96
  };
96
97
  const abscissType = (() => {
97
98
  switch (opts.numberType) {
@@ -169,7 +170,7 @@ const getQuestionFromIdentifiers = (identifiers, opts) => {
169
170
  };
170
171
  return question;
171
172
  };
172
- const optsDefault = {
173
+ const arrayedOptsDefault = {
173
174
  questionType: ["standard", "éviter le comptage"],
174
175
  numberType: ["Entiers", "Rationnels", "Décimaux"],
175
176
  };
@@ -180,7 +181,7 @@ const options = [
180
181
  target: GeneratorOptionTarget.generation,
181
182
  type: GeneratorOptionType.multiselect,
182
183
  values: ["standard", "éviter le comptage"],
183
- defaultValue: optsDefault.questionType,
184
+ defaultValue: arrayedOptsDefault.questionType,
184
185
  },
185
186
  {
186
187
  id: "numberType",
@@ -188,7 +189,7 @@ const options = [
188
189
  target: GeneratorOptionTarget.generation,
189
190
  type: GeneratorOptionType.multiselect,
190
191
  values: ["Entiers", "Rationnels", "Décimaux"],
191
- defaultValue: optsDefault.numberType,
192
+ defaultValue: arrayedOptsDefault.numberType,
192
193
  },
193
194
  ];
194
195
  export const placeAbscissOnSemiLineV2 = {
@@ -1 +1 @@
1
- {"version":3,"file":"scalarProductAlKashiBH.d.ts","sourceRoot":"","sources":["../../../../../../../src/exercises/math/geometry/vectors/scalarProduct/alKashi/scalarProductAlKashiBH.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAmBT,MAAM,6BAA6B,CAAC;AAKrC,OAAO,EAGL,gBAAgB,EACjB,MAAM,8BAA8B,CAAC;AAGtC,OAAO,EAGL,mBAAmB,EACpB,MAAM,2CAA2C,CAAC;AAwBnD,KAAK,WAAW,GAAG;IACjB,cAAc,EAAE,MAAM,CAAC;IACvB,WAAW,EAAE,mBAAmB,CAAC;IACjC,SAAS,EAAE,gBAAgB,CAAC;CAC7B,CAAC;AAopBF,KAAK,OAAO,GAAG;IACb,cAAc,EAAE,MAAM,CAAC;CACxB,CAAC;AAuBF,eAAO,MAAM,sBAAsB,EAAE,QAAQ,CAAC,WAAW,EAAE,OAAO,CA2BjE,CAAC"}
1
+ {"version":3,"file":"scalarProductAlKashiBH.d.ts","sourceRoot":"","sources":["../../../../../../../src/exercises/math/geometry/vectors/scalarProduct/alKashi/scalarProductAlKashiBH.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAmBT,MAAM,6BAA6B,CAAC;AAMrC,OAAO,EAGL,gBAAgB,EACjB,MAAM,8BAA8B,CAAC;AAGtC,OAAO,EAGL,mBAAmB,EACpB,MAAM,2CAA2C,CAAC;AAwBnD,KAAK,WAAW,GAAG;IACjB,cAAc,EAAE,MAAM,CAAC;IACvB,WAAW,EAAE,mBAAmB,CAAC;IACjC,SAAS,EAAE,gBAAgB,CAAC;CAC7B,CAAC;AAmpBF,KAAK,OAAO,GAAG;IACb,cAAc,EAAE,MAAM,CAAC;CACxB,CAAC;AAuBF,eAAO,MAAM,sBAAsB,EAAE,QAAQ,CAAC,WAAW,EAAE,OAAO,CA2BjE,CAAC"}