math-exercises 2.1.14 → 2.1.16
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/exercise.d.ts +1 -1
- package/lib/exercises/exercise.d.ts.map +1 -1
- package/lib/exercises/math/calcul/arithmetics/paritySumsAndProducts.js +1 -1
- package/lib/exercises/math/calculLitteral/equation/binomialsTrinomialsProposedSolutions.js +1 -1
- package/lib/exercises/math/calculLitteral/systems/verifySystemSolution.js +1 -1
- package/lib/exercises/math/derivation/derivative/convexityQuadrinomials.js +1 -1
- package/lib/exercises/math/derivation/derivative/convexityTrinomials.js +1 -1
- package/lib/exercises/math/equaDiff/equaDiffCheckSolutionFirstOrder.js +1 -1
- package/lib/exercises/math/functions/affines/affineAdjustment.d.ts.map +1 -1
- package/lib/exercises/math/functions/affines/affineAdjustment.js +16 -16
- package/lib/exercises/math/functions/affines/affineAdjustmentComplete.d.ts.map +1 -1
- package/lib/exercises/math/functions/affines/affineAdjustmentComplete.js +17 -17
- package/lib/exercises/math/functions/affines/affineAdjustmentRsquared.js +12 -12
- package/lib/exercises/math/functions/affines/affineMeanValue.d.ts +9 -0
- package/lib/exercises/math/functions/affines/affineMeanValue.d.ts.map +1 -0
- package/lib/exercises/math/functions/affines/affineMeanValue.js +77 -0
- package/lib/exercises/math/functions/affines/index.d.ts +1 -0
- package/lib/exercises/math/functions/affines/index.d.ts.map +1 -1
- package/lib/exercises/math/functions/affines/index.js +1 -0
- package/lib/exercises/math/functions/index.d.ts +1 -0
- package/lib/exercises/math/functions/index.d.ts.map +1 -1
- package/lib/exercises/math/functions/index.js +1 -0
- package/lib/exercises/math/functions/integral/index.d.ts +10 -0
- package/lib/exercises/math/functions/integral/index.d.ts.map +1 -0
- package/lib/exercises/math/functions/integral/index.js +25 -0
- package/lib/exercises/math/functions/integral/integralAffines.d.ts +9 -0
- package/lib/exercises/math/functions/integral/integralAffines.d.ts.map +1 -0
- package/lib/exercises/math/functions/integral/integralAffines.js +72 -0
- package/lib/exercises/math/functions/integral/integralDerivatedUCosU.d.ts +10 -0
- package/lib/exercises/math/functions/integral/integralDerivatedUCosU.d.ts.map +1 -0
- package/lib/exercises/math/functions/integral/integralDerivatedUCosU.js +81 -0
- package/lib/exercises/math/functions/integral/integralDerivatedUSinU.d.ts +10 -0
- package/lib/exercises/math/functions/integral/integralDerivatedUSinU.d.ts.map +1 -0
- package/lib/exercises/math/functions/integral/integralDerivatedUSinU.js +86 -0
- package/lib/exercises/math/functions/integral/integralExpAxPlusB.d.ts +10 -0
- package/lib/exercises/math/functions/integral/integralExpAxPlusB.d.ts.map +1 -0
- package/lib/exercises/math/functions/integral/integralExpAxPlusB.js +83 -0
- package/lib/exercises/math/functions/integral/integralExpU.d.ts +10 -0
- package/lib/exercises/math/functions/integral/integralExpU.d.ts.map +1 -0
- package/lib/exercises/math/functions/integral/integralExpU.js +95 -0
- package/lib/exercises/math/functions/integral/integralFractions.d.ts +10 -0
- package/lib/exercises/math/functions/integral/integralFractions.d.ts.map +1 -0
- package/lib/exercises/math/functions/integral/integralFractions.js +109 -0
- package/lib/exercises/math/functions/integral/integralKCosinus.d.ts +9 -0
- package/lib/exercises/math/functions/integral/integralKCosinus.d.ts.map +1 -0
- package/lib/exercises/math/functions/integral/integralKCosinus.js +83 -0
- package/lib/exercises/math/functions/integral/integralKSinus.d.ts +9 -0
- package/lib/exercises/math/functions/integral/integralKSinus.d.ts.map +1 -0
- package/lib/exercises/math/functions/integral/integralKSinus.js +83 -0
- package/lib/exercises/math/functions/integral/integralTrinomials.d.ts +9 -0
- package/lib/exercises/math/functions/integral/integralTrinomials.d.ts.map +1 -0
- package/lib/exercises/math/functions/integral/integralTrinomials.js +78 -0
- package/lib/exercises/math/functions/parity/parityFromAlgebra.js +1 -1
- package/lib/exercises/math/functions/parity/parityFromGraph.js +1 -1
- package/lib/exercises/math/functions/trinoms/extremumTypeFromAlgebricForm.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/trinomialMeanValue.d.ts +9 -0
- package/lib/exercises/math/functions/trinoms/trinomialMeanValue.d.ts.map +1 -0
- package/lib/exercises/math/functions/trinoms/trinomialMeanValue.js +77 -0
- package/lib/exercises/math/functions/trinoms/variationsFromAlgebricForm.js +1 -1
- package/lib/exercises/math/geometry/convexity/convexityTrinomialsGeo.js +1 -1
- package/lib/exercises/math/geometry/vectors/alignementViaColinearity.js +1 -1
- package/lib/exercises/math/geometry/vectors/colinearity.js +1 -1
- package/lib/exercises/math/geometry/vectors/equalCaracteristicFromGraph.js +1 -1
- package/lib/exercises/math/geometry/vectors/paralellismViaColinearity.js +1 -1
- package/lib/exercises/math/geometry/vectors/parallelogramViaEqualVectors.js +1 -1
- package/lib/exercises/math/matrices/matrixGeneralTerm.js +1 -1
- package/lib/exercises/math/probaStat/calculateProbaOfBinomialDistribution.d.ts +13 -0
- package/lib/exercises/math/probaStat/calculateProbaOfBinomialDistribution.d.ts.map +1 -0
- package/lib/exercises/math/probaStat/calculateProbaOfBinomialDistribution.js +85 -0
- package/lib/exercises/math/probaStat/expectedValueOfBinomialProba.d.ts +9 -0
- package/lib/exercises/math/probaStat/expectedValueOfBinomialProba.d.ts.map +1 -0
- package/lib/exercises/math/probaStat/expectedValueOfBinomialProba.js +77 -0
- package/lib/exercises/math/probaStat/independancy.js +1 -1
- package/lib/exercises/math/probaStat/index.d.ts +3 -0
- package/lib/exercises/math/probaStat/index.d.ts.map +1 -1
- package/lib/exercises/math/probaStat/index.js +3 -0
- package/lib/exercises/math/probaStat/stats2var/fineAdjustementExercise.d.ts.map +1 -1
- package/lib/exercises/math/probaStat/stats2var/fineAdjustementExercise.js +20 -9
- package/lib/exercises/math/probaStat/varianceOfBinomialProba.d.ts +9 -0
- package/lib/exercises/math/probaStat/varianceOfBinomialProba.d.ts.map +1 -0
- package/lib/exercises/math/probaStat/varianceOfBinomialProba.js +74 -0
- package/lib/exercises/math/sequences/arithmetic/recognizeArithmeticFromFirstTerms.js +1 -1
- package/lib/exercises/math/sequences/arithmetic/recognizeArithmeticFromGraph.js +1 -1
- package/lib/exercises/math/sequences/genericSequenceVariations.js +1 -1
- package/lib/exercises/math/trigonometry/arcValue.d.ts +9 -0
- package/lib/exercises/math/trigonometry/arcValue.d.ts.map +1 -0
- package/lib/exercises/math/trigonometry/arcValue.js +78 -0
- package/lib/exercises/math/trigonometry/calculateCosSinAndTan.d.ts +7 -0
- package/lib/exercises/math/trigonometry/calculateCosSinAndTan.d.ts.map +1 -0
- package/lib/exercises/math/trigonometry/calculateCosSinAndTan.js +71 -0
- package/lib/exercises/math/trigonometry/index.d.ts +2 -0
- package/lib/exercises/math/trigonometry/index.d.ts.map +1 -1
- package/lib/exercises/math/trigonometry/index.js +2 -0
- package/lib/exercises/pc/chemicalElements/atomicStructureOfNucleus.js +1 -1
- package/lib/exercises/pc/chemicalElements/identifyRightElectronicConfiguration.js +1 -1
- package/lib/exercises/pc/chemicalReactions/identifyLimitingReagent.js +1 -1
- package/lib/exercises/pc/chemicalReactions/identifyStoichiometricMixture.js +1 -1
- package/lib/exercises/pc/sound/frequencyComparison.js +1 -1
- package/lib/index.d.ts +70 -0
- package/lib/index.d.ts.map +1 -1
- package/lib/math/trigonometry/remarkableValue.d.ts.map +1 -1
- package/lib/math/trigonometry/remarkableValue.js +1 -0
- package/lib/math/trigonometry/remarkableValues.d.ts +1 -0
- package/lib/math/trigonometry/remarkableValues.d.ts.map +1 -1
- package/lib/math/trigonometry/remarkableValues.js +30 -29
- package/lib/math/utils/combinatorics/combination.d.ts +2 -0
- package/lib/math/utils/combinatorics/combination.d.ts.map +1 -0
- package/lib/math/utils/combinatorics/combination.js +8 -0
- package/lib/tree/nodes/algebraicNode.d.ts +1 -0
- package/lib/tree/nodes/algebraicNode.d.ts.map +1 -1
- package/lib/tree/nodes/functions/arcSinNode.d.ts +19 -0
- package/lib/tree/nodes/functions/arcSinNode.d.ts.map +1 -0
- package/lib/tree/nodes/functions/arcSinNode.js +59 -0
- package/lib/tree/nodes/functions/arccosNode.d.ts +19 -0
- package/lib/tree/nodes/functions/arccosNode.d.ts.map +1 -0
- package/lib/tree/nodes/functions/arccosNode.js +60 -0
- package/lib/tree/nodes/functions/arctanNode.d.ts +19 -0
- package/lib/tree/nodes/functions/arctanNode.d.ts.map +1 -0
- package/lib/tree/nodes/functions/arctanNode.js +60 -0
- package/lib/tree/nodes/functions/cosNode.d.ts +3 -3
- package/lib/tree/nodes/functions/cosNode.d.ts.map +1 -1
- package/lib/tree/nodes/functions/cosNode.js +14 -15
- package/lib/tree/nodes/functions/expNode.d.ts +1 -1
- package/lib/tree/nodes/functions/expNode.d.ts.map +1 -1
- package/lib/tree/nodes/functions/expNode.js +11 -1
- package/lib/tree/nodes/functions/functionNode.d.ts +8 -4
- package/lib/tree/nodes/functions/functionNode.d.ts.map +1 -1
- package/lib/tree/nodes/functions/functionNode.js +8 -4
- package/lib/tree/nodes/functions/integralNode.d.ts +12 -0
- package/lib/tree/nodes/functions/integralNode.d.ts.map +1 -0
- package/lib/tree/nodes/functions/integralNode.js +16 -0
- package/lib/tree/nodes/functions/sinNode.d.ts +2 -2
- package/lib/tree/nodes/functions/sinNode.d.ts.map +1 -1
- package/lib/tree/nodes/functions/sinNode.js +13 -14
- package/lib/tree/nodes/functions/tanNode.d.ts +19 -0
- package/lib/tree/nodes/functions/tanNode.d.ts.map +1 -0
- package/lib/tree/nodes/functions/tanNode.js +64 -0
- package/lib/tree/nodes/geometry/degree.d.ts +20 -0
- package/lib/tree/nodes/geometry/degree.d.ts.map +1 -0
- package/lib/tree/nodes/geometry/degree.js +48 -0
- package/lib/tree/nodes/operators/operatorNode.d.ts +2 -1
- package/lib/tree/nodes/operators/operatorNode.d.ts.map +1 -1
- package/lib/tree/nodes/operators/operatorNode.js +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.IntegralDerivatedUCosU = void 0;
|
|
4
|
+
const exercise_1 = require("../../../../exercises/exercise");
|
|
5
|
+
const getDistinctQuestions_1 = require("../../../../exercises/utils/getDistinctQuestions");
|
|
6
|
+
const affine_1 = require("../../../../math/polynomials/affine");
|
|
7
|
+
const randint_1 = require("../../../../math/utils/random/randint");
|
|
8
|
+
const cosNode_1 = require("../../../../tree/nodes/functions/cosNode");
|
|
9
|
+
const integralNode_1 = require("../../../../tree/nodes/functions/integralNode");
|
|
10
|
+
const sinNode_1 = require("../../../../tree/nodes/functions/sinNode");
|
|
11
|
+
const addNode_1 = require("../../../../tree/nodes/operators/addNode");
|
|
12
|
+
const multiplyNode_1 = require("../../../../tree/nodes/operators/multiplyNode");
|
|
13
|
+
const substractNode_1 = require("../../../../tree/nodes/operators/substractNode");
|
|
14
|
+
const getIntegralDerivatedUCosUQuestion = () => {
|
|
15
|
+
const u = affine_1.AffineConstructor.random();
|
|
16
|
+
const cosU = new cosNode_1.CosNode(u.toTree());
|
|
17
|
+
const b = (0, randint_1.randint)(-4, 6);
|
|
18
|
+
const a = (0, randint_1.randint)(-5, b);
|
|
19
|
+
const integral = new integralNode_1.IntegralNode(new multiplyNode_1.MultiplyNode(u.derivate().toTree(), cosU), a.toTree(), b.toTree(), "x");
|
|
20
|
+
const correctAns = getCorrectAnswer(a, b, u);
|
|
21
|
+
const question = {
|
|
22
|
+
answer: correctAns.simplify().toTex(),
|
|
23
|
+
instruction: `Calculer : $${integral.toTex()}$`,
|
|
24
|
+
keys: ["sin", "cos"],
|
|
25
|
+
answerFormat: "tex",
|
|
26
|
+
identifiers: { a, b, aU: u.a, bU: u.b },
|
|
27
|
+
};
|
|
28
|
+
return question;
|
|
29
|
+
};
|
|
30
|
+
const getPropositions = (n, { answer, a, b, aU, bU }) => {
|
|
31
|
+
const propositions = [];
|
|
32
|
+
const u = new affine_1.Affine(aU, bU, "x");
|
|
33
|
+
(0, exercise_1.addValidProp)(propositions, answer);
|
|
34
|
+
generatePropositions(a, b, u).forEach((value) => (0, exercise_1.tryToAddWrongProp)(propositions, value));
|
|
35
|
+
let sinA;
|
|
36
|
+
let sinB;
|
|
37
|
+
while (propositions.length < n) {
|
|
38
|
+
sinA = new sinNode_1.SinNode((0, randint_1.randint)(-11, 10, [0]).toTree());
|
|
39
|
+
sinB = new sinNode_1.SinNode((0, randint_1.randint)(-11, 10, [0]).toTree());
|
|
40
|
+
(0, exercise_1.tryToAddWrongProp)(propositions, new substractNode_1.SubstractNode(sinB, sinA).toTex());
|
|
41
|
+
}
|
|
42
|
+
return (0, exercise_1.shuffleProps)(propositions, n);
|
|
43
|
+
};
|
|
44
|
+
const isAnswerValid = (ans, { a, b, aU, bU }) => {
|
|
45
|
+
const u = new affine_1.Affine(aU, bU, "x");
|
|
46
|
+
const correctAns = getCorrectAnswer(a, b, u).simplify();
|
|
47
|
+
return correctAns.toAllValidTexs().includes(ans);
|
|
48
|
+
};
|
|
49
|
+
const getCorrectAnswer = (a, b, u) => {
|
|
50
|
+
const uTree = u.toTree();
|
|
51
|
+
const primitiveA = new sinNode_1.SinNode(uTree.evaluate({ x: a }).toTree());
|
|
52
|
+
const primitiveB = new sinNode_1.SinNode(uTree.evaluate({ x: b }).toTree());
|
|
53
|
+
return new substractNode_1.SubstractNode(primitiveB, primitiveA);
|
|
54
|
+
};
|
|
55
|
+
const generatePropositions = (a, b, u) => {
|
|
56
|
+
const uTree = u.toTree();
|
|
57
|
+
const uDerivated = u.derivate();
|
|
58
|
+
const sinA = new sinNode_1.SinNode(uTree.evaluate({ x: a }).toTree());
|
|
59
|
+
const sinB = new sinNode_1.SinNode(uTree.evaluate({ x: b }).toTree());
|
|
60
|
+
const firstProposition = new addNode_1.AddNode(sinB, sinA).simplify();
|
|
61
|
+
const secondProposition = new substractNode_1.SubstractNode(sinA, sinB).simplify();
|
|
62
|
+
const thirdProposition = new multiplyNode_1.MultiplyNode(uDerivated.toTree(), new sinNode_1.SinNode(uTree)).simplify();
|
|
63
|
+
return [
|
|
64
|
+
firstProposition.toTex(),
|
|
65
|
+
secondProposition.toTex(),
|
|
66
|
+
thirdProposition.toTex(),
|
|
67
|
+
];
|
|
68
|
+
};
|
|
69
|
+
exports.IntegralDerivatedUCosU = {
|
|
70
|
+
id: "IntegralDerivatedUCosU",
|
|
71
|
+
label: "Calcul d'intégrales de fonctions du type $u'\\cos(u)$",
|
|
72
|
+
levels: ["TermSpé"],
|
|
73
|
+
isSingleStep: true,
|
|
74
|
+
sections: ["Intégration"],
|
|
75
|
+
generator: (nb) => (0, getDistinctQuestions_1.getDistinctQuestions)(getIntegralDerivatedUCosUQuestion, nb),
|
|
76
|
+
qcmTimer: 60,
|
|
77
|
+
freeTimer: 60,
|
|
78
|
+
getPropositions,
|
|
79
|
+
isAnswerValid,
|
|
80
|
+
subject: "Mathématiques",
|
|
81
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Exercise } from "../../../../exercises/exercise";
|
|
2
|
+
type Identifiers = {
|
|
3
|
+
a: number;
|
|
4
|
+
b: number;
|
|
5
|
+
aU: number;
|
|
6
|
+
bU: number;
|
|
7
|
+
};
|
|
8
|
+
export declare const integralDerivatedUSinU: Exercise<Identifiers>;
|
|
9
|
+
export {};
|
|
10
|
+
//# sourceMappingURL=integralDerivatedUSinU.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"integralDerivatedUSinU.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/functions/integral/integralDerivatedUSinU.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAST,MAAM,0BAA0B,CAAC;AAYlC,KAAK,WAAW,GAAG;IACjB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,EAAE,EAAE,MAAM,CAAC;IACX,EAAE,EAAE,MAAM,CAAC;CACZ,CAAC;AAgHF,eAAO,MAAM,sBAAsB,EAAE,QAAQ,CAAC,WAAW,CAaxD,CAAC"}
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.integralDerivatedUSinU = void 0;
|
|
4
|
+
const exercise_1 = require("../../../../exercises/exercise");
|
|
5
|
+
const getDistinctQuestions_1 = require("../../../../exercises/utils/getDistinctQuestions");
|
|
6
|
+
const affine_1 = require("../../../../math/polynomials/affine");
|
|
7
|
+
const randint_1 = require("../../../../math/utils/random/randint");
|
|
8
|
+
const cosNode_1 = require("../../../../tree/nodes/functions/cosNode");
|
|
9
|
+
const integralNode_1 = require("../../../../tree/nodes/functions/integralNode");
|
|
10
|
+
const sinNode_1 = require("../../../../tree/nodes/functions/sinNode");
|
|
11
|
+
const addNode_1 = require("../../../../tree/nodes/operators/addNode");
|
|
12
|
+
const multiplyNode_1 = require("../../../../tree/nodes/operators/multiplyNode");
|
|
13
|
+
const substractNode_1 = require("../../../../tree/nodes/operators/substractNode");
|
|
14
|
+
const getIntegralDerivatedUSinUQuestion = () => {
|
|
15
|
+
const u = affine_1.AffineConstructor.random();
|
|
16
|
+
const b = (0, randint_1.randint)(-4, 6);
|
|
17
|
+
const a = (0, randint_1.randint)(-5, b);
|
|
18
|
+
const integral = new integralNode_1.IntegralNode(new multiplyNode_1.MultiplyNode(u.derivate().toTree(), new sinNode_1.SinNode(u.toTree())), a.toTree(), b.toTree(), "x");
|
|
19
|
+
const correctAns = getCorrectAnswer(a, b, u);
|
|
20
|
+
const question = {
|
|
21
|
+
answer: correctAns.simplify().toTex(),
|
|
22
|
+
instruction: `Calculer : $${integral.toTex()}$`,
|
|
23
|
+
keys: ["sin", "cos"],
|
|
24
|
+
answerFormat: "tex",
|
|
25
|
+
identifiers: { a, b, aU: u.a, bU: u.b },
|
|
26
|
+
};
|
|
27
|
+
return question;
|
|
28
|
+
};
|
|
29
|
+
const getPropositions = (n, { answer, a, b, aU, bU }) => {
|
|
30
|
+
const propositions = [];
|
|
31
|
+
const u = new affine_1.Affine(aU, bU, "x");
|
|
32
|
+
generatePropositions(a, b, u).forEach((value) => (0, exercise_1.tryToAddWrongProp)(propositions, value));
|
|
33
|
+
(0, exercise_1.addValidProp)(propositions, answer);
|
|
34
|
+
let primitiveA;
|
|
35
|
+
let primitiveB;
|
|
36
|
+
const minusOne = (-1).toTree();
|
|
37
|
+
while (propositions.length < n) {
|
|
38
|
+
primitiveA = new multiplyNode_1.MultiplyNode(minusOne, new cosNode_1.CosNode((0, randint_1.randint)(-10, 11, [0]).toTree())).simplify();
|
|
39
|
+
primitiveB = new multiplyNode_1.MultiplyNode(minusOne, new cosNode_1.CosNode((0, randint_1.randint)(-10, 11, [0]).toTree())).simplify();
|
|
40
|
+
(0, exercise_1.tryToAddWrongProp)(propositions, new substractNode_1.SubstractNode(primitiveB, primitiveA).simplify().toTex());
|
|
41
|
+
}
|
|
42
|
+
return (0, exercise_1.shuffleProps)(propositions, n);
|
|
43
|
+
};
|
|
44
|
+
const isAnswerValid = (ans, { a, b, aU, bU }) => {
|
|
45
|
+
const u = new affine_1.Affine(aU, bU, "x");
|
|
46
|
+
const correctAns = getCorrectAnswer(a, b, u).simplify();
|
|
47
|
+
return correctAns.toAllValidTexs().includes(ans);
|
|
48
|
+
};
|
|
49
|
+
const getCorrectAnswer = (a, b, u) => {
|
|
50
|
+
const minusOne = (-1).toTree();
|
|
51
|
+
const uTree = u.toTree();
|
|
52
|
+
const primitiveA = new multiplyNode_1.MultiplyNode(minusOne, new cosNode_1.CosNode(uTree.evaluate({ x: a }).toTree())).simplify();
|
|
53
|
+
const primitiveB = new multiplyNode_1.MultiplyNode(minusOne, new cosNode_1.CosNode(uTree.evaluate({ x: b }).toTree())).simplify();
|
|
54
|
+
return new substractNode_1.SubstractNode(primitiveB, primitiveA);
|
|
55
|
+
};
|
|
56
|
+
const generatePropositions = (a, b, u) => {
|
|
57
|
+
const minusOne = (-1).toTree();
|
|
58
|
+
const uTree = u.toTree();
|
|
59
|
+
const uA = uTree.evaluate({ x: a }).toTree();
|
|
60
|
+
const uB = uTree.evaluate({ x: b }).toTree();
|
|
61
|
+
const sinA = new sinNode_1.SinNode(uA);
|
|
62
|
+
const sinB = new sinNode_1.SinNode(uB);
|
|
63
|
+
const primitiveA = new multiplyNode_1.MultiplyNode(minusOne, new cosNode_1.CosNode(uA)).simplify();
|
|
64
|
+
const primitiveB = new multiplyNode_1.MultiplyNode(minusOne, new cosNode_1.CosNode(uB)).simplify();
|
|
65
|
+
const firstProposition = new addNode_1.AddNode(primitiveB, primitiveA);
|
|
66
|
+
const secondProposition = new addNode_1.AddNode(sinB, sinA).simplify();
|
|
67
|
+
const thirdProposition = new substractNode_1.SubstractNode(sinB, sinA).simplify();
|
|
68
|
+
return [
|
|
69
|
+
firstProposition.toTex(),
|
|
70
|
+
secondProposition.toTex(),
|
|
71
|
+
thirdProposition.toTex(),
|
|
72
|
+
];
|
|
73
|
+
};
|
|
74
|
+
exports.integralDerivatedUSinU = {
|
|
75
|
+
id: "integralDerivatedUSinU",
|
|
76
|
+
label: "Calcul d'intégrales de fonctions du type $u'\\sin(u)$",
|
|
77
|
+
levels: ["TermSpé"],
|
|
78
|
+
isSingleStep: true,
|
|
79
|
+
sections: ["Intégration"],
|
|
80
|
+
generator: (nb) => (0, getDistinctQuestions_1.getDistinctQuestions)(getIntegralDerivatedUSinUQuestion, nb),
|
|
81
|
+
qcmTimer: 60,
|
|
82
|
+
freeTimer: 60,
|
|
83
|
+
getPropositions,
|
|
84
|
+
isAnswerValid,
|
|
85
|
+
subject: "Mathématiques",
|
|
86
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Exercise } from "../../../../exercises/exercise";
|
|
2
|
+
type Identifiers = {
|
|
3
|
+
a: number;
|
|
4
|
+
b: number;
|
|
5
|
+
aX: number;
|
|
6
|
+
bX: number;
|
|
7
|
+
};
|
|
8
|
+
export declare const integralExpAxPlusB: Exercise<Identifiers>;
|
|
9
|
+
export {};
|
|
10
|
+
//# sourceMappingURL=integralExpAxPlusB.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"integralExpAxPlusB.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/functions/integral/integralExpAxPlusB.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAST,MAAM,0BAA0B,CAAC;AAYlC,KAAK,WAAW,GAAG;IACjB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,EAAE,EAAE,MAAM,CAAC;IACX,EAAE,EAAE,MAAM,CAAC;CACZ,CAAC;AA2GF,eAAO,MAAM,kBAAkB,EAAE,QAAQ,CAAC,WAAW,CAapD,CAAC"}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.integralExpAxPlusB = void 0;
|
|
4
|
+
const exercise_1 = require("../../../../exercises/exercise");
|
|
5
|
+
const getDistinctQuestions_1 = require("../../../../exercises/utils/getDistinctQuestions");
|
|
6
|
+
const affine_1 = require("../../../../math/polynomials/affine");
|
|
7
|
+
const randint_1 = require("../../../../math/utils/random/randint");
|
|
8
|
+
const expNode_1 = require("../../../../tree/nodes/functions/expNode");
|
|
9
|
+
const integralNode_1 = require("../../../../tree/nodes/functions/integralNode");
|
|
10
|
+
const addNode_1 = require("../../../../tree/nodes/operators/addNode");
|
|
11
|
+
const fractionNode_1 = require("../../../../tree/nodes/operators/fractionNode");
|
|
12
|
+
const multiplyNode_1 = require("../../../../tree/nodes/operators/multiplyNode");
|
|
13
|
+
const substractNode_1 = require("../../../../tree/nodes/operators/substractNode");
|
|
14
|
+
const getIntegralExpAxPlusBQuestion = () => {
|
|
15
|
+
const f = affine_1.AffineConstructor.random();
|
|
16
|
+
const b = (0, randint_1.randint)(-4, 6);
|
|
17
|
+
const a = (0, randint_1.randint)(-5, b);
|
|
18
|
+
const e = new expNode_1.ExpNode(new affine_1.Affine(f.a, f.b, "x").toTree());
|
|
19
|
+
const integral = new integralNode_1.IntegralNode(e, a.toTree(), b.toTree(), "x");
|
|
20
|
+
const correctAns = getCorrectAnswer(a, b, f.a, f.b);
|
|
21
|
+
const question = {
|
|
22
|
+
answer: correctAns.toTex(),
|
|
23
|
+
instruction: `Calculer : $${integral.toTex()}$`,
|
|
24
|
+
keys: ["epower"],
|
|
25
|
+
answerFormat: "tex",
|
|
26
|
+
identifiers: { a, b, aX: f.a, bX: f.b },
|
|
27
|
+
};
|
|
28
|
+
return question;
|
|
29
|
+
};
|
|
30
|
+
const getPropositions = (n, { answer, a, b, aX, bX }) => {
|
|
31
|
+
const propositions = [];
|
|
32
|
+
(0, exercise_1.addValidProp)(propositions, answer);
|
|
33
|
+
generatePropositions(a, b, aX, bX).forEach((value) => (0, exercise_1.tryToAddWrongProp)(propositions, value));
|
|
34
|
+
let random;
|
|
35
|
+
const oneDivAx = new fractionNode_1.FractionNode((1).toTree(), aX.toTree()).simplify();
|
|
36
|
+
while (propositions.length < n) {
|
|
37
|
+
const a = (0, randint_1.randint)(-10, 11).toTree();
|
|
38
|
+
const b = (0, randint_1.randint)(-10, 11).toTree();
|
|
39
|
+
random = new multiplyNode_1.MultiplyNode(oneDivAx, new substractNode_1.SubstractNode(new expNode_1.ExpNode(a).simplify(), new expNode_1.ExpNode(b).simplify()).simplify());
|
|
40
|
+
(0, exercise_1.tryToAddWrongProp)(propositions, random.toTex());
|
|
41
|
+
}
|
|
42
|
+
return (0, exercise_1.shuffleProps)(propositions, n);
|
|
43
|
+
};
|
|
44
|
+
const isAnswerValid = (ans, { a, b, aX, bX }) => {
|
|
45
|
+
const correctAns = getCorrectAnswer(a, b, aX, bX);
|
|
46
|
+
return correctAns.toAllValidTexs().includes(ans);
|
|
47
|
+
};
|
|
48
|
+
const getCorrectAnswer = (a, b, aX, bX) => {
|
|
49
|
+
const f = new affine_1.Affine(aX, bX, "x").toTree();
|
|
50
|
+
const oneDivAx = new fractionNode_1.FractionNode((1).toTree(), aX.toTree()).simplify();
|
|
51
|
+
return new multiplyNode_1.MultiplyNode(oneDivAx, new substractNode_1.SubstractNode(new expNode_1.ExpNode(f.evaluate({ x: b }).toTree()).simplify(), new expNode_1.ExpNode(f.evaluate({ x: a }).toTree()).simplify()).simplify());
|
|
52
|
+
};
|
|
53
|
+
const generatePropositions = (a, b, aX, bX) => {
|
|
54
|
+
const f = new affine_1.Affine(aX, bX, "x");
|
|
55
|
+
const fTree = f.toTree();
|
|
56
|
+
const aXNode = aX.toTree();
|
|
57
|
+
const oneDivAx = new fractionNode_1.FractionNode((1).toTree(), aXNode).simplify();
|
|
58
|
+
const fA = fTree.evaluate({ x: a }).toTree();
|
|
59
|
+
const fB = fTree.evaluate({ x: b }).toTree();
|
|
60
|
+
const expFA = new expNode_1.ExpNode(fA).simplify();
|
|
61
|
+
const expFB = new expNode_1.ExpNode(fB).simplify();
|
|
62
|
+
const firstProposition = new substractNode_1.SubstractNode(expFB, expFA).simplify();
|
|
63
|
+
const secondProposition = new multiplyNode_1.MultiplyNode(oneDivAx, new addNode_1.AddNode(expFB, expFA).simplify());
|
|
64
|
+
const thirdProposition = new substractNode_1.SubstractNode(new multiplyNode_1.MultiplyNode(aXNode, expFB).simplify(), new multiplyNode_1.MultiplyNode(aXNode, expFA).simplify()).simplify();
|
|
65
|
+
return [
|
|
66
|
+
firstProposition.toTex(),
|
|
67
|
+
secondProposition.toTex(),
|
|
68
|
+
thirdProposition.toTex(),
|
|
69
|
+
];
|
|
70
|
+
};
|
|
71
|
+
exports.integralExpAxPlusB = {
|
|
72
|
+
id: "integralExpAxPlusB",
|
|
73
|
+
label: "Calcul d'intégrales de fonctions du type $\\exp(ax+b)$",
|
|
74
|
+
levels: ["TermSpé"],
|
|
75
|
+
isSingleStep: true,
|
|
76
|
+
sections: ["Intégration"],
|
|
77
|
+
generator: (nb) => (0, getDistinctQuestions_1.getDistinctQuestions)(getIntegralExpAxPlusBQuestion, nb),
|
|
78
|
+
qcmTimer: 60,
|
|
79
|
+
freeTimer: 60,
|
|
80
|
+
getPropositions,
|
|
81
|
+
isAnswerValid,
|
|
82
|
+
subject: "Mathématiques",
|
|
83
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Exercise } from "../../../../exercises/exercise";
|
|
2
|
+
type Identifiers = {
|
|
3
|
+
questionType: string;
|
|
4
|
+
trinomial: number[];
|
|
5
|
+
upperBound: number;
|
|
6
|
+
lowerBound: number;
|
|
7
|
+
};
|
|
8
|
+
export declare const integralExpU: Exercise<Identifiers>;
|
|
9
|
+
export {};
|
|
10
|
+
//# sourceMappingURL=integralExpU.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"integralExpU.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/functions/integral/integralExpU.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAST,MAAM,0BAA0B,CAAC;AAclC,KAAK,WAAW,GAAG;IACjB,YAAY,EAAE,MAAM,CAAC;IACrB,SAAS,EAAE,MAAM,EAAE,CAAC;IACpB,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;CACpB,CAAC;AAoIF,eAAO,MAAM,YAAY,EAAE,QAAQ,CAAC,WAAW,CAY9C,CAAC"}
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.integralExpU = void 0;
|
|
4
|
+
const exercise_1 = require("../../../../exercises/exercise");
|
|
5
|
+
const getDistinctQuestions_1 = require("../../../../exercises/utils/getDistinctQuestions");
|
|
6
|
+
const trinom_1 = require("../../../../math/polynomials/trinom");
|
|
7
|
+
const randint_1 = require("../../../../math/utils/random/randint");
|
|
8
|
+
const integralNode_1 = require("../../../../tree/nodes/functions/integralNode");
|
|
9
|
+
const expNode_1 = require("../../../../tree/nodes/functions/expNode");
|
|
10
|
+
const addNode_1 = require("../../../../tree/nodes/operators/addNode");
|
|
11
|
+
const multiplyNode_1 = require("../../../../tree/nodes/operators/multiplyNode");
|
|
12
|
+
const substractNode_1 = require("../../../../tree/nodes/operators/substractNode");
|
|
13
|
+
const coinFlip_1 = require("../../../../utils/coinFlip");
|
|
14
|
+
const doesTrinomialVanishInInterval = (trinomial, a, b) => {
|
|
15
|
+
const calculate = (x) => trinomial.calculate(x);
|
|
16
|
+
for (let x = a; x <= b; x++) {
|
|
17
|
+
if (calculate(x) === 0) {
|
|
18
|
+
return true;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
return false;
|
|
22
|
+
};
|
|
23
|
+
const getIntegralExpUQuestion = () => {
|
|
24
|
+
const questionType = (0, coinFlip_1.coinFlip)() ? "Trinomial" : "Affine";
|
|
25
|
+
let trinomial;
|
|
26
|
+
let affine;
|
|
27
|
+
let lowerBound;
|
|
28
|
+
let upperBound;
|
|
29
|
+
do {
|
|
30
|
+
trinomial = trinom_1.TrinomConstructor.random({ min: -5, max: 5, excludes: [0] }, { min: -5, max: 5, excludes: [0] }, { min: -5, max: 5, excludes: [0] });
|
|
31
|
+
affine = trinomial.derivate();
|
|
32
|
+
lowerBound = (0, randint_1.randint)(-5, 5, [0]);
|
|
33
|
+
upperBound = (0, randint_1.randint)(-5, 5, [0]);
|
|
34
|
+
while (lowerBound >= upperBound) {
|
|
35
|
+
lowerBound = (0, randint_1.randint)(-5, 5, [0]);
|
|
36
|
+
upperBound = (0, randint_1.randint)(-5, 5, [0]);
|
|
37
|
+
}
|
|
38
|
+
} while (doesTrinomialVanishInInterval(trinomial, lowerBound, upperBound));
|
|
39
|
+
const polynomial = questionType === "Trinomial" ? trinomial : affine;
|
|
40
|
+
const expU = new multiplyNode_1.MultiplyNode(polynomial.derivate().toTree(), new expNode_1.ExpNode(polynomial.toTree()));
|
|
41
|
+
const integral = new integralNode_1.IntegralNode(expU, lowerBound.toTree(), upperBound.toTree(), "x");
|
|
42
|
+
const answer = new substractNode_1.SubstractNode(new expNode_1.ExpNode(polynomial.calculate(upperBound).toTree()).simplify(), new expNode_1.ExpNode(polynomial.calculate(lowerBound).toTree()).simplify()).simplify();
|
|
43
|
+
const question = {
|
|
44
|
+
answer: answer.toTex(),
|
|
45
|
+
instruction: `Calculer : $${integral.toTex()}$`,
|
|
46
|
+
keys: ["epower", "e"],
|
|
47
|
+
answerFormat: "tex",
|
|
48
|
+
identifiers: {
|
|
49
|
+
questionType,
|
|
50
|
+
trinomial: [trinomial.a, trinomial.b, trinomial.c],
|
|
51
|
+
upperBound,
|
|
52
|
+
lowerBound,
|
|
53
|
+
},
|
|
54
|
+
};
|
|
55
|
+
return question;
|
|
56
|
+
};
|
|
57
|
+
const getPropositions = (n, { answer, questionType, trinomial, upperBound, lowerBound }) => {
|
|
58
|
+
const propositions = [];
|
|
59
|
+
(0, exercise_1.addValidProp)(propositions, answer);
|
|
60
|
+
const trinomial1 = new trinom_1.Trinom(trinomial[0], trinomial[1], trinomial[2]);
|
|
61
|
+
const affine = trinomial1.derivate();
|
|
62
|
+
const polynomial = questionType === "Trinomial" ? trinomial1 : affine;
|
|
63
|
+
const wrongAnswer1 = new substractNode_1.SubstractNode(new expNode_1.ExpNode(polynomial.calculate(lowerBound).toTree()).simplify(), new expNode_1.ExpNode(polynomial.calculate(upperBound).toTree()).simplify()).simplify();
|
|
64
|
+
const wrongAnswer2 = new addNode_1.AddNode(new expNode_1.ExpNode(polynomial.calculate(upperBound).toTree()).simplify(), new expNode_1.ExpNode(polynomial.calculate(lowerBound).toTree()).simplify()).simplify();
|
|
65
|
+
const wrongAnswer3 = new substractNode_1.SubstractNode(polynomial.calculate(upperBound).toTree().simplify(), polynomial.calculate(lowerBound).toTree().simplify()).simplify();
|
|
66
|
+
(0, exercise_1.tryToAddWrongProp)(propositions, wrongAnswer1.toTex());
|
|
67
|
+
(0, exercise_1.tryToAddWrongProp)(propositions, wrongAnswer2.toTex());
|
|
68
|
+
(0, exercise_1.tryToAddWrongProp)(propositions, wrongAnswer3.toTex());
|
|
69
|
+
while (propositions.length < n) {
|
|
70
|
+
const random = (0, randint_1.randint)(-10, 10, [0]);
|
|
71
|
+
(0, exercise_1.tryToAddWrongProp)(propositions, new expNode_1.ExpNode(random.toTree()).toTex());
|
|
72
|
+
}
|
|
73
|
+
return (0, exercise_1.shuffleProps)(propositions, n);
|
|
74
|
+
};
|
|
75
|
+
const isAnswerValid = (ans, { answer, questionType, upperBound, lowerBound, trinomial }) => {
|
|
76
|
+
const trinomial1 = new trinom_1.Trinom(trinomial[0], trinomial[1], trinomial[2]);
|
|
77
|
+
const affine = trinomial1.derivate();
|
|
78
|
+
const polynomial = questionType === "Trinomial" ? trinomial1 : affine;
|
|
79
|
+
const validAnswer = new substractNode_1.SubstractNode(new expNode_1.ExpNode(polynomial.calculate(upperBound).toTree()).simplify(), new expNode_1.ExpNode(polynomial.calculate(lowerBound).toTree()).simplify()).simplify();
|
|
80
|
+
const latexs = validAnswer.toAllValidTexs({ allowPowerOne: true });
|
|
81
|
+
return latexs.includes(ans);
|
|
82
|
+
};
|
|
83
|
+
exports.integralExpU = {
|
|
84
|
+
id: "integralExpU",
|
|
85
|
+
label: "Calcul d'intégrales de fonctions du type $u'e^u$",
|
|
86
|
+
levels: ["TermSpé"],
|
|
87
|
+
isSingleStep: true,
|
|
88
|
+
sections: ["Intégration"],
|
|
89
|
+
generator: (nb) => (0, getDistinctQuestions_1.getDistinctQuestions)(getIntegralExpUQuestion, nb),
|
|
90
|
+
qcmTimer: 60,
|
|
91
|
+
freeTimer: 60,
|
|
92
|
+
getPropositions,
|
|
93
|
+
isAnswerValid,
|
|
94
|
+
subject: "Mathématiques",
|
|
95
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Exercise } from "../../../../exercises/exercise";
|
|
2
|
+
type Identifiers = {
|
|
3
|
+
questionType: string;
|
|
4
|
+
trinomial: number[];
|
|
5
|
+
upperBound: number;
|
|
6
|
+
lowerBound: number;
|
|
7
|
+
};
|
|
8
|
+
export declare const integralFractions: Exercise<Identifiers>;
|
|
9
|
+
export {};
|
|
10
|
+
//# sourceMappingURL=integralFractions.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"integralFractions.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/functions/integral/integralFractions.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAST,MAAM,0BAA0B,CAAC;AAclC,KAAK,WAAW,GAAG;IACjB,YAAY,EAAE,MAAM,CAAC;IACrB,SAAS,EAAE,MAAM,EAAE,CAAC;IACpB,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;CACpB,CAAC;AA6LF,eAAO,MAAM,iBAAiB,EAAE,QAAQ,CAAC,WAAW,CAanD,CAAC"}
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.integralFractions = void 0;
|
|
4
|
+
const exercise_1 = require("../../../../exercises/exercise");
|
|
5
|
+
const getDistinctQuestions_1 = require("../../../../exercises/utils/getDistinctQuestions");
|
|
6
|
+
const trinom_1 = require("../../../../math/polynomials/trinom");
|
|
7
|
+
const randint_1 = require("../../../../math/utils/random/randint");
|
|
8
|
+
const integralNode_1 = require("../../../../tree/nodes/functions/integralNode");
|
|
9
|
+
const logNode_1 = require("../../../../tree/nodes/functions/logNode");
|
|
10
|
+
const addNode_1 = require("../../../../tree/nodes/operators/addNode");
|
|
11
|
+
const fractionNode_1 = require("../../../../tree/nodes/operators/fractionNode");
|
|
12
|
+
const substractNode_1 = require("../../../../tree/nodes/operators/substractNode");
|
|
13
|
+
const coinFlip_1 = require("../../../../utils/coinFlip");
|
|
14
|
+
const doesTrinomialVanishInInterval = (trinomial, a, b) => {
|
|
15
|
+
const calculate = (x) => trinomial.calculate(x);
|
|
16
|
+
for (let x = a; x <= b; x++) {
|
|
17
|
+
if (calculate(x) === 0) {
|
|
18
|
+
return true;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
return false;
|
|
22
|
+
};
|
|
23
|
+
const getIntegralFractionsQuestion = () => {
|
|
24
|
+
const questionType = (0, coinFlip_1.coinFlip)() ? "Trinomial" : "Affine";
|
|
25
|
+
let trinomial;
|
|
26
|
+
let affine;
|
|
27
|
+
let lowerBound;
|
|
28
|
+
let upperBound;
|
|
29
|
+
do {
|
|
30
|
+
trinomial = trinom_1.TrinomConstructor.random({ min: -5, max: 5, excludes: [0] }, { min: -5, max: 5 }, { min: -5, max: 5 });
|
|
31
|
+
affine = trinomial.derivate();
|
|
32
|
+
lowerBound = (0, randint_1.randint)(-5, 5, [0]);
|
|
33
|
+
upperBound = (0, randint_1.randint)(-5, 5, [0]);
|
|
34
|
+
while (lowerBound >= upperBound) {
|
|
35
|
+
lowerBound = (0, randint_1.randint)(-5, 5, [0]);
|
|
36
|
+
upperBound = (0, randint_1.randint)(-5, 5, [0]);
|
|
37
|
+
}
|
|
38
|
+
} while (doesTrinomialVanishInInterval(trinomial, lowerBound, upperBound));
|
|
39
|
+
const fraction = questionType === "Trinomial"
|
|
40
|
+
? new fractionNode_1.FractionNode(affine.toTree(), trinomial.toTree())
|
|
41
|
+
: new fractionNode_1.FractionNode(affine.coefficients[1].toTree(), affine.toTree());
|
|
42
|
+
const integral = new integralNode_1.IntegralNode(fraction, lowerBound.toTree(), upperBound.toTree(), "x");
|
|
43
|
+
const answer = questionType === "Trinomial"
|
|
44
|
+
? new substractNode_1.SubstractNode(new logNode_1.LogNode(Math.abs(trinomial.calculate(upperBound)).toTree()).simplify(), new logNode_1.LogNode(Math.abs(trinomial.calculate(lowerBound)).toTree()).simplify()).simplify()
|
|
45
|
+
: new substractNode_1.SubstractNode(new logNode_1.LogNode(Math.abs(affine.calculate(upperBound)).toTree()).simplify(), new logNode_1.LogNode(Math.abs(affine.calculate(lowerBound)).toTree()).simplify()).simplify();
|
|
46
|
+
const question = {
|
|
47
|
+
answer: answer.toTex(),
|
|
48
|
+
instruction: `Calculer : $${integral.toTex()}$`,
|
|
49
|
+
keys: ["ln"],
|
|
50
|
+
answerFormat: "tex",
|
|
51
|
+
identifiers: {
|
|
52
|
+
questionType,
|
|
53
|
+
trinomial: [trinomial.a, trinomial.b, trinomial.c],
|
|
54
|
+
upperBound,
|
|
55
|
+
lowerBound,
|
|
56
|
+
},
|
|
57
|
+
};
|
|
58
|
+
return question;
|
|
59
|
+
};
|
|
60
|
+
const getPropositions = (n, { answer, questionType, trinomial, upperBound, lowerBound }) => {
|
|
61
|
+
const propositions = [];
|
|
62
|
+
(0, exercise_1.addValidProp)(propositions, answer);
|
|
63
|
+
const trinomial1 = new trinom_1.Trinom(trinomial[0], trinomial[1], trinomial[2]);
|
|
64
|
+
const affine = trinomial1.derivate();
|
|
65
|
+
const wrongAnswer1 = questionType === "Trinomial"
|
|
66
|
+
? new substractNode_1.SubstractNode(new logNode_1.LogNode(trinomial1.calculate(lowerBound).toTree()), new logNode_1.LogNode(trinomial1.calculate(upperBound).toTree())).simplify()
|
|
67
|
+
: new substractNode_1.SubstractNode(new logNode_1.LogNode(affine.calculate(lowerBound).toTree()), new logNode_1.LogNode(affine.calculate(upperBound).toTree())).simplify();
|
|
68
|
+
const wrongAnswer2 = questionType === "Trinomial"
|
|
69
|
+
? new addNode_1.AddNode(new logNode_1.LogNode(trinomial1.calculate(upperBound).toTree()), new logNode_1.LogNode(trinomial1.calculate(lowerBound).toTree())).simplify()
|
|
70
|
+
: new addNode_1.AddNode(new logNode_1.LogNode(affine.calculate(upperBound).toTree()), new logNode_1.LogNode(affine.calculate(lowerBound).toTree())).simplify();
|
|
71
|
+
const wrongAnswer3 = questionType === "Trinomial"
|
|
72
|
+
? new substractNode_1.SubstractNode(trinomial1.calculate(upperBound).toTree(), trinomial1.calculate(lowerBound).toTree()).simplify()
|
|
73
|
+
: new substractNode_1.SubstractNode(affine.calculate(upperBound).toTree(), affine.calculate(lowerBound).toTree()).simplify();
|
|
74
|
+
(0, exercise_1.tryToAddWrongProp)(propositions, wrongAnswer1.toTex());
|
|
75
|
+
(0, exercise_1.tryToAddWrongProp)(propositions, wrongAnswer2.toTex());
|
|
76
|
+
(0, exercise_1.tryToAddWrongProp)(propositions, wrongAnswer3.toTex());
|
|
77
|
+
while (propositions.length < n) {
|
|
78
|
+
const random = (0, randint_1.randint)(-10, 10, [0]);
|
|
79
|
+
(0, exercise_1.tryToAddWrongProp)(propositions, new logNode_1.LogNode(random.toTree()).toTex());
|
|
80
|
+
}
|
|
81
|
+
return (0, exercise_1.shuffleProps)(propositions, n);
|
|
82
|
+
};
|
|
83
|
+
const isAnswerValid = (ans, { answer, questionType, upperBound, lowerBound, trinomial }) => {
|
|
84
|
+
const trinomial1 = new trinom_1.Trinom(trinomial[0], trinomial[1], trinomial[2]);
|
|
85
|
+
const affine = trinomial1.derivate();
|
|
86
|
+
const validanswer1 = questionType === "Trinomial"
|
|
87
|
+
? new substractNode_1.SubstractNode(new logNode_1.LogNode(Math.abs(trinomial1.calculate(upperBound)).toTree()).simplify(), new logNode_1.LogNode(Math.abs(trinomial1.calculate(lowerBound)).toTree()).simplify()).simplify()
|
|
88
|
+
: new substractNode_1.SubstractNode(new logNode_1.LogNode(Math.abs(affine.calculate(upperBound)).toTree()).simplify(), new logNode_1.LogNode(Math.abs(affine.calculate(lowerBound)).toTree()).simplify()).simplify();
|
|
89
|
+
const validanswer2 = questionType === "Trinomial"
|
|
90
|
+
? new logNode_1.LogNode(new fractionNode_1.FractionNode(Math.abs(trinomial1.calculate(upperBound)).toTree(), Math.abs(trinomial1.calculate(lowerBound)).toTree()).simplify())
|
|
91
|
+
: new logNode_1.LogNode(new fractionNode_1.FractionNode(Math.abs(affine.calculate(upperBound)).toTree(), Math.abs(affine.calculate(lowerBound)).toTree()).simplify());
|
|
92
|
+
const latexs = validanswer1
|
|
93
|
+
.toAllValidTexs()
|
|
94
|
+
.concat(validanswer2.toAllValidTexs());
|
|
95
|
+
return latexs.includes(ans);
|
|
96
|
+
};
|
|
97
|
+
exports.integralFractions = {
|
|
98
|
+
id: "integralFractions",
|
|
99
|
+
label: "Calcul d'intégrales de fonctions du type $\\frac{u'}{u}$",
|
|
100
|
+
levels: ["TermSpé"],
|
|
101
|
+
isSingleStep: true,
|
|
102
|
+
sections: ["Intégration"],
|
|
103
|
+
generator: (nb) => (0, getDistinctQuestions_1.getDistinctQuestions)(getIntegralFractionsQuestion, nb),
|
|
104
|
+
qcmTimer: 60,
|
|
105
|
+
freeTimer: 60,
|
|
106
|
+
getPropositions,
|
|
107
|
+
isAnswerValid,
|
|
108
|
+
subject: "Mathématiques",
|
|
109
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Exercise } from "../../../../exercises/exercise";
|
|
2
|
+
type Identifiers = {
|
|
3
|
+
lowerBoundIndex: number;
|
|
4
|
+
upperBoundIndex: number;
|
|
5
|
+
k: number;
|
|
6
|
+
};
|
|
7
|
+
export declare const integralKCosinus: Exercise<Identifiers>;
|
|
8
|
+
export {};
|
|
9
|
+
//# sourceMappingURL=integralKCosinus.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"integralKCosinus.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/functions/integral/integralKCosinus.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAST,MAAM,0BAA0B,CAAC;AAelC,KAAK,WAAW,GAAG;IACjB,eAAe,EAAE,MAAM,CAAC;IACxB,eAAe,EAAE,MAAM,CAAC;IACxB,CAAC,EAAE,MAAM,CAAC;CACX,CAAC;AA8GF,eAAO,MAAM,gBAAgB,EAAE,QAAQ,CAAC,WAAW,CAalD,CAAC"}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.integralKCosinus = void 0;
|
|
4
|
+
const exercise_1 = require("../../../../exercises/exercise");
|
|
5
|
+
const getDistinctQuestions_1 = require("../../../../exercises/utils/getDistinctQuestions");
|
|
6
|
+
const remarkableValues_1 = require("../../../../math/trigonometry/remarkableValues");
|
|
7
|
+
const randint_1 = require("../../../../math/utils/random/randint");
|
|
8
|
+
const integralNode_1 = require("../../../../tree/nodes/functions/integralNode");
|
|
9
|
+
const cosNode_1 = require("../../../../tree/nodes/functions/cosNode");
|
|
10
|
+
const sinNode_1 = require("../../../../tree/nodes/functions/sinNode");
|
|
11
|
+
const addNode_1 = require("../../../../tree/nodes/operators/addNode");
|
|
12
|
+
const multiplyNode_1 = require("../../../../tree/nodes/operators/multiplyNode");
|
|
13
|
+
const substractNode_1 = require("../../../../tree/nodes/operators/substractNode");
|
|
14
|
+
const variableNode_1 = require("../../../../tree/nodes/variables/variableNode");
|
|
15
|
+
const selectedIndices = [0, 1, 2, 3, 4, 8];
|
|
16
|
+
const trigValues = selectedIndices.map((index) => remarkableValues_1.remarkableTrigoValues[index].angle);
|
|
17
|
+
const getIntegralKCosinusQuestion = () => {
|
|
18
|
+
const k = (0, randint_1.randint)(-10, 10, [0]);
|
|
19
|
+
const cosine = new multiplyNode_1.MultiplyNode(k.toTree(), new cosNode_1.CosNode(new variableNode_1.VariableNode("x")));
|
|
20
|
+
let lowerBoundIndex = (0, randint_1.randint)(0, trigValues.length);
|
|
21
|
+
let upperBoundIndex = (0, randint_1.randint)(0, trigValues.length);
|
|
22
|
+
while (trigValues[lowerBoundIndex].evaluate({}) >=
|
|
23
|
+
trigValues[upperBoundIndex].evaluate({})) {
|
|
24
|
+
lowerBoundIndex = (0, randint_1.randint)(0, trigValues.length);
|
|
25
|
+
upperBoundIndex = (0, randint_1.randint)(0, trigValues.length);
|
|
26
|
+
}
|
|
27
|
+
const lowerBound = trigValues[lowerBoundIndex];
|
|
28
|
+
const upperBound = trigValues[upperBoundIndex];
|
|
29
|
+
const integral = new integralNode_1.IntegralNode(cosine, lowerBound, upperBound, "x");
|
|
30
|
+
const sina = new sinNode_1.SinNode(lowerBound);
|
|
31
|
+
const sinb = new sinNode_1.SinNode(upperBound);
|
|
32
|
+
const answer = new substractNode_1.SubstractNode(new multiplyNode_1.MultiplyNode(k.toTree(), sinb), new multiplyNode_1.MultiplyNode(k.toTree(), sina)).simplify();
|
|
33
|
+
const question = {
|
|
34
|
+
answer: answer.toTex(),
|
|
35
|
+
instruction: `Calculez la valeur de l'intégrale suivante : $${integral.toTex()}$`,
|
|
36
|
+
keys: [],
|
|
37
|
+
answerFormat: "tex",
|
|
38
|
+
identifiers: { lowerBoundIndex, upperBoundIndex, k },
|
|
39
|
+
};
|
|
40
|
+
return question;
|
|
41
|
+
};
|
|
42
|
+
const getPropositions = (n, { answer, lowerBoundIndex, upperBoundIndex, k }) => {
|
|
43
|
+
const propositions = [];
|
|
44
|
+
(0, exercise_1.addValidProp)(propositions, answer);
|
|
45
|
+
const lowerBound = trigValues[lowerBoundIndex];
|
|
46
|
+
const upperBound = trigValues[upperBoundIndex];
|
|
47
|
+
const cosa = new cosNode_1.CosNode(lowerBound);
|
|
48
|
+
const cosb = new cosNode_1.CosNode(upperBound);
|
|
49
|
+
const wrongAnswer1 = new substractNode_1.SubstractNode(new multiplyNode_1.MultiplyNode(k.toTree(), cosb), new multiplyNode_1.MultiplyNode(k.toTree(), cosa)).simplify();
|
|
50
|
+
const sina = new sinNode_1.SinNode(lowerBound);
|
|
51
|
+
const sinb = new sinNode_1.SinNode(upperBound);
|
|
52
|
+
const wrongAnswer2 = new substractNode_1.SubstractNode(new multiplyNode_1.MultiplyNode(k.toTree(), sina), new multiplyNode_1.MultiplyNode(k.toTree(), sinb)).simplify();
|
|
53
|
+
const wrongAnswer3 = new addNode_1.AddNode(new multiplyNode_1.MultiplyNode(k.toTree(), sinb), new multiplyNode_1.MultiplyNode(k.toTree(), sina)).simplify();
|
|
54
|
+
(0, exercise_1.tryToAddWrongProp)(propositions, wrongAnswer1.toTex());
|
|
55
|
+
(0, exercise_1.tryToAddWrongProp)(propositions, wrongAnswer2.toTex());
|
|
56
|
+
(0, exercise_1.tryToAddWrongProp)(propositions, wrongAnswer3.toTex());
|
|
57
|
+
while (propositions.length < n) {
|
|
58
|
+
(0, exercise_1.tryToAddWrongProp)(propositions, (0, randint_1.randint)(-10, 10).toTree().toTex());
|
|
59
|
+
}
|
|
60
|
+
return (0, exercise_1.shuffleProps)(propositions, n);
|
|
61
|
+
};
|
|
62
|
+
const isAnswerValid = (ans, { answer, lowerBoundIndex, upperBoundIndex, k }) => {
|
|
63
|
+
const lowerBound = trigValues[lowerBoundIndex];
|
|
64
|
+
const upperBound = trigValues[upperBoundIndex];
|
|
65
|
+
const sina = new sinNode_1.SinNode(lowerBound);
|
|
66
|
+
const sinb = new sinNode_1.SinNode(upperBound);
|
|
67
|
+
const validanswer = new substractNode_1.SubstractNode(new multiplyNode_1.MultiplyNode(k.toTree(), sinb), new multiplyNode_1.MultiplyNode(k.toTree(), sina)).simplify();
|
|
68
|
+
const latexs = validanswer.toAllValidTexs({ allowSimplifySqrt: true });
|
|
69
|
+
return latexs.includes(ans);
|
|
70
|
+
};
|
|
71
|
+
exports.integralKCosinus = {
|
|
72
|
+
id: "integralKCosinus",
|
|
73
|
+
label: "Calcul d'intégrales de fonctions du type $k\\cos(x)$",
|
|
74
|
+
levels: ["TermSpé"],
|
|
75
|
+
isSingleStep: true,
|
|
76
|
+
sections: ["Intégration"],
|
|
77
|
+
generator: (nb) => (0, getDistinctQuestions_1.getDistinctQuestions)(getIntegralKCosinusQuestion, nb),
|
|
78
|
+
qcmTimer: 60,
|
|
79
|
+
freeTimer: 60,
|
|
80
|
+
getPropositions,
|
|
81
|
+
isAnswerValid,
|
|
82
|
+
subject: "Mathématiques",
|
|
83
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Exercise } from "../../../../exercises/exercise";
|
|
2
|
+
type Identifiers = {
|
|
3
|
+
lowerBoundIndex: number;
|
|
4
|
+
upperBoundIndex: number;
|
|
5
|
+
k: number;
|
|
6
|
+
};
|
|
7
|
+
export declare const integralKSinus: Exercise<Identifiers>;
|
|
8
|
+
export {};
|
|
9
|
+
//# sourceMappingURL=integralKSinus.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"integralKSinus.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/functions/integral/integralKSinus.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAST,MAAM,0BAA0B,CAAC;AAelC,KAAK,WAAW,GAAG;IACjB,eAAe,EAAE,MAAM,CAAC;IACxB,eAAe,EAAE,MAAM,CAAC;IACxB,CAAC,EAAE,MAAM,CAAC;CACX,CAAC;AA2GF,eAAO,MAAM,cAAc,EAAE,QAAQ,CAAC,WAAW,CAahD,CAAC"}
|