math-exercises 3.0.187 → 3.0.189
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/derivative/exp/expDerivativeProductFExp.d.ts.map +1 -1
- package/lib/exercises/math/derivation/derivative/exp/expDerivativeProductFExp.js +22 -6
- package/lib/exercises/math/derivation/derivative/exp/expDerivativeQuotientFExp.d.ts.map +1 -1
- package/lib/exercises/math/derivation/derivative/exp/expDerivativeQuotientFExp.js +16 -8
- package/lib/exercises/math/derivation/derivative/valueDerivativeFromFunctionExpression.d.ts.map +1 -1
- package/lib/exercises/math/derivation/derivative/valueDerivativeFromFunctionExpression.js +44 -37
- package/lib/exercises/math/derivation/derivativeNumber/derivativeNumberAndImageReading.d.ts +9 -0
- package/lib/exercises/math/derivation/derivativeNumber/derivativeNumberAndImageReading.d.ts.map +1 -0
- package/lib/exercises/math/derivation/derivativeNumber/derivativeNumberAndImageReading.js +155 -0
- package/lib/exercises/math/derivation/derivativeNumber/index.d.ts +1 -0
- package/lib/exercises/math/derivation/derivativeNumber/index.d.ts.map +1 -1
- package/lib/exercises/math/derivation/derivativeNumber/index.js +1 -0
- package/lib/exercises/math/derivation/problems/problemMaximizeBoxVolumeFindX.d.ts.map +1 -1
- package/lib/exercises/math/derivation/problems/problemMaximizeBoxVolumeFindX.js +80 -29
- package/lib/exercises/math/derivation/problems/problemMaximizeProfitFindProduction.d.ts.map +1 -1
- package/lib/exercises/math/derivation/problems/problemMaximizeProfitFindProduction.js +30 -2
- package/lib/exercises/math/derivation/problems/problemMovementOnLineFindSpeedAtPoint.d.ts.map +1 -1
- package/lib/exercises/math/derivation/problems/problemMovementOnLineFindSpeedAtPoint.js +59 -16
- package/lib/exercises/math/derivation/tangent/tangentEquationFromFunctionExpression.d.ts.map +1 -1
- package/lib/exercises/math/derivation/tangent/tangentEquationFromFunctionExpression.js +23 -9
- package/lib/exercises/math/derivation/variations/findAbscissaOfExtremaFromFunctionExpression.d.ts.map +1 -1
- package/lib/exercises/math/derivation/variations/findAbscissaOfExtremaFromFunctionExpression.js +2 -7
- package/lib/exercises/math/derivation/variations/findExtremaFromFunctionExpression.d.ts.map +1 -1
- package/lib/exercises/math/derivation/variations/findExtremaFromFunctionExpression.js +18 -68
- package/lib/exercises/math/derivation/variations/signVarTableQuotientFExp.d.ts.map +1 -1
- package/lib/exercises/math/derivation/variations/signVarTableQuotientFExp.js +27 -35
- package/lib/exercises/math/functions/affines/adjustment/affineAdjustment.d.ts +8 -0
- package/lib/exercises/math/functions/affines/adjustment/affineAdjustment.d.ts.map +1 -0
- package/lib/exercises/math/functions/affines/adjustment/affineAdjustment.js +129 -0
- package/lib/exercises/math/functions/affines/adjustment/affineAdjustmentComplete.d.ts +8 -0
- package/lib/exercises/math/functions/affines/adjustment/affineAdjustmentComplete.d.ts.map +1 -0
- package/lib/exercises/math/functions/affines/adjustment/affineAdjustmentComplete.js +108 -0
- package/lib/exercises/math/functions/affines/adjustment/affineAdjustmentRsquared.d.ts +8 -0
- package/lib/exercises/math/functions/affines/adjustment/affineAdjustmentRsquared.d.ts.map +1 -0
- package/lib/exercises/math/functions/affines/adjustment/affineAdjustmentRsquared.js +92 -0
- package/lib/exercises/math/functions/affines/adjustment/index.d.ts +4 -0
- package/lib/exercises/math/functions/affines/adjustment/index.d.ts.map +1 -0
- package/lib/exercises/math/functions/affines/adjustment/index.js +3 -0
- package/lib/exercises/math/functions/affines/index.d.ts +2 -4
- package/lib/exercises/math/functions/affines/index.d.ts.map +1 -1
- package/lib/exercises/math/functions/affines/index.js +2 -4
- package/lib/exercises/math/functions/affines/situations/affineFromExercise.d.ts +10 -0
- package/lib/exercises/math/functions/affines/situations/affineFromExercise.d.ts.map +1 -0
- package/lib/exercises/math/functions/affines/situations/affineFromExercise.js +219 -0
- package/lib/exercises/math/functions/affines/situations/affineModelisationSituations.d.ts +10 -0
- package/lib/exercises/math/functions/affines/situations/affineModelisationSituations.d.ts.map +1 -0
- package/lib/exercises/math/functions/affines/situations/affineModelisationSituations.js +69 -0
- package/lib/exercises/math/functions/affines/situations/affineSituationComputeAntecedent.d.ts +10 -0
- package/lib/exercises/math/functions/affines/situations/affineSituationComputeAntecedent.d.ts.map +1 -0
- package/lib/exercises/math/functions/affines/situations/affineSituationComputeAntecedent.js +133 -0
- package/lib/exercises/math/functions/affines/situations/affineSituationComputeImage.d.ts +10 -0
- package/lib/exercises/math/functions/affines/situations/affineSituationComputeImage.d.ts.map +1 -0
- package/lib/exercises/math/functions/affines/situations/affineSituationComputeImage.js +229 -0
- package/lib/exercises/math/functions/affines/situations/affineSituationThreshold.d.ts +10 -0
- package/lib/exercises/math/functions/affines/situations/affineSituationThreshold.d.ts.map +1 -0
- package/lib/exercises/math/functions/affines/situations/affineSituationThreshold.js +166 -0
- package/lib/exercises/math/functions/affines/situations/affineSituationVariation.d.ts +9 -0
- package/lib/exercises/math/functions/affines/situations/affineSituationVariation.d.ts.map +1 -0
- package/lib/exercises/math/functions/affines/situations/affineSituationVariation.js +78 -0
- package/lib/exercises/math/functions/affines/situations/index.d.ts +6 -0
- package/lib/exercises/math/functions/affines/situations/index.d.ts.map +1 -0
- package/lib/exercises/math/functions/affines/situations/index.js +5 -0
- package/lib/exercises/math/functions/sign/equationFromSignTable.d.ts +1 -0
- package/lib/exercises/math/functions/sign/equationFromSignTable.d.ts.map +1 -1
- package/lib/exercises/math/functions/sign/equationFromSignTable.js +60 -33
- package/lib/exercises/math/functions/sign/partialSignTableFromGraph.d.ts +6 -4
- package/lib/exercises/math/functions/sign/partialSignTableFromGraph.d.ts.map +1 -1
- package/lib/exercises/math/functions/sign/partialSignTableFromGraph.js +160 -63
- package/lib/exercises/math/functions/sign/readSignTable.d.ts +4 -1
- package/lib/exercises/math/functions/sign/readSignTable.d.ts.map +1 -1
- package/lib/exercises/math/functions/sign/readSignTable.js +32 -9
- package/lib/exercises/math/functions/sign/signTableFromGraph.d.ts +6 -4
- package/lib/exercises/math/functions/sign/signTableFromGraph.d.ts.map +1 -1
- package/lib/exercises/math/functions/sign/signTableFromGraph.js +160 -57
- package/lib/exercises/math/percent/evolutions/averageEvolutionRateFromStartAndEndValue.d.ts +9 -0
- package/lib/exercises/math/percent/evolutions/averageEvolutionRateFromStartAndEndValue.d.ts.map +1 -0
- package/lib/exercises/math/percent/evolutions/averageEvolutionRateFromStartAndEndValue.js +135 -0
- package/lib/exercises/math/percent/evolutions/index.d.ts +1 -0
- package/lib/exercises/math/percent/evolutions/index.d.ts.map +1 -1
- package/lib/exercises/math/percent/evolutions/index.js +1 -0
- package/lib/exercises/math/powers/equationOnePlusTPowerN.d.ts +9 -0
- package/lib/exercises/math/powers/equationOnePlusTPowerN.d.ts.map +1 -0
- package/lib/exercises/math/powers/equationOnePlusTPowerN.js +118 -0
- package/lib/exercises/math/powers/estimateNthRoot.d.ts +13 -0
- package/lib/exercises/math/powers/estimateNthRoot.d.ts.map +1 -0
- package/lib/exercises/math/powers/estimateNthRoot.js +126 -0
- package/lib/exercises/math/powers/index.d.ts +3 -0
- package/lib/exercises/math/powers/index.d.ts.map +1 -1
- package/lib/exercises/math/powers/index.js +3 -0
- package/lib/exercises/math/powers/solveNthRootEquation.d.ts +9 -0
- package/lib/exercises/math/powers/solveNthRootEquation.d.ts.map +1 -0
- package/lib/exercises/math/powers/solveNthRootEquation.js +111 -0
- package/lib/exercises/math/probaStat/randomVariable/index.d.ts +1 -7
- package/lib/exercises/math/probaStat/randomVariable/index.d.ts.map +1 -1
- package/lib/exercises/math/probaStat/randomVariable/index.js +1 -7
- package/lib/exercises/math/probaStat/randomVariable/situations/index.d.ts +8 -0
- package/lib/exercises/math/probaStat/randomVariable/situations/index.d.ts.map +1 -0
- package/lib/exercises/math/probaStat/randomVariable/situations/index.js +7 -0
- package/lib/exercises/math/probaStat/randomVariable/situations/randomVariableSituationAverage.d.ts +11 -0
- package/lib/exercises/math/probaStat/randomVariable/situations/randomVariableSituationAverage.d.ts.map +1 -0
- package/lib/exercises/math/probaStat/randomVariable/situations/randomVariableSituationAverage.js +112 -0
- package/lib/exercises/math/probaStat/randomVariable/situations/randomVariableSituationComputeProbability.d.ts +9 -0
- package/lib/exercises/math/probaStat/randomVariable/situations/randomVariableSituationComputeProbability.d.ts.map +1 -0
- package/lib/exercises/math/probaStat/randomVariable/situations/randomVariableSituationComputeProbability.js +176 -0
- package/lib/exercises/math/probaStat/randomVariable/situations/randomVariableSituationIsGameFavorable.d.ts +8 -0
- package/lib/exercises/math/probaStat/randomVariable/situations/randomVariableSituationIsGameFavorable.d.ts.map +1 -0
- package/lib/exercises/math/probaStat/randomVariable/situations/randomVariableSituationIsGameFavorable.js +94 -0
- package/lib/exercises/math/probaStat/randomVariable/situations/randomVariableSituationProbabilityLaw.d.ts +9 -0
- package/lib/exercises/math/probaStat/randomVariable/situations/randomVariableSituationProbabilityLaw.d.ts.map +1 -0
- package/lib/exercises/math/probaStat/randomVariable/situations/randomVariableSituationProbabilityLaw.js +166 -0
- package/lib/exercises/math/probaStat/randomVariable/situations/randomVariableSituationStandardDeviation.d.ts +8 -0
- package/lib/exercises/math/probaStat/randomVariable/situations/randomVariableSituationStandardDeviation.d.ts.map +1 -0
- package/lib/exercises/math/probaStat/randomVariable/situations/randomVariableSituationStandardDeviation.js +133 -0
- package/lib/exercises/math/probaStat/randomVariable/situations/randomVariableSituationValues.d.ts +8 -0
- package/lib/exercises/math/probaStat/randomVariable/situations/randomVariableSituationValues.d.ts.map +1 -0
- package/lib/exercises/math/probaStat/randomVariable/situations/randomVariableSituationValues.js +211 -0
- package/lib/exercises/math/probaStat/randomVariable/situations/randomVariableSituationVariance.d.ts +8 -0
- package/lib/exercises/math/probaStat/randomVariable/situations/randomVariableSituationVariance.d.ts.map +1 -0
- package/lib/exercises/math/probaStat/randomVariable/situations/randomVariableSituationVariance.js +113 -0
- package/lib/exercises/math/probaStat/randomVariable/situations/randomVariableSituations.d.ts +41 -0
- package/lib/exercises/math/probaStat/randomVariable/situations/randomVariableSituations.d.ts.map +1 -0
- package/lib/exercises/math/probaStat/randomVariable/situations/randomVariableSituations.js +173 -0
- package/lib/exercises/math/python/list/pyListMutationMix.d.ts.map +1 -1
- package/lib/exercises/math/python/list/pyListMutationMix.js +11 -6
- package/lib/exercises/math/sequences/arithmetic/situations/arithmeticFindRecurrenceFormulaFromSituation.d.ts.map +1 -1
- package/lib/exercises/math/sequences/arithmetic/situations/arithmeticFindRecurrenceFormulaFromSituation.js +2 -2
- package/lib/exercises/math/sequences/geometric/geometricFindExplicitFormulaFromTwoConsecutiveTerms.js +1 -1
- package/lib/exercises/math/sequences/geometric/geometricFindRandomTermFromTwoConsecutiveTerms.js +1 -1
- package/lib/exercises/vea/percentVEA.d.ts +6 -1
- package/lib/exercises/vea/percentVEA.d.ts.map +1 -1
- package/lib/exercises/vea/percentVEA.js +15 -1
- package/lib/index.d.ts +78 -33
- package/lib/index.d.ts.map +1 -1
- package/lib/math/utils/sequences/situations/seqArithmeticSituations.d.ts.map +1 -1
- package/lib/math/utils/sequences/situations/seqArithmeticSituations.js +5 -8
- package/lib/math/utils/sequences/situations/seqArithmeticUtils.d.ts +1 -1
- package/lib/math/utils/sequences/situations/seqArithmeticUtils.d.ts.map +1 -1
- package/lib/math/utils/sequences/situations/seqArithmeticUtils.js +1 -3
- package/lib/math/utils/sequences/situations/seqGeometricSituations.d.ts.map +1 -1
- package/lib/math/utils/sequences/situations/seqGeometricSituations.js +8 -10
- package/lib/tests/questionTest.d.ts.map +1 -1
- package/lib/tests/questionTest.js +8 -0
- package/lib/tree/nodes/sets/closure.d.ts +1 -0
- package/lib/tree/nodes/sets/closure.d.ts.map +1 -1
- package/lib/tree/nodes/sets/closure.js +12 -0
- package/lib/tree/utilities/nodeUtils.d.ts +2 -0
- package/lib/tree/utilities/nodeUtils.d.ts.map +1 -1
- package/lib/tree/utilities/nodeUtils.js +40 -0
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"expDerivativeProductFExp.d.ts","sourceRoot":"","sources":["../../../../../../src/exercises/math/derivation/derivative/exp/expDerivativeProductFExp.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAiBT,MAAM,6BAA6B,CAAC;
|
|
1
|
+
{"version":3,"file":"expDerivativeProductFExp.d.ts","sourceRoot":"","sources":["../../../../../../src/exercises/math/derivation/derivative/exp/expDerivativeProductFExp.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAiBT,MAAM,6BAA6B,CAAC;AAgErC,KAAK,WAAW,GAAG;IAEjB,OAAO,EAAE,MAAM,EAAE,CAAC;IAGlB,OAAO,EAAE,MAAM,EAAE,CAAC;CACnB,CAAC;AAuVF,KAAK,OAAO,GAAG;IACb,KAAK,EAAE,MAAM,CAAC;IACd,yBAAyB,EAAE,OAAO,CAAC;IAGnC,QAAQ,EAAE,MAAM,CAAC;CAClB,CAAC;AA4BF,eAAO,MAAM,wBAAwB,EAAE,QAAQ,CAAC,WAAW,EAAE,OAAO,CAwBnE,CAAC;AAEF,eAAO,MAAM,8BAA8B,EAAE,QAAQ,CAAC,WAAW,EAAE,OAAO,CAwBzE,CAAC"}
|
|
@@ -6,8 +6,9 @@ import { randint } from "../../../../../math/utils/random/randint.js";
|
|
|
6
6
|
import { exp, ExpNode } from "../../../../../tree/nodes/functions/expNode.js";
|
|
7
7
|
import { add, AddNode } from "../../../../../tree/nodes/operators/addNode.js";
|
|
8
8
|
import { isMultiplyNode, multiply, MultiplyNode, } from "../../../../../tree/nodes/operators/multiplyNode.js";
|
|
9
|
-
import { substract } from "../../../../../tree/nodes/operators/substractNode.js";
|
|
10
9
|
import { parseAlgebraic } from "../../../../../tree/parsers/latexParser.js";
|
|
10
|
+
import { NodeComparator } from "../../../../../tree/utilities/nodeComparator.js";
|
|
11
|
+
import { NodeRewriter } from "../../../../../tree/utilities/nodeRewriter.js";
|
|
11
12
|
const simplifyMore = (node) => {
|
|
12
13
|
if (isMultiplyNode(node)) {
|
|
13
14
|
const nodeLeft = node.leftChild;
|
|
@@ -234,12 +235,22 @@ const isAnswerValid = (ans, { answer }, optsIn) => {
|
|
|
234
235
|
}
|
|
235
236
|
}
|
|
236
237
|
const nodeAnswer = parseAlgebraic(answer);
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
238
|
+
const isEquivalentFound = () => {
|
|
239
|
+
const arrNodeAnswerEquivalent = NodeRewriter.getArrNodeEquivalent(nodeAnswer);
|
|
240
|
+
const isEquivalentViaSub = () => arrNodeAnswerEquivalent.some((nodeAnswerRefined) => {
|
|
241
|
+
const isEqual = NodeComparator.isEqualViaSub(nodeAns, nodeAnswerRefined);
|
|
242
|
+
return isEqual;
|
|
243
|
+
});
|
|
244
|
+
const isEquivalentViaFrac = () => arrNodeAnswerEquivalent.some((nodeAnswerRefined) => {
|
|
245
|
+
const isEqual = NodeComparator.isEqualViaFrac(nodeAns, nodeAnswerRefined);
|
|
246
|
+
return isEqual;
|
|
247
|
+
});
|
|
248
|
+
return isEquivalentViaSub() || isEquivalentViaFrac();
|
|
249
|
+
};
|
|
250
|
+
const isValid = isEquivalentFound();
|
|
251
|
+
return isValid;
|
|
240
252
|
};
|
|
241
|
-
const
|
|
242
|
-
const opts = optsIn ?? optsDefault;
|
|
253
|
+
const createRandomIdentifiers = (opts) => {
|
|
243
254
|
const { typeF, typeExpG } = opts;
|
|
244
255
|
const coeffsF = (() => {
|
|
245
256
|
switch (typeF) {
|
|
@@ -265,6 +276,11 @@ const getExpDerivativeProductFExpQuestion = (optsIn) => {
|
|
|
265
276
|
coeffsF,
|
|
266
277
|
coeffsG,
|
|
267
278
|
};
|
|
279
|
+
return identifiers;
|
|
280
|
+
};
|
|
281
|
+
const getExpDerivativeProductFExpQuestion = (optsIn) => {
|
|
282
|
+
const opts = optsIn ?? optsDefault;
|
|
283
|
+
const identifiers = createRandomIdentifiers(opts);
|
|
268
284
|
return getQuestionFromIdentifiers(identifiers, opts);
|
|
269
285
|
};
|
|
270
286
|
const getQuestionFromIdentifiers = (identifiers, opts) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"expDerivativeQuotientFExp.d.ts","sourceRoot":"","sources":["../../../../../../src/exercises/math/derivation/derivative/exp/expDerivativeQuotientFExp.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAiBT,MAAM,6BAA6B,CAAC;
|
|
1
|
+
{"version":3,"file":"expDerivativeQuotientFExp.d.ts","sourceRoot":"","sources":["../../../../../../src/exercises/math/derivation/derivative/exp/expDerivativeQuotientFExp.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAiBT,MAAM,6BAA6B,CAAC;AAsGrC,KAAK,WAAW,GAAG;IAEjB,OAAO,EAAE,MAAM,EAAE,CAAC;IAGlB,OAAO,EAAE,MAAM,EAAE,CAAC;IAElB,WAAW,EAAE,OAAO,CAAC;CACtB,CAAC;AA4YF,KAAK,OAAO,GAAG;IACb,KAAK,EAAE,MAAM,CAAC;IACd,yBAAyB,EAAE,OAAO,CAAC;IAGnC,QAAQ,EAAE,MAAM,CAAC;CAClB,CAAC;AA4BF,eAAO,MAAM,yBAAyB,EAAE,QAAQ,CAAC,WAAW,EAAE,OAAO,CAwBpE,CAAC;AAEF,eAAO,MAAM,+BAA+B,EAAE,QAAQ,CAAC,WAAW,EAAE,OAAO,CAyB1E,CAAC"}
|
|
@@ -4,13 +4,14 @@ import { AffineConstructor } from "../../../../../math/polynomials/affine.js";
|
|
|
4
4
|
import { TrinomConstructor } from "../../../../../math/polynomials/trinom.js";
|
|
5
5
|
import { randint } from "../../../../../math/utils/random/randint.js";
|
|
6
6
|
import { exp, ExpNode } from "../../../../../tree/nodes/functions/expNode.js";
|
|
7
|
-
import { PiNode } from "../../../../../tree/nodes/numbers/piNode.js";
|
|
8
7
|
import { add, AddNode } from "../../../../../tree/nodes/operators/addNode.js";
|
|
9
8
|
import { frac, FractionNode, isFractionNode, } from "../../../../../tree/nodes/operators/fractionNode.js";
|
|
10
9
|
import { isMultiplyNode, multiply, MultiplyNode, } from "../../../../../tree/nodes/operators/multiplyNode.js";
|
|
11
10
|
import { power } from "../../../../../tree/nodes/operators/powerNode.js";
|
|
12
11
|
import { substract } from "../../../../../tree/nodes/operators/substractNode.js";
|
|
13
12
|
import { parseAlgebraic } from "../../../../../tree/parsers/latexParser.js";
|
|
13
|
+
import { NodeComparator } from "../../../../../tree/utilities/nodeComparator.js";
|
|
14
|
+
import { NodeRewriter } from "../../../../../tree/utilities/nodeRewriter.js";
|
|
14
15
|
import { coinFlip } from "../../../../../utils/alea/coinFlip.js";
|
|
15
16
|
const simplifyMoreProduct = (node) => {
|
|
16
17
|
if (isMultiplyNode(node)) {
|
|
@@ -317,13 +318,20 @@ const isAnswerValid = (ans, { answer }, optsIn) => {
|
|
|
317
318
|
}
|
|
318
319
|
}
|
|
319
320
|
const nodeAnswer = parseAlgebraic(answer);
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
321
|
+
const isEquivalentFound = () => {
|
|
322
|
+
const arrNodeAnswerEquivalent = NodeRewriter.getArrNodeEquivalent(nodeAnswer);
|
|
323
|
+
const isEquivalentViaSub = () => arrNodeAnswerEquivalent.some((nodeAnswerRefined) => {
|
|
324
|
+
const isEqual = NodeComparator.isEqualViaSub(nodeAns, nodeAnswerRefined);
|
|
325
|
+
return isEqual;
|
|
326
|
+
});
|
|
327
|
+
const isEquivalentViaFrac = () => arrNodeAnswerEquivalent.some((nodeAnswerRefined) => {
|
|
328
|
+
const isEqual = NodeComparator.isEqualViaFrac(nodeAns, nodeAnswerRefined);
|
|
329
|
+
return isEqual;
|
|
330
|
+
});
|
|
331
|
+
return isEquivalentViaSub() || isEquivalentViaFrac();
|
|
332
|
+
};
|
|
333
|
+
const isValid = isEquivalentFound();
|
|
334
|
+
return isValid;
|
|
327
335
|
};
|
|
328
336
|
const getExpDerivativeQuotientFExpQuestion = (optsIn) => {
|
|
329
337
|
const opts = optsIn ?? optsDefault;
|
package/lib/exercises/math/derivation/derivative/valueDerivativeFromFunctionExpression.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"valueDerivativeFromFunctionExpression.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/derivation/derivative/valueDerivativeFromFunctionExpression.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAkBT,MAAM,6BAA6B,CAAC;AASrC,OAAO,EAEL,eAAe,EAChB,MAAM,qCAAqC,CAAC;AAgF7C,KAAK,WAAW,GAAG;IACjB,aAAa,EAAE,eAAe,CAAC;IAC/B,QAAQ,EAAE,eAAe,CAAC;IAC1B,KAAK,EAAE,MAAM,CAAC;CACf,CAAC;
|
|
1
|
+
{"version":3,"file":"valueDerivativeFromFunctionExpression.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/derivation/derivative/valueDerivativeFromFunctionExpression.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAkBT,MAAM,6BAA6B,CAAC;AASrC,OAAO,EAEL,eAAe,EAChB,MAAM,qCAAqC,CAAC;AAgF7C,KAAK,WAAW,GAAG;IACjB,aAAa,EAAE,eAAe,CAAC;IAC/B,QAAQ,EAAE,eAAe,CAAC;IAC1B,KAAK,EAAE,MAAM,CAAC;CACf,CAAC;AAqQF,KAAK,OAAO,GAAG;IACb,KAAK,EAAE,MAAM,CAAC;CACf,CAAC;AAgDF,eAAO,MAAM,qCAAqC,EAAE,QAAQ,CAC1D,WAAW,EACX,OAAO,CAoBR,CAAC"}
|
|
@@ -155,32 +155,37 @@ const getPropositions = (n, { answer, ...identifiers }) => {
|
|
|
155
155
|
const { nodeIdsXAsked, nodeIdsF } = identifiers;
|
|
156
156
|
const [nodeXAsked, nodeF] = [nodeIdsXAsked, nodeIdsF].map((nodeIds) => NodeConstructor.fromIdentifiers(nodeIds));
|
|
157
157
|
const nodeDerivative = getPrettyDerivativeNode(nodeF);
|
|
158
|
-
function tryToAddWrongPropWithSuccess(propositions,
|
|
158
|
+
function tryToAddWrongPropWithSuccess(propositions, func) {
|
|
159
159
|
const nbPropsBefore = propositions.length;
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
160
|
+
try {
|
|
161
|
+
tryToAddWrongProp(propositions, func());
|
|
162
|
+
const nbPropsAfter = propositions.length;
|
|
163
|
+
return nbPropsAfter !== nbPropsBefore;
|
|
164
|
+
}
|
|
165
|
+
catch (_) {
|
|
166
|
+
return false;
|
|
167
|
+
}
|
|
163
168
|
}
|
|
164
169
|
propWhile(propositions, n, () => {
|
|
165
|
-
if (!tryToAddWrongPropWithSuccess(propositions, (
|
|
170
|
+
if (!tryToAddWrongPropWithSuccess(propositions, () => {
|
|
166
171
|
const nodeFShuffled = NodeShuffler.deepShuffle(nodeF);
|
|
167
172
|
const identifiersWrong = {
|
|
168
173
|
...identifiers,
|
|
169
174
|
nodeIdsF: nodeFShuffled.toIdentifiers(),
|
|
170
175
|
};
|
|
171
176
|
return getAnswer(identifiersWrong);
|
|
172
|
-
})
|
|
173
|
-
if (!tryToAddWrongPropWithSuccess(propositions, (
|
|
177
|
+
})) {
|
|
178
|
+
if (!tryToAddWrongPropWithSuccess(propositions, () => {
|
|
174
179
|
const nodeDerivativeShuffled = NodeShuffler.deepShuffle(nodeDerivative);
|
|
175
180
|
const nodeWrong = nodeBySubstitutingVar(nodeDerivativeShuffled, nodeXAsked, "x".toTree()).simplify();
|
|
176
181
|
return nodeWrong.simplify().toTex();
|
|
177
|
-
})
|
|
182
|
+
})) {
|
|
178
183
|
try {
|
|
179
|
-
tryToAddWrongPropWithSuccess(propositions, (
|
|
184
|
+
tryToAddWrongPropWithSuccess(propositions, () => {
|
|
180
185
|
const typeF = random(arrayedOptsDefault.typeF);
|
|
181
186
|
const identifiersWrong = createRandomIdentifiers(typeF);
|
|
182
187
|
return getAnswer(identifiersWrong);
|
|
183
|
-
})
|
|
188
|
+
});
|
|
184
189
|
}
|
|
185
190
|
catch (_) {
|
|
186
191
|
tryToAddWrongProp(propositions, randint(-20, 20).frenchify());
|
|
@@ -214,48 +219,50 @@ const createRandomIdentifiers = (typeF) => {
|
|
|
214
219
|
};
|
|
215
220
|
return identifiers;
|
|
216
221
|
};
|
|
217
|
-
const
|
|
218
|
-
const
|
|
219
|
-
|
|
222
|
+
const isIdentifiersQCPassed = (identifiers) => {
|
|
223
|
+
const isExploding = (identifiers) => {
|
|
224
|
+
const { nodeIdsXAsked, nodeIdsF } = identifiers;
|
|
225
|
+
const [nodeXAsked, nodeF] = [nodeIdsXAsked, nodeIdsF].map((nodeIds) => NodeConstructor.fromIdentifiers(nodeIds));
|
|
226
|
+
const nodeDerivative = getPrettyDerivativeNode(nodeF);
|
|
227
|
+
let isExploding = false;
|
|
228
|
+
try {
|
|
229
|
+
const _nodeValueFunction = nodeBySubstitutingVar(nodeF, nodeXAsked, "x".toTree()).simplify();
|
|
230
|
+
const _nodeValueDerivative = nodeBySubstitutingVar(nodeDerivative, nodeXAsked, "x".toTree()).simplify();
|
|
231
|
+
getAnswer(identifiers);
|
|
232
|
+
}
|
|
233
|
+
catch (_) {
|
|
234
|
+
isExploding = true;
|
|
235
|
+
}
|
|
236
|
+
return isExploding;
|
|
237
|
+
};
|
|
238
|
+
return !isExploding(identifiers);
|
|
239
|
+
};
|
|
240
|
+
const createQCPassedIdentifiers = (typeF) => {
|
|
220
241
|
let identifiers;
|
|
221
|
-
let isValid = false;
|
|
222
242
|
let counter = -1;
|
|
243
|
+
let isValid = false;
|
|
223
244
|
while (!isValid && counter < 100) {
|
|
224
245
|
counter++;
|
|
225
246
|
const identifiersCandidate = createRandomIdentifiers(typeF);
|
|
226
|
-
|
|
227
|
-
const { nodeIdsXAsked, nodeIdsF } = identifiers;
|
|
228
|
-
const [nodeXAsked, nodeF] = [nodeIdsXAsked, nodeIdsF].map((nodeIds) => NodeConstructor.fromIdentifiers(nodeIds));
|
|
229
|
-
const nodeDerivative = getPrettyDerivativeNode(nodeF);
|
|
230
|
-
let isExploding = false;
|
|
231
|
-
try {
|
|
232
|
-
const _nodeValueFunction = nodeBySubstitutingVar(nodeF, nodeXAsked, "x".toTree()).simplify();
|
|
233
|
-
const _nodeValueDerivative = nodeBySubstitutingVar(nodeDerivative, nodeXAsked, "x".toTree()).simplify();
|
|
234
|
-
}
|
|
235
|
-
catch (_) {
|
|
236
|
-
isExploding = true;
|
|
237
|
-
}
|
|
238
|
-
return isExploding;
|
|
239
|
-
};
|
|
240
|
-
isValid = !isExploding(identifiersCandidate);
|
|
247
|
+
isValid = isIdentifiersQCPassed(identifiersCandidate);
|
|
241
248
|
if (isValid) {
|
|
242
249
|
identifiers = identifiersCandidate;
|
|
243
250
|
}
|
|
244
251
|
}
|
|
245
252
|
if (!isValid) {
|
|
246
253
|
const identifiersDefault = {
|
|
247
|
-
nodeIdsXAsked:
|
|
248
|
-
|
|
249
|
-
value: 3,
|
|
250
|
-
},
|
|
251
|
-
nodeIdsF: {
|
|
252
|
-
id: 10,
|
|
253
|
-
name: "x",
|
|
254
|
-
},
|
|
254
|
+
nodeIdsXAsked: (3).toTree().toIdentifiers(),
|
|
255
|
+
nodeIdsF: "x".toTree().toIdentifiers(),
|
|
255
256
|
typeF: "$x$",
|
|
256
257
|
};
|
|
257
258
|
identifiers = identifiersDefault;
|
|
258
259
|
}
|
|
260
|
+
return identifiers;
|
|
261
|
+
};
|
|
262
|
+
const getValueDerivativeFromFunctionExpressionQuestion = (optsIn) => {
|
|
263
|
+
const arrayedOptions = optsIn ?? arrayedOptsDefault;
|
|
264
|
+
const typeF = random(arrayedOptions.typeF);
|
|
265
|
+
const identifiers = createQCPassedIdentifiers(typeF);
|
|
259
266
|
return getQuestionFromIdentifiers(identifiers);
|
|
260
267
|
};
|
|
261
268
|
const getQuestionFromIdentifiers = (identifiers) => {
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Exercise } from "../../../../exercises/exercise.js";
|
|
2
|
+
type Identifiers = {
|
|
3
|
+
A: number[];
|
|
4
|
+
B: number[];
|
|
5
|
+
coeffs: number[];
|
|
6
|
+
};
|
|
7
|
+
export declare const derivativeNumberAndImageReading: Exercise<Identifiers>;
|
|
8
|
+
export {};
|
|
9
|
+
//# sourceMappingURL=derivativeNumberAndImageReading.d.ts.map
|
package/lib/exercises/math/derivation/derivativeNumber/derivativeNumberAndImageReading.d.ts.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"derivativeNumberAndImageReading.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/derivation/derivativeNumber/derivativeNumberAndImageReading.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAUT,MAAM,6BAA6B,CAAC;AAWrC,KAAK,WAAW,GAAG;IACjB,CAAC,EAAE,MAAM,EAAE,CAAC;IACZ,CAAC,EAAE,MAAM,EAAE,CAAC;IACZ,MAAM,EAAE,MAAM,EAAE,CAAC;CAClB,CAAC;AAkJF,eAAO,MAAM,+BAA+B,EAAE,QAAQ,CAAC,WAAW,CAejE,CAAC"}
|
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
import { getDistinctQuestions } from "../../../../exercises/utils/getDistinctQuestions.js";
|
|
2
|
+
import { valueTableVEA } from "../../../../exercises/vea/valueTableVEA.js";
|
|
3
|
+
import { blueMain, orange } from "../../../../geogebra/colors.js";
|
|
4
|
+
import { GeogebraConstructor } from "../../../../geogebra/geogebraConstructor.js";
|
|
5
|
+
import { Integer } from "../../../../math/numbers/integer/integer.js";
|
|
6
|
+
import { Rational } from "../../../../math/numbers/rationals/rational.js";
|
|
7
|
+
import { Polynomial } from "../../../../math/polynomials/polynomial.js";
|
|
8
|
+
import { randint } from "../../../../math/utils/random/randint.js";
|
|
9
|
+
import { handleVEAError } from "../../../../utils/errors/handleVEAError.js";
|
|
10
|
+
const getInstruction = (identifiers) => {
|
|
11
|
+
const { A } = identifiers;
|
|
12
|
+
const xA = A[0];
|
|
13
|
+
return `Ci-dessous sont tracées la courbe $\\mathcal C_f$ de la fonction $f$ et la tangente à cette courbe au point d'abscisse $${xA}$.
|
|
14
|
+
|
|
15
|
+
Déterminer $f(${xA})$ et $f'(${xA})$.`;
|
|
16
|
+
};
|
|
17
|
+
const getAnswerTable = (identifiers) => {
|
|
18
|
+
const { A, B } = identifiers;
|
|
19
|
+
const xA = A[0];
|
|
20
|
+
const xB = B[0];
|
|
21
|
+
const yA = A[1];
|
|
22
|
+
const yB = B[1];
|
|
23
|
+
const pente = new Rational(yB - yA, xB - xA).simplify();
|
|
24
|
+
const penteTree = pente.toTree();
|
|
25
|
+
const deriv = penteTree.toTex();
|
|
26
|
+
return [
|
|
27
|
+
[`$f(${xA})$`, yA.frenchify()],
|
|
28
|
+
[`$f'(${xA})$`, deriv],
|
|
29
|
+
];
|
|
30
|
+
};
|
|
31
|
+
const getGGBOptions = (identifiers) => {
|
|
32
|
+
const { A, B } = identifiers;
|
|
33
|
+
const xA = A[0];
|
|
34
|
+
const xB = B[0];
|
|
35
|
+
const yA = A[1];
|
|
36
|
+
const yB = B[1];
|
|
37
|
+
const pente = new Rational(yB - yA, xB - xA).simplify();
|
|
38
|
+
const origin = pente
|
|
39
|
+
.opposite()
|
|
40
|
+
.multiply(new Integer(xA))
|
|
41
|
+
.add(new Integer(yA));
|
|
42
|
+
const penteTree = pente.toTree();
|
|
43
|
+
const originTree = origin.toTree();
|
|
44
|
+
const penteString = penteTree.toMathString();
|
|
45
|
+
const originString = originTree.toMathString();
|
|
46
|
+
const polynome = new Polynomial(identifiers.coeffs);
|
|
47
|
+
const commands = [
|
|
48
|
+
`f(x) = ${polynome.toMathString()}`,
|
|
49
|
+
`SetColor(f, "${blueMain}")`,
|
|
50
|
+
`SetCaption(f, "$\\mathcal C_f$")`,
|
|
51
|
+
`ShowLabel(f, true)`,
|
|
52
|
+
`g(x) = (${penteString}) * x + (${originString})`,
|
|
53
|
+
`SetColor(g, "${orange}")`,
|
|
54
|
+
`A = (${xA},${yA})`,
|
|
55
|
+
"SetFixed(A, true, false)",
|
|
56
|
+
"SetPointStyle(A, 1)",
|
|
57
|
+
];
|
|
58
|
+
const xMin = Math.min(xA, xB);
|
|
59
|
+
const yMin = Math.min(yA, yB);
|
|
60
|
+
const xMax = Math.max(xA, xB);
|
|
61
|
+
const yMax = Math.max(yA, yB);
|
|
62
|
+
const ggb = new GeogebraConstructor({
|
|
63
|
+
commands,
|
|
64
|
+
});
|
|
65
|
+
return ggb.getOptions({
|
|
66
|
+
coords: [xMin - 5, xMax + 5, yMin - 5, yMax + 5],
|
|
67
|
+
});
|
|
68
|
+
};
|
|
69
|
+
const getHint = () => {
|
|
70
|
+
return `- $f(a)$ est l'image de $a$ par la fonction $f$.
|
|
71
|
+
|
|
72
|
+
- $f'(a)$ est le nombre dérivé de $f$ en $a$ : c'est le coefficient directeur de la tangente à la courbe de $f$ au point d'abscisse $a$.`;
|
|
73
|
+
};
|
|
74
|
+
const getCorrection = (identifiers) => {
|
|
75
|
+
const { A, B } = identifiers;
|
|
76
|
+
const xA = A[0];
|
|
77
|
+
const xB = B[0];
|
|
78
|
+
const yA = A[1];
|
|
79
|
+
const yB = B[1];
|
|
80
|
+
const pente = new Rational(yB - yA, xB - xA).simplify();
|
|
81
|
+
const penteTree = pente.toTree();
|
|
82
|
+
const deriv = penteTree.toTex();
|
|
83
|
+
return `On commence par lire $f(${xA})$ : c'est l'image par $f$ de $${xA}$. On lit donc graphiquement :
|
|
84
|
+
|
|
85
|
+
$$
|
|
86
|
+
f(${xA}) = ${yA.frenchify()}
|
|
87
|
+
$$
|
|
88
|
+
|
|
89
|
+
Puis, on lit $f'(${xA})$ : c'est le nombre dérivé de $f$ en $a$, c'est à dire le coefficient directeur de la tangente à la courbe de $f$ au point d'abscisse $a$. On lit donc graphiquement :
|
|
90
|
+
|
|
91
|
+
$$
|
|
92
|
+
f'(${xA}) = ${deriv}
|
|
93
|
+
$$
|
|
94
|
+
`;
|
|
95
|
+
};
|
|
96
|
+
const getDerivativeNumberReading = () => {
|
|
97
|
+
const [xA, yA] = [1, 2].map((_el) => randint(-5, 6));
|
|
98
|
+
const xB = xA > 0 ? randint(xA - 4, 6, [xA]) : randint(-4, xA + 5, [xA]); // l'écart entre les deux points ne soit pas grand
|
|
99
|
+
const yB = yA > 0 ? randint(yA - 4, 6) : randint(-4, yA + 5);
|
|
100
|
+
const pente = new Rational(yB - yA, xB - xA).simplify();
|
|
101
|
+
const penteValue = pente.value;
|
|
102
|
+
const [a, b] = [
|
|
103
|
+
(3 * randint(-100, 100, [0])) / 100,
|
|
104
|
+
(2 * randint(-4, 5)) / 100,
|
|
105
|
+
];
|
|
106
|
+
const c = penteValue - a * Math.pow(xA, 2) - b * xA;
|
|
107
|
+
const d = yA - (a / 3) * Math.pow(xA, 3) - (b / 2) * Math.pow(xA, 2) - xA * c;
|
|
108
|
+
const identifiers = {
|
|
109
|
+
A: [xA, yA],
|
|
110
|
+
B: [xB, yB],
|
|
111
|
+
coeffs: [d, c, b / 2, a / 3],
|
|
112
|
+
};
|
|
113
|
+
return getQuestionFromIdentifiers(identifiers);
|
|
114
|
+
};
|
|
115
|
+
const getQuestionFromIdentifiers = (identifiers) => {
|
|
116
|
+
const xA = identifiers.A[0];
|
|
117
|
+
const question = {
|
|
118
|
+
instruction: getInstruction(identifiers),
|
|
119
|
+
answerTable: getAnswerTable(identifiers),
|
|
120
|
+
ggbOptions: getGGBOptions(identifiers),
|
|
121
|
+
answerFormat: "tex",
|
|
122
|
+
keys: [],
|
|
123
|
+
identifiers,
|
|
124
|
+
hint: getHint(identifiers),
|
|
125
|
+
correction: getCorrection(identifiers),
|
|
126
|
+
initTable: [
|
|
127
|
+
[`$f(${xA})$`, ""],
|
|
128
|
+
[`$f'(${xA})$`, ""],
|
|
129
|
+
],
|
|
130
|
+
};
|
|
131
|
+
return question;
|
|
132
|
+
};
|
|
133
|
+
const isAnswerTableValid = (ans, { answerTable }) => {
|
|
134
|
+
try {
|
|
135
|
+
return valueTableVEA(ans, answerTable);
|
|
136
|
+
}
|
|
137
|
+
catch (err) {
|
|
138
|
+
return handleVEAError(err);
|
|
139
|
+
}
|
|
140
|
+
};
|
|
141
|
+
export const derivativeNumberAndImageReading = {
|
|
142
|
+
id: "derivativeNumberAndImageReading",
|
|
143
|
+
connector: "=",
|
|
144
|
+
label: "Lire graphiquement $f'(a)$ et $f(a)$",
|
|
145
|
+
isSingleStep: false,
|
|
146
|
+
generator: (nb) => getDistinctQuestions(getDerivativeNumberReading, nb),
|
|
147
|
+
qcmTimer: 60,
|
|
148
|
+
freeTimer: 60,
|
|
149
|
+
isAnswerTableValid,
|
|
150
|
+
hasGeogebra: true,
|
|
151
|
+
subject: "Mathématiques",
|
|
152
|
+
getQuestionFromIdentifiers,
|
|
153
|
+
answerType: "valueTable",
|
|
154
|
+
hasHintAndCorrection: true,
|
|
155
|
+
};
|
|
@@ -6,4 +6,5 @@ export * from "./expressFAPlusH.js";
|
|
|
6
6
|
export * from "./findAverageRateLimit.js";
|
|
7
7
|
export * from "./signOfDerivativeNumberFromFunctionCurve.js";
|
|
8
8
|
export * from "./valueTableImageAndDerivativeFromFunctionExpression.js";
|
|
9
|
+
export * from "./derivativeNumberAndImageReading.js";
|
|
9
10
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/derivation/derivativeNumber/index.ts"],"names":[],"mappings":"AAAA,cAAc,6BAA6B,CAAC;AAC5C,cAAc,oCAAoC,CAAC;AACnD,cAAc,uCAAuC,CAAC;AACtD,cAAc,6CAA6C,CAAC;AAC5D,cAAc,qBAAqB,CAAC;AACpC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,8CAA8C,CAAC;AAC7D,cAAc,yDAAyD,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/derivation/derivativeNumber/index.ts"],"names":[],"mappings":"AAAA,cAAc,6BAA6B,CAAC;AAC5C,cAAc,oCAAoC,CAAC;AACnD,cAAc,uCAAuC,CAAC;AACtD,cAAc,6CAA6C,CAAC;AAC5D,cAAc,qBAAqB,CAAC;AACpC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,8CAA8C,CAAC;AAC7D,cAAc,yDAAyD,CAAC;AACxE,cAAc,sCAAsC,CAAC"}
|
|
@@ -6,3 +6,4 @@ export * from "./expressFAPlusH.js";
|
|
|
6
6
|
export * from "./findAverageRateLimit.js";
|
|
7
7
|
export * from "./signOfDerivativeNumberFromFunctionCurve.js";
|
|
8
8
|
export * from "./valueTableImageAndDerivativeFromFunctionExpression.js";
|
|
9
|
+
export * from "./derivativeNumberAndImageReading.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"problemMaximizeBoxVolumeFindX.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/derivation/problems/problemMaximizeBoxVolumeFindX.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,
|
|
1
|
+
{"version":3,"file":"problemMaximizeBoxVolumeFindX.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/derivation/problems/problemMaximizeBoxVolumeFindX.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAeT,MAAM,6BAA6B,CAAC;AAkCrC,KAAK,WAAW,GAAG;IACjB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;CACX,CAAC;AAmPF,eAAO,MAAM,6BAA6B,EAAE,QAAQ,CAAC,WAAW,CAiB/D,CAAC"}
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import { addValidProp, tryToAddWrongProp, propWhile, } from "../../../../exercises/exercise.js";
|
|
2
2
|
import { getDistinctQuestions } from "../../../../exercises/utils/getDistinctQuestions.js";
|
|
3
3
|
import { SetVEA } from "../../../../exercises/vea/setVEA.js";
|
|
4
|
+
import { blueLight } from "../../../../geogebra/colors.js";
|
|
5
|
+
import { GeogebraConstructor } from "../../../../geogebra/geogebraConstructor.js";
|
|
6
|
+
import { Point } from "../../../../math/geometry/point.js";
|
|
4
7
|
import { createNodeFPolynomialFromCoeffs, getAnswerStuffSolveSecondDegreePolynomial, getArrNodeCoeffOfPolynomialNode, getTexSolveSecondDegreeEquation, } from "../../../../math/utils/polynomial/polynomialUtils.js";
|
|
5
8
|
import { round } from "../../../../math/utils/round.js";
|
|
6
9
|
import { EquationSolutionNode } from "../../../../tree/nodes/equations/equationSolutionNode.js";
|
|
@@ -11,7 +14,6 @@ import { DiscreteSetNode } from "../../../../tree/nodes/sets/discreteSetNode.js"
|
|
|
11
14
|
import { discreteSetParser } from "../../../../tree/parsers/discreteSetParser.js";
|
|
12
15
|
import { randomMany } from "../../../../utils/alea/random.js";
|
|
13
16
|
import { shuffle } from "../../../../utils/alea/shuffle.js";
|
|
14
|
-
import { alignTex } from "../../../../utils/latex/alignTex.js";
|
|
15
17
|
const getNodeF = (a, b) => {
|
|
16
18
|
const nodeVarX = "x".toTree();
|
|
17
19
|
return multiply(multiply(substract(a, multiply(2, nodeVarX)), substract(b, multiply(2, nodeVarX))), nodeVarX);
|
|
@@ -42,61 +44,69 @@ const getAnswerNode = (identifiers) => {
|
|
|
42
44
|
const getAnswer = (identifiers) => {
|
|
43
45
|
return getAnswerNode(identifiers).toTex();
|
|
44
46
|
};
|
|
45
|
-
const getHint = () => {
|
|
47
|
+
const getHint = (identifiers) => {
|
|
48
|
+
const { a, b } = identifiers;
|
|
46
49
|
return `Le volume de la boîte peut être calculé avec la formule :
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
Ici, la largeur
|
|
55
|
-
la longueur
|
|
56
|
-
et la profondeur
|
|
50
|
+
|
|
51
|
+
$$
|
|
52
|
+
V = l \\times L \\times h
|
|
53
|
+
$$
|
|
54
|
+
|
|
55
|
+
avec $l$ la longueur, $L$ la largeur et $h$ la profondeur.
|
|
56
|
+
|
|
57
|
+
Ici, la largeur vaut $${a.frenchify()}-2x$,
|
|
58
|
+
la longueur vaut $${b.frenchify()}-2x$
|
|
59
|
+
et la profondeur vaut $x$.
|
|
60
|
+
|
|
61
|
+
Pour déterminer les valeurs maximales de $V$,
|
|
62
|
+
on cherche les extremums locaux de $V$,
|
|
63
|
+
c'est-à-dire les valeurs de $x$ pour lesquelles $V'(x)=0$.
|
|
64
|
+
|
|
65
|
+
`;
|
|
57
66
|
};
|
|
58
67
|
const getCorrection = (identifiers) => {
|
|
59
68
|
const { a, b } = identifiers;
|
|
60
|
-
const
|
|
69
|
+
const nodeFRaw = getNodeF(a, b);
|
|
70
|
+
const nodeF = createNodeFPolynomialFromCoeffs(getArrNodeCoeffOfPolynomialNode(nodeFRaw));
|
|
61
71
|
const nodeDerivative = nodeF.derivative();
|
|
62
72
|
const nodeDerivativeExpanded = (() => {
|
|
63
73
|
const arrNodeCoeff = getArrNodeCoeffOfPolynomialNode(nodeDerivative);
|
|
64
74
|
return createNodeFPolynomialFromCoeffs(arrNodeCoeff);
|
|
65
75
|
})();
|
|
66
76
|
const nodeMaxBound = frac(a, 2);
|
|
67
|
-
return `On calcule le volume en fonction de $x
|
|
77
|
+
return `On calcule le volume en fonction de $x$.
|
|
78
|
+
|
|
79
|
+
Ici, la largeur vaut $${a.frenchify()}-2x$,
|
|
80
|
+
la longueur vaut $${b.frenchify()}-2x$
|
|
81
|
+
et la profondeur vaut $x$.
|
|
82
|
+
|
|
83
|
+
Donc :
|
|
68
84
|
|
|
69
85
|
$$
|
|
70
|
-
V(x) = ${
|
|
86
|
+
V(x) = ${nodeFRaw.toTex()}
|
|
71
87
|
$$
|
|
72
88
|
|
|
73
89
|
$x$ est compris entre $0$ et $${[
|
|
74
90
|
...new Set([nodeMaxBound.toTex(), nodeMaxBound.simplify().toTex()]),
|
|
75
91
|
].join("=")}$.
|
|
76
92
|
|
|
77
|
-
On
|
|
93
|
+
On cherche à maximiser $V$.
|
|
94
|
+
$V$ est continue et dérivable. On calcule :
|
|
78
95
|
|
|
79
96
|
$$
|
|
80
|
-
V(
|
|
97
|
+
V(x) = ${nodeF.toTex()}
|
|
81
98
|
$$
|
|
82
99
|
|
|
83
|
-
et pour $x$ différent de $0$ et de $${nodeMaxBound.simplify().toTex()}$ :
|
|
84
|
-
|
|
85
100
|
$$
|
|
86
|
-
V(x)
|
|
101
|
+
V'(x) = ${nodeDerivativeExpanded.toTex()}
|
|
87
102
|
$$
|
|
88
103
|
|
|
89
|
-
On cherche à maximiser $V$.
|
|
90
|
-
$V$ est continue et dérivable. On calcule :
|
|
91
|
-
|
|
92
|
-
${alignTex([
|
|
93
|
-
[`V'(x)`, "=", nodeDerivative.toTex()],
|
|
94
|
-
[``, "=", nodeDerivativeExpanded.toTex()],
|
|
95
|
-
])}
|
|
96
|
-
|
|
97
104
|
On résout $V'(x)=0$ :
|
|
98
105
|
|
|
99
|
-
${getTexSolveSecondDegreeEquation(nodeDerivativeExpanded
|
|
106
|
+
${getTexSolveSecondDegreeEquation(nodeDerivativeExpanded, {
|
|
107
|
+
nodeVar: "x".toTree(),
|
|
108
|
+
isShouldApprox: true,
|
|
109
|
+
})}
|
|
100
110
|
|
|
101
111
|
On ne garde que les valeurs de $x$ qui sont possibles (c'est-à-dire entre $0$ et $${nodeMaxBound
|
|
102
112
|
.simplify()
|
|
@@ -108,6 +118,45 @@ $$
|
|
|
108
118
|
|
|
109
119
|
`;
|
|
110
120
|
};
|
|
121
|
+
const getGGBOptions = () => {
|
|
122
|
+
const w = 9;
|
|
123
|
+
const h = 5;
|
|
124
|
+
const z = 1;
|
|
125
|
+
const pointTL1 = new Point("PTL1", 0, h);
|
|
126
|
+
const pointBR1 = new Point("PBR1", w, 0);
|
|
127
|
+
const pointTL2 = new Point("PTL2", z, h - z);
|
|
128
|
+
const pointBR2 = new Point("PBR2", w - z, z);
|
|
129
|
+
const commands = [
|
|
130
|
+
//rect1
|
|
131
|
+
`r1 = Polygon((${pointTL1.x.toMathString()}, ${pointBR1.y.toMathString()}), (${pointTL1.x.toMathString()}, ${pointTL1.y.toMathString()}), (${pointBR1.x.toMathString()}, ${pointTL1.y.toMathString()}), (${pointBR1.x.toMathString()}, ${pointBR1.y.toMathString()}))`,
|
|
132
|
+
//rect2 main
|
|
133
|
+
`r2M = Polygon((${pointTL2.x.toMathString()}, ${pointBR2.y.toMathString()}), (${pointTL2.x.toMathString()}, ${pointTL2.y.toMathString()}), (${pointBR2.x.toMathString()}, ${pointTL2.y.toMathString()}), (${pointBR2.x.toMathString()}, ${pointBR2.y.toMathString()}))`,
|
|
134
|
+
`SetLineStyle(r2M, 3)`,
|
|
135
|
+
`SetColor(r2M, "${blueLight}")`,
|
|
136
|
+
//rect2 R
|
|
137
|
+
`r2R = Polygon((${pointBR2.x.toMathString()}, ${pointBR2.y.toMathString()}), (${pointBR2.x.toMathString()}, ${pointTL2.y.toMathString()}), (${pointBR2.x.evaluate() + z}, ${pointTL2.y.toMathString()}), (${pointBR2.x.evaluate() + z}, ${pointBR2.y.toMathString()}))`,
|
|
138
|
+
`SetColor(r2R, "${blueLight}")`,
|
|
139
|
+
//rect2 B
|
|
140
|
+
`r2B = Polygon((${pointTL2.x.toMathString()}, ${pointBR2.y.toMathString()}), (${pointBR2.x.toMathString()}, ${pointBR2.y.toMathString()}), (${pointBR2.x.toMathString()}, ${pointBR2.y.evaluate() - z}), (${pointTL2.x.toMathString()}, ${pointBR2.y.evaluate() - z}))`,
|
|
141
|
+
`SetColor(r2B, "${blueLight}")`,
|
|
142
|
+
//rect2 L
|
|
143
|
+
`r2L = Polygon((${pointTL2.x.evaluate() - z}, ${pointBR2.y.toMathString()}), (${pointTL2.x.evaluate() - z}, ${pointTL2.y.toMathString()}), (${pointTL2.x.evaluate()}, ${pointTL2.y.toMathString()}), (${pointTL2.x.evaluate()}, ${pointBR2.y.toMathString()}))`,
|
|
144
|
+
`SetColor(r2L, "${blueLight}")`,
|
|
145
|
+
//rect2 T
|
|
146
|
+
`r2T = Polygon((${pointTL2.x.toMathString()}, ${pointTL2.y.toMathString()}), (${pointTL2.x.toMathString()}, ${pointTL2.y.evaluate() + z}), (${pointBR2.x.evaluate()}, ${pointTL2.y.evaluate() + z}), (${pointBR2.x.evaluate()}, ${pointTL2.y.toMathString()}))`,
|
|
147
|
+
`SetColor(r2T, "${blueLight}")`,
|
|
148
|
+
];
|
|
149
|
+
const ggb = new GeogebraConstructor({
|
|
150
|
+
commands,
|
|
151
|
+
forbidShiftDragZoom: true,
|
|
152
|
+
hideAxes: true,
|
|
153
|
+
hideGrid: true,
|
|
154
|
+
fontSize: 20,
|
|
155
|
+
});
|
|
156
|
+
return ggb.getOptions({
|
|
157
|
+
coords: [-2, w + 2, -2, h + 2],
|
|
158
|
+
});
|
|
159
|
+
};
|
|
111
160
|
const getPropositions = (n, { answer }) => {
|
|
112
161
|
const propositions = [];
|
|
113
162
|
addValidProp(propositions, answer);
|
|
@@ -152,6 +201,7 @@ const getQuestionFromIdentifiers = (identifiers) => {
|
|
|
152
201
|
identifiers,
|
|
153
202
|
hint: getHint(identifiers),
|
|
154
203
|
correction: getCorrection(identifiers),
|
|
204
|
+
ggbOptions: getGGBOptions(identifiers),
|
|
155
205
|
};
|
|
156
206
|
};
|
|
157
207
|
export const problemMaximizeBoxVolumeFindX = {
|
|
@@ -168,4 +218,5 @@ export const problemMaximizeBoxVolumeFindX = {
|
|
|
168
218
|
getPropositions,
|
|
169
219
|
getQuestionFromIdentifiers,
|
|
170
220
|
hasHintAndCorrection: true,
|
|
221
|
+
hasGeogebra: true,
|
|
171
222
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"problemMaximizeProfitFindProduction.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/derivation/problems/problemMaximizeProfitFindProduction.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAkBT,MAAM,6BAA6B,CAAC;AAOrC,OAAO,EAIL,0BAA0B,EAC3B,MAAM,6DAA6D,CAAC;AAYrE,OAAO,EAEL,eAAe,EAChB,MAAM,qCAAqC,CAAC;AAQ7C,KAAK,WAAW,GAAG;IACjB,QAAQ,EAAE,eAAe,CAAC;IAC1B,MAAM,EAAE,0BAA0B,EAAE,CAAC;IACrC,UAAU,EAAE,MAAM,CAAC;IACnB,KAAK,EAAE,MAAM,CAAC;CACf,CAAC;
|
|
1
|
+
{"version":3,"file":"problemMaximizeProfitFindProduction.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/derivation/problems/problemMaximizeProfitFindProduction.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAkBT,MAAM,6BAA6B,CAAC;AAOrC,OAAO,EAIL,0BAA0B,EAC3B,MAAM,6DAA6D,CAAC;AAYrE,OAAO,EAEL,eAAe,EAChB,MAAM,qCAAqC,CAAC;AAQ7C,KAAK,WAAW,GAAG;IACjB,QAAQ,EAAE,eAAe,CAAC;IAC1B,MAAM,EAAE,0BAA0B,EAAE,CAAC;IACrC,UAAU,EAAE,MAAM,CAAC;IACnB,KAAK,EAAE,MAAM,CAAC;CACf,CAAC;AAqaF,KAAK,OAAO,GAAG;IACb,KAAK,EAAE,MAAM,CAAC;CACf,CAAC;AAsBF,eAAO,MAAM,mCAAmC,EAAE,QAAQ,CACxD,WAAW,EACX,OAAO,CAoBR,CAAC"}
|