math-exercises 3.0.72 → 3.0.73
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 +3 -1
- package/lib/exercises/exercise.d.ts.map +1 -1
- package/lib/exercises/math/calcul/arithmetics/getParityBetweenTwoNumbers.d.ts +9 -0
- package/lib/exercises/math/calcul/arithmetics/getParityBetweenTwoNumbers.d.ts.map +1 -0
- package/lib/exercises/math/calcul/arithmetics/getParityBetweenTwoNumbers.js +114 -0
- package/lib/exercises/math/calcul/arithmetics/imageOfSquareFunction.d.ts +8 -0
- package/lib/exercises/math/calcul/arithmetics/imageOfSquareFunction.d.ts.map +1 -0
- package/lib/exercises/math/calcul/arithmetics/imageOfSquareFunction.js +152 -0
- package/lib/exercises/math/calcul/arithmetics/index.d.ts +9 -0
- package/lib/exercises/math/calcul/arithmetics/index.d.ts.map +1 -1
- package/lib/exercises/math/calcul/arithmetics/index.js +9 -0
- package/lib/exercises/math/calcul/arithmetics/isInequalityTrue.d.ts +15 -0
- package/lib/exercises/math/calcul/arithmetics/isInequalityTrue.d.ts.map +1 -0
- package/lib/exercises/math/calcul/arithmetics/isInequalityTrue.js +143 -0
- package/lib/exercises/math/calcul/arithmetics/isPointOnCubicFunction.d.ts +9 -0
- package/lib/exercises/math/calcul/arithmetics/isPointOnCubicFunction.d.ts.map +1 -0
- package/lib/exercises/math/calcul/arithmetics/isPointOnCubicFunction.js +111 -0
- package/lib/exercises/math/calcul/arithmetics/isPointOnFunction.d.ts +10 -0
- package/lib/exercises/math/calcul/arithmetics/isPointOnFunction.d.ts.map +1 -0
- package/lib/exercises/math/calcul/arithmetics/isPointOnFunction.js +133 -0
- package/lib/exercises/math/calcul/arithmetics/isPointOnReciprocalFunction.d.ts +9 -0
- package/lib/exercises/math/calcul/arithmetics/isPointOnReciprocalFunction.d.ts.map +1 -0
- package/lib/exercises/math/calcul/arithmetics/isPointOnReciprocalFunction.js +117 -0
- package/lib/exercises/math/calcul/arithmetics/minNumberInequality.d.ts +13 -0
- package/lib/exercises/math/calcul/arithmetics/minNumberInequality.d.ts.map +1 -0
- package/lib/exercises/math/calcul/arithmetics/minNumberInequality.js +192 -0
- package/lib/exercises/math/calcul/arithmetics/primeNumberIdentification.d.ts +7 -0
- package/lib/exercises/math/calcul/arithmetics/primeNumberIdentification.d.ts.map +1 -0
- package/lib/exercises/math/calcul/arithmetics/primeNumberIdentification.js +84 -0
- package/lib/exercises/math/calcul/arithmetics/squareRootCalculation.d.ts +8 -0
- package/lib/exercises/math/calcul/arithmetics/squareRootCalculation.d.ts.map +1 -0
- package/lib/exercises/math/calcul/arithmetics/squareRootCalculation.js +107 -0
- package/lib/exercises/math/calcul/fractions/fractionAndIntegerSum.d.ts.map +1 -1
- package/lib/exercises/math/calcul/fractions/fractionAndIntegerSum.js +37 -0
- package/lib/exercises/math/calcul/fractions/fractionToPercentToDecimal.d.ts.map +1 -1
- package/lib/exercises/math/calcul/fractions/fractionToPercentToDecimal.js +57 -6
- package/lib/exercises/math/calcul/fractions/fractionsOperations.d.ts.map +1 -1
- package/lib/exercises/math/calcul/fractions/fractionsOperations.js +64 -22
- package/lib/exercises/math/calcul/fractions/fractionsSubstraction.d.ts.map +1 -1
- package/lib/exercises/math/calcul/fractions/fractionsSubstraction.js +143 -4
- package/lib/exercises/math/calcul/fractions/fractionsSum.d.ts.map +1 -1
- package/lib/exercises/math/calcul/fractions/fractionsSum.js +141 -3
- package/lib/exercises/math/calcul/fractions/index.d.ts +1 -0
- package/lib/exercises/math/calcul/fractions/index.d.ts.map +1 -1
- package/lib/exercises/math/calcul/fractions/index.js +1 -0
- package/lib/exercises/math/calcul/fractions/periodicWritingToFraction.js +3 -3
- package/lib/exercises/math/calcul/fractions/powerNotation.d.ts +9 -0
- package/lib/exercises/math/calcul/fractions/powerNotation.d.ts.map +1 -0
- package/lib/exercises/math/calcul/fractions/powerNotation.js +125 -0
- package/lib/exercises/math/calcul/proportionality/proportionalityTable.d.ts.map +1 -1
- package/lib/exercises/math/calcul/proportionality/proportionalityTable.js +29 -5
- package/lib/exercises/math/calcul/sign/absoluteNumber.d.ts +7 -0
- package/lib/exercises/math/calcul/sign/absoluteNumber.d.ts.map +1 -0
- package/lib/exercises/math/calcul/sign/absoluteNumber.js +80 -0
- package/lib/exercises/math/calcul/sign/index.d.ts +1 -0
- package/lib/exercises/math/calcul/sign/index.d.ts.map +1 -1
- package/lib/exercises/math/calcul/sign/index.js +1 -0
- package/lib/exercises/math/calculLitteral/equation/binomialsTrinomialsProposedSolutions.d.ts.map +1 -1
- package/lib/exercises/math/calculLitteral/equation/binomialsTrinomialsProposedSolutions.js +67 -21
- package/lib/exercises/math/calculLitteral/equation/equa3.d.ts.map +1 -1
- package/lib/exercises/math/calculLitteral/equation/equa3.js +0 -2
- package/lib/exercises/math/calculLitteral/equation/equationWithDistributivity.d.ts.map +1 -1
- package/lib/exercises/math/calculLitteral/equation/equationWithDistributivity.js +53 -9
- package/lib/exercises/math/calculLitteral/equation/factorizeEquation.d.ts +9 -0
- package/lib/exercises/math/calculLitteral/equation/factorizeEquation.d.ts.map +1 -0
- package/lib/exercises/math/calculLitteral/equation/factorizeEquation.js +145 -0
- package/lib/exercises/math/calculLitteral/equation/index.d.ts +1 -0
- package/lib/exercises/math/calculLitteral/equation/index.d.ts.map +1 -1
- package/lib/exercises/math/calculLitteral/equation/index.js +1 -0
- package/lib/exercises/math/calculLitteral/inequations/firstDegreeInequationsType2.d.ts.map +1 -1
- package/lib/exercises/math/calculLitteral/inequations/firstDegreeInequationsType2.js +32 -4
- package/lib/exercises/math/calculLitteral/inequations/firstDegreeInequationsType3.d.ts.map +1 -1
- package/lib/exercises/math/calculLitteral/inequations/firstDegreeInequationsType3.js +30 -2
- package/lib/exercises/math/calculLitteral/inequations/index.d.ts +1 -0
- package/lib/exercises/math/calculLitteral/inequations/index.d.ts.map +1 -1
- package/lib/exercises/math/calculLitteral/inequations/index.js +1 -0
- package/lib/exercises/math/calculLitteral/inequations/inequationsSign.d.ts +9 -0
- package/lib/exercises/math/calculLitteral/inequations/inequationsSign.d.ts.map +1 -0
- package/lib/exercises/math/calculLitteral/inequations/inequationsSign.js +75 -0
- package/lib/exercises/math/calculLitteral/inequations/inverseInequality.d.ts +9 -0
- package/lib/exercises/math/calculLitteral/inequations/inverseInequality.d.ts.map +1 -0
- package/lib/exercises/math/calculLitteral/inequations/inverseInequality.js +120 -0
- package/lib/exercises/math/calculLitteral/simplifying/distributeAndSimplify.d.ts.map +1 -1
- package/lib/exercises/math/calculLitteral/simplifying/distributeAndSimplify.js +43 -1
- package/lib/exercises/math/curve/index.d.ts +3 -0
- package/lib/exercises/math/curve/index.d.ts.map +1 -0
- package/lib/exercises/math/curve/index.js +2 -0
- package/lib/exercises/math/curve/sqrtCurvePoint.d.ts +8 -0
- package/lib/exercises/math/curve/sqrtCurvePoint.d.ts.map +1 -0
- package/lib/exercises/math/curve/sqrtCurvePoint.js +132 -0
- package/lib/exercises/math/curve/squareCurvePoint.d.ts +8 -0
- package/lib/exercises/math/curve/squareCurvePoint.d.ts.map +1 -0
- package/lib/exercises/math/curve/squareCurvePoint.js +133 -0
- package/lib/exercises/math/functions/absolute/index.d.ts +2 -0
- package/lib/exercises/math/functions/absolute/index.d.ts.map +1 -1
- package/lib/exercises/math/functions/absolute/index.js +2 -0
- package/lib/exercises/math/functions/absolute/removeAbsNotation.d.ts +8 -0
- package/lib/exercises/math/functions/absolute/removeAbsNotation.d.ts.map +1 -0
- package/lib/exercises/math/functions/absolute/removeAbsNotation.js +105 -0
- package/lib/exercises/math/functions/absolute/removeAbsNotationSign.d.ts +8 -0
- package/lib/exercises/math/functions/absolute/removeAbsNotationSign.d.ts.map +1 -0
- package/lib/exercises/math/functions/absolute/removeAbsNotationSign.js +108 -0
- package/lib/exercises/math/functions/affines/affineExpressionReading.d.ts.map +1 -1
- package/lib/exercises/math/functions/affines/affineExpressionReading.js +36 -0
- package/lib/exercises/math/functions/basics/index.d.ts +1 -0
- package/lib/exercises/math/functions/basics/index.d.ts.map +1 -1
- package/lib/exercises/math/functions/basics/index.js +1 -0
- package/lib/exercises/math/functions/basics/valueTableCompletion.d.ts +7 -0
- package/lib/exercises/math/functions/basics/valueTableCompletion.d.ts.map +1 -0
- package/lib/exercises/math/functions/basics/valueTableCompletion.js +78 -0
- package/lib/exercises/math/functions/cube/imageOfCubeFunction.d.ts +8 -0
- package/lib/exercises/math/functions/cube/imageOfCubeFunction.d.ts.map +1 -0
- package/lib/exercises/math/functions/cube/imageOfCubeFunction.js +142 -0
- package/lib/exercises/math/functions/cube/index.d.ts +1 -0
- package/lib/exercises/math/functions/cube/index.d.ts.map +1 -1
- package/lib/exercises/math/functions/cube/index.js +1 -0
- package/lib/exercises/math/functions/square/getImageOfSquareRootFunction.d.ts +8 -0
- package/lib/exercises/math/functions/square/getImageOfSquareRootFunction.d.ts.map +1 -0
- package/lib/exercises/math/functions/square/getImageOfSquareRootFunction.js +128 -0
- package/lib/exercises/math/functions/square/index.d.ts +1 -0
- package/lib/exercises/math/functions/square/index.d.ts.map +1 -1
- package/lib/exercises/math/functions/square/index.js +1 -0
- package/lib/exercises/math/geometry/euclidian/pythagoreOrThales.d.ts.map +1 -1
- package/lib/exercises/math/geometry/euclidian/pythagoreOrThales.js +32 -2
- package/lib/exercises/math/index.d.ts +1 -0
- package/lib/exercises/math/index.d.ts.map +1 -1
- package/lib/exercises/math/index.js +1 -0
- package/lib/exercises/math/powers/decimalToScientific.d.ts.map +1 -1
- package/lib/exercises/math/powers/decimalToScientific.js +0 -1
- package/lib/exercises/math/powers/powersMixOperations.d.ts.map +1 -1
- package/lib/exercises/math/powers/powersMixOperations.js +0 -1
- package/lib/exercises/math/probaStat/ballsBasicProbas.d.ts.map +1 -1
- package/lib/exercises/math/probaStat/ballsBasicProbas.js +1 -3
- package/lib/exercises/math/python/index.d.ts +2 -0
- package/lib/exercises/math/python/index.d.ts.map +1 -1
- package/lib/exercises/math/python/index.js +2 -0
- package/lib/exercises/math/python/pyIfElseCondition.d.ts +8 -0
- package/lib/exercises/math/python/pyIfElseCondition.d.ts.map +1 -0
- package/lib/exercises/math/python/pyIfElseCondition.js +133 -0
- package/lib/exercises/math/python/variableType.d.ts +8 -0
- package/lib/exercises/math/python/variableType.d.ts.map +1 -0
- package/lib/exercises/math/python/variableType.js +118 -0
- package/lib/exercises/math/python/whileLoop.js +1 -1
- package/lib/exercises/math/sequences/arithmetic/arithmeticExplicitFormulaUsage.d.ts.map +1 -1
- package/lib/exercises/math/sequences/arithmetic/arithmeticExplicitFormulaUsage.js +1 -0
- package/lib/exercises/math/sequences/arithmetic/arithmeticFindReason.d.ts.map +1 -1
- package/lib/exercises/math/sequences/arithmetic/arithmeticFindReason.js +2 -1
- package/lib/exercises/math/sets/intervals/inequalityToInterval.d.ts.map +1 -1
- package/lib/exercises/math/sets/intervals/inequalityToInterval.js +21 -0
- package/lib/exercises/math/sets/intervals/intervalToInequality.d.ts.map +1 -1
- package/lib/exercises/math/sets/intervals/intervalToInequality.js +20 -0
- package/lib/exercises/math/sets/intervals/intervalsUnion.d.ts.map +1 -1
- package/lib/exercises/math/sets/intervals/intervalsUnion.js +19 -0
- package/lib/exercises/math/sets/setBelonging.d.ts.map +1 -1
- package/lib/exercises/math/sets/setBelonging.js +24 -0
- package/lib/exercises/pc/chemicalElements/weightPercent.d.ts.map +1 -1
- package/lib/exercises/pc/chemicalElements/weightPercent.js +0 -1
- package/lib/exercises/utils/getDistinctQuestions.d.ts.map +1 -1
- package/lib/exercises/utils/getDistinctQuestions.js +6 -0
- package/lib/index.d.ts +71 -0
- package/lib/index.d.ts.map +1 -1
- package/lib/latexTester.d.ts.map +1 -1
- package/lib/latexTester.js +5 -2
- package/lib/math/numbers/decimals/decimal.d.ts +1 -1
- package/lib/math/numbers/decimals/decimal.d.ts.map +1 -1
- package/lib/math/numbers/decimals/decimal.js +5 -2
- package/lib/playground.js +5 -7
- package/lib/tests/pdfExo.test.d.ts.map +1 -1
- package/lib/tests/pdfExo.test.js +2 -2
- package/lib/tests/pdfs/mdCodeToLatex.d.ts.map +1 -1
- package/lib/tests/pdfs/mdCodeToLatex.js +10 -0
- package/lib/tests/pdfs/quizPdfPreambule.js +1 -1
- package/lib/tree/nodes/algebraicNode.d.ts +2 -0
- package/lib/tree/nodes/algebraicNode.d.ts.map +1 -1
- package/lib/tree/nodes/nodeConstructor.js +1 -1
- package/lib/tree/nodes/numbers/numberNode.js +2 -2
- package/lib/tree/nodes/operators/fractionNode.d.ts.map +1 -1
- package/lib/tree/nodes/operators/fractionNode.js +10 -4
- package/lib/tree/nodes/operators/powerNode.d.ts.map +1 -1
- package/lib/tree/nodes/operators/powerNode.js +4 -0
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calculLitteral/inequations/index.ts"],"names":[],"mappings":"AAAA,cAAc,kCAAkC,CAAC;AACjD,cAAc,kCAAkC,CAAC;AACjD,cAAc,kCAAkC,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calculLitteral/inequations/index.ts"],"names":[],"mappings":"AAAA,cAAc,kCAAkC,CAAC;AACjD,cAAc,kCAAkC,CAAC;AACjD,cAAc,kCAAkC,CAAC;AACjD,cAAc,kCAAkC,CAAC;AACjD,cAAc,+BAA+B,CAAC;AAC9C,cAAc,sBAAsB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"inequationsSign.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calculLitteral/inequations/inequationsSign.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAeT,MAAM,6BAA6B,CAAC;AAMrC,KAAK,WAAW,GAAG;IACjB,CAAC,EAAE,MAAM,CAAC;IAEV,EAAE,EAAE,OAAO,CAAC;IACZ,CAAC,EAAE,MAAM,CAAC;CACX,CAAC;AAqEF,eAAO,MAAM,eAAe,EAAE,QAAQ,CAAC,WAAW,CAiBjD,CAAC"}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import { addValidProp, shuffleProps, tryToAddWrongProp, } from "../../../../exercises/exercise.js";
|
|
2
|
+
import { getDistinctQuestions } from "../../../../exercises/utils/getDistinctQuestions.js";
|
|
3
|
+
import { RationalConstructor } from "../../../../math/numbers/rationals/rational.js";
|
|
4
|
+
import { frac } from "../../../../tree/nodes/operators/fractionNode.js";
|
|
5
|
+
import { coinFlip } from "../../../../utils/alea/coinFlip.js";
|
|
6
|
+
const getPropositions = (n, { answer }) => {
|
|
7
|
+
const propositions = [];
|
|
8
|
+
addValidProp(propositions, answer);
|
|
9
|
+
tryToAddWrongProp(propositions, ">");
|
|
10
|
+
tryToAddWrongProp(propositions, "<");
|
|
11
|
+
return shuffleProps(propositions, n);
|
|
12
|
+
};
|
|
13
|
+
const getAnswer = (identifiers) => {
|
|
14
|
+
const { a, lt, b } = identifiers;
|
|
15
|
+
return a < 0 === lt ? ">" : "<";
|
|
16
|
+
};
|
|
17
|
+
const getInstruction = (identifiers) => {
|
|
18
|
+
const { a, lt, b } = identifiers;
|
|
19
|
+
const simplifiedFrac = frac(b, a).simplify().toTex();
|
|
20
|
+
return `Complétez par le bon symbole:
|
|
21
|
+
|
|
22
|
+
$$
|
|
23
|
+
${a}x ${lt ? "<" : ">"} ${b} \\iff x \\, \\ldots ${simplifiedFrac}
|
|
24
|
+
$$`;
|
|
25
|
+
};
|
|
26
|
+
const getHint = (identifiers) => {
|
|
27
|
+
const lt = identifiers.lt;
|
|
28
|
+
return `Si on multiplie (ou divise) les deux membres d'une inéquation par un nombre négatif, le sens de l'inéquation est inversé. Sinon, le sens de l'inéquation ne change pas.`;
|
|
29
|
+
};
|
|
30
|
+
const getCorrection = (identifiers) => {
|
|
31
|
+
const { a, lt, b } = identifiers;
|
|
32
|
+
const simplifiedFrac = frac(b, a).simplify().toTex();
|
|
33
|
+
const invertSign = a < 0;
|
|
34
|
+
return `Puisque $${a} ${invertSign ? "<" : ">"} 0$, alors
|
|
35
|
+
|
|
36
|
+
$$
|
|
37
|
+
${a}x ${lt ? "<" : ">"} ${b} \\iff x ${invertSign ? (lt ? ">" : "<") : lt ? "<" : ">"} ${simplifiedFrac}
|
|
38
|
+
$$`;
|
|
39
|
+
};
|
|
40
|
+
const getInequationsSignQuestion = (ops) => {
|
|
41
|
+
const irreductibleFrac = RationalConstructor.randomIrreductible();
|
|
42
|
+
const a = coinFlip() ? -irreductibleFrac.denum : irreductibleFrac.denum;
|
|
43
|
+
const b = coinFlip() ? -irreductibleFrac.num : irreductibleFrac.num;
|
|
44
|
+
const lt = coinFlip();
|
|
45
|
+
const identifiers = { a, lt, b };
|
|
46
|
+
return getQuestionFromIdentifiers(identifiers);
|
|
47
|
+
};
|
|
48
|
+
const getQuestionFromIdentifiers = (identifiers) => {
|
|
49
|
+
return {
|
|
50
|
+
answer: getAnswer(identifiers),
|
|
51
|
+
instruction: getInstruction(identifiers),
|
|
52
|
+
keys: [],
|
|
53
|
+
answerFormat: "tex",
|
|
54
|
+
identifiers,
|
|
55
|
+
hint: getHint(identifiers),
|
|
56
|
+
correction: getCorrection(identifiers),
|
|
57
|
+
};
|
|
58
|
+
};
|
|
59
|
+
export const inequationsSign = {
|
|
60
|
+
id: "inequationsSign",
|
|
61
|
+
answerType: "QCU",
|
|
62
|
+
label: "Compléter une inégalité par le signe qui convient",
|
|
63
|
+
isSingleStep: true,
|
|
64
|
+
generator: (nb, opts) => getDistinctQuestions(() => getInequationsSignQuestion(opts), nb),
|
|
65
|
+
qcmTimer: 60,
|
|
66
|
+
freeTimer: 60,
|
|
67
|
+
getPropositions,
|
|
68
|
+
subject: "Mathématiques",
|
|
69
|
+
getInstruction,
|
|
70
|
+
getHint,
|
|
71
|
+
getCorrection,
|
|
72
|
+
getAnswer,
|
|
73
|
+
getQuestionFromIdentifiers,
|
|
74
|
+
hasHintAndCorrection: true,
|
|
75
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Exercise } from "../../../../exercises/exercise.js";
|
|
2
|
+
import { InegalitySymbols } from "../../../../math/inequations/inequation.js";
|
|
3
|
+
type Identifiers = {
|
|
4
|
+
k: number;
|
|
5
|
+
inequationSymbol: InegalitySymbols;
|
|
6
|
+
};
|
|
7
|
+
export declare const inverseInequality: Exercise<Identifiers>;
|
|
8
|
+
export {};
|
|
9
|
+
//# sourceMappingURL=inverseInequality.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"inverseInequality.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calculLitteral/inequations/inverseInequality.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAeT,MAAM,6BAA6B,CAAC;AAErC,OAAO,EACL,gBAAgB,EAGjB,MAAM,sCAAsC,CAAC;AAiB9C,KAAK,WAAW,GAAG;IACjB,CAAC,EAAE,MAAM,CAAC;IACV,gBAAgB,EAAE,gBAAgB,CAAC;CACpC,CAAC;AAgJF,eAAO,MAAM,iBAAiB,EAAE,QAAQ,CAAC,WAAW,CAcnD,CAAC"}
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
import { addValidProp, shuffleProps, tryToAddWrongProp, } from "../../../../exercises/exercise.js";
|
|
2
|
+
import { getDistinctQuestions } from "../../../../exercises/utils/getDistinctQuestions.js";
|
|
3
|
+
import { InequationSymbol, InequationSymbolConstructor, } from "../../../../math/inequations/inequation.js";
|
|
4
|
+
import { randint } from "../../../../math/utils/random/randint.js";
|
|
5
|
+
import { InequationSolutionNode } from "../../../../tree/nodes/inequations/inequationSolutionNode.js";
|
|
6
|
+
import { MinusInfinityNode, PlusInfinityNode, } from "../../../../tree/nodes/numbers/infiniteNode.js";
|
|
7
|
+
import { NumberNode } from "../../../../tree/nodes/numbers/numberNode.js";
|
|
8
|
+
import { frac } from "../../../../tree/nodes/operators/fractionNode.js";
|
|
9
|
+
import { ClosureType } from "../../../../tree/nodes/sets/closure.js";
|
|
10
|
+
import { IntervalNode } from "../../../../tree/nodes/sets/intervalNode.js";
|
|
11
|
+
import { UnionIntervalNode } from "../../../../tree/nodes/sets/unionIntervalNode.js";
|
|
12
|
+
import { unionIntervalParser } from "../../../../tree/parsers/unionIntervalParser.js";
|
|
13
|
+
import { handleVEAError } from "../../../../utils/errors/handleVEAError.js";
|
|
14
|
+
const getPropositions = (n, { answer, k, inequationSymbol }) => {
|
|
15
|
+
const propositions = [];
|
|
16
|
+
addValidProp(propositions, answer);
|
|
17
|
+
tryToAddWrongProp(propositions, getAnswer({ k: -k, inequationSymbol }));
|
|
18
|
+
tryToAddWrongProp(propositions, getAnswer({
|
|
19
|
+
k,
|
|
20
|
+
inequationSymbol: new InequationSymbol(inequationSymbol).reversed(),
|
|
21
|
+
}));
|
|
22
|
+
tryToAddWrongProp(propositions, getAnswer({
|
|
23
|
+
k,
|
|
24
|
+
inequationSymbol: new InequationSymbol(inequationSymbol).strictnessToggled(),
|
|
25
|
+
}));
|
|
26
|
+
return shuffleProps(propositions, n);
|
|
27
|
+
};
|
|
28
|
+
const getAnswer = (identifiers) => {
|
|
29
|
+
const { k, inequationSymbol } = identifiers;
|
|
30
|
+
const symbol = new InequationSymbol(inequationSymbol);
|
|
31
|
+
const isStrict = symbol.isStrict;
|
|
32
|
+
if (k > 0) {
|
|
33
|
+
if (symbol.isSup) {
|
|
34
|
+
// Pour l'inegalite 1/x > k on a en solution [0, 1/k]
|
|
35
|
+
const interval = new IntervalNode(new NumberNode(0), frac(1, k).simplify(),
|
|
36
|
+
// Toujours ferme sur 0
|
|
37
|
+
// Pour 1/k, ouvert si <, sinon ferme pour <=
|
|
38
|
+
isStrict ? ClosureType.FO : ClosureType.FF);
|
|
39
|
+
return new InequationSolutionNode(interval).toTex();
|
|
40
|
+
}
|
|
41
|
+
else {
|
|
42
|
+
// Pour l'inegalite 1/x < k on a en solution ]-inf, 0[ u [1/k, +inf]
|
|
43
|
+
const intervalNeg = new IntervalNode(MinusInfinityNode, new NumberNode(0), ClosureType.OO);
|
|
44
|
+
const intervalSup = new IntervalNode(frac(1, k).simplify(), PlusInfinityNode,
|
|
45
|
+
// Pour 1/k, ouvert si <, sinon ferme pour <=
|
|
46
|
+
// Toujours ouvert sur +inf
|
|
47
|
+
isStrict ? ClosureType.OO : ClosureType.FO);
|
|
48
|
+
return new InequationSolutionNode(new UnionIntervalNode([intervalNeg, intervalSup])).toTex();
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
else {
|
|
52
|
+
if (symbol.isSup) {
|
|
53
|
+
// Pour 1/x > k on a en solution ]-inf, 1/k) u ]0, +inf[
|
|
54
|
+
const intervalNeg = new IntervalNode(MinusInfinityNode,
|
|
55
|
+
// Pour 1/k, ouvert si <, sinon ferme pour <=
|
|
56
|
+
// Toujours ouvert sur +inf
|
|
57
|
+
frac(1, k).simplify(), isStrict ? ClosureType.OO : ClosureType.OF);
|
|
58
|
+
const intervalSup = new IntervalNode(new NumberNode(0), PlusInfinityNode, ClosureType.OO);
|
|
59
|
+
return new InequationSolutionNode(new UnionIntervalNode([intervalNeg, intervalSup])).toTex();
|
|
60
|
+
}
|
|
61
|
+
else {
|
|
62
|
+
// Pour 1/x < k on a en solution (1/k, 0[
|
|
63
|
+
const interval = new IntervalNode(frac(1, k).simplify(), new NumberNode(0),
|
|
64
|
+
// Pour 1/k, ouvert si <, sinon ferme pour <=
|
|
65
|
+
// Toujours ouvert sur 0
|
|
66
|
+
isStrict ? ClosureType.OO : ClosureType.FO);
|
|
67
|
+
return new InequationSolutionNode(interval).toTex();
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
};
|
|
71
|
+
const getInstruction = (identifiers) => {
|
|
72
|
+
const { k, inequationSymbol } = identifiers;
|
|
73
|
+
return `Résoudre $${frac(1, "x").toTex()} ${inequationSymbol} ${k}$.`;
|
|
74
|
+
};
|
|
75
|
+
const getKeys = (identifiers) => {
|
|
76
|
+
return ["S", "equal", "lbracket", "rbracket", "semicolon", "infty", "cup"];
|
|
77
|
+
};
|
|
78
|
+
const isAnswerValid = (ans, { answer }) => {
|
|
79
|
+
try {
|
|
80
|
+
const parsed = unionIntervalParser(ans.replaceAll("S", "").replaceAll("=", ""));
|
|
81
|
+
if (!parsed)
|
|
82
|
+
return false;
|
|
83
|
+
return "S=\\ " + parsed.simplify().toTex() === answer;
|
|
84
|
+
}
|
|
85
|
+
catch (err) {
|
|
86
|
+
return handleVEAError(err);
|
|
87
|
+
}
|
|
88
|
+
};
|
|
89
|
+
const getInverseInequalityQuestion = (ops) => {
|
|
90
|
+
const k = randint(-40, 40, [0]);
|
|
91
|
+
const inequationSymbol = InequationSymbolConstructor.random();
|
|
92
|
+
const identifiers = {
|
|
93
|
+
k,
|
|
94
|
+
inequationSymbol: inequationSymbol.symbol,
|
|
95
|
+
};
|
|
96
|
+
return getQuestionFromIdentifiers(identifiers);
|
|
97
|
+
};
|
|
98
|
+
const getQuestionFromIdentifiers = (identifiers) => {
|
|
99
|
+
return {
|
|
100
|
+
answer: getAnswer(identifiers),
|
|
101
|
+
instruction: getInstruction(identifiers),
|
|
102
|
+
keys: getKeys(identifiers),
|
|
103
|
+
answerFormat: "tex",
|
|
104
|
+
identifiers,
|
|
105
|
+
};
|
|
106
|
+
};
|
|
107
|
+
export const inverseInequality = {
|
|
108
|
+
id: "inverseInequality",
|
|
109
|
+
label: "Résoudre $\\frac{1}{x} < k$",
|
|
110
|
+
isSingleStep: true,
|
|
111
|
+
generator: (nb, opts) => getDistinctQuestions(() => getInverseInequalityQuestion(opts), nb),
|
|
112
|
+
qcmTimer: 60,
|
|
113
|
+
freeTimer: 60,
|
|
114
|
+
getPropositions,
|
|
115
|
+
isAnswerValid,
|
|
116
|
+
subject: "Mathématiques",
|
|
117
|
+
getInstruction,
|
|
118
|
+
getAnswer,
|
|
119
|
+
getQuestionFromIdentifiers,
|
|
120
|
+
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"distributeAndSimplify.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calculLitteral/simplifying/distributeAndSimplify.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAcT,MAAM,6BAA6B,CAAC;AAUrC,KAAK,WAAW,GAAG;IACjB,iBAAiB,EAAE,OAAO,CAAC;IAC3B,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;CACX,CAAC;
|
|
1
|
+
{"version":3,"file":"distributeAndSimplify.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calculLitteral/simplifying/distributeAndSimplify.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAcT,MAAM,6BAA6B,CAAC;AAUrC,KAAK,WAAW,GAAG;IACjB,iBAAiB,EAAE,OAAO,CAAC;IAC3B,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;CACX,CAAC;AA4IF,eAAO,MAAM,qBAAqB,EAAE,QAAQ,CAAC,WAAW,CAcvD,CAAC"}
|
|
@@ -2,7 +2,7 @@ import { addValidProp, shuffleProps, tryToAddWrongProp, } from "../../../../exer
|
|
|
2
2
|
import { getDistinctQuestions } from "../../../../exercises/utils/getDistinctQuestions.js";
|
|
3
3
|
import { Affine, AffineConstructor } from "../../../../math/polynomials/affine.js";
|
|
4
4
|
import { randint } from "../../../../math/utils/random/randint.js";
|
|
5
|
-
import { AddNode } from "../../../../tree/nodes/operators/addNode.js";
|
|
5
|
+
import { add, AddNode } from "../../../../tree/nodes/operators/addNode.js";
|
|
6
6
|
import { MultiplyNode } from "../../../../tree/nodes/operators/multiplyNode.js";
|
|
7
7
|
import { polynomialParser } from "../../../../tree/parsers/polynomialParser.js";
|
|
8
8
|
import { coinFlip } from "../../../../utils/alea/coinFlip.js";
|
|
@@ -16,6 +16,45 @@ const getStatementNode = (identifiers) => {
|
|
|
16
16
|
: a.toTree(), new MultiplyNode(e.toTree(), new Affine(f, g).toTree()));
|
|
17
17
|
return statement;
|
|
18
18
|
};
|
|
19
|
+
const getHint = (identifiers) => {
|
|
20
|
+
const { firstTermIsAffine } = identifiers;
|
|
21
|
+
return `Commence par développer ${firstTermIsAffine ? "les produits" : "le produit"} en utilisant la distributivité. Puis, additionne les termes en $x$ entre eux, et les termes sans $x$ entre eux.`;
|
|
22
|
+
};
|
|
23
|
+
const getCorrection = (identifiers) => {
|
|
24
|
+
const { firstTermIsAffine, a, b, c, d, e, f, g } = identifiers;
|
|
25
|
+
const first = firstTermIsAffine
|
|
26
|
+
? new MultiplyNode(b.toTree(), new Affine(c, d).toTree())
|
|
27
|
+
: a.toTree();
|
|
28
|
+
const firstSimp = first.simplify({
|
|
29
|
+
towardsDistribute: true,
|
|
30
|
+
forbidFactorize: true,
|
|
31
|
+
});
|
|
32
|
+
const second = new MultiplyNode(e.toTree(), new Affine(f, g).toTree());
|
|
33
|
+
const secondSimp = second.simplify({
|
|
34
|
+
towardsDistribute: true,
|
|
35
|
+
forbidFactorize: true,
|
|
36
|
+
});
|
|
37
|
+
return `On commence par développer ${firstTermIsAffine ? "les produits" : "le produit"} en utilisant la distributivité :
|
|
38
|
+
|
|
39
|
+
${firstTermIsAffine
|
|
40
|
+
? `
|
|
41
|
+
$$
|
|
42
|
+
${first.toTex()} = ${firstSimp.toTex()}
|
|
43
|
+
$$
|
|
44
|
+
`
|
|
45
|
+
: ""}
|
|
46
|
+
$$
|
|
47
|
+
${second.toTex()} = ${secondSimp.toTex()}
|
|
48
|
+
$$
|
|
49
|
+
|
|
50
|
+
On réduit ensuite l'expression :
|
|
51
|
+
|
|
52
|
+
$$
|
|
53
|
+
${add(firstSimp, secondSimp).toTex()} = ${getAnswer(identifiers)}
|
|
54
|
+
$$
|
|
55
|
+
|
|
56
|
+
`;
|
|
57
|
+
};
|
|
19
58
|
const getInstruction = (identifiers) => {
|
|
20
59
|
return `Développer et réduire :
|
|
21
60
|
|
|
@@ -52,6 +91,8 @@ const getQuestionFromIdentifiers = (identifiers) => {
|
|
|
52
91
|
keys: ["x"],
|
|
53
92
|
answerFormat: "tex",
|
|
54
93
|
identifiers,
|
|
94
|
+
hint: getHint(identifiers),
|
|
95
|
+
correction: getCorrection(identifiers),
|
|
55
96
|
};
|
|
56
97
|
return question;
|
|
57
98
|
};
|
|
@@ -88,4 +129,5 @@ export const distributeAndSimplify = {
|
|
|
88
129
|
isAnswerValid,
|
|
89
130
|
subject: "Mathématiques",
|
|
90
131
|
getQuestionFromIdentifiers,
|
|
132
|
+
hasHintAndCorrection: true,
|
|
91
133
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/curve/index.ts"],"names":[],"mappings":"AAAA,cAAc,uBAAuB,CAAC;AACtC,cAAc,qBAAqB,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { Exercise } from "../../../exercises/exercise.js";
|
|
2
|
+
import { PointIdentifiers } from "../../../math/geometry/point.js";
|
|
3
|
+
type Identifiers = {
|
|
4
|
+
point: PointIdentifiers;
|
|
5
|
+
};
|
|
6
|
+
export declare const sqrtCurvePoint: Exercise<Identifiers>;
|
|
7
|
+
export {};
|
|
8
|
+
//# sourceMappingURL=sqrtCurvePoint.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sqrtCurvePoint.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/curve/sqrtCurvePoint.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAaT,MAAM,6BAA6B,CAAC;AAErC,OAAO,EAGL,gBAAgB,EACjB,MAAM,8BAA8B,CAAC;AAatC,KAAK,WAAW,GAAG;IACjB,KAAK,EAAE,gBAAgB,CAAC;CACzB,CAAC;AAuHF,eAAO,MAAM,cAAc,EAAE,QAAQ,CAAC,WAAW,CAkBhD,CAAC"}
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
import { addValidProp, shuffleProps, tryToAddWrongProp, } from "../../../exercises/exercise.js";
|
|
2
|
+
import { getDistinctQuestions } from "../../../exercises/utils/getDistinctQuestions.js";
|
|
3
|
+
import { Point, PointConstructor, } from "../../../math/geometry/point.js";
|
|
4
|
+
import { RationalConstructor } from "../../../math/numbers/rationals/rational.js";
|
|
5
|
+
import { randint } from "../../../math/utils/random/randint.js";
|
|
6
|
+
import { sqrt } from "../../../tree/nodes/functions/sqrtNode.js";
|
|
7
|
+
import { reifyAlgebraic, } from "../../../tree/nodes/nodeConstructor.js";
|
|
8
|
+
import { NumberNode } from "../../../tree/nodes/numbers/numberNode.js";
|
|
9
|
+
import { substract } from "../../../tree/nodes/operators/substractNode.js";
|
|
10
|
+
import { coinFlip } from "../../../utils/alea/coinFlip.js";
|
|
11
|
+
import { alignTex } from "../../../utils/latex/alignTex.js";
|
|
12
|
+
const getPropositions = (n, { answer }) => {
|
|
13
|
+
const propositions = [];
|
|
14
|
+
addValidProp(propositions, answer, "raw");
|
|
15
|
+
tryToAddWrongProp(propositions, "Oui", "raw");
|
|
16
|
+
tryToAddWrongProp(propositions, "Non", "raw");
|
|
17
|
+
return shuffleProps(propositions, n);
|
|
18
|
+
};
|
|
19
|
+
const isPointOnCurve = (identifiers) => {
|
|
20
|
+
const { point } = identifiers;
|
|
21
|
+
const x = reifyAlgebraic(point.x);
|
|
22
|
+
const y = reifyAlgebraic(point.y);
|
|
23
|
+
// Point sur la courbe -> f(x) - y = 0
|
|
24
|
+
if (substract(sqrt(x), y).simplify().equals(new NumberNode(0))) {
|
|
25
|
+
return true;
|
|
26
|
+
}
|
|
27
|
+
else {
|
|
28
|
+
return false;
|
|
29
|
+
}
|
|
30
|
+
};
|
|
31
|
+
const getAnswer = (identifiers) => {
|
|
32
|
+
if (isPointOnCurve(identifiers)) {
|
|
33
|
+
return "Oui";
|
|
34
|
+
}
|
|
35
|
+
else {
|
|
36
|
+
return "Non";
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
const getInstruction = (identifiers) => {
|
|
40
|
+
const { point } = identifiers;
|
|
41
|
+
return `Le point $${PointConstructor.fromIdentifiers(point).toTexWithCoords()}$ appartient-il à la courbe de la fonction racine carré ?`;
|
|
42
|
+
};
|
|
43
|
+
const getHint = (identifiers) => {
|
|
44
|
+
return "Un point $A(x; y)$ appartient à la courbe de la fonction $f$ si et seulement si $f(x) = y$.";
|
|
45
|
+
};
|
|
46
|
+
const getCorrection = (identifiers) => {
|
|
47
|
+
const { point: pointId } = identifiers;
|
|
48
|
+
const point = PointConstructor.fromIdentifiers(pointId);
|
|
49
|
+
const x = point.x;
|
|
50
|
+
const y = point.y;
|
|
51
|
+
const isValidPoint = isPointOnCurve(identifiers);
|
|
52
|
+
const conclusion = isValidPoint
|
|
53
|
+
? "Le point est donc sur la courbe."
|
|
54
|
+
: "Le point n'est donc pas sur la courbe.";
|
|
55
|
+
return `$${point.toTexWithCoords()}$ appartient à la courbe de la fonction racine carré si et seulement si :
|
|
56
|
+
|
|
57
|
+
${alignTex(sqrt(x).simplify().toTex() != sqrt(x).toTex()
|
|
58
|
+
? [
|
|
59
|
+
["", `f\\left(${x.toTex()}\\right)`, "=", `${y.toTex()}`],
|
|
60
|
+
["\\iff", `${sqrt(x).toTex()}`, "=", `${y.toTex()}`],
|
|
61
|
+
["\\iff", `${sqrt(x).simplify().toTex()}`, "=", `${y.toTex()}`],
|
|
62
|
+
]
|
|
63
|
+
: [
|
|
64
|
+
["", `f\\left(${x.toTex()}\\right)`, "=", `${y.toTex()}`],
|
|
65
|
+
["\\iff", `${sqrt(x).toTex()}`, "=", `${y.toTex()}`],
|
|
66
|
+
])}
|
|
67
|
+
|
|
68
|
+
${conclusion}`;
|
|
69
|
+
};
|
|
70
|
+
const getSqrtCurvePointQuestion = (ops) => {
|
|
71
|
+
let x = null;
|
|
72
|
+
switch (randint(1, 3)) {
|
|
73
|
+
case 1:
|
|
74
|
+
x = new NumberNode(randint(1, 10));
|
|
75
|
+
break;
|
|
76
|
+
case 2:
|
|
77
|
+
default:
|
|
78
|
+
x = RationalConstructor.randomIrreductible(10).toTree();
|
|
79
|
+
break;
|
|
80
|
+
}
|
|
81
|
+
// 50% de chance que le point (x, y) soit sur la courbe
|
|
82
|
+
// Sinon il est proche de sqrt(x)
|
|
83
|
+
const bound = Math.floor(sqrt(x).evaluate());
|
|
84
|
+
let y = null;
|
|
85
|
+
if (coinFlip()) {
|
|
86
|
+
y = sqrt(x).simplify();
|
|
87
|
+
}
|
|
88
|
+
else {
|
|
89
|
+
switch (randint(1, 3)) {
|
|
90
|
+
case 1:
|
|
91
|
+
y = new NumberNode(randint(bound - 2, bound + 2));
|
|
92
|
+
break;
|
|
93
|
+
case 2:
|
|
94
|
+
default:
|
|
95
|
+
y = RationalConstructor.randomIrreductible(bound + 2).toTree();
|
|
96
|
+
break;
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
const point = new Point("A", x, y).toIdentifiers();
|
|
100
|
+
const identifiers = {
|
|
101
|
+
point,
|
|
102
|
+
};
|
|
103
|
+
return getQuestionFromIdentifiers(identifiers);
|
|
104
|
+
};
|
|
105
|
+
const getQuestionFromIdentifiers = (identifiers) => {
|
|
106
|
+
return {
|
|
107
|
+
answer: getAnswer(identifiers),
|
|
108
|
+
instruction: getInstruction(identifiers),
|
|
109
|
+
keys: [],
|
|
110
|
+
answerFormat: "raw",
|
|
111
|
+
identifiers,
|
|
112
|
+
hint: getHint(identifiers),
|
|
113
|
+
correction: getCorrection(identifiers),
|
|
114
|
+
};
|
|
115
|
+
};
|
|
116
|
+
export const sqrtCurvePoint = {
|
|
117
|
+
id: "sqrtCurvePoint",
|
|
118
|
+
label: "Déterminer si un point appartient à la courbe de la fonction racine carré",
|
|
119
|
+
answerType: "QCU",
|
|
120
|
+
isSingleStep: true,
|
|
121
|
+
generator: (nb, opts) => getDistinctQuestions(() => getSqrtCurvePointQuestion(opts), nb),
|
|
122
|
+
qcmTimer: 60,
|
|
123
|
+
freeTimer: 60,
|
|
124
|
+
getPropositions,
|
|
125
|
+
subject: "Mathématiques",
|
|
126
|
+
getInstruction,
|
|
127
|
+
getHint,
|
|
128
|
+
getCorrection,
|
|
129
|
+
getAnswer,
|
|
130
|
+
getQuestionFromIdentifiers,
|
|
131
|
+
hasHintAndCorrection: true,
|
|
132
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { Exercise } from "../../../exercises/exercise.js";
|
|
2
|
+
import { PointIdentifiers } from "../../../math/geometry/point.js";
|
|
3
|
+
type Identifiers = {
|
|
4
|
+
point: PointIdentifiers;
|
|
5
|
+
};
|
|
6
|
+
export declare const squareCurvePoint: Exercise<Identifiers>;
|
|
7
|
+
export {};
|
|
8
|
+
//# sourceMappingURL=squareCurvePoint.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"squareCurvePoint.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/curve/squareCurvePoint.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAaT,MAAM,6BAA6B,CAAC;AAErC,OAAO,EAGL,gBAAgB,EACjB,MAAM,8BAA8B,CAAC;AActC,KAAK,WAAW,GAAG;IACjB,KAAK,EAAE,gBAAgB,CAAC;CACzB,CAAC;AAyHF,eAAO,MAAM,gBAAgB,EAAE,QAAQ,CAAC,WAAW,CAiBlD,CAAC"}
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
import { addValidProp, shuffleProps, tryToAddWrongProp, } from "../../../exercises/exercise.js";
|
|
2
|
+
import { getDistinctQuestions } from "../../../exercises/utils/getDistinctQuestions.js";
|
|
3
|
+
import { Point, PointConstructor, } from "../../../math/geometry/point.js";
|
|
4
|
+
import { RationalConstructor } from "../../../math/numbers/rationals/rational.js";
|
|
5
|
+
import { SquareRootConstructor } from "../../../math/numbers/reals/real.js";
|
|
6
|
+
import { randint } from "../../../math/utils/random/randint.js";
|
|
7
|
+
import { reifyAlgebraic, } from "../../../tree/nodes/nodeConstructor.js";
|
|
8
|
+
import { NumberNode } from "../../../tree/nodes/numbers/numberNode.js";
|
|
9
|
+
import { square } from "../../../tree/nodes/operators/powerNode.js";
|
|
10
|
+
import { substract } from "../../../tree/nodes/operators/substractNode.js";
|
|
11
|
+
import { coinFlip } from "../../../utils/alea/coinFlip.js";
|
|
12
|
+
import { alignTex } from "../../../utils/latex/alignTex.js";
|
|
13
|
+
const getPropositions = (n, { answer }) => {
|
|
14
|
+
const propositions = [];
|
|
15
|
+
addValidProp(propositions, answer, "raw");
|
|
16
|
+
tryToAddWrongProp(propositions, "Oui", "raw");
|
|
17
|
+
tryToAddWrongProp(propositions, "Non", "raw");
|
|
18
|
+
return shuffleProps(propositions, n);
|
|
19
|
+
};
|
|
20
|
+
const isPointOnCurve = (identifiers) => {
|
|
21
|
+
const { point } = identifiers;
|
|
22
|
+
const x = reifyAlgebraic(point.x);
|
|
23
|
+
const y = reifyAlgebraic(point.y);
|
|
24
|
+
// Point sur la courbe -> f(x) - y = 0
|
|
25
|
+
if (substract(square(x), y).simplify().equals(new NumberNode(0))) {
|
|
26
|
+
return true;
|
|
27
|
+
}
|
|
28
|
+
else {
|
|
29
|
+
return false;
|
|
30
|
+
}
|
|
31
|
+
};
|
|
32
|
+
const getAnswer = (identifiers) => {
|
|
33
|
+
if (isPointOnCurve(identifiers)) {
|
|
34
|
+
return "Oui";
|
|
35
|
+
}
|
|
36
|
+
else {
|
|
37
|
+
return "Non";
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
const getInstruction = (identifiers) => {
|
|
41
|
+
const { point } = identifiers;
|
|
42
|
+
return `Le point $${PointConstructor.fromIdentifiers(point).toTexWithCoords()}$ appartient-il à la courbe de la fonction carré ?`;
|
|
43
|
+
};
|
|
44
|
+
const getHint = (identifiers) => {
|
|
45
|
+
return "Un point $A(x; y)$ appartient à la courbe de la fonction $f$ si et seulement si $f(x) = y$.";
|
|
46
|
+
};
|
|
47
|
+
const getCorrection = (identifiers) => {
|
|
48
|
+
const { point: pointId } = identifiers;
|
|
49
|
+
const point = PointConstructor.fromIdentifiers(pointId);
|
|
50
|
+
const isValidPoint = isPointOnCurve(identifiers);
|
|
51
|
+
const conclusion = isValidPoint
|
|
52
|
+
? "Le point est donc sur la courbe."
|
|
53
|
+
: "Le point n'est donc pas sur la courbe.";
|
|
54
|
+
return `$${point.toTexWithCoords()}$ appartient à la courbe de la fonction carré si et seulement si :
|
|
55
|
+
|
|
56
|
+
${alignTex([
|
|
57
|
+
["", `f(${point.x.toTex()})`, "=", `${point.y.toTex()}`],
|
|
58
|
+
["\\iff", `${square(point.x).toTex()}`, "=", `${point.y.toTex()}`],
|
|
59
|
+
["\\iff", `${square(point.x).simplify().toTex()}`, "=", `${point.y.toTex()}`],
|
|
60
|
+
])}
|
|
61
|
+
|
|
62
|
+
${conclusion}`;
|
|
63
|
+
};
|
|
64
|
+
const getKeys = (identifiers) => {
|
|
65
|
+
return [];
|
|
66
|
+
};
|
|
67
|
+
const getSquareCurvePointQuestion = (ops) => {
|
|
68
|
+
let x = null;
|
|
69
|
+
switch (randint(1, 4)) {
|
|
70
|
+
case 1:
|
|
71
|
+
x = new NumberNode(randint(-5, 5));
|
|
72
|
+
break;
|
|
73
|
+
case 2:
|
|
74
|
+
x = RationalConstructor.randomIrreductible().toTree();
|
|
75
|
+
break;
|
|
76
|
+
case 3:
|
|
77
|
+
default:
|
|
78
|
+
x = SquareRootConstructor.randomIrreductible(25).toTree();
|
|
79
|
+
break;
|
|
80
|
+
}
|
|
81
|
+
let y = null;
|
|
82
|
+
// 50% de chance que le point (x, y) soit sur la courbe
|
|
83
|
+
if (coinFlip()) {
|
|
84
|
+
y = square(x).simplify();
|
|
85
|
+
}
|
|
86
|
+
else {
|
|
87
|
+
switch (randint(1, 4)) {
|
|
88
|
+
case 1:
|
|
89
|
+
y = new NumberNode(randint(-5, 5));
|
|
90
|
+
break;
|
|
91
|
+
case 2:
|
|
92
|
+
y = RationalConstructor.randomIrreductible().toTree();
|
|
93
|
+
break;
|
|
94
|
+
case 3:
|
|
95
|
+
default:
|
|
96
|
+
y = SquareRootConstructor.randomIrreductible(25).toTree();
|
|
97
|
+
break;
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
const point = new Point("A", x, y).toIdentifiers();
|
|
101
|
+
const identifiers = {
|
|
102
|
+
point,
|
|
103
|
+
};
|
|
104
|
+
return getQuestionFromIdentifiers(identifiers);
|
|
105
|
+
};
|
|
106
|
+
const getQuestionFromIdentifiers = (identifiers) => {
|
|
107
|
+
return {
|
|
108
|
+
answer: getAnswer(identifiers),
|
|
109
|
+
instruction: getInstruction(identifiers),
|
|
110
|
+
keys: getKeys(identifiers),
|
|
111
|
+
answerFormat: "raw",
|
|
112
|
+
identifiers,
|
|
113
|
+
hint: getHint(identifiers),
|
|
114
|
+
correction: getCorrection(identifiers),
|
|
115
|
+
};
|
|
116
|
+
};
|
|
117
|
+
export const squareCurvePoint = {
|
|
118
|
+
id: "squareCurvePoint",
|
|
119
|
+
label: "Déterminer si un point appartient à la courbe de la fonction carré",
|
|
120
|
+
answerType: "QCU",
|
|
121
|
+
isSingleStep: true,
|
|
122
|
+
generator: (nb, opts) => getDistinctQuestions(() => getSquareCurvePointQuestion(opts), nb),
|
|
123
|
+
qcmTimer: 60,
|
|
124
|
+
freeTimer: 60,
|
|
125
|
+
getPropositions,
|
|
126
|
+
subject: "Mathématiques",
|
|
127
|
+
getInstruction,
|
|
128
|
+
getHint,
|
|
129
|
+
getCorrection,
|
|
130
|
+
getAnswer,
|
|
131
|
+
getQuestionFromIdentifiers,
|
|
132
|
+
hasHintAndCorrection: true,
|
|
133
|
+
};
|
|
@@ -2,4 +2,6 @@ export * from "./absoluteValueEquations.js";
|
|
|
2
2
|
export * from "./absoluteValueInequations.js";
|
|
3
3
|
export * from "./absolueValueAffineEquation.js";
|
|
4
4
|
export * from "./absolueValueInequationsSup.js";
|
|
5
|
+
export * from "./removeAbsNotation.js";
|
|
6
|
+
export * from "./removeAbsNotationSign.js";
|
|
5
7
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/functions/absolute/index.ts"],"names":[],"mappings":"AAAA,cAAc,6BAA6B,CAAC;AAC5C,cAAc,+BAA+B,CAAC;AAC9C,cAAc,iCAAiC,CAAC;AAChD,cAAc,iCAAiC,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/functions/absolute/index.ts"],"names":[],"mappings":"AAAA,cAAc,6BAA6B,CAAC;AAC5C,cAAc,+BAA+B,CAAC;AAC9C,cAAc,iCAAiC,CAAC;AAChD,cAAc,iCAAiC,CAAC;AAChD,cAAc,wBAAwB,CAAC;AACvC,cAAc,4BAA4B,CAAC"}
|
|
@@ -2,3 +2,5 @@ export * from "./absoluteValueEquations.js";
|
|
|
2
2
|
export * from "./absoluteValueInequations.js";
|
|
3
3
|
export * from "./absolueValueAffineEquation.js";
|
|
4
4
|
export * from "./absolueValueInequationsSup.js";
|
|
5
|
+
export * from "./removeAbsNotation.js";
|
|
6
|
+
export * from "./removeAbsNotationSign.js";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"removeAbsNotation.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/functions/absolute/removeAbsNotation.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAeT,MAAM,6BAA6B,CAAC;AAYrC,KAAK,WAAW,GAAG;IACjB,KAAK,EAAE,OAAO,CAAC;IACf,CAAC,EAAE,MAAM,CAAC;CACX,CAAC;AAuGF,eAAO,MAAM,iBAAiB,EAAE,QAAQ,CAAC,WAAW,CAiBnD,CAAC"}
|