math-exercises 3.0.168 → 3.0.170
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/derivation/derivativeNumber/averageRateOfChangeAlgebraicExpression.d.ts +4 -3
- package/lib/exercises/math/derivation/derivativeNumber/averageRateOfChangeAlgebraicExpression.d.ts.map +1 -1
- package/lib/exercises/math/derivation/derivativeNumber/averageRateOfChangeAlgebraicExpression.js +236 -52
- package/lib/exercises/math/derivation/derivativeNumber/expressFAPlusH.d.ts +13 -0
- package/lib/exercises/math/derivation/derivativeNumber/expressFAPlusH.d.ts.map +1 -0
- package/lib/exercises/math/derivation/derivativeNumber/expressFAPlusH.js +225 -0
- package/lib/exercises/math/derivation/derivativeNumber/findAverageRateLimit.d.ts +14 -0
- package/lib/exercises/math/derivation/derivativeNumber/findAverageRateLimit.d.ts.map +1 -0
- package/lib/exercises/math/derivation/derivativeNumber/findAverageRateLimit.js +162 -0
- package/lib/exercises/math/derivation/derivativeNumber/index.d.ts +3 -0
- package/lib/exercises/math/derivation/derivativeNumber/index.d.ts.map +1 -1
- package/lib/exercises/math/derivation/derivativeNumber/index.js +3 -1
- package/lib/exercises/math/derivation/tangent/derivativeNumberReading.d.ts +4 -1
- package/lib/exercises/math/derivation/tangent/derivativeNumberReading.d.ts.map +1 -1
- package/lib/exercises/math/derivation/tangent/derivativeNumberReading.js +50 -9
- package/lib/exercises/math/derivation/variations/signVarTableFromDerivativeGraph.js +1 -1
- package/lib/exercises/math/derivation/variations/signVarTableFromGraph.js +1 -1
- package/lib/exercises/math/functions/trinoms/equation/findTwoNumbersFromSumAndProduct.d.ts +8 -0
- package/lib/exercises/math/functions/trinoms/equation/findTwoNumbersFromSumAndProduct.d.ts.map +1 -0
- package/lib/exercises/math/functions/trinoms/equation/findTwoNumbersFromSumAndProduct.js +182 -0
- package/lib/exercises/math/functions/trinoms/equation/index.d.ts +1 -0
- package/lib/exercises/math/functions/trinoms/equation/index.d.ts.map +1 -1
- package/lib/exercises/math/functions/trinoms/equation/index.js +1 -0
- package/lib/exercises/math/functions/trinoms/equation/trinomSelectEquationWithoutDeltaNeeded.js +1 -1
- package/lib/exercises/math/functions/trinoms/index.d.ts +1 -0
- package/lib/exercises/math/functions/trinoms/index.d.ts.map +1 -1
- package/lib/exercises/math/functions/trinoms/index.js +1 -0
- package/lib/exercises/math/functions/trinoms/problems/index.d.ts +3 -0
- package/lib/exercises/math/functions/trinoms/problems/index.d.ts.map +1 -0
- package/lib/exercises/math/functions/trinoms/problems/index.js +2 -0
- package/lib/exercises/math/functions/trinoms/problems/maxSurfaceForGivenClosure.d.ts +11 -0
- package/lib/exercises/math/functions/trinoms/problems/maxSurfaceForGivenClosure.d.ts.map +1 -0
- package/lib/exercises/math/functions/trinoms/problems/maxSurfaceForGivenClosure.js +212 -0
- package/lib/exercises/math/functions/trinoms/problems/swedishFlag.d.ts +8 -0
- package/lib/exercises/math/functions/trinoms/problems/swedishFlag.d.ts.map +1 -0
- package/lib/exercises/math/functions/trinoms/problems/swedishFlag.js +174 -0
- package/lib/exercises/math/functions/trinoms/summitAndCanonical/findTrinomCanonicalFormFromGraph.js +2 -2
- package/lib/exercises/math/functions/trinoms/summitAndCanonical/summitReading.d.ts.map +1 -1
- package/lib/exercises/math/functions/trinoms/summitAndCanonical/summitReading.js +22 -1
- package/lib/exercises/math/sequences/arithmetic/recognizeArithmeticFromGraph.d.ts +4 -1
- package/lib/exercises/math/sequences/arithmetic/recognizeArithmeticFromGraph.d.ts.map +1 -1
- package/lib/exercises/math/sequences/arithmetic/recognizeArithmeticFromGraph.js +45 -20
- package/lib/exercises/math/sequences/arithmetic/recognizeReasonFromGraph.d.ts +4 -1
- package/lib/exercises/math/sequences/arithmetic/recognizeReasonFromGraph.d.ts.map +1 -1
- package/lib/exercises/math/sequences/arithmetic/recognizeReasonFromGraph.js +43 -9
- package/lib/exercises/math/sequences/index.d.ts +1 -0
- package/lib/exercises/math/sequences/index.d.ts.map +1 -1
- package/lib/exercises/math/sequences/index.js +1 -0
- package/lib/exercises/math/sequences/variations/expressConsecutiveTermsDifference.d.ts +11 -0
- package/lib/exercises/math/sequences/variations/expressConsecutiveTermsDifference.d.ts.map +1 -0
- package/lib/exercises/math/sequences/variations/expressConsecutiveTermsDifference.js +160 -0
- package/lib/exercises/math/sequences/variations/index.d.ts +2 -0
- package/lib/exercises/math/sequences/variations/index.d.ts.map +1 -0
- package/lib/exercises/math/sequences/variations/index.js +1 -0
- package/lib/exercises/math/trigonometry/circle/findAngleFromCosAndSin.d.ts.map +1 -1
- package/lib/exercises/math/trigonometry/circle/findAngleFromCosAndSin.js +0 -1
- package/lib/exercises/math/trigonometry/circle/findAssociateAnglePointOnTrigoCircle.d.ts +8 -0
- package/lib/exercises/math/trigonometry/circle/findAssociateAnglePointOnTrigoCircle.d.ts.map +1 -0
- package/lib/exercises/math/trigonometry/circle/findAssociateAnglePointOnTrigoCircle.js +158 -0
- package/lib/exercises/math/trigonometry/circle/index.d.ts +2 -0
- package/lib/exercises/math/trigonometry/circle/index.d.ts.map +1 -1
- package/lib/exercises/math/trigonometry/circle/index.js +2 -0
- package/lib/exercises/math/trigonometry/circle/mainAngleMeasure.d.ts.map +1 -1
- package/lib/exercises/math/trigonometry/circle/mainAngleMeasure.js +8 -3
- package/lib/exercises/math/trigonometry/circle/placeAssociateAngleOnCircle.d.ts +8 -0
- package/lib/exercises/math/trigonometry/circle/placeAssociateAngleOnCircle.d.ts.map +1 -0
- package/lib/exercises/math/trigonometry/circle/placeAssociateAngleOnCircle.js +167 -0
- package/lib/exercises/utils/geogebra/toolBarConstructor.d.ts +2 -0
- package/lib/exercises/utils/geogebra/toolBarConstructor.d.ts.map +1 -1
- package/lib/exercises/utils/geogebra/toolBarConstructor.js +4 -0
- package/lib/index.d.ts +52 -4
- package/lib/index.d.ts.map +1 -1
- package/lib/math/geometry/segment.d.ts +1 -1
- package/lib/math/polynomials/trinom.d.ts +1 -1
- package/lib/math/polynomials/trinom.d.ts.map +1 -1
- package/lib/math/polynomials/trinom.js +2 -2
- package/lib/playground.d.ts.map +1 -1
- package/lib/playground.js +1 -3
- package/lib/tree/nodes/algebraicNode.d.ts +2 -0
- package/lib/tree/nodes/algebraicNode.d.ts.map +1 -1
- package/lib/tree/nodes/complex/complexNode.d.ts +1 -0
- package/lib/tree/nodes/complex/complexNode.d.ts.map +1 -1
- package/lib/tree/nodes/complex/complexNode.js +3 -0
- package/lib/tree/nodes/equations/equalNode.d.ts +1 -0
- package/lib/tree/nodes/equations/equalNode.d.ts.map +1 -1
- package/lib/tree/nodes/equations/equalNode.js +3 -0
- package/lib/tree/nodes/equations/equationSolutionNode.d.ts +1 -0
- package/lib/tree/nodes/equations/equationSolutionNode.d.ts.map +1 -1
- package/lib/tree/nodes/equations/equationSolutionNode.js +3 -0
- package/lib/tree/nodes/equations/multiEqualNode.d.ts +1 -0
- package/lib/tree/nodes/equations/multiEqualNode.d.ts.map +1 -1
- package/lib/tree/nodes/equations/multiEqualNode.js +3 -0
- package/lib/tree/nodes/equations/notEqualNode.d.ts +1 -0
- package/lib/tree/nodes/equations/notEqualNode.d.ts.map +1 -1
- package/lib/tree/nodes/equations/notEqualNode.js +3 -0
- package/lib/tree/nodes/functions/absNode.d.ts +1 -0
- package/lib/tree/nodes/functions/absNode.d.ts.map +1 -1
- package/lib/tree/nodes/functions/absNode.js +3 -0
- package/lib/tree/nodes/functions/arcSinNode.d.ts +1 -0
- package/lib/tree/nodes/functions/arcSinNode.d.ts.map +1 -1
- package/lib/tree/nodes/functions/arcSinNode.js +3 -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 +3 -0
- package/lib/tree/nodes/functions/arctanNode.d.ts +1 -0
- package/lib/tree/nodes/functions/arctanNode.d.ts.map +1 -1
- package/lib/tree/nodes/functions/arctanNode.js +3 -0
- package/lib/tree/nodes/functions/cosNode.d.ts +1 -0
- package/lib/tree/nodes/functions/cosNode.d.ts.map +1 -1
- package/lib/tree/nodes/functions/cosNode.js +3 -0
- package/lib/tree/nodes/functions/expNode.d.ts +1 -0
- package/lib/tree/nodes/functions/expNode.d.ts.map +1 -1
- package/lib/tree/nodes/functions/expNode.js +3 -0
- package/lib/tree/nodes/functions/integralNode.d.ts +1 -0
- package/lib/tree/nodes/functions/integralNode.d.ts.map +1 -1
- package/lib/tree/nodes/functions/integralNode.js +3 -0
- package/lib/tree/nodes/functions/log10Node.d.ts +1 -0
- package/lib/tree/nodes/functions/log10Node.d.ts.map +1 -1
- package/lib/tree/nodes/functions/log10Node.js +3 -0
- package/lib/tree/nodes/functions/logNode.d.ts +1 -0
- package/lib/tree/nodes/functions/logNode.d.ts.map +1 -1
- package/lib/tree/nodes/functions/logNode.js +3 -0
- package/lib/tree/nodes/functions/oppositeNode.d.ts +1 -0
- package/lib/tree/nodes/functions/oppositeNode.d.ts.map +1 -1
- package/lib/tree/nodes/functions/oppositeNode.js +6 -0
- package/lib/tree/nodes/functions/sinNode.d.ts +1 -0
- package/lib/tree/nodes/functions/sinNode.d.ts.map +1 -1
- package/lib/tree/nodes/functions/sinNode.js +3 -0
- package/lib/tree/nodes/functions/sqrtNode.d.ts +1 -2
- package/lib/tree/nodes/functions/sqrtNode.d.ts.map +1 -1
- package/lib/tree/nodes/functions/tanNode.d.ts +1 -0
- package/lib/tree/nodes/functions/tanNode.d.ts.map +1 -1
- package/lib/tree/nodes/functions/tanNode.js +3 -0
- package/lib/tree/nodes/geometry/degree.d.ts +1 -0
- package/lib/tree/nodes/geometry/degree.d.ts.map +1 -1
- package/lib/tree/nodes/geometry/degree.js +3 -0
- package/lib/tree/nodes/geometry/lengthNode.d.ts +1 -0
- package/lib/tree/nodes/geometry/lengthNode.d.ts.map +1 -1
- package/lib/tree/nodes/geometry/lengthNode.js +3 -0
- package/lib/tree/nodes/geometry/pointNode.d.ts +1 -0
- package/lib/tree/nodes/geometry/pointNode.d.ts.map +1 -1
- package/lib/tree/nodes/geometry/pointNode.js +3 -0
- package/lib/tree/nodes/geometry/vectorNode.d.ts +1 -0
- package/lib/tree/nodes/geometry/vectorNode.d.ts.map +1 -1
- package/lib/tree/nodes/geometry/vectorNode.js +3 -0
- package/lib/tree/nodes/inequations/inequationNode.d.ts +1 -0
- package/lib/tree/nodes/inequations/inequationNode.d.ts.map +1 -1
- package/lib/tree/nodes/inequations/inequationNode.js +3 -0
- package/lib/tree/nodes/inequations/inequationSolutionNode.d.ts +1 -0
- package/lib/tree/nodes/inequations/inequationSolutionNode.d.ts.map +1 -1
- package/lib/tree/nodes/inequations/inequationSolutionNode.js +3 -0
- package/lib/tree/nodes/numbers/constantNode.d.ts +3 -2
- package/lib/tree/nodes/numbers/constantNode.d.ts.map +1 -1
- package/lib/tree/nodes/numbers/constantNode.js +7 -1
- package/lib/tree/nodes/numbers/numberNode.d.ts +1 -0
- package/lib/tree/nodes/numbers/numberNode.d.ts.map +1 -1
- package/lib/tree/nodes/numbers/numberNode.js +6 -0
- package/lib/tree/nodes/numbers/percentNode.d.ts +1 -0
- package/lib/tree/nodes/numbers/percentNode.d.ts.map +1 -1
- package/lib/tree/nodes/numbers/percentNode.js +3 -0
- package/lib/tree/nodes/operators/addNode.js +17 -14
- package/lib/tree/nodes/operators/binomialCoefficientNode.d.ts +1 -0
- package/lib/tree/nodes/operators/binomialCoefficientNode.d.ts.map +1 -1
- package/lib/tree/nodes/operators/binomialCoefficientNode.js +3 -0
- package/lib/tree/nodes/operators/divideNode.d.ts +1 -0
- package/lib/tree/nodes/operators/divideNode.d.ts.map +1 -1
- package/lib/tree/nodes/operators/divideNode.js +3 -0
- package/lib/tree/nodes/operators/fractionNode.d.ts.map +1 -1
- package/lib/tree/nodes/operators/limitNode.d.ts +1 -0
- package/lib/tree/nodes/operators/limitNode.d.ts.map +1 -1
- package/lib/tree/nodes/operators/limitNode.js +3 -0
- package/lib/tree/nodes/operators/powerNode.d.ts +1 -0
- package/lib/tree/nodes/operators/powerNode.d.ts.map +1 -1
- package/lib/tree/nodes/operators/powerNode.js +6 -0
- package/lib/tree/nodes/polynomials/monomNode.d.ts +1 -0
- package/lib/tree/nodes/polynomials/monomNode.d.ts.map +1 -1
- package/lib/tree/nodes/polynomials/monomNode.js +3 -0
- package/lib/tree/nodes/polynomials/trinomNode.d.ts +1 -0
- package/lib/tree/nodes/polynomials/trinomNode.d.ts.map +1 -1
- package/lib/tree/nodes/polynomials/trinomNode.js +3 -0
- package/lib/tree/nodes/sets/belongsNode.d.ts +1 -0
- package/lib/tree/nodes/sets/belongsNode.d.ts.map +1 -1
- package/lib/tree/nodes/sets/belongsNode.js +3 -0
- package/lib/tree/nodes/sets/discreteSetNode.d.ts +1 -0
- package/lib/tree/nodes/sets/discreteSetNode.d.ts.map +1 -1
- package/lib/tree/nodes/sets/discreteSetNode.js +3 -0
- package/lib/tree/nodes/sets/intervalNode.d.ts +1 -0
- package/lib/tree/nodes/sets/intervalNode.d.ts.map +1 -1
- package/lib/tree/nodes/sets/intervalNode.js +3 -0
- package/lib/tree/nodes/sets/unionIntervalNode.d.ts +1 -0
- package/lib/tree/nodes/sets/unionIntervalNode.d.ts.map +1 -1
- package/lib/tree/nodes/sets/unionIntervalNode.js +3 -0
- package/lib/tree/nodes/variables/variableNode.d.ts +1 -0
- package/lib/tree/nodes/variables/variableNode.d.ts.map +1 -1
- package/lib/tree/nodes/variables/variableNode.js +3 -0
- package/package.json +1 -1
package/lib/exercises/math/derivation/derivativeNumber/averageRateOfChangeAlgebraicExpression.d.ts
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { Exercise } from "../../../../exercises/exercise.js";
|
|
2
2
|
import { NodeIdentifiers } from "../../../../tree/nodes/nodeConstructor.js";
|
|
3
3
|
type Identifiers = {
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
type: number;
|
|
5
|
+
functionIds: NodeIdentifiers;
|
|
6
|
+
a: number;
|
|
6
7
|
};
|
|
7
8
|
type Options = {
|
|
8
|
-
|
|
9
|
+
functionTypes: string[];
|
|
9
10
|
};
|
|
10
11
|
export declare const averageRateOfChangeAlgebraicExpression: Exercise<Identifiers, Options>;
|
|
11
12
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"averageRateOfChangeAlgebraicExpression.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/derivation/derivativeNumber/averageRateOfChangeAlgebraicExpression.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAkBT,MAAM,6BAA6B,CAAC;AAMrC,OAAO,EACL,eAAe,EAEhB,MAAM,qCAAqC,CAAC;
|
|
1
|
+
{"version":3,"file":"averageRateOfChangeAlgebraicExpression.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/derivation/derivativeNumber/averageRateOfChangeAlgebraicExpression.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAkBT,MAAM,6BAA6B,CAAC;AAMrC,OAAO,EACL,eAAe,EAEhB,MAAM,qCAAqC,CAAC;AAY7C,KAAK,WAAW,GAAG;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,eAAe,CAAC;IAC7B,CAAC,EAAE,MAAM,CAAC;CACX,CAAC;AAkSF,KAAK,OAAO,GAAG;IACb,aAAa,EAAE,MAAM,EAAE,CAAC;CACzB,CAAC;AA8BF,eAAO,MAAM,sCAAsC,EAAE,QAAQ,CAC3D,WAAW,EACX,OAAO,CAwBR,CAAC"}
|
package/lib/exercises/math/derivation/derivativeNumber/averageRateOfChangeAlgebraicExpression.js
CHANGED
|
@@ -1,90 +1,285 @@
|
|
|
1
|
-
import { addValidProp, shuffleProps, GeneratorOptionTarget, GeneratorOptionType,
|
|
1
|
+
import { addValidProp, shuffleProps, GeneratorOptionTarget, GeneratorOptionType, tryToAddWrongProp, } from "../../../../exercises/exercise.js";
|
|
2
2
|
import { getDistinctQuestions } from "../../../../exercises/utils/getDistinctQuestions.js";
|
|
3
|
-
import { rationalVEA } from "../../../../exercises/vea/rationalVEA.js";
|
|
4
3
|
import { AffineConstructor } from "../../../../math/polynomials/affine.js";
|
|
5
4
|
import { TrinomConstructor } from "../../../../math/polynomials/trinom.js";
|
|
6
5
|
import { randint } from "../../../../math/utils/random/randint.js";
|
|
6
|
+
import { round } from "../../../../math/utils/round.js";
|
|
7
7
|
import { reifyAlgebraic, } from "../../../../tree/nodes/nodeConstructor.js";
|
|
8
8
|
import { add } from "../../../../tree/nodes/operators/addNode.js";
|
|
9
9
|
import { frac } from "../../../../tree/nodes/operators/fractionNode.js";
|
|
10
|
+
import { multiply } from "../../../../tree/nodes/operators/multiplyNode.js";
|
|
11
|
+
import { square } from "../../../../tree/nodes/operators/powerNode.js";
|
|
10
12
|
import { substract } from "../../../../tree/nodes/operators/substractNode.js";
|
|
13
|
+
import { parseAlgebraic } from "../../../../tree/parsers/latexParser.js";
|
|
11
14
|
import { random } from "../../../../utils/alea/random.js";
|
|
15
|
+
import { doWhile } from "../../../../utils/doWhile.js";
|
|
12
16
|
import { handleVEAError } from "../../../../utils/errors/handleVEAError.js";
|
|
13
|
-
|
|
17
|
+
import { alignTex } from "../../../../utils/latex/alignTex.js";
|
|
18
|
+
const getPropositions = (n, { answer, ...identifiers }) => {
|
|
14
19
|
const propositions = [];
|
|
20
|
+
const { a, functionIds } = identifiers;
|
|
21
|
+
const fct = reifyAlgebraic(functionIds);
|
|
15
22
|
addValidProp(propositions, answer);
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
23
|
+
tryToAddWrongProp(propositions, fct
|
|
24
|
+
.toDetailedEvaluation({ x: a.toTree() })
|
|
25
|
+
.simplify({
|
|
26
|
+
towardsDistribute: true,
|
|
27
|
+
forbidFactorize: true,
|
|
28
|
+
})
|
|
29
|
+
.toTex());
|
|
30
|
+
tryToAddWrongProp(propositions, fct
|
|
31
|
+
.toDetailedEvaluation({ x: "h".toTree() })
|
|
32
|
+
.simplify({
|
|
33
|
+
towardsDistribute: true,
|
|
34
|
+
forbidFactorize: true,
|
|
35
|
+
})
|
|
36
|
+
.toTex());
|
|
37
|
+
let safeA = randint(-10, 10, [0]);
|
|
38
|
+
let isSafe = false;
|
|
39
|
+
let counter = 0;
|
|
40
|
+
while (!isSafe && counter < 100) {
|
|
41
|
+
counter++;
|
|
42
|
+
if (counter > 100) {
|
|
43
|
+
throw new Error("Too many iterations in getPropositions expressFAPlusH");
|
|
44
|
+
}
|
|
45
|
+
try {
|
|
46
|
+
fct.toDetailedEvaluation({ x: safeA.toTree() }).simplify();
|
|
47
|
+
isSafe = true;
|
|
48
|
+
}
|
|
49
|
+
catch (_e) {
|
|
50
|
+
safeA = randint(-10, 10, [0]);
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
tryToAddWrongProp(propositions, fct
|
|
54
|
+
.toDetailedEvaluation({ x: add(safeA, "h") })
|
|
55
|
+
.simplify({
|
|
56
|
+
towardsDistribute: true,
|
|
57
|
+
forbidFactorize: true,
|
|
58
|
+
})
|
|
59
|
+
.toTex());
|
|
19
60
|
return shuffleProps(propositions, n);
|
|
20
61
|
};
|
|
21
|
-
const
|
|
22
|
-
const {
|
|
23
|
-
const
|
|
24
|
-
const
|
|
25
|
-
const
|
|
26
|
-
const fah = fx.toDetailedEvaluation({ x: add(a, "h") }).simplify({
|
|
62
|
+
const getAnswerNode = (identifiers) => {
|
|
63
|
+
const { a, functionIds, type } = identifiers;
|
|
64
|
+
const fct = reifyAlgebraic(functionIds);
|
|
65
|
+
const faSimp = fct.toDetailedEvaluation({ x: a.toTree() }).simplify();
|
|
66
|
+
const fahSimp = fct.toDetailedEvaluation({ x: add(a, "h") }).simplify({
|
|
27
67
|
towardsDistribute: true,
|
|
28
68
|
forbidFactorize: true,
|
|
29
69
|
});
|
|
30
|
-
|
|
70
|
+
const diff = substract(fahSimp, faSimp);
|
|
71
|
+
const diffSimp = diff.simplify({
|
|
72
|
+
towardsDistribute: true,
|
|
73
|
+
forbidFactorize: true,
|
|
74
|
+
forceAddFractions: true,
|
|
75
|
+
});
|
|
76
|
+
const taux = type === 0 || type === 1
|
|
77
|
+
? frac(diffSimp, "h")
|
|
78
|
+
: multiply(diffSimp, frac(1, "h"));
|
|
79
|
+
//? terrible manipulation pour faire marcher le cas dans ce cas très chiant
|
|
80
|
+
const tauxSimp = type === 3
|
|
81
|
+
? frac(frac(diffSimp.leftChild, "h").simplify({
|
|
82
|
+
forceDistributeFractions: true,
|
|
83
|
+
}), diffSimp.rightChild)
|
|
84
|
+
: taux.simplify({
|
|
85
|
+
forceDistributeFractions: type === 0 || type === 1,
|
|
86
|
+
});
|
|
87
|
+
return tauxSimp;
|
|
88
|
+
};
|
|
89
|
+
const getAnswer = (identifiers) => {
|
|
90
|
+
return getAnswerNode(identifiers).toTex();
|
|
31
91
|
};
|
|
32
92
|
const getInstruction = (identifiers) => {
|
|
33
|
-
const {
|
|
34
|
-
const
|
|
35
|
-
|
|
36
|
-
return `Soit $f$ la fonction définie sur $\\mathbb{R}$ par :
|
|
93
|
+
const { a, functionIds } = identifiers;
|
|
94
|
+
const fct = reifyAlgebraic(functionIds);
|
|
95
|
+
return `On considère la fonction $f$ définie par :
|
|
37
96
|
|
|
38
97
|
$$
|
|
39
|
-
f(x) = ${
|
|
98
|
+
f(x) = ${fct.toTex()}
|
|
40
99
|
$$
|
|
41
100
|
|
|
42
|
-
Pour
|
|
43
|
-
`;
|
|
101
|
+
Pour $h>0$, exprimer le taux d'accroissement de $f$ entre $${a}$ et $${a}+h$ en fonction de $h$.`;
|
|
44
102
|
};
|
|
45
|
-
const getHint = () => {
|
|
46
|
-
|
|
103
|
+
const getHint = (identifiers) => {
|
|
104
|
+
const { a } = identifiers;
|
|
105
|
+
return `Le taux d'accroissement d'une fonction $f$ entre deux nombres réels $a$ et $b$ est égal à :
|
|
106
|
+
|
|
107
|
+
$$
|
|
108
|
+
\\frac{f(b)-f(a)}{b-a}
|
|
109
|
+
$$
|
|
110
|
+
|
|
111
|
+
Ici, on pose $b=${a}+h$. Le taux d'accroissement vaut donc :
|
|
112
|
+
|
|
113
|
+
$$
|
|
114
|
+
\\frac{f(${a}+h)-f(${a})}{h}
|
|
115
|
+
$$
|
|
116
|
+
`;
|
|
47
117
|
};
|
|
48
|
-
const getCorrection = () => {
|
|
49
|
-
|
|
118
|
+
const getCorrection = (identifiers) => {
|
|
119
|
+
const { a, functionIds, type } = identifiers;
|
|
120
|
+
const fct = reifyAlgebraic(functionIds);
|
|
121
|
+
const fa = fct.toDetailedEvaluation({ x: a.toTree() });
|
|
122
|
+
const faSimp = fa.simplify();
|
|
123
|
+
const fah = fct.toDetailedEvaluation({ x: add(a, "h") });
|
|
124
|
+
const fahSimp = fct.toDetailedEvaluation({ x: add(a, "h") }).simplify({
|
|
125
|
+
towardsDistribute: true,
|
|
126
|
+
forbidFactorize: true,
|
|
127
|
+
});
|
|
128
|
+
const diff = substract(fahSimp, faSimp);
|
|
129
|
+
const diffPreSimp = diff.simplify({
|
|
130
|
+
// towardsDistribute: true,
|
|
131
|
+
forbidFactorize: true,
|
|
132
|
+
forceAddFractions: true,
|
|
133
|
+
});
|
|
134
|
+
const diffSimp = diff.simplify({
|
|
135
|
+
towardsDistribute: true,
|
|
136
|
+
forbidFactorize: true,
|
|
137
|
+
forceAddFractions: true,
|
|
138
|
+
});
|
|
139
|
+
const taux = type === 0 || type === 1
|
|
140
|
+
? frac(diffSimp, "h")
|
|
141
|
+
: multiply(diffSimp, frac(1, "h"));
|
|
142
|
+
//? terrible manipulation pour faire marcher le cas dans ce cas très chiant
|
|
143
|
+
const tauxSimp = type === 3
|
|
144
|
+
? frac(frac(diffSimp.leftChild, "h").simplify({
|
|
145
|
+
forceDistributeFractions: true,
|
|
146
|
+
}), diffSimp.rightChild)
|
|
147
|
+
: taux.simplify({
|
|
148
|
+
forceDistributeFractions: type === 0 || type === 1,
|
|
149
|
+
});
|
|
150
|
+
return `Le taux d'accroissement de $f$ entre $${a}$ et $${a}+h$ vaut :
|
|
151
|
+
|
|
152
|
+
$$
|
|
153
|
+
\\frac{f(${a}+h)-f(${a})}{h}
|
|
154
|
+
$$
|
|
155
|
+
|
|
156
|
+
On calcule donc $f(${a})$ :
|
|
157
|
+
|
|
158
|
+
${alignTex([
|
|
159
|
+
[`f(${a})`, "=", type === 2 ? fa.toSimplificationTex() : fa.toTex()],
|
|
160
|
+
...(type !== 2 ? [["", "=", faSimp.toTex()]] : []),
|
|
161
|
+
])}
|
|
162
|
+
|
|
163
|
+
Puis $f(${a}+h)$ :
|
|
164
|
+
|
|
165
|
+
${alignTex([
|
|
166
|
+
[`f(${a}+h)`, "=", fah.toTex()],
|
|
167
|
+
["", "=", fahSimp.toTex()],
|
|
168
|
+
])}
|
|
169
|
+
|
|
170
|
+
Puis $f(${a}+h)-f(${a})$ :
|
|
171
|
+
|
|
172
|
+
${alignTex([
|
|
173
|
+
[`f(${a}+h)-f(${a})`, "=", diff.toTex()],
|
|
174
|
+
["", "=", diffPreSimp.toTex()],
|
|
175
|
+
...(type !== 0 && type !== 1 ? [["", "=", diffSimp.toTex()]] : []),
|
|
176
|
+
])}
|
|
177
|
+
|
|
178
|
+
Enfin, on divise par $h$ pour obtenir le taux d'accroissement de $f$ entre $${a}$ et $${a}+h$ :
|
|
179
|
+
|
|
180
|
+
${alignTex([
|
|
181
|
+
[`\\frac{f(${a}+h)-f(${a})}{h}`, "=", taux.toTex()],
|
|
182
|
+
["", "=", tauxSimp.toTex()],
|
|
183
|
+
])}
|
|
184
|
+
`;
|
|
50
185
|
};
|
|
51
186
|
const getKeys = () => {
|
|
52
187
|
return ["h"];
|
|
53
188
|
};
|
|
54
|
-
const isAnswerValid = (ans, { answer }) => {
|
|
189
|
+
const isAnswerValid = (ans, { answer, ...identifiers }) => {
|
|
55
190
|
try {
|
|
56
|
-
|
|
191
|
+
const parsed = parseAlgebraic(ans);
|
|
192
|
+
if (!parsed)
|
|
193
|
+
return false;
|
|
194
|
+
return (parsed
|
|
195
|
+
.simplify({ towardsDistribute: true, forbidFactorize: true })
|
|
196
|
+
.toTex() ===
|
|
197
|
+
getAnswerNode(identifiers)
|
|
198
|
+
.simplify({
|
|
199
|
+
towardsDistribute: true,
|
|
200
|
+
forbidFactorize: true,
|
|
201
|
+
})
|
|
202
|
+
.toTex());
|
|
57
203
|
}
|
|
58
204
|
catch (err) {
|
|
59
205
|
return handleVEAError(err);
|
|
60
206
|
}
|
|
61
207
|
};
|
|
62
208
|
const getAverageRateOfChangeAlgebraicExpressionQuestion = (opts) => {
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
209
|
+
const defaultTypes = [
|
|
210
|
+
"$ax+b$",
|
|
211
|
+
"$ax^2+bx+c$",
|
|
212
|
+
"$\\frac{k}{x}$",
|
|
213
|
+
"$\\frac{k}{x^2}$",
|
|
214
|
+
"$\\frac{ax+b}{cx+d}$",
|
|
215
|
+
];
|
|
216
|
+
const frenchType = random(opts?.functionTypes ?? defaultTypes);
|
|
217
|
+
const type = defaultTypes.indexOf(frenchType);
|
|
218
|
+
let functionIds = undefined;
|
|
219
|
+
let a = 0;
|
|
220
|
+
switch (type) {
|
|
221
|
+
case 0:
|
|
222
|
+
functionIds = AffineConstructor.random().toTree().toIdentifiers();
|
|
223
|
+
a = randint(-5, 6, [0]);
|
|
224
|
+
break;
|
|
225
|
+
case 1:
|
|
226
|
+
functionIds = TrinomConstructor.random().toTree().toIdentifiers();
|
|
227
|
+
a = randint(-5, 6, [0]);
|
|
228
|
+
break;
|
|
229
|
+
case 2:
|
|
230
|
+
a = randint(-5, 6, [0]);
|
|
231
|
+
functionIds = frac(randint(-10, 10, [0]), "x").toIdentifiers();
|
|
232
|
+
break;
|
|
233
|
+
case 3:
|
|
234
|
+
a = randint(-5, 6, [0]);
|
|
235
|
+
functionIds = frac(randint(-10, 10, [0]), square("x")).toIdentifiers();
|
|
236
|
+
break;
|
|
237
|
+
case 4:
|
|
238
|
+
default: {
|
|
239
|
+
const denum = AffineConstructor.random();
|
|
240
|
+
const num = doWhile(() => AffineConstructor.random(), (aff) => (denum.b === 0 && aff.b === 0) ||
|
|
241
|
+
round(aff.a / denum.a, 5) === round(aff.b / denum.b, 5));
|
|
242
|
+
a = randint(-5, 6, [denum.getRoot().value]);
|
|
243
|
+
functionIds = frac(num.toTree(), denum.toTree()).toIdentifiers();
|
|
244
|
+
break;
|
|
245
|
+
}
|
|
246
|
+
}
|
|
70
247
|
const identifiers = {
|
|
71
|
-
|
|
72
|
-
|
|
248
|
+
type,
|
|
249
|
+
functionIds,
|
|
250
|
+
a,
|
|
73
251
|
};
|
|
74
252
|
return getQuestionFromIdentifiers(identifiers);
|
|
75
253
|
};
|
|
254
|
+
const getQuestionFromIdentifiers = (identifiers) => {
|
|
255
|
+
return {
|
|
256
|
+
answer: getAnswer(identifiers),
|
|
257
|
+
instruction: getInstruction(identifiers),
|
|
258
|
+
keys: getKeys(identifiers),
|
|
259
|
+
answerFormat: "tex",
|
|
260
|
+
identifiers,
|
|
261
|
+
hint: getHint(identifiers),
|
|
262
|
+
correction: getCorrection(identifiers),
|
|
263
|
+
};
|
|
264
|
+
};
|
|
76
265
|
const options = [
|
|
77
266
|
{
|
|
78
|
-
id: "
|
|
79
|
-
label: "
|
|
267
|
+
id: "functionTypes",
|
|
268
|
+
label: "Types de fonction",
|
|
80
269
|
target: GeneratorOptionTarget.generation,
|
|
81
270
|
type: GeneratorOptionType.multiselect,
|
|
82
|
-
values: [
|
|
83
|
-
|
|
271
|
+
values: [
|
|
272
|
+
"$ax+b$",
|
|
273
|
+
"$ax^2+bx+c$",
|
|
274
|
+
"$\\frac{k}{x}$",
|
|
275
|
+
"$\\frac{k}{x^2}$",
|
|
276
|
+
"$\\frac{ax+b}{cx+d}$",
|
|
277
|
+
],
|
|
278
|
+
defaultValue: ["$ax+b$", "$ax^2+bx+c$", "$\\frac{k}{x}$"],
|
|
84
279
|
},
|
|
85
280
|
];
|
|
86
281
|
const validateOptions = (opts) => {
|
|
87
|
-
if (!opts.
|
|
282
|
+
if (!opts.functionTypes?.length)
|
|
88
283
|
return {
|
|
89
284
|
valid: false,
|
|
90
285
|
message: "Veuillez choisir au moins un type de fonction.",
|
|
@@ -94,21 +289,10 @@ const validateOptions = (opts) => {
|
|
|
94
289
|
message: "",
|
|
95
290
|
};
|
|
96
291
|
};
|
|
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
292
|
export const averageRateOfChangeAlgebraicExpression = {
|
|
109
293
|
id: "averageRateOfChangeAlgebraicExpression",
|
|
110
294
|
connector: "=",
|
|
111
|
-
label: "
|
|
295
|
+
label: "Exprimer en fonction de $h$ le taux d'accroissement d'une fonction",
|
|
112
296
|
isSingleStep: true,
|
|
113
297
|
generator: (nb, opts) => getDistinctQuestions(() => getAverageRateOfChangeAlgebraicExpressionQuestion(opts), nb),
|
|
114
298
|
qcmTimer: 60,
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Exercise } from "../../../../exercises/exercise.js";
|
|
2
|
+
import { NodeIdentifiers } from "../../../../tree/nodes/nodeConstructor.js";
|
|
3
|
+
type Identifiers = {
|
|
4
|
+
type: number;
|
|
5
|
+
functionIds: NodeIdentifiers;
|
|
6
|
+
a: number;
|
|
7
|
+
};
|
|
8
|
+
type Options = {
|
|
9
|
+
functionTypes: string[];
|
|
10
|
+
};
|
|
11
|
+
export declare const expressFAPlusH: Exercise<Identifiers, Options>;
|
|
12
|
+
export {};
|
|
13
|
+
//# sourceMappingURL=expressFAPlusH.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"expressFAPlusH.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/derivation/derivativeNumber/expressFAPlusH.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAkBT,MAAM,6BAA6B,CAAC;AAMrC,OAAO,EACL,eAAe,EAEhB,MAAM,qCAAqC,CAAC;AAU7C,KAAK,WAAW,GAAG;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,eAAe,CAAC;IAC7B,CAAC,EAAE,MAAM,CAAC;CACX,CAAC;AA+LF,KAAK,OAAO,GAAG;IACb,aAAa,EAAE,MAAM,EAAE,CAAC;CACzB,CAAC;AAoCF,eAAO,MAAM,cAAc,EAAE,QAAQ,CAAC,WAAW,EAAE,OAAO,CAoBzD,CAAC"}
|
|
@@ -0,0 +1,225 @@
|
|
|
1
|
+
import { addValidProp, shuffleProps, GeneratorOptionTarget, GeneratorOptionType, tryToAddWrongProp, } from "../../../../exercises/exercise.js";
|
|
2
|
+
import { getDistinctQuestions } from "../../../../exercises/utils/getDistinctQuestions.js";
|
|
3
|
+
import { AffineConstructor } from "../../../../math/polynomials/affine.js";
|
|
4
|
+
import { TrinomConstructor } from "../../../../math/polynomials/trinom.js";
|
|
5
|
+
import { randint } from "../../../../math/utils/random/randint.js";
|
|
6
|
+
import { round } from "../../../../math/utils/round.js";
|
|
7
|
+
import { reifyAlgebraic, } from "../../../../tree/nodes/nodeConstructor.js";
|
|
8
|
+
import { add } from "../../../../tree/nodes/operators/addNode.js";
|
|
9
|
+
import { frac } from "../../../../tree/nodes/operators/fractionNode.js";
|
|
10
|
+
import { square } from "../../../../tree/nodes/operators/powerNode.js";
|
|
11
|
+
import { parseAlgebraic } from "../../../../tree/parsers/latexParser.js";
|
|
12
|
+
import { random } from "../../../../utils/alea/random.js";
|
|
13
|
+
import { doWhile } from "../../../../utils/doWhile.js";
|
|
14
|
+
import { handleVEAError } from "../../../../utils/errors/handleVEAError.js";
|
|
15
|
+
import { alignTex } from "../../../../utils/latex/alignTex.js";
|
|
16
|
+
const getPropositions = (n, { answer, ...identifiers }) => {
|
|
17
|
+
const propositions = [];
|
|
18
|
+
const { a, functionIds } = identifiers;
|
|
19
|
+
const fct = reifyAlgebraic(functionIds);
|
|
20
|
+
addValidProp(propositions, answer);
|
|
21
|
+
tryToAddWrongProp(propositions, fct
|
|
22
|
+
.toDetailedEvaluation({ x: a.toTree() })
|
|
23
|
+
.simplify({
|
|
24
|
+
towardsDistribute: true,
|
|
25
|
+
forbidFactorize: true,
|
|
26
|
+
})
|
|
27
|
+
.toTex());
|
|
28
|
+
tryToAddWrongProp(propositions, fct
|
|
29
|
+
.toDetailedEvaluation({ x: "h".toTree() })
|
|
30
|
+
.simplify({
|
|
31
|
+
towardsDistribute: true,
|
|
32
|
+
forbidFactorize: true,
|
|
33
|
+
})
|
|
34
|
+
.toTex());
|
|
35
|
+
let safeA = randint(-10, 10, [0]);
|
|
36
|
+
let isSafe = false;
|
|
37
|
+
let counter = 0;
|
|
38
|
+
while (!isSafe && counter < 100) {
|
|
39
|
+
counter++;
|
|
40
|
+
if (counter > 100) {
|
|
41
|
+
throw new Error("Too many iterations in getPropositions expressFAPlusH");
|
|
42
|
+
}
|
|
43
|
+
try {
|
|
44
|
+
fct.toDetailedEvaluation({ x: safeA.toTree() }).simplify();
|
|
45
|
+
isSafe = true;
|
|
46
|
+
}
|
|
47
|
+
catch (_e) {
|
|
48
|
+
safeA = randint(-10, 10, [0]);
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
tryToAddWrongProp(propositions, fct
|
|
52
|
+
.toDetailedEvaluation({ x: add(safeA, "h") })
|
|
53
|
+
.simplify({
|
|
54
|
+
towardsDistribute: true,
|
|
55
|
+
forbidFactorize: true,
|
|
56
|
+
})
|
|
57
|
+
.toTex());
|
|
58
|
+
return shuffleProps(propositions, n);
|
|
59
|
+
};
|
|
60
|
+
const getAnswer = (identifiers) => {
|
|
61
|
+
const { a, functionIds } = identifiers;
|
|
62
|
+
const fct = reifyAlgebraic(functionIds);
|
|
63
|
+
return fct
|
|
64
|
+
.toDetailedEvaluation({ x: add(a, "h") })
|
|
65
|
+
.simplify({ towardsDistribute: true, forbidFactorize: true })
|
|
66
|
+
.toTex();
|
|
67
|
+
};
|
|
68
|
+
const getInstruction = (identifiers) => {
|
|
69
|
+
const { a, functionIds } = identifiers;
|
|
70
|
+
const fct = reifyAlgebraic(functionIds);
|
|
71
|
+
return `On considère la fonction $f$ définie par :
|
|
72
|
+
|
|
73
|
+
$$
|
|
74
|
+
f(x) = ${fct.toTex()}
|
|
75
|
+
$$
|
|
76
|
+
|
|
77
|
+
Pour $h>0$, exprimer $f(${a}+h)$ en fonction de $h$.`;
|
|
78
|
+
};
|
|
79
|
+
const getHint = (identifiers) => {
|
|
80
|
+
const { a } = identifiers;
|
|
81
|
+
return `Il suffit de remplacer $x$ par $${a}+h$ dans l'expression algébrique de $f$, puis de simplifier si nécessaire.`;
|
|
82
|
+
};
|
|
83
|
+
const getCorrection = (identifiers) => {
|
|
84
|
+
const { a, functionIds } = identifiers;
|
|
85
|
+
const fct = reifyAlgebraic(functionIds);
|
|
86
|
+
return `On remplace $x$ par $${a}+h$ dans l'expression algébrique de $f$ :
|
|
87
|
+
|
|
88
|
+
${alignTex([
|
|
89
|
+
[`f(${a}+h)`, "=", fct.toDetailedEvaluation({ x: add(a, "h") }).toTex()],
|
|
90
|
+
[
|
|
91
|
+
"",
|
|
92
|
+
"=",
|
|
93
|
+
fct
|
|
94
|
+
.toDetailedEvaluation({ x: add(a, "h") })
|
|
95
|
+
.simplify({ towardsDistribute: true, forbidFactorize: true })
|
|
96
|
+
.toTex(),
|
|
97
|
+
],
|
|
98
|
+
])}`;
|
|
99
|
+
};
|
|
100
|
+
const getKeys = () => {
|
|
101
|
+
return ["h"];
|
|
102
|
+
};
|
|
103
|
+
const isAnswerValid = (ans, { answer }) => {
|
|
104
|
+
try {
|
|
105
|
+
const parsed = parseAlgebraic(ans);
|
|
106
|
+
if (!parsed)
|
|
107
|
+
return false;
|
|
108
|
+
return (parsed
|
|
109
|
+
.simplify({ towardsDistribute: true, forbidFactorize: true })
|
|
110
|
+
.toTex() === answer);
|
|
111
|
+
}
|
|
112
|
+
catch (err) {
|
|
113
|
+
return handleVEAError(err);
|
|
114
|
+
}
|
|
115
|
+
};
|
|
116
|
+
const getExpressFaPlusHQuestion = (opts) => {
|
|
117
|
+
const defaultTypes = [
|
|
118
|
+
"$ax+b$",
|
|
119
|
+
"$ax^2+bx+c$",
|
|
120
|
+
"$\\frac{k}{x}$",
|
|
121
|
+
"$\\frac{k}{x^2}$",
|
|
122
|
+
"$\\frac{ax+b}{cx+d}$",
|
|
123
|
+
];
|
|
124
|
+
const frenchType = random(opts?.functionTypes ?? defaultTypes);
|
|
125
|
+
const type = defaultTypes.indexOf(frenchType);
|
|
126
|
+
let functionIds = undefined;
|
|
127
|
+
let a = 0;
|
|
128
|
+
switch (type) {
|
|
129
|
+
case 0:
|
|
130
|
+
functionIds = AffineConstructor.random().toTree().toIdentifiers();
|
|
131
|
+
a = randint(-10, 10, [0]);
|
|
132
|
+
break;
|
|
133
|
+
case 1:
|
|
134
|
+
functionIds = TrinomConstructor.random().toTree().toIdentifiers();
|
|
135
|
+
a = randint(-10, 10, [0]);
|
|
136
|
+
break;
|
|
137
|
+
case 2:
|
|
138
|
+
a = randint(-10, 10, [0]);
|
|
139
|
+
functionIds = frac(randint(-10, 10, [0]), "x").toIdentifiers();
|
|
140
|
+
break;
|
|
141
|
+
case 3:
|
|
142
|
+
a = randint(-10, 10, [0]);
|
|
143
|
+
functionIds = frac(randint(-10, 10, [0]), square("x")).toIdentifiers();
|
|
144
|
+
break;
|
|
145
|
+
case 4:
|
|
146
|
+
default: {
|
|
147
|
+
const denum = AffineConstructor.random();
|
|
148
|
+
const num = doWhile(() => AffineConstructor.random(), (aff) => (denum.b === 0 && aff.b === 0) ||
|
|
149
|
+
round(aff.a / denum.a, 5) === round(aff.b / denum.b, 5));
|
|
150
|
+
a = randint(-10, 10, [denum.getRoot().value]);
|
|
151
|
+
functionIds = frac(num.toTree(), denum.toTree()).toIdentifiers();
|
|
152
|
+
break;
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
const identifiers = {
|
|
156
|
+
type,
|
|
157
|
+
functionIds,
|
|
158
|
+
a,
|
|
159
|
+
};
|
|
160
|
+
return getQuestionFromIdentifiers(identifiers);
|
|
161
|
+
};
|
|
162
|
+
const getQuestionFromIdentifiers = (identifiers) => {
|
|
163
|
+
return {
|
|
164
|
+
answer: getAnswer(identifiers),
|
|
165
|
+
instruction: getInstruction(identifiers),
|
|
166
|
+
keys: getKeys(identifiers),
|
|
167
|
+
answerFormat: "tex",
|
|
168
|
+
identifiers,
|
|
169
|
+
hint: getHint(identifiers),
|
|
170
|
+
correction: getCorrection(identifiers),
|
|
171
|
+
};
|
|
172
|
+
};
|
|
173
|
+
const options = [
|
|
174
|
+
{
|
|
175
|
+
id: "functionTypes",
|
|
176
|
+
label: "Types de fonction",
|
|
177
|
+
target: GeneratorOptionTarget.generation,
|
|
178
|
+
type: GeneratorOptionType.multiselect,
|
|
179
|
+
values: [
|
|
180
|
+
"$ax+b$",
|
|
181
|
+
"$ax^2+bx+c$",
|
|
182
|
+
"$\\frac{k}{x}$",
|
|
183
|
+
"$\\frac{k}{x^2}$",
|
|
184
|
+
"$\\frac{ax+b}{cx+d}$",
|
|
185
|
+
],
|
|
186
|
+
defaultValue: [
|
|
187
|
+
"$ax+b$",
|
|
188
|
+
"$ax^2+bx+c$",
|
|
189
|
+
"$\\frac{k}{x}$",
|
|
190
|
+
"$\\frac{k}{x^2}$",
|
|
191
|
+
"$\\frac{ax+b}{cx+d}$",
|
|
192
|
+
],
|
|
193
|
+
},
|
|
194
|
+
];
|
|
195
|
+
const validateOptions = (opts) => {
|
|
196
|
+
if (!opts.functionTypes?.length)
|
|
197
|
+
return {
|
|
198
|
+
valid: false,
|
|
199
|
+
message: "Veuillez choisir au moins un type de fonction.",
|
|
200
|
+
};
|
|
201
|
+
return {
|
|
202
|
+
valid: true,
|
|
203
|
+
message: "",
|
|
204
|
+
};
|
|
205
|
+
};
|
|
206
|
+
export const expressFAPlusH = {
|
|
207
|
+
id: "expressFAPlusH",
|
|
208
|
+
connector: "=",
|
|
209
|
+
label: "Exprimer $f(a+h)$ en fonction de $h$ pour $f$ et $a$ donnés",
|
|
210
|
+
isSingleStep: true,
|
|
211
|
+
generator: (nb, opts) => getDistinctQuestions(() => getExpressFaPlusHQuestion(opts), nb),
|
|
212
|
+
qcmTimer: 60,
|
|
213
|
+
freeTimer: 60,
|
|
214
|
+
getPropositions,
|
|
215
|
+
isAnswerValid,
|
|
216
|
+
subject: "Mathématiques",
|
|
217
|
+
getInstruction,
|
|
218
|
+
getHint,
|
|
219
|
+
getCorrection,
|
|
220
|
+
getAnswer,
|
|
221
|
+
getQuestionFromIdentifiers,
|
|
222
|
+
hasHintAndCorrection: true,
|
|
223
|
+
options,
|
|
224
|
+
validateOptions,
|
|
225
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { Exercise } from "../../../../exercises/exercise.js";
|
|
2
|
+
import { NodeIdentifiers } from "../../../../tree/nodes/nodeConstructor.js";
|
|
3
|
+
type Identifiers = {
|
|
4
|
+
type: number;
|
|
5
|
+
rateIds: NodeIdentifiers;
|
|
6
|
+
a: number;
|
|
7
|
+
};
|
|
8
|
+
type Options = {
|
|
9
|
+
functionTypes: string[];
|
|
10
|
+
questionType: string;
|
|
11
|
+
};
|
|
12
|
+
export declare const findAverageRateLimit: Exercise<Identifiers, Options>;
|
|
13
|
+
export {};
|
|
14
|
+
//# sourceMappingURL=findAverageRateLimit.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"findAverageRateLimit.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/derivation/derivativeNumber/findAverageRateLimit.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAkBT,MAAM,6BAA6B,CAAC;AAMrC,OAAO,EACL,eAAe,EAEhB,MAAM,qCAAqC,CAAC;AAK7C,KAAK,WAAW,GAAG;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,eAAe,CAAC;IACzB,CAAC,EAAE,MAAM,CAAC;CACX,CAAC;AA+IF,KAAK,OAAO,GAAG;IACb,aAAa,EAAE,MAAM,EAAE,CAAC;IACxB,YAAY,EAAE,MAAM,CAAC;CACtB,CAAC;AAmBF,eAAO,MAAM,oBAAoB,EAAE,QAAQ,CAAC,WAAW,EAAE,OAAO,CAoB/D,CAAC"}
|