math-exercises 3.0.49 → 3.0.51
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/exercises/math/calcul/addAndSubWithoutRelatives.d.ts.map +1 -1
- package/lib/exercises/math/calcul/fractions/fractionsOperations.js +2 -2
- package/lib/exercises/math/calcul/mentalCaluls/mentalAddAndSub.js +1 -1
- package/lib/exercises/math/calcul/mentalCaluls/mentalMultiplications.js +1 -1
- package/lib/exercises/math/calcul/operations/expressionNature.d.ts.map +1 -1
- package/lib/exercises/math/calcul/operations/expressionNature.js +6 -12
- package/lib/exercises/math/calcul/operations/operationsPriorities.d.ts.map +1 -1
- package/lib/exercises/math/calcul/operations/operationsPriorities.js +5 -6
- package/lib/exercises/math/calcul/operations/operationsPrioritiesParenthesis.js +1 -2
- package/lib/exercises/math/calcul/operations/operationsPrioritiesParenthesisNoRelatives.d.ts.map +1 -1
- package/lib/exercises/math/calcul/operations/operationsPrioritiesParenthesisNoRelatives.js +1 -2
- package/lib/exercises/math/calcul/operations/operationsPrioritiesWithoutRelative.d.ts.map +1 -1
- package/lib/exercises/math/calcul/operations/operationsPrioritiesWithoutRelative.js +1 -2
- package/lib/exercises/math/calcul/ordering/decimalOrdering.d.ts.map +1 -1
- package/lib/exercises/math/calcul/ordering/decimalOrdering.js +0 -2
- package/lib/exercises/math/calcul/proportionality/proportionalityTable.d.ts.map +1 -1
- package/lib/exercises/math/calcul/proportionality/proportionalityTable.js +6 -0
- package/lib/exercises/math/calcul/proportionality/proportionalityTableCoefficient.d.ts.map +1 -1
- package/lib/exercises/math/calcul/proportionality/proportionalityTableCoefficient.js +33 -3
- package/lib/exercises/math/calculLitteral/index.d.ts +1 -0
- package/lib/exercises/math/calculLitteral/index.d.ts.map +1 -1
- package/lib/exercises/math/calculLitteral/index.js +1 -0
- package/lib/exercises/math/calculLitteral/isolate/index.d.ts +2 -0
- package/lib/exercises/math/calculLitteral/isolate/index.d.ts.map +1 -0
- package/lib/exercises/math/calculLitteral/isolate/index.js +2 -0
- package/lib/exercises/math/calculLitteral/isolate/isolateVariable.d.ts +2 -0
- package/lib/exercises/math/calculLitteral/isolate/isolateVariable.d.ts.map +1 -0
- package/lib/exercises/math/calculLitteral/isolate/isolateVariable.js +147 -0
- package/lib/exercises/math/calculLitteral/simplifying/reduceExpression.d.ts.map +1 -1
- package/lib/exercises/math/derivation/derivative/lnDerivativeThree.d.ts.map +1 -1
- package/lib/exercises/math/derivation/derivative/rootFunctionDerivative.d.ts.map +1 -1
- package/lib/exercises/math/derivation/derivative/rootFunctionDerivative.js +1 -1
- package/lib/exercises/math/equaDiff/equaDiffCheckSolutionFirstOrder.d.ts.map +1 -1
- package/lib/exercises/math/functions/affines/affineExpressionReading.d.ts.map +1 -1
- package/lib/exercises/math/functions/affines/signFunction.d.ts.map +1 -1
- package/lib/exercises/math/functions/basics/inverseImageFunction.d.ts.map +1 -1
- package/lib/exercises/math/functions/basics/inverseImageFunction.js +16 -3
- package/lib/exercises/math/functions/exponential/expSimplifiying.d.ts.map +1 -1
- package/lib/exercises/math/functions/exponential/expSimplifiying.js +1 -2
- package/lib/exercises/math/functions/trinoms/equation/secondDegreeInequation.d.ts.map +1 -1
- package/lib/exercises/math/functions/trinoms/equation/solveSecondDegreeEquationFromCano.d.ts.map +1 -1
- package/lib/exercises/math/functions/trinoms/roots/rootsFromFactorizedForm.d.ts.map +1 -1
- package/lib/exercises/math/functions/trinoms/roots/rootsFromFactorizedForm.js +10 -0
- package/lib/exercises/math/functions/trinoms/summitAndCanonical/summitAbscissFromDevForm.d.ts.map +1 -1
- package/lib/exercises/math/functions/trinoms/summitAndCanonical/summitAbscissFromDevForm.js +31 -16
- package/lib/exercises/math/functions/trinoms/summitAndCanonical/summitAbscissFromRoots.d.ts.map +1 -1
- package/lib/exercises/math/functions/trinoms/summitAndCanonical/summitAbscissFromRoots.js +50 -14
- package/lib/exercises/math/geometry/cartesian/directionVectorEquation.d.ts +1 -0
- package/lib/exercises/math/geometry/cartesian/directionVectorEquation.d.ts.map +1 -1
- package/lib/exercises/math/geometry/cartesian/directionVectorEquation.js +48 -40
- package/lib/exercises/math/geometry/lines/isPointOnLine.js +1 -1
- package/lib/exercises/math/geometry/lines/linesRelativePositions.d.ts.map +1 -1
- package/lib/exercises/math/geometry/lines/linesRelativePositions.js +0 -2
- package/lib/exercises/math/geometry/vectors/scalarProduct/angleFromScalarProduct.d.ts +8 -0
- package/lib/exercises/math/geometry/vectors/scalarProduct/angleFromScalarProduct.d.ts.map +1 -0
- package/lib/exercises/math/geometry/vectors/scalarProduct/angleFromScalarProduct.js +93 -0
- package/lib/exercises/math/geometry/vectors/scalarProduct/findCoordinatesToOrthogonalize.d.ts +9 -0
- package/lib/exercises/math/geometry/vectors/scalarProduct/findCoordinatesToOrthogonalize.d.ts.map +1 -0
- package/lib/exercises/math/geometry/vectors/scalarProduct/findCoordinatesToOrthogonalize.js +111 -0
- package/lib/exercises/math/geometry/vectors/scalarProduct/index.d.ts +3 -0
- package/lib/exercises/math/geometry/vectors/scalarProduct/index.d.ts.map +1 -1
- package/lib/exercises/math/geometry/vectors/scalarProduct/index.js +3 -0
- package/lib/exercises/math/geometry/vectors/scalarProduct/scalarProductIdentities.d.ts +10 -0
- package/lib/exercises/math/geometry/vectors/scalarProduct/scalarProductIdentities.d.ts.map +1 -0
- package/lib/exercises/math/geometry/vectors/scalarProduct/scalarProductIdentities.js +174 -0
- package/lib/exercises/math/geometry/vectors/vectorLinearCombination.js +2 -2
- package/lib/exercises/math/primitive/constantPrimitive.d.ts.map +1 -1
- package/lib/exercises/math/primitive/constantPrimitive.js +22 -5
- package/lib/exercises/math/primitive/expUPrimitive.d.ts.map +1 -1
- package/lib/exercises/math/primitive/expUPrimitive.js +25 -7
- package/lib/exercises/math/primitive/exponentialPrimitive.d.ts.map +1 -1
- package/lib/exercises/math/primitive/exponentialPrimitive.js +23 -5
- package/lib/exercises/math/primitive/index.d.ts +2 -0
- package/lib/exercises/math/primitive/index.d.ts.map +1 -1
- package/lib/exercises/math/primitive/index.js +2 -0
- package/lib/exercises/math/primitive/kexpUPrimitive.d.ts +9 -0
- package/lib/exercises/math/primitive/kexpUPrimitive.d.ts.map +1 -0
- package/lib/exercises/math/primitive/kexpUPrimitive.js +130 -0
- package/lib/exercises/math/primitive/klogUPrimitive.d.ts +9 -0
- package/lib/exercises/math/primitive/klogUPrimitive.d.ts.map +1 -0
- package/lib/exercises/math/primitive/klogUPrimitive.js +120 -0
- package/lib/exercises/math/primitive/logarithmePrimitive.d.ts.map +1 -1
- package/lib/exercises/math/primitive/logarithmePrimitive.js +30 -18
- package/lib/exercises/math/primitive/polynomialPrimitive.d.ts.map +1 -1
- package/lib/exercises/math/primitive/polynomialPrimitive.js +0 -11
- package/lib/exercises/math/primitive/sinCosPrimitive.d.ts.map +1 -1
- package/lib/exercises/math/primitive/sinUCosUPrimitive.d.ts.map +1 -1
- package/lib/exercises/math/primitive/sinUCosUPrimitive.js +33 -18
- package/lib/exercises/math/probaStat/ballsBasicProbas.d.ts.map +1 -1
- package/lib/exercises/math/probaStat/ballsBasicProbas.js +28 -4
- package/lib/exercises/math/probaStat/basicStats/calculateFrequency.d.ts +4 -1
- package/lib/exercises/math/probaStat/basicStats/calculateFrequency.d.ts.map +1 -1
- package/lib/exercises/math/probaStat/basicStats/calculateFrequency.js +43 -18
- package/lib/exercises/math/squareRoots/squareRootIdentities.d.ts.map +1 -1
- package/lib/index.d.ts +20 -1
- package/lib/index.d.ts.map +1 -1
- package/lib/math/geometry/spaceVector.d.ts +1 -2
- package/lib/math/geometry/spaceVector.d.ts.map +1 -1
- package/lib/math/geometry/vector.d.ts +8 -0
- package/lib/math/geometry/vector.d.ts.map +1 -1
- package/lib/math/geometry/vector.js +12 -1
- package/lib/math/numbers/decimals/decimal.d.ts.map +1 -1
- package/lib/math/numbers/integer/integer.d.ts.map +1 -1
- package/lib/math/numbers/integer/power.d.ts.map +1 -1
- package/lib/math/numbers/nombre.d.ts.map +1 -1
- package/lib/math/numbers/rationals/rational.d.ts.map +1 -1
- package/lib/math/numbers/reals/real.d.ts.map +1 -1
- package/lib/math/polynomials/polynomial.d.ts.map +1 -1
- package/lib/math/sequences/sequence.d.ts +3 -3
- package/lib/math/sequences/sequence.d.ts.map +1 -1
- package/lib/playground.d.ts.map +1 -1
- package/lib/playground.js +8 -0
- package/lib/prototypesEnhancement.d.ts.map +1 -1
- package/lib/tree/nodes/complex/complexNode.d.ts.map +1 -1
- package/lib/tree/nodes/equations/equalNode.d.ts +14 -8
- package/lib/tree/nodes/equations/equalNode.d.ts.map +1 -1
- package/lib/tree/nodes/equations/equalNode.js +126 -6
- package/lib/tree/nodes/equations/equationSolutionNode.d.ts +8 -2
- package/lib/tree/nodes/equations/equationSolutionNode.d.ts.map +1 -1
- package/lib/tree/nodes/equations/equationSolutionNode.js +14 -0
- package/lib/tree/nodes/equations/multiEqualNode.d.ts +7 -1
- package/lib/tree/nodes/equations/multiEqualNode.d.ts.map +1 -1
- package/lib/tree/nodes/equations/multiEqualNode.js +14 -0
- package/lib/tree/nodes/functions/arccosNode.d.ts +1 -0
- package/lib/tree/nodes/functions/arccosNode.d.ts.map +1 -1
- package/lib/tree/nodes/functions/arccosNode.js +4 -0
- package/lib/tree/nodes/functions/integralNode.d.ts +8 -3
- package/lib/tree/nodes/functions/integralNode.d.ts.map +1 -1
- package/lib/tree/nodes/functions/integralNode.js +14 -0
- package/lib/tree/nodes/geometry/pointNode.d.ts +8 -2
- package/lib/tree/nodes/geometry/pointNode.d.ts.map +1 -1
- package/lib/tree/nodes/geometry/pointNode.js +14 -0
- package/lib/tree/nodes/geometry/vectorNode.d.ts +8 -2
- package/lib/tree/nodes/geometry/vectorNode.d.ts.map +1 -1
- package/lib/tree/nodes/geometry/vectorNode.js +14 -0
- package/lib/tree/nodes/hasVariableNode.d.ts +1 -1
- package/lib/tree/nodes/hasVariableNode.d.ts.map +1 -1
- package/lib/tree/nodes/hasVariableNode.js +4 -4
- package/lib/tree/nodes/inequations/inequationNode.d.ts +8 -3
- package/lib/tree/nodes/inequations/inequationNode.d.ts.map +1 -1
- package/lib/tree/nodes/inequations/inequationNode.js +14 -0
- package/lib/tree/nodes/inequations/inequationSolutionNode.d.ts +8 -2
- package/lib/tree/nodes/inequations/inequationSolutionNode.d.ts.map +1 -1
- package/lib/tree/nodes/inequations/inequationSolutionNode.js +14 -0
- package/lib/tree/nodes/nodeConstructor.d.ts.map +1 -1
- package/lib/tree/nodes/numbers/percentNode.d.ts +10 -3
- package/lib/tree/nodes/numbers/percentNode.d.ts.map +1 -1
- package/lib/tree/nodes/numbers/percentNode.js +17 -1
- package/lib/tree/nodes/operators/addNode.d.ts +1 -1
- package/lib/tree/nodes/operators/addNode.d.ts.map +1 -1
- package/lib/tree/nodes/operators/addNode.js +2 -1
- package/lib/tree/nodes/operators/divideNode.d.ts +1 -1
- package/lib/tree/nodes/operators/divideNode.d.ts.map +1 -1
- package/lib/tree/nodes/operators/divideNode.js +1 -2
- package/lib/tree/nodes/operators/multiplyNode.d.ts +1 -1
- package/lib/tree/nodes/operators/multiplyNode.d.ts.map +1 -1
- package/lib/tree/nodes/operators/multiplyNode.js +2 -1
- package/lib/tree/nodes/operators/operatorNode.d.ts +1 -1
- package/lib/tree/nodes/operators/operatorNode.d.ts.map +1 -1
- package/lib/tree/nodes/operators/scalarProductNode.d.ts.map +1 -1
- package/lib/tree/nodes/operators/substractNode.d.ts +2 -1
- package/lib/tree/nodes/operators/substractNode.d.ts.map +1 -1
- package/lib/tree/nodes/operators/substractNode.js +4 -3
- package/lib/tree/nodes/sets/belongsNode.d.ts +11 -5
- package/lib/tree/nodes/sets/belongsNode.d.ts.map +1 -1
- package/lib/tree/nodes/sets/belongsNode.js +14 -0
- package/lib/tree/parsers/affineParser.d.ts.map +1 -1
- package/lib/tree/parsers/affineParser.js +0 -1
- package/lib/tree/parsers/equationSolutionParser.d.ts +1 -1
- package/lib/tree/parsers/equationSolutionParser.d.ts.map +1 -1
- package/lib/tree/parsers/vectorParser.d.ts +3 -0
- package/lib/tree/parsers/vectorParser.d.ts.map +1 -0
- package/lib/tree/parsers/vectorParser.js +13 -0
- package/package.json +1 -1
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Exercise } from "../../../../../exercises/exercise.js";
|
|
2
|
+
type Identifiers = {
|
|
3
|
+
type: number;
|
|
4
|
+
normU: number;
|
|
5
|
+
normV: number;
|
|
6
|
+
udotv: number;
|
|
7
|
+
};
|
|
8
|
+
export declare const scalarProductIdentities: Exercise<Identifiers>;
|
|
9
|
+
export {};
|
|
10
|
+
//# sourceMappingURL=scalarProductIdentities.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"scalarProductIdentities.d.ts","sourceRoot":"","sources":["../../../../../../src/exercises/math/geometry/vectors/scalarProduct/scalarProductIdentities.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAeT,MAAM,6BAA6B,CAAC;AAWrC,KAAK,WAAW,GAAG;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;CACf,CAAC;AAkKF,eAAO,MAAM,uBAAuB,EAAE,QAAQ,CAAC,WAAW,CAkBzD,CAAC"}
|
|
@@ -0,0 +1,174 @@
|
|
|
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 { add } from "../../../../../tree/nodes/operators/addNode.js";
|
|
5
|
+
import { multiply } from "../../../../../tree/nodes/operators/multiplyNode.js";
|
|
6
|
+
import { square } from "../../../../../tree/nodes/operators/powerNode.js";
|
|
7
|
+
import { substract } from "../../../../../tree/nodes/operators/substractNode.js";
|
|
8
|
+
import { parseAlgebraic } from "../../../../../tree/parsers/latexParser.js";
|
|
9
|
+
import { handleVEAError } from "../../../../../utils/errors/handleVEAError.js";
|
|
10
|
+
import { alignTex } from "../../../../../utils/latex/alignTex.js";
|
|
11
|
+
const getPropositions = (n, { answer }) => {
|
|
12
|
+
const propositions = [];
|
|
13
|
+
addValidProp(propositions, answer);
|
|
14
|
+
while (propositions.length < n) {
|
|
15
|
+
tryToAddWrongProp(propositions, randint(-30, 30) + "");
|
|
16
|
+
}
|
|
17
|
+
return shuffleProps(propositions, n);
|
|
18
|
+
};
|
|
19
|
+
const getAnswer = (identifiers) => {
|
|
20
|
+
const { type, normU, normV, udotv } = identifiers;
|
|
21
|
+
switch (type) {
|
|
22
|
+
case 0:
|
|
23
|
+
return add(square(normU), add(multiply(2, udotv), square(normV)))
|
|
24
|
+
.simplify()
|
|
25
|
+
.toTex();
|
|
26
|
+
case 1:
|
|
27
|
+
return add(square(normU), add(multiply(-2, udotv), square(normV)))
|
|
28
|
+
.simplify()
|
|
29
|
+
.toTex();
|
|
30
|
+
case 2:
|
|
31
|
+
default:
|
|
32
|
+
return substract(square(normU), square(normV)).simplify().toTex();
|
|
33
|
+
}
|
|
34
|
+
};
|
|
35
|
+
const getStatementNode = (identifiers) => {
|
|
36
|
+
const { type, normU, normV, udotv } = identifiers;
|
|
37
|
+
const u = "\\overrightarrow u";
|
|
38
|
+
const v = "\\overrightarrow v";
|
|
39
|
+
switch (type) {
|
|
40
|
+
case 0:
|
|
41
|
+
return square(add(u, v));
|
|
42
|
+
case 1:
|
|
43
|
+
return square(substract(u, v));
|
|
44
|
+
case 2:
|
|
45
|
+
default:
|
|
46
|
+
return multiply(add(u, v), substract(u, v));
|
|
47
|
+
}
|
|
48
|
+
};
|
|
49
|
+
const getInstruction = (identifiers) => {
|
|
50
|
+
const { type, normU, normV, udotv } = identifiers;
|
|
51
|
+
const u = "\\overrightarrow u";
|
|
52
|
+
const v = "\\overrightarrow v";
|
|
53
|
+
return `Soit $${u}$ et $${v}$ deux vecteurs tels que $\\lVert ${u}\\rVert = ${normU}$, $\\lVert ${v}\\rVert = ${normV}$ et $${u} \\cdot ${v} = ${udotv}$.
|
|
54
|
+
|
|
55
|
+
Calculer :
|
|
56
|
+
|
|
57
|
+
$$
|
|
58
|
+
${getStatementNode(identifiers).toTex()}
|
|
59
|
+
$$`;
|
|
60
|
+
};
|
|
61
|
+
const getHint = (identifiers) => {
|
|
62
|
+
return `Utilise une identité remarquable, puis utilise le fait que pour tout vecteur $\\overrightarrow{u}$ :
|
|
63
|
+
|
|
64
|
+
$$
|
|
65
|
+
\\overrightarrow{u}^2 = \\lVert \\overrightarrow{u} \\rVert^2
|
|
66
|
+
$$`;
|
|
67
|
+
};
|
|
68
|
+
const getCorrection = (identifiers) => {
|
|
69
|
+
const { type, normU, normV, udotv } = identifiers;
|
|
70
|
+
const u = "\\overrightarrow u";
|
|
71
|
+
const v = "\\overrightarrow v";
|
|
72
|
+
const vertU = `\\lVert \\overrightarrow{u} \\rVert`;
|
|
73
|
+
const vertV = `\\lVert \\overrightarrow{v} \\rVert`;
|
|
74
|
+
const ps = `${u}\\cdot ${v}`;
|
|
75
|
+
const statement = getStatementNode(identifiers);
|
|
76
|
+
const steps = type === 0
|
|
77
|
+
? [
|
|
78
|
+
["", statement.toTex()],
|
|
79
|
+
["=", add(square(u), add(multiply(2, ps), square(v))).toTex()],
|
|
80
|
+
[
|
|
81
|
+
"=",
|
|
82
|
+
add(square(vertU), add(multiply(2, ps), square(vertV))).toTex(),
|
|
83
|
+
],
|
|
84
|
+
[
|
|
85
|
+
"=",
|
|
86
|
+
add(square(normU), add(multiply(2, udotv), square(normV))).toTex(),
|
|
87
|
+
],
|
|
88
|
+
["=", getAnswer(identifiers)],
|
|
89
|
+
]
|
|
90
|
+
: type === 1
|
|
91
|
+
? [
|
|
92
|
+
["", statement.toTex()],
|
|
93
|
+
["=", add(square(u), add(multiply(-2, ps), square(v))).toTex()],
|
|
94
|
+
[
|
|
95
|
+
"=",
|
|
96
|
+
add(square(vertU), add(multiply(-2, ps), square(vertV))).toTex(),
|
|
97
|
+
],
|
|
98
|
+
[
|
|
99
|
+
"=",
|
|
100
|
+
add(square(normU), add(multiply(-2, udotv), square(normV))).toTex(),
|
|
101
|
+
],
|
|
102
|
+
["=", getAnswer(identifiers)],
|
|
103
|
+
]
|
|
104
|
+
: [
|
|
105
|
+
["", statement.toTex()],
|
|
106
|
+
["=", substract(square(u), square(v)).toTex()],
|
|
107
|
+
["=", substract(square(vertU), square(vertV)).toTex()],
|
|
108
|
+
["=", substract(square(normU), square(normV)).toTex()],
|
|
109
|
+
["=", getAnswer(identifiers)],
|
|
110
|
+
];
|
|
111
|
+
return `On utilies une identité remarquable, ainsi que le fait que pour tout vecteur $\\overrightarrow{u}$ :
|
|
112
|
+
|
|
113
|
+
$$
|
|
114
|
+
\\overrightarrow{u}^2 = \\lVert \\overrightarrow{u} \\rVert^2
|
|
115
|
+
$$
|
|
116
|
+
|
|
117
|
+
Cela donne :
|
|
118
|
+
|
|
119
|
+
${alignTex(steps)}`;
|
|
120
|
+
};
|
|
121
|
+
const getKeys = (identifiers) => {
|
|
122
|
+
return [];
|
|
123
|
+
};
|
|
124
|
+
const isAnswerValid = (ans, { answer }) => {
|
|
125
|
+
try {
|
|
126
|
+
const parsed = parseAlgebraic(ans);
|
|
127
|
+
return parsed.simplify().toTex() === answer;
|
|
128
|
+
}
|
|
129
|
+
catch (err) {
|
|
130
|
+
return handleVEAError(err);
|
|
131
|
+
}
|
|
132
|
+
};
|
|
133
|
+
const getScalarProductIdentitiesQuestion = (ops) => {
|
|
134
|
+
const type = randint(0, 3);
|
|
135
|
+
const normU = randint(1, 10);
|
|
136
|
+
const normV = randint(1, 10);
|
|
137
|
+
const udotv = randint(-9, 10);
|
|
138
|
+
const identifiers = {
|
|
139
|
+
normU,
|
|
140
|
+
normV,
|
|
141
|
+
type,
|
|
142
|
+
udotv,
|
|
143
|
+
};
|
|
144
|
+
return getQuestionFromIdentifiers(identifiers);
|
|
145
|
+
};
|
|
146
|
+
const getQuestionFromIdentifiers = (identifiers) => {
|
|
147
|
+
return {
|
|
148
|
+
answer: getAnswer(identifiers),
|
|
149
|
+
instruction: getInstruction(identifiers),
|
|
150
|
+
keys: getKeys(identifiers),
|
|
151
|
+
answerFormat: "tex",
|
|
152
|
+
identifiers,
|
|
153
|
+
hint: getHint(identifiers),
|
|
154
|
+
correction: getCorrection(identifiers),
|
|
155
|
+
};
|
|
156
|
+
};
|
|
157
|
+
export const scalarProductIdentities = {
|
|
158
|
+
id: "scalarProductIdentities",
|
|
159
|
+
connector: "=",
|
|
160
|
+
label: "Identités remarquables avec des vecteurs (produit scalaire)",
|
|
161
|
+
isSingleStep: true,
|
|
162
|
+
generator: (nb, opts) => getDistinctQuestions(() => getScalarProductIdentitiesQuestion(opts), nb),
|
|
163
|
+
qcmTimer: 60,
|
|
164
|
+
freeTimer: 60,
|
|
165
|
+
getPropositions,
|
|
166
|
+
isAnswerValid,
|
|
167
|
+
subject: "Mathématiques",
|
|
168
|
+
getInstruction,
|
|
169
|
+
getHint,
|
|
170
|
+
getCorrection,
|
|
171
|
+
getAnswer,
|
|
172
|
+
getQuestionFromIdentifiers,
|
|
173
|
+
hasHintAndCorrection: true,
|
|
174
|
+
};
|
|
@@ -7,8 +7,8 @@ import { AddNode } from "../../../../tree/nodes/operators/addNode.js";
|
|
|
7
7
|
import { MultiplyNode } from "../../../../tree/nodes/operators/multiplyNode.js";
|
|
8
8
|
import { VariableNode } from "../../../../tree/nodes/variables/variableNode.js";
|
|
9
9
|
const getVectorLinearCombinationQuestion = () => {
|
|
10
|
-
const u = VectorConstructor.random("u"
|
|
11
|
-
const v = VectorConstructor.random("v"
|
|
10
|
+
const u = VectorConstructor.random("u");
|
|
11
|
+
const v = VectorConstructor.random("v");
|
|
12
12
|
const a = randint(-10, 11, [0]);
|
|
13
13
|
const b = randint(-10, 11, [0]);
|
|
14
14
|
const uCoords = {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constantPrimitive.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/primitive/constantPrimitive.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,
|
|
1
|
+
{"version":3,"file":"constantPrimitive.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/primitive/constantPrimitive.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAKR,YAAY,EAEZ,iBAAiB,EACjB,GAAG,EAGJ,MAAM,6BAA6B,CAAC;AAQrC,KAAK,WAAW,GAAG;IACjB,CAAC,EAAE,MAAM,CAAC;CACX,CAAC;AAoBF,eAAO,MAAM,oBAAoB,EAAE,iBAAiB,CAAC,WAAW,CAI/D,CAAC;AAgBF,eAAO,MAAM,gCAAgC,EAAE,YAAY,CAAC,WAAW,CActE,CAAC;AAEF,eAAO,MAAM,8BAA8B,EAAE,GAAG,CAAC,WAAW,CAO3D,CAAC;AAEF,eAAO,MAAM,iBAAiB,EAAE,QAAQ,CAAC,WAAW,CAcnD,CAAC"}
|
|
@@ -5,17 +5,33 @@ import { randint } from "../../../math/utils/random/randint.js";
|
|
|
5
5
|
import { AddNode } from "../../../tree/nodes/operators/addNode.js";
|
|
6
6
|
import { VariableNode } from "../../../tree/nodes/variables/variableNode.js";
|
|
7
7
|
import { shuffle } from "../../../utils/alea/shuffle.js";
|
|
8
|
-
|
|
9
|
-
const c =
|
|
8
|
+
const getInstruction = (identifiers) => {
|
|
9
|
+
const { c } = identifiers;
|
|
10
|
+
return `Déterminer la forme générale des primitives de la fonction constante $f$ définie par :
|
|
11
|
+
|
|
12
|
+
$$
|
|
13
|
+
f(x) = ${c}
|
|
14
|
+
$$`;
|
|
15
|
+
};
|
|
16
|
+
const getAnswer = (identifiers) => {
|
|
17
|
+
const { c } = identifiers;
|
|
10
18
|
const monom = new Monom(1, c);
|
|
11
19
|
const answer = new AddNode(monom.toTree(), new VariableNode("C")).toTex();
|
|
20
|
+
return answer;
|
|
21
|
+
};
|
|
22
|
+
export const getConstantPrimitive = () => {
|
|
23
|
+
const c = randint(-19, 20, [0]);
|
|
24
|
+
const identifiers = { c };
|
|
25
|
+
return getQuestionFromIdentifiers(identifiers);
|
|
26
|
+
};
|
|
27
|
+
const getQuestionFromIdentifiers = (identifiers) => {
|
|
12
28
|
const question = {
|
|
13
|
-
instruction:
|
|
29
|
+
instruction: getInstruction(identifiers),
|
|
14
30
|
startStatement: `F(x)`,
|
|
15
|
-
answer,
|
|
31
|
+
answer: getAnswer(identifiers),
|
|
16
32
|
keys: ["x", "C"],
|
|
17
33
|
answerFormat: "tex",
|
|
18
|
-
identifiers
|
|
34
|
+
identifiers,
|
|
19
35
|
};
|
|
20
36
|
return question;
|
|
21
37
|
};
|
|
@@ -48,4 +64,5 @@ export const constantPrimitive = {
|
|
|
48
64
|
getPropositions: getConstantPrimitivePropositions,
|
|
49
65
|
isAnswerValid: isConstantPrimitiveAnswerValid,
|
|
50
66
|
subject: "Mathématiques",
|
|
67
|
+
getQuestionFromIdentifiers,
|
|
51
68
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"expUPrimitive.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/primitive/expUPrimitive.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,
|
|
1
|
+
{"version":3,"file":"expUPrimitive.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/primitive/expUPrimitive.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAKR,YAAY,EAEZ,iBAAiB,EACjB,GAAG,EAIJ,MAAM,6BAA6B,CAAC;AAcrC,KAAK,WAAW,GAAG;IACjB,MAAM,EAAE,MAAM,EAAE,CAAC;CAClB,CAAC;AA0BF,eAAO,MAAM,gBAAgB,EAAE,iBAAiB,CAAC,WAAW,CAK3D,CAAC;AAgBF,eAAO,MAAM,4BAA4B,EAAE,YAAY,CAAC,WAAW,CAiClE,CAAC;AAEF,eAAO,MAAM,0BAA0B,EAAE,GAAG,CAAC,WAAW,CAYvD,CAAC;AACF,eAAO,MAAM,aAAa,EAAE,QAAQ,CAAC,WAAW,CAa/C,CAAC"}
|
|
@@ -8,18 +8,37 @@ import { AddNode } from "../../../tree/nodes/operators/addNode.js";
|
|
|
8
8
|
import { FractionNode } from "../../../tree/nodes/operators/fractionNode.js";
|
|
9
9
|
import { MultiplyNode } from "../../../tree/nodes/operators/multiplyNode.js";
|
|
10
10
|
import { VariableNode } from "../../../tree/nodes/variables/variableNode.js";
|
|
11
|
-
|
|
12
|
-
const
|
|
11
|
+
const getInstruction = (identifiers) => {
|
|
12
|
+
const { coeffs } = identifiers;
|
|
13
|
+
const u = new Polynomial(coeffs);
|
|
13
14
|
const integratedFuction = new ExpNode(u.toTree());
|
|
14
15
|
const selectedFunction = new MultiplyNode(u.derivate().toTree(), integratedFuction);
|
|
16
|
+
return `Déterminer la forme générale des primitives de la fonction $f$ définie par :
|
|
17
|
+
|
|
18
|
+
$$
|
|
19
|
+
f(x) = ${selectedFunction.toTex()}
|
|
20
|
+
$$`;
|
|
21
|
+
};
|
|
22
|
+
const getAnswer = (identifiers) => {
|
|
23
|
+
const { coeffs } = identifiers;
|
|
24
|
+
const u = new Polynomial(coeffs);
|
|
25
|
+
const integratedFuction = new ExpNode(u.toTree());
|
|
15
26
|
const answer = new AddNode(integratedFuction, new VariableNode("C")).toTex();
|
|
27
|
+
return answer;
|
|
28
|
+
};
|
|
29
|
+
export const getExpUPrimitive = () => {
|
|
30
|
+
const u = PolynomialConstructor.randomWithOrder(randint(1, 3));
|
|
31
|
+
const identifiers = { coeffs: u.coefficients };
|
|
32
|
+
return getQuestionFromIdentifiers(identifiers);
|
|
33
|
+
};
|
|
34
|
+
const getQuestionFromIdentifiers = (identifiers) => {
|
|
16
35
|
const question = {
|
|
17
|
-
instruction:
|
|
36
|
+
instruction: getInstruction(identifiers),
|
|
18
37
|
startStatement: `F(x)`,
|
|
19
|
-
answer,
|
|
38
|
+
answer: getAnswer(identifiers),
|
|
20
39
|
keys: ["x", "C", "epower", "exp"],
|
|
21
40
|
answerFormat: "tex",
|
|
22
|
-
identifiers
|
|
41
|
+
identifiers,
|
|
23
42
|
};
|
|
24
43
|
return question;
|
|
25
44
|
};
|
|
@@ -58,8 +77,6 @@ export const expUPrimitive = {
|
|
|
58
77
|
id: "expUPrimitive",
|
|
59
78
|
connector: "=",
|
|
60
79
|
label: "Primitive de $u'\\exp(u)$",
|
|
61
|
-
levels: ["TermSpé", "MathComp"],
|
|
62
|
-
sections: ["Primitives", "Exponentielle"],
|
|
63
80
|
isSingleStep: false,
|
|
64
81
|
generator: (nb) => getDistinctQuestions(getExpUPrimitive, nb),
|
|
65
82
|
qcmTimer: 60,
|
|
@@ -68,4 +85,5 @@ export const expUPrimitive = {
|
|
|
68
85
|
isAnswerValid: isExpUPrimitiveAnswerValid,
|
|
69
86
|
subject: "Mathématiques",
|
|
70
87
|
pdfOptions: { shouldSpreadPropositions: true },
|
|
88
|
+
getQuestionFromIdentifiers,
|
|
71
89
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"exponentialPrimitive.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/primitive/exponentialPrimitive.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,
|
|
1
|
+
{"version":3,"file":"exponentialPrimitive.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/primitive/exponentialPrimitive.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAKR,YAAY,EAEZ,iBAAiB,EACjB,GAAG,EAIJ,MAAM,6BAA6B,CAAC;AAYrC,KAAK,WAAW,GAAG;IACjB,CAAC,EAAE,MAAM,CAAC;CACX,CAAC;AAwBF,eAAO,MAAM,uBAAuB,EAAE,iBAAiB,CAAC,WAAW,CAIlE,CAAC;AAiBF,eAAO,MAAM,mCAAmC,EAAE,YAAY,CAAC,WAAW,CAgCzE,CAAC;AAEF,eAAO,MAAM,iCAAiC,EAAE,GAAG,CAAC,WAAW,CAY9D,CAAC;AAEF,eAAO,MAAM,oBAAoB,EAAE,QAAQ,CAAC,WAAW,CAetD,CAAC"}
|
|
@@ -8,17 +8,34 @@ import { FractionNode } from "../../../tree/nodes/operators/fractionNode.js";
|
|
|
8
8
|
import { MultiplyNode } from "../../../tree/nodes/operators/multiplyNode.js";
|
|
9
9
|
import { PowerNode } from "../../../tree/nodes/operators/powerNode.js";
|
|
10
10
|
import { VariableNode } from "../../../tree/nodes/variables/variableNode.js";
|
|
11
|
-
|
|
12
|
-
const a =
|
|
11
|
+
const getInstruction = (identifiers) => {
|
|
12
|
+
const { a } = identifiers;
|
|
13
|
+
const integratedFuction = new MultiplyNode(new NumberNode(a), new ExpNode(new VariableNode("x")));
|
|
14
|
+
return `Déterminer la forme générale des primitives de la fonction $f$ définie par :
|
|
15
|
+
|
|
16
|
+
$$
|
|
17
|
+
f(x) = ${integratedFuction.toTex()}
|
|
18
|
+
$$`;
|
|
19
|
+
};
|
|
20
|
+
const getAnswer = (identifiers) => {
|
|
21
|
+
const { a } = identifiers;
|
|
13
22
|
const integratedFuction = new MultiplyNode(new NumberNode(a), new ExpNode(new VariableNode("x")));
|
|
14
23
|
const answer = new AddNode(integratedFuction, new VariableNode("C")).toTex();
|
|
24
|
+
return answer;
|
|
25
|
+
};
|
|
26
|
+
export const getExponentialPrimitive = () => {
|
|
27
|
+
const a = randint(-20, 20, [0]);
|
|
28
|
+
const identifiers = { a };
|
|
29
|
+
return getQuestionFromIdentifiers(identifiers);
|
|
30
|
+
};
|
|
31
|
+
const getQuestionFromIdentifiers = (identifiers) => {
|
|
15
32
|
const question = {
|
|
16
|
-
instruction:
|
|
33
|
+
instruction: getInstruction(identifiers),
|
|
17
34
|
startStatement: `F(x)`,
|
|
18
|
-
answer,
|
|
35
|
+
answer: getAnswer(identifiers),
|
|
19
36
|
keys: ["x", "C", "epower", "exp"],
|
|
20
37
|
answerFormat: "tex",
|
|
21
|
-
identifiers
|
|
38
|
+
identifiers,
|
|
22
39
|
};
|
|
23
40
|
return question;
|
|
24
41
|
};
|
|
@@ -64,4 +81,5 @@ export const exponentialPrimitive = {
|
|
|
64
81
|
isAnswerValid: isExponentialPrimitiveAnswerValid,
|
|
65
82
|
subject: "Mathématiques",
|
|
66
83
|
pdfOptions: { shouldSpreadPropositions: true },
|
|
84
|
+
getQuestionFromIdentifiers,
|
|
67
85
|
};
|
|
@@ -6,4 +6,6 @@ export { polynomialPrimitive } from "./polynomialPrimitive.js";
|
|
|
6
6
|
export { sinCosPrimitive } from "./sinCosPrimitive.js";
|
|
7
7
|
export { sinUCosUPrimitive } from "./sinUCosUPrimitive.js";
|
|
8
8
|
export * from "./usualPrimitives.js";
|
|
9
|
+
export * from "./kexpUPrimitive.js";
|
|
10
|
+
export * from "./klogUPrimitive.js";
|
|
9
11
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/primitive/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAC3D,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AACjE,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAC/D,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAC/D,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAC3D,cAAc,sBAAsB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/primitive/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAC3D,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AACjE,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAC/D,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAC/D,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAC3D,cAAc,sBAAsB,CAAC;AACrC,cAAc,qBAAqB,CAAC;AACpC,cAAc,qBAAqB,CAAC"}
|
|
@@ -6,3 +6,5 @@ export { polynomialPrimitive } from "./polynomialPrimitive.js";
|
|
|
6
6
|
export { sinCosPrimitive } from "./sinCosPrimitive.js";
|
|
7
7
|
export { sinUCosUPrimitive } from "./sinUCosUPrimitive.js";
|
|
8
8
|
export * from "./usualPrimitives.js";
|
|
9
|
+
export * from "./kexpUPrimitive.js";
|
|
10
|
+
export * from "./klogUPrimitive.js";
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Exercise } from "../../../exercises/exercise.js";
|
|
2
|
+
import { NodeIdentifiers } from "../../../tree/nodes/nodeConstructor.js";
|
|
3
|
+
type Identifiers = {
|
|
4
|
+
kIds: NodeIdentifiers;
|
|
5
|
+
uCoeffs: number[];
|
|
6
|
+
};
|
|
7
|
+
export declare const kexpUPrimitive: Exercise<Identifiers>;
|
|
8
|
+
export {};
|
|
9
|
+
//# sourceMappingURL=kexpUPrimitive.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"kexpUPrimitive.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/primitive/kexpUPrimitive.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAeT,MAAM,6BAA6B,CAAC;AAUrC,OAAO,EACL,eAAe,EAEhB,MAAM,qCAAqC,CAAC;AAQ7C,KAAK,WAAW,GAAG;IACjB,IAAI,EAAE,eAAe,CAAC;IACtB,OAAO,EAAE,MAAM,EAAE,CAAC;CACnB,CAAC;AA4HF,eAAO,MAAM,cAAc,EAAE,QAAQ,CAAC,WAAW,CAiBhD,CAAC"}
|
|
@@ -0,0 +1,130 @@
|
|
|
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 { Polynomial, } from "../../../math/polynomials/polynomial.js";
|
|
5
|
+
import { Trinom, TrinomConstructor } from "../../../math/polynomials/trinom.js";
|
|
6
|
+
import { randint } from "../../../math/utils/random/randint.js";
|
|
7
|
+
import { exp, ExpNode } from "../../../tree/nodes/functions/expNode.js";
|
|
8
|
+
import { reifyAlgebraic, } from "../../../tree/nodes/nodeConstructor.js";
|
|
9
|
+
import { add } from "../../../tree/nodes/operators/addNode.js";
|
|
10
|
+
import { frac } from "../../../tree/nodes/operators/fractionNode.js";
|
|
11
|
+
import { multiply } from "../../../tree/nodes/operators/multiplyNode.js";
|
|
12
|
+
import { parseAlgebraic } from "../../../tree/parsers/latexParser.js";
|
|
13
|
+
import { coinFlip } from "../../../utils/alea/coinFlip.js";
|
|
14
|
+
import { handleVEAError } from "../../../utils/errors/handleVEAError.js";
|
|
15
|
+
//k u' e^u --> k e^u
|
|
16
|
+
const getPropositions = (n, { answer, ...identifiers }) => {
|
|
17
|
+
const propositions = [];
|
|
18
|
+
const { uCoeffs, kIds } = identifiers;
|
|
19
|
+
const k = reifyAlgebraic(kIds);
|
|
20
|
+
const u = new Polynomial(uCoeffs);
|
|
21
|
+
addValidProp(propositions, answer);
|
|
22
|
+
while (propositions.length < n) {
|
|
23
|
+
const kRand = coinFlip()
|
|
24
|
+
? randint(-5, 6, [0, 1, -1]).toTree()
|
|
25
|
+
: RationalConstructor.randomIrreductibleProba().toTree();
|
|
26
|
+
tryToAddWrongProp(propositions, multiply(kRand, exp(u.toTree())).toTex() + "+C");
|
|
27
|
+
}
|
|
28
|
+
return shuffleProps(propositions, n);
|
|
29
|
+
};
|
|
30
|
+
const getAnswer = (identifiers) => {
|
|
31
|
+
const { uCoeffs, kIds } = identifiers;
|
|
32
|
+
const k = reifyAlgebraic(kIds);
|
|
33
|
+
const u = new Polynomial(uCoeffs);
|
|
34
|
+
const integratedFuction = new ExpNode(u.toTree());
|
|
35
|
+
const answer = add(multiply(k, integratedFuction), "C").toTex();
|
|
36
|
+
return answer;
|
|
37
|
+
};
|
|
38
|
+
const getInstruction = (identifiers) => {
|
|
39
|
+
const { uCoeffs, kIds } = identifiers;
|
|
40
|
+
const u = new Polynomial(uCoeffs).toTree();
|
|
41
|
+
const uprime = u.derivative().simplify({
|
|
42
|
+
towardsDistribute: true,
|
|
43
|
+
forbidFactorize: true,
|
|
44
|
+
});
|
|
45
|
+
const k = reifyAlgebraic(kIds);
|
|
46
|
+
const fct = multiply(multiply(k, uprime).simplify({
|
|
47
|
+
towardsDistribute: true,
|
|
48
|
+
forbidFactorize: true,
|
|
49
|
+
forceDistributeFractions: true,
|
|
50
|
+
}), new ExpNode(u));
|
|
51
|
+
return `Déterminer la forme générale des primitives de la fonction $f$ définie par :
|
|
52
|
+
|
|
53
|
+
$$
|
|
54
|
+
f(x) = ${fct.toTex()}
|
|
55
|
+
$$`;
|
|
56
|
+
};
|
|
57
|
+
// const getHint: GetHint<Identifiers> = (identifiers) => {};
|
|
58
|
+
// const getCorrection: GetCorrection<Identifiers> = (identifiers) => {};
|
|
59
|
+
const getKeys = (identifiers) => {
|
|
60
|
+
return ["epower", "x", "C"];
|
|
61
|
+
};
|
|
62
|
+
const isAnswerValid = (ans, { answer }) => {
|
|
63
|
+
try {
|
|
64
|
+
const parsed = parseAlgebraic(ans);
|
|
65
|
+
if (!parsed)
|
|
66
|
+
return false;
|
|
67
|
+
return (parsed
|
|
68
|
+
.simplify({
|
|
69
|
+
towardsDistribute: true,
|
|
70
|
+
forbidFactorize: true,
|
|
71
|
+
forceDistributeFractions: true,
|
|
72
|
+
decimalToFractions: true,
|
|
73
|
+
})
|
|
74
|
+
.toTex() === answer);
|
|
75
|
+
}
|
|
76
|
+
catch (err) {
|
|
77
|
+
return handleVEAError(err);
|
|
78
|
+
}
|
|
79
|
+
};
|
|
80
|
+
const getKexpUPrimitiveQuestion = (ops) => {
|
|
81
|
+
const kIsInt = coinFlip();
|
|
82
|
+
let k;
|
|
83
|
+
let u;
|
|
84
|
+
if (kIsInt) {
|
|
85
|
+
k = randint(-4, 5, [0, 1, -1]).toTree();
|
|
86
|
+
u = TrinomConstructor.random();
|
|
87
|
+
}
|
|
88
|
+
else {
|
|
89
|
+
const denum = randint(2, 6);
|
|
90
|
+
k = frac(1, denum);
|
|
91
|
+
u = new Trinom(denum * randint(1, 4), denum * randint(1, 4), randint(-9, 10));
|
|
92
|
+
}
|
|
93
|
+
// const k = coinFlip()
|
|
94
|
+
// ? randint(-9, 10, [0, 1, -1]).toTree()
|
|
95
|
+
// : RationalConstructor.randomIrreductibleProba().toTree();
|
|
96
|
+
// const u = TrinomConstructor.random();
|
|
97
|
+
const identifiers = {
|
|
98
|
+
kIds: k.toIdentifiers(),
|
|
99
|
+
uCoeffs: u.coefficients,
|
|
100
|
+
};
|
|
101
|
+
return getQuestionFromIdentifiers(identifiers);
|
|
102
|
+
};
|
|
103
|
+
const getQuestionFromIdentifiers = (identifiers) => {
|
|
104
|
+
return {
|
|
105
|
+
answer: getAnswer(identifiers),
|
|
106
|
+
instruction: getInstruction(identifiers),
|
|
107
|
+
keys: getKeys(identifiers),
|
|
108
|
+
answerFormat: "tex",
|
|
109
|
+
identifiers,
|
|
110
|
+
// hint: getHint(identifiers),
|
|
111
|
+
// correction: getCorrection(identifiers),
|
|
112
|
+
};
|
|
113
|
+
};
|
|
114
|
+
export const kexpUPrimitive = {
|
|
115
|
+
id: "kexpUPrimitive",
|
|
116
|
+
connector: "=",
|
|
117
|
+
label: "Primitive du type $k u'\\exp(u)$",
|
|
118
|
+
isSingleStep: true,
|
|
119
|
+
generator: (nb, opts) => getDistinctQuestions(() => getKexpUPrimitiveQuestion(opts), nb),
|
|
120
|
+
qcmTimer: 60,
|
|
121
|
+
freeTimer: 60,
|
|
122
|
+
getPropositions,
|
|
123
|
+
isAnswerValid,
|
|
124
|
+
subject: "Mathématiques",
|
|
125
|
+
getInstruction,
|
|
126
|
+
// getHint,
|
|
127
|
+
// getCorrection,
|
|
128
|
+
getAnswer,
|
|
129
|
+
getQuestionFromIdentifiers,
|
|
130
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Exercise } from "../../../exercises/exercise.js";
|
|
2
|
+
import { NodeIdentifiers } from "../../../tree/nodes/nodeConstructor.js";
|
|
3
|
+
type Identifiers = {
|
|
4
|
+
kIds: NodeIdentifiers;
|
|
5
|
+
uCoeffs: number[];
|
|
6
|
+
};
|
|
7
|
+
export declare const klogUPrimitive: Exercise<Identifiers>;
|
|
8
|
+
export {};
|
|
9
|
+
//# sourceMappingURL=klogUPrimitive.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"klogUPrimitive.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/primitive/klogUPrimitive.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAeT,MAAM,6BAA6B,CAAC;AASrC,OAAO,EACL,eAAe,EAEhB,MAAM,qCAAqC,CAAC;AAQ7C,KAAK,WAAW,GAAG;IACjB,IAAI,EAAE,eAAe,CAAC;IACtB,OAAO,EAAE,MAAM,EAAE,CAAC;CACnB,CAAC;AAqHF,eAAO,MAAM,cAAc,EAAE,QAAQ,CAAC,WAAW,CAiBhD,CAAC"}
|