math-exercises 3.0.158 → 3.0.159
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/exercises/math/calculLitteral/equation/exp/expOfFEqualsExpOfGEquation.js +7 -6
- package/lib/exercises/math/calculLitteral/equation/exp/expOfTrinomEquals1Equation.d.ts.map +1 -1
- package/lib/exercises/math/calculLitteral/equation/exp/expOfTrinomEquals1Equation.js +88 -9
- package/lib/exercises/math/calculLitteral/equation/factorizeEquation.d.ts.map +1 -1
- package/lib/exercises/math/calculLitteral/equation/factorizeEquation.js +8 -2
- 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/equation/multiplicationEquation.d.ts.map +1 -1
- package/lib/exercises/math/calculLitteral/equation/multiplicationEquation.js +27 -2
- package/lib/exercises/math/calculLitteral/equation/solveByFactorizingWithIdRmq3.d.ts.map +1 -1
- package/lib/exercises/math/calculLitteral/equation/solveByFactorizingWithIdRmq3.js +0 -1
- package/lib/exercises/math/calculLitteral/equation/square/equationSquareWithSteps.d.ts.map +1 -1
- package/lib/exercises/math/calculLitteral/equation/square/equationSquareWithSteps.js +0 -1
- package/lib/exercises/math/calculLitteral/inequations/exp/expOfFEqualsExpOfGInequation.d.ts.map +1 -1
- package/lib/exercises/math/calculLitteral/inequations/exp/expOfFEqualsExpOfGInequation.js +11 -4
- package/lib/exercises/math/calculLitteral/inequations/firstDegreeInequationsType3.d.ts.map +1 -1
- package/lib/exercises/math/calculLitteral/inequations/firstDegreeInequationsType3.js +11 -5
- 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/derivation/derivative/exp/expDerivativeFour.d.ts.map +1 -1
- package/lib/exercises/math/derivation/derivative/exp/expDerivativeFour.js +91 -21
- package/lib/exercises/math/derivation/derivative/exp/expDerivativeOne.d.ts.map +1 -1
- package/lib/exercises/math/derivation/derivative/exp/expDerivativeOne.js +63 -43
- package/lib/exercises/math/derivation/derivative/exp/expDerivativeThree.d.ts.map +1 -1
- package/lib/exercises/math/derivation/derivative/exp/expDerivativeThree.js +72 -49
- package/lib/exercises/math/derivation/derivative/exp/expDerivativeTwo.d.ts.map +1 -1
- package/lib/exercises/math/derivation/derivative/exp/expDerivativeTwo.js +19 -19
- package/lib/exercises/math/derivation/derivative/exp/expOverExpDerivative.d.ts.map +1 -1
- package/lib/exercises/math/derivation/derivative/exp/expOverExpDerivative.js +26 -14
- package/lib/exercises/math/derivation/derivative/exp/index.d.ts +1 -0
- package/lib/exercises/math/derivation/derivative/exp/index.d.ts.map +1 -1
- package/lib/exercises/math/derivation/derivative/exp/index.js +1 -0
- package/lib/exercises/math/derivation/variations/index.d.ts +1 -0
- package/lib/exercises/math/derivation/variations/index.d.ts.map +1 -1
- package/lib/exercises/math/derivation/variations/index.js +1 -0
- package/lib/exercises/math/derivation/variations/readExtremaAbscissFromDerivativeCurve.d.ts +7 -0
- package/lib/exercises/math/derivation/variations/readExtremaAbscissFromDerivativeCurve.d.ts.map +1 -0
- package/lib/exercises/math/derivation/variations/readExtremaAbscissFromDerivativeCurve.js +174 -0
- package/lib/exercises/math/functions/exponential/algebraic/approxExpAPlusB.d.ts.map +1 -1
- package/lib/exercises/math/functions/exponential/algebraic/approxExpAPlusB.js +30 -3
- package/lib/exercises/math/functions/exponential/algebraic/approxExpKa.d.ts.map +1 -1
- package/lib/exercises/math/functions/exponential/algebraic/approxExpKa.js +12 -7
- package/lib/exercises/math/functions/exponential/algebraic/approxExpN.js +1 -1
- package/lib/exercises/math/functions/exponential/algebraic/rewriteExpUsingExpA.js +2 -2
- package/lib/exercises/math/functions/exponential/definition/approxExpAPlusH.d.ts.map +1 -1
- package/lib/exercises/math/functions/exponential/definition/approxExpAPlusH.js +33 -44
- package/lib/exercises/math/functions/exponential/definition/expAntecedentFromGraph.d.ts.map +1 -1
- package/lib/exercises/math/functions/exponential/definition/expAntecedentFromGraph.js +80 -8
- package/lib/exercises/math/functions/exponential/definition/expImageFromGraph.d.ts.map +1 -1
- package/lib/exercises/math/functions/exponential/definition/expImageFromGraph.js +80 -25
- package/lib/exercises/math/functions/exponential/definition/isPlausibleExpFromGraph.d.ts.map +1 -1
- package/lib/exercises/math/functions/exponential/definition/isPlausibleExpFromGraph.js +6 -15
- package/lib/exercises/math/functions/exponential/expFactorization.d.ts.map +1 -1
- package/lib/exercises/math/functions/exponential/expFactorization.js +54 -42
- package/lib/exercises/math/functions/exponential/index.d.ts +2 -0
- package/lib/exercises/math/functions/exponential/index.d.ts.map +1 -1
- package/lib/exercises/math/functions/exponential/index.js +2 -0
- package/lib/exercises/math/functions/trinoms/equation/secondDegreeInequation.js +3 -0
- package/lib/exercises/math/functions/variations/exp/varOfAEXPlusB.d.ts.map +1 -1
- package/lib/exercises/math/functions/variations/exp/varOfAEXPlusB.js +18 -23
- package/lib/exercises/math/functions/variations/exp/varOfAEXPlusBOverCEXPlusD.d.ts.map +1 -1
- package/lib/exercises/math/functions/variations/exp/varOfAEXPlusBOverCEXPlusD.js +24 -26
- package/lib/exercises/math/functions/variations/index.d.ts +1 -0
- package/lib/exercises/math/functions/variations/index.d.ts.map +1 -1
- package/lib/exercises/math/functions/variations/index.js +1 -0
- package/lib/exercises/math/geometry/cartesian/cartesianEquationOfLineFromPerpendicularLine.d.ts +12 -0
- package/lib/exercises/math/geometry/cartesian/cartesianEquationOfLineFromPerpendicularLine.d.ts.map +1 -0
- package/lib/exercises/math/geometry/cartesian/cartesianEquationOfLineFromPerpendicularLine.js +230 -0
- package/lib/exercises/math/geometry/cartesian/cartesianEquationOfLineFromPointAndNormalVector.d.ts +10 -0
- package/lib/exercises/math/geometry/cartesian/cartesianEquationOfLineFromPointAndNormalVector.d.ts.map +1 -0
- package/lib/exercises/math/geometry/cartesian/cartesianEquationOfLineFromPointAndNormalVector.js +167 -0
- package/lib/exercises/math/geometry/cartesian/index.d.ts +3 -0
- package/lib/exercises/math/geometry/cartesian/index.d.ts.map +1 -1
- package/lib/exercises/math/geometry/cartesian/index.js +3 -0
- package/lib/exercises/math/geometry/cartesian/normalVectorFromCartesianLineEquation.d.ts +10 -0
- package/lib/exercises/math/geometry/cartesian/normalVectorFromCartesianLineEquation.d.ts.map +1 -0
- package/lib/exercises/math/geometry/cartesian/normalVectorFromCartesianLineEquation.js +131 -0
- package/lib/exercises/math/geometry/circles/index.d.ts +2 -0
- package/lib/exercises/math/geometry/circles/index.d.ts.map +1 -0
- package/lib/exercises/math/geometry/circles/index.js +1 -0
- package/lib/exercises/math/geometry/circles/isPointOnCircleFromCartesianEquation.d.ts +11 -0
- package/lib/exercises/math/geometry/circles/isPointOnCircleFromCartesianEquation.d.ts.map +1 -0
- package/lib/exercises/math/geometry/circles/isPointOnCircleFromCartesianEquation.js +131 -0
- package/lib/exercises/math/geometry/euclidian/pinSegmentFromRotation.d.ts.map +1 -1
- package/lib/exercises/math/geometry/euclidian/pinSegmentFromRotation.js +0 -2
- package/lib/exercises/math/geometry/index.d.ts +1 -0
- package/lib/exercises/math/geometry/index.d.ts.map +1 -1
- package/lib/exercises/math/geometry/index.js +1 -0
- package/lib/exercises/math/geometry/vectors/scalarProduct/alKashi/index.d.ts +4 -0
- package/lib/exercises/math/geometry/vectors/scalarProduct/alKashi/index.d.ts.map +1 -0
- package/lib/exercises/math/geometry/vectors/scalarProduct/alKashi/index.js +3 -0
- package/lib/exercises/math/geometry/vectors/scalarProduct/alKashi/scalarProductAlKashiAngle.d.ts +9 -0
- package/lib/exercises/math/geometry/vectors/scalarProduct/alKashi/scalarProductAlKashiAngle.d.ts.map +1 -0
- package/lib/exercises/math/geometry/vectors/scalarProduct/alKashi/scalarProductAlKashiAngle.js +247 -0
- package/lib/exercises/math/geometry/vectors/scalarProduct/alKashi/scalarProductAlKashiBH.d.ts +13 -0
- package/lib/exercises/math/geometry/vectors/scalarProduct/alKashi/scalarProductAlKashiBH.d.ts.map +1 -0
- package/lib/exercises/math/geometry/vectors/scalarProduct/alKashi/scalarProductAlKashiBH.js +452 -0
- package/lib/exercises/math/geometry/vectors/scalarProduct/alKashi/scalarProductAlKashiSideLength.d.ts +9 -0
- package/lib/exercises/math/geometry/vectors/scalarProduct/alKashi/scalarProductAlKashiSideLength.d.ts.map +1 -0
- package/lib/exercises/math/geometry/vectors/scalarProduct/alKashi/scalarProductAlKashiSideLength.js +253 -0
- package/lib/exercises/math/geometry/vectors/scalarProduct/alg/index.d.ts +4 -0
- package/lib/exercises/math/geometry/vectors/scalarProduct/alg/index.d.ts.map +1 -0
- package/lib/exercises/math/geometry/vectors/scalarProduct/alg/index.js +3 -0
- package/lib/exercises/math/geometry/vectors/scalarProduct/alg/scalarProductIdentities.d.ts +10 -0
- package/lib/exercises/math/geometry/vectors/scalarProduct/alg/scalarProductIdentities.d.ts.map +1 -0
- package/lib/exercises/math/geometry/vectors/scalarProduct/alg/scalarProductIdentities.js +174 -0
- package/lib/exercises/math/geometry/vectors/scalarProduct/alg/scalarProductInOrthonormalBasisIJ.d.ts +9 -0
- package/lib/exercises/math/geometry/vectors/scalarProduct/alg/scalarProductInOrthonormalBasisIJ.d.ts.map +1 -0
- package/lib/exercises/math/geometry/vectors/scalarProduct/alg/scalarProductInOrthonormalBasisIJ.js +231 -0
- package/lib/exercises/math/geometry/vectors/scalarProduct/alg/scalarProductLamdbaULambdaV.d.ts +14 -0
- package/lib/exercises/math/geometry/vectors/scalarProduct/alg/scalarProductLamdbaULambdaV.d.ts.map +1 -0
- package/lib/exercises/math/geometry/vectors/scalarProduct/alg/scalarProductLamdbaULambdaV.js +292 -0
- package/lib/exercises/math/geometry/vectors/scalarProduct/orth/index.d.ts +6 -0
- package/lib/exercises/math/geometry/vectors/scalarProduct/orth/index.d.ts.map +1 -0
- package/lib/exercises/math/geometry/vectors/scalarProduct/orth/index.js +5 -0
- package/lib/exercises/math/geometry/vectors/scalarProduct/orth/scalarProductIsOrthogonalVecsBasisIJ.d.ts +9 -0
- package/lib/exercises/math/geometry/vectors/scalarProduct/orth/scalarProductIsOrthogonalVecsBasisIJ.d.ts.map +1 -0
- package/lib/exercises/math/geometry/vectors/scalarProduct/orth/scalarProductIsOrthogonalVecsBasisIJ.js +202 -0
- package/lib/exercises/math/geometry/vectors/scalarProduct/orth/scalarProductIsOrthogonalVecsUsingCoords.d.ts +9 -0
- package/lib/exercises/math/geometry/vectors/scalarProduct/orth/scalarProductIsOrthogonalVecsUsingCoords.d.ts.map +1 -0
- package/lib/exercises/math/geometry/vectors/scalarProduct/orth/scalarProductIsOrthogonalVecsUsingCoords.js +127 -0
- package/lib/exercises/math/geometry/vectors/scalarProduct/orth/scalarProductIsPointOnCircle.d.ts +12 -0
- package/lib/exercises/math/geometry/vectors/scalarProduct/orth/scalarProductIsPointOnCircle.d.ts.map +1 -0
- package/lib/exercises/math/geometry/vectors/scalarProduct/orth/scalarProductIsPointOnCircle.js +167 -0
- package/lib/exercises/math/geometry/vectors/scalarProduct/orth/scalarProductIsPointOnPerpendicularBisector.d.ts +12 -0
- package/lib/exercises/math/geometry/vectors/scalarProduct/orth/scalarProductIsPointOnPerpendicularBisector.d.ts.map +1 -0
- package/lib/exercises/math/geometry/vectors/scalarProduct/orth/scalarProductIsPointOnPerpendicularBisector.js +180 -0
- package/lib/exercises/math/geometry/vectors/scalarProduct/orth/scalarProductIsRightTriangleUsingPointCoords.d.ts +12 -0
- package/lib/exercises/math/geometry/vectors/scalarProduct/orth/scalarProductIsRightTriangleUsingPointCoords.d.ts.map +1 -0
- package/lib/exercises/math/geometry/vectors/scalarProduct/orth/scalarProductIsRightTriangleUsingPointCoords.js +235 -0
- package/lib/exercises/math/geometry/vectors/scalarProduct/scalarProductComputeBH.d.ts +12 -0
- package/lib/exercises/math/geometry/vectors/scalarProduct/scalarProductComputeBH.d.ts.map +1 -0
- package/lib/exercises/math/geometry/vectors/scalarProduct/scalarProductComputeBH.js +423 -0
- package/lib/exercises/math/geometry/vectors/scalarProduct/scalarProductOfVectsOnGrid1.d.ts +17 -0
- package/lib/exercises/math/geometry/vectors/scalarProduct/scalarProductOfVectsOnGrid1.d.ts.map +1 -0
- package/lib/exercises/math/geometry/vectors/scalarProduct/scalarProductOfVectsOnGrid1.js +347 -0
- package/lib/exercises/math/geometry/vectors/scalarProduct/scalarProductParallelogramDiagonalPlus.d.ts +8 -0
- package/lib/exercises/math/geometry/vectors/scalarProduct/scalarProductParallelogramDiagonalPlus.d.ts.map +1 -0
- package/lib/exercises/math/geometry/vectors/scalarProduct/scalarProductParallelogramDiagonalPlus.js +301 -0
- package/lib/exercises/math/probaStat/randomVariable/findValueForFairRandomVariable.d.ts +9 -0
- package/lib/exercises/math/probaStat/randomVariable/findValueForFairRandomVariable.d.ts.map +1 -0
- package/lib/exercises/math/probaStat/randomVariable/findValueForFairRandomVariable.js +141 -0
- package/lib/exercises/math/probaStat/randomVariable/findValueToMatchRandomVariableAverage.d.ts +10 -0
- package/lib/exercises/math/probaStat/randomVariable/findValueToMatchRandomVariableAverage.d.ts.map +1 -0
- package/lib/exercises/math/probaStat/randomVariable/findValueToMatchRandomVariableAverage.js +174 -0
- package/lib/exercises/math/probaStat/randomVariable/index.d.ts +1 -0
- package/lib/exercises/math/probaStat/randomVariable/index.d.ts.map +1 -1
- package/lib/exercises/math/probaStat/randomVariable/index.js +2 -0
- package/lib/exercises/math/sequences/generation/index.d.ts +2 -0
- package/lib/exercises/math/sequences/generation/index.d.ts.map +1 -0
- package/lib/exercises/math/sequences/generation/index.js +1 -0
- package/lib/exercises/math/sequences/generation/recognizeRecurrenceOrExplicit.d.ts +8 -0
- package/lib/exercises/math/sequences/generation/recognizeRecurrenceOrExplicit.d.ts.map +1 -0
- package/lib/exercises/math/sequences/generation/recognizeRecurrenceOrExplicit.js +63 -0
- package/lib/exercises/math/sequences/graph/index.d.ts +2 -0
- package/lib/exercises/math/sequences/graph/index.d.ts.map +1 -0
- package/lib/exercises/math/sequences/graph/index.js +1 -0
- package/lib/exercises/math/sequences/graph/placeFirstSequencePoints.d.ts +11 -0
- package/lib/exercises/math/sequences/graph/placeFirstSequencePoints.d.ts.map +1 -0
- package/lib/exercises/math/sequences/graph/placeFirstSequencePoints.js +113 -0
- package/lib/exercises/math/sequences/index.d.ts +2 -0
- package/lib/exercises/math/sequences/index.d.ts.map +1 -1
- package/lib/exercises/math/sequences/index.js +2 -0
- package/lib/exercises/math/sequences/notation/identifyRankInSequenceTermsList.d.ts +12 -0
- package/lib/exercises/math/sequences/notation/identifyRankInSequenceTermsList.d.ts.map +1 -0
- package/lib/exercises/math/sequences/notation/identifyRankInSequenceTermsList.js +114 -0
- package/lib/exercises/math/sequences/notation/identifySequenceTermInList.d.ts +12 -0
- package/lib/exercises/math/sequences/notation/identifySequenceTermInList.d.ts.map +1 -0
- package/lib/exercises/math/sequences/notation/identifySequenceTermInList.js +111 -0
- package/lib/exercises/math/sequences/notation/index.d.ts +3 -0
- package/lib/exercises/math/sequences/notation/index.d.ts.map +1 -0
- package/lib/exercises/math/sequences/notation/index.js +2 -0
- package/lib/exercises/math/spaceGeometry/basis/findSpacePointOnRectangularPrism.d.ts.map +1 -1
- package/lib/exercises/math/spaceGeometry/basis/findSpacePointOnRectangularPrism.js +0 -1
- package/lib/exercises/math/spaceGeometry/sphere/sphereLatLonReading.2d.d.ts.map +1 -1
- package/lib/exercises/math/spaceGeometry/sphere/sphereLatLonReading.2d.js +0 -2
- package/lib/exercises/vea/cartesianLineVEA.d.ts +2 -0
- package/lib/exercises/vea/cartesianLineVEA.d.ts.map +1 -0
- package/lib/exercises/vea/cartesianLineVEA.js +1 -0
- package/lib/index.d.ts +123 -0
- package/lib/index.d.ts.map +1 -1
- package/lib/math/geometry/line.d.ts +2 -0
- package/lib/math/geometry/line.d.ts.map +1 -1
- package/lib/math/geometry/line.js +7 -0
- package/lib/math/geometry/point.d.ts +1 -0
- package/lib/math/geometry/point.d.ts.map +1 -1
- package/lib/math/geometry/point.js +5 -0
- package/lib/math/geometry/polygons/relationPP.d.ts +8 -0
- package/lib/math/geometry/polygons/relationPP.d.ts.map +1 -0
- package/lib/math/geometry/polygons/relationPP.js +41 -0
- package/lib/math/polynomials/trinom.d.ts +1 -1
- package/lib/math/polynomials/trinom.d.ts.map +1 -1
- package/lib/math/polynomials/trinom.js +15 -6
- package/lib/math/utils/arithmetic/primeFactors.js +1 -1
- package/lib/math/utils/geometry/randomVecs2.d.ts +6 -0
- package/lib/math/utils/geometry/randomVecs2.d.ts.map +1 -0
- package/lib/math/utils/geometry/randomVecs2.js +34 -0
- package/lib/tests/questionTest.d.ts.map +1 -1
- package/lib/tests/questionTest.js +2 -2
- package/lib/tree/nodes/equations/equationSolutionNode.d.ts +1 -0
- package/lib/tree/nodes/equations/equationSolutionNode.d.ts.map +1 -1
- package/lib/tree/nodes/equations/equationSolutionNode.js +3 -0
- package/lib/tree/nodes/functions/expNode.d.ts +1 -1
- package/lib/tree/nodes/functions/expNode.d.ts.map +1 -1
- package/lib/tree/nodes/inequations/inequationSolutionNode.d.ts +1 -0
- package/lib/tree/nodes/inequations/inequationSolutionNode.d.ts.map +1 -1
- package/lib/tree/nodes/inequations/inequationSolutionNode.js +3 -0
- package/lib/tree/nodes/operators/fractionNode.d.ts +1 -1
- package/lib/tree/nodes/operators/fractionNode.d.ts.map +1 -1
- package/lib/tree/nodes/operators/fractionNode.js +6 -4
- package/lib/tree/nodes/sets/intervalNode.d.ts +6 -0
- package/lib/tree/nodes/sets/intervalNode.d.ts.map +1 -1
- package/lib/tree/nodes/sets/namedIntervalNode.d.ts +31 -0
- package/lib/tree/nodes/sets/namedIntervalNode.d.ts.map +1 -0
- package/lib/tree/nodes/sets/namedIntervalNode.js +77 -0
- package/package.json +1 -1
|
@@ -0,0 +1,347 @@
|
|
|
1
|
+
import { addValidProp, shuffleProps, tryToAddWrongProp, GeneratorOptionType, GeneratorOptionTarget, } from "../../../../../exercises/exercise.js";
|
|
2
|
+
import { getDistinctQuestions } from "../../../../../exercises/utils/getDistinctQuestions.js";
|
|
3
|
+
import { rationalVEA } from "../../../../../exercises/vea/rationalVEA.js";
|
|
4
|
+
import { blueMain, greenMain, orange } from "../../../../../geogebra/colors.js";
|
|
5
|
+
import { GeogebraConstructor } from "../../../../../geogebra/geogebraConstructor.js";
|
|
6
|
+
import { Point, PointConstructor, } from "../../../../../math/geometry/point.js";
|
|
7
|
+
import { Vector, VectorConstructor, } from "../../../../../math/geometry/vector.js";
|
|
8
|
+
import { randint } from "../../../../../math/utils/random/randint.js";
|
|
9
|
+
import { abs } from "../../../../../tree/nodes/functions/absNode.js";
|
|
10
|
+
import { add } from "../../../../../tree/nodes/operators/addNode.js";
|
|
11
|
+
import { multiply } from "../../../../../tree/nodes/operators/multiplyNode.js";
|
|
12
|
+
import { coinFlip } from "../../../../../utils/alea/coinFlip.js";
|
|
13
|
+
import { randomMany } from "../../../../../utils/alea/random.js";
|
|
14
|
+
import { getCartesiansProducts } from "../../../../../utils/arrays/cartesianProducts.js";
|
|
15
|
+
import { handleVEAError } from "../../../../../utils/errors/handleVEAError.js";
|
|
16
|
+
import { alignTex } from "../../../../../utils/latex/alignTex.js";
|
|
17
|
+
const getHydratedVecs = (identifiers) => {
|
|
18
|
+
const { vecIds1, vecIds2 } = identifiers;
|
|
19
|
+
const [vec1, vec2] = [vecIds1, vecIds2].map((vecIds) => VectorConstructor.fromIdentifiers(vecIds));
|
|
20
|
+
return [vec1, vec2];
|
|
21
|
+
};
|
|
22
|
+
const getHydratedPoints = (identifiers) => {
|
|
23
|
+
const { pointIds1A, pointIds2A } = identifiers;
|
|
24
|
+
const [vec1, vec2] = getHydratedVecs(identifiers);
|
|
25
|
+
const [point1A, point2A] = [pointIds1A, pointIds2A].map((pointIds) => PointConstructor.fromIdentifiers(pointIds));
|
|
26
|
+
const point1B = vec1.getEndPoint(point1A);
|
|
27
|
+
const point2B = vec2.getEndPoint(point2A);
|
|
28
|
+
return [point1A, point1B, point2A, point2B];
|
|
29
|
+
};
|
|
30
|
+
const getInstruction = (identifiers) => {
|
|
31
|
+
const [vec1, vec2] = getHydratedVecs(identifiers);
|
|
32
|
+
return `Calculer :
|
|
33
|
+
|
|
34
|
+
$$
|
|
35
|
+
${vec1.toTex()} \\cdot ${vec2.toTex()}
|
|
36
|
+
$$`;
|
|
37
|
+
};
|
|
38
|
+
const getAnswerNode = (identifiers) => {
|
|
39
|
+
const { isVec1OnAxis, isOnAxisX } = identifiers;
|
|
40
|
+
const [vec1, vec2] = getHydratedVecs(identifiers);
|
|
41
|
+
const [vecOnAxis, vecOther] = isVec1OnAxis ? [vec1, vec2] : [vec2, vec1];
|
|
42
|
+
const vecOtherProj = isOnAxisX
|
|
43
|
+
? new Vector("p", vecOther.x, (0).toTree())
|
|
44
|
+
: new Vector("p", (0).toTree(), vecOther.y);
|
|
45
|
+
const nodeCompVecOnAxis = isOnAxisX ? vecOnAxis.x : vecOnAxis.y;
|
|
46
|
+
const nodeCompVecOtherProj = isOnAxisX ? vecOtherProj.x : vecOtherProj.y;
|
|
47
|
+
const isSameSign = nodeCompVecOnAxis.evaluate() * nodeCompVecOtherProj.evaluate() > 0;
|
|
48
|
+
const nodeCompVecOnAxisPretty = abs(nodeCompVecOnAxis).evaluate().toTree();
|
|
49
|
+
const nodeCompVecOtherProjPretty = ((isSameSign ? +1 : -1) * abs(nodeCompVecOtherProj).evaluate()).toTree();
|
|
50
|
+
return isVec1OnAxis
|
|
51
|
+
? multiply(nodeCompVecOnAxisPretty, nodeCompVecOtherProjPretty)
|
|
52
|
+
: multiply(nodeCompVecOtherProjPretty, nodeCompVecOnAxisPretty);
|
|
53
|
+
};
|
|
54
|
+
const getAnswer = (identifiers) => {
|
|
55
|
+
return getAnswerNode(identifiers).simplify().toTex();
|
|
56
|
+
};
|
|
57
|
+
const getHint = () => {
|
|
58
|
+
return `Ici, on va se servir de la grille. Trouve un vecteur qui est parallèle à un axe de la grille, puis projète orthogonalement l'autre vecteur sur ce même axe.
|
|
59
|
+
Ensuite, tu n'as plus qu'une multiplication à effectuer.`;
|
|
60
|
+
};
|
|
61
|
+
const getCorrection = (identifiers) => {
|
|
62
|
+
const { isVec1OnAxis, isOnAxisX } = identifiers;
|
|
63
|
+
const [vec1, vec2] = getHydratedVecs(identifiers);
|
|
64
|
+
const [vecOnAxis, vecOther] = isVec1OnAxis ? [vec1, vec2] : [vec2, vec1];
|
|
65
|
+
const vecOtherProj = isOnAxisX
|
|
66
|
+
? new Vector("p", vecOther.x, (0).toTree())
|
|
67
|
+
: new Vector("p", (0).toTree(), vecOther.y);
|
|
68
|
+
const nodeAnswer = getAnswerNode(identifiers);
|
|
69
|
+
const isScalarProductZero = nodeAnswer.evaluate() === 0;
|
|
70
|
+
if (isScalarProductZero) {
|
|
71
|
+
return `Sur la grille, on remarque que les deux vecteurs sont orthogonaux.
|
|
72
|
+
|
|
73
|
+
Leur produit scalaire est donc nul :
|
|
74
|
+
|
|
75
|
+
$$
|
|
76
|
+
${vec1.toTex()} \\cdot ${vec2.toTex()} = 0
|
|
77
|
+
$$
|
|
78
|
+
|
|
79
|
+
`;
|
|
80
|
+
}
|
|
81
|
+
else {
|
|
82
|
+
return `Sur la grille, on remarque que le vecteur $${vecOnAxis.toTex()}$ est parallèle à un axe de la grille.
|
|
83
|
+
|
|
84
|
+
On projète $${vecOther.toTex()}$ sur ce même axe : on obtient le vecteur $${vecOtherProj.toTex()}$.
|
|
85
|
+
|
|
86
|
+
Les vecteurs $${vecOnAxis.toTex()}$ et $${vecOtherProj.toTex()}$ sont colinéaires.
|
|
87
|
+
|
|
88
|
+
Le calcul du produit scalaire est facilité :
|
|
89
|
+
|
|
90
|
+
${alignTex([
|
|
91
|
+
[
|
|
92
|
+
`${vec1.toTex()} \\cdot ${vec2.toTex()}`,
|
|
93
|
+
"=",
|
|
94
|
+
`${isVec1OnAxis
|
|
95
|
+
? `${vecOnAxis.toTex()} \\cdot ${vecOtherProj.toTex()}`
|
|
96
|
+
: `${vecOtherProj.toTex()} \\cdot ${vecOnAxis.toTex()}`}`,
|
|
97
|
+
],
|
|
98
|
+
["", "=", `${nodeAnswer.toTex({ forceNoSimplification: true })}`],
|
|
99
|
+
["", "=", `${getAnswer(identifiers)}`],
|
|
100
|
+
])}
|
|
101
|
+
|
|
102
|
+
`;
|
|
103
|
+
}
|
|
104
|
+
};
|
|
105
|
+
const getCorrectionGGBOptions = (identifiers) => {
|
|
106
|
+
const { isVec1OnAxis, isOnAxisX } = identifiers;
|
|
107
|
+
const [vec1, vec2] = getHydratedVecs(identifiers);
|
|
108
|
+
const [point1A, point1B, point2A, point2B] = getHydratedPoints(identifiers);
|
|
109
|
+
const [_, vecOther] = isVec1OnAxis ? [vec1, vec2] : [vec2, vec1];
|
|
110
|
+
const vecOtherProj = isOnAxisX
|
|
111
|
+
? new Vector("p", vecOther.x, (0).toTree())
|
|
112
|
+
: new Vector("p", (0).toTree(), vecOther.y);
|
|
113
|
+
const pointPA = isVec1OnAxis ? point2A : point1A;
|
|
114
|
+
const pointPB = vecOtherProj.getEndPoint(pointPA);
|
|
115
|
+
const nodeAnswer = getAnswerNode(identifiers);
|
|
116
|
+
const isScalarProductZero = nodeAnswer.evaluate() === 0;
|
|
117
|
+
const ggb = new GeogebraConstructor({
|
|
118
|
+
commands: [
|
|
119
|
+
`v1 = Vector(${point1A.toMathString()},${point1B.toMathString()})`,
|
|
120
|
+
`SetColor(v1, "${blueMain}")`,
|
|
121
|
+
`SetCaption(v1, "$${vec1.toTex()}$")`,
|
|
122
|
+
`ShowLabel(v1, true)`,
|
|
123
|
+
`v2 = Vector(${point2A.toMathString()},${point2B.toMathString()})`,
|
|
124
|
+
`SetColor(v2, "${orange}")`,
|
|
125
|
+
`SetCaption(v2, "$${vec2.toTex()}$")`,
|
|
126
|
+
`ShowLabel(v2, true)`,
|
|
127
|
+
...(isScalarProductZero
|
|
128
|
+
? []
|
|
129
|
+
: [
|
|
130
|
+
`vP = Vector(${pointPA.toMathString()},${pointPB.toMathString()})`,
|
|
131
|
+
`SetColor(vP, "${greenMain}")`,
|
|
132
|
+
`SetCaption(vP, "$${vecOtherProj.toTex()}$")`,
|
|
133
|
+
`ShowLabel(vP, true)`,
|
|
134
|
+
]),
|
|
135
|
+
],
|
|
136
|
+
hideAxes: true,
|
|
137
|
+
});
|
|
138
|
+
return ggb.getOptions({
|
|
139
|
+
coords: ggb.getCoordsForPoints([point1A, point1B, point2A, point2B]),
|
|
140
|
+
});
|
|
141
|
+
};
|
|
142
|
+
const getGGBOptions = (identifiers) => {
|
|
143
|
+
const [vec1, vec2] = getHydratedVecs(identifiers);
|
|
144
|
+
const [point1A, point1B, point2A, point2B] = getHydratedPoints(identifiers);
|
|
145
|
+
const ggb = new GeogebraConstructor({
|
|
146
|
+
commands: [
|
|
147
|
+
`v1 = Vector(${point1A.toMathString()},${point1B.toMathString()})`,
|
|
148
|
+
`SetColor(v1, "${blueMain}")`,
|
|
149
|
+
`SetCaption(v1, "$${vec1.toTex()}$")`,
|
|
150
|
+
`ShowLabel(v1, true)`,
|
|
151
|
+
`v2 = Vector(${point2A.toMathString()},${point2B.toMathString()})`,
|
|
152
|
+
`SetColor(v2, "${orange}")`,
|
|
153
|
+
`SetCaption(v2, "$${vec2.toTex()}$")`,
|
|
154
|
+
`ShowLabel(v2, true)`,
|
|
155
|
+
],
|
|
156
|
+
hideAxes: true,
|
|
157
|
+
});
|
|
158
|
+
return ggb.getOptions({
|
|
159
|
+
coords: ggb.getCoordsForPoints([point1A, point1B, point2A, point2B]),
|
|
160
|
+
});
|
|
161
|
+
};
|
|
162
|
+
const getPropositions = (n, { answer, ...identifiers }) => {
|
|
163
|
+
const propositions = [];
|
|
164
|
+
addValidProp(propositions, answer);
|
|
165
|
+
const [vec1, vec2] = getHydratedVecs(identifiers);
|
|
166
|
+
const arrCoord1Coord2 = getCartesiansProducts([
|
|
167
|
+
[vec1.x, vec1.y],
|
|
168
|
+
[vec2.x, vec2.y],
|
|
169
|
+
]);
|
|
170
|
+
//v1.[x or y] \\times v2.[x or y]
|
|
171
|
+
{
|
|
172
|
+
const arrNodeWrong = arrCoord1Coord2.map(([node1, node2]) => multiply(node1, node2).simplify());
|
|
173
|
+
arrNodeWrong.forEach((node) => {
|
|
174
|
+
tryToAddWrongProp(propositions, node.toTex());
|
|
175
|
+
});
|
|
176
|
+
}
|
|
177
|
+
//v1.[x or y] + v2.[x or y]
|
|
178
|
+
{
|
|
179
|
+
const arrNodeWrong = arrCoord1Coord2.map(([node1, node2]) => add(node1, node2).simplify());
|
|
180
|
+
arrNodeWrong.forEach((node) => {
|
|
181
|
+
tryToAddWrongProp(propositions, node.toTex());
|
|
182
|
+
});
|
|
183
|
+
}
|
|
184
|
+
//filler
|
|
185
|
+
{
|
|
186
|
+
if (propositions.length < n) {
|
|
187
|
+
const coordPool = [...Array(7).keys()].map((i) => i - 3);
|
|
188
|
+
const arrCoord1Coord2 = getCartesiansProducts([coordPool, coordPool]);
|
|
189
|
+
const arrNodeWrong = arrCoord1Coord2.map(([node1, node2]) => multiply(node1, node2).simplify());
|
|
190
|
+
arrNodeWrong.forEach((node) => {
|
|
191
|
+
tryToAddWrongProp(propositions, node.toTex());
|
|
192
|
+
});
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
return shuffleProps(propositions, n);
|
|
196
|
+
};
|
|
197
|
+
const getKeys = () => {
|
|
198
|
+
return [];
|
|
199
|
+
};
|
|
200
|
+
const isAnswerValid = (ans, { answer }) => {
|
|
201
|
+
try {
|
|
202
|
+
return rationalVEA(ans, answer);
|
|
203
|
+
}
|
|
204
|
+
catch (err) {
|
|
205
|
+
return handleVEAError(err);
|
|
206
|
+
}
|
|
207
|
+
};
|
|
208
|
+
const getScalarProductOfVectsOnGrid1Question = (optsIn) => {
|
|
209
|
+
const opts = optsIn ?? optsDefault;
|
|
210
|
+
const { isSameStartPoint } = opts;
|
|
211
|
+
function createRandomIdentifiers() {
|
|
212
|
+
const isOnAxisX = coinFlip();
|
|
213
|
+
const vAxis = new Vector("vAxis", (!isOnAxisX ? 0 : randint(-3, 4, [0])).toTree(), (isOnAxisX ? 0 : randint(-3, 4, [0])).toTree());
|
|
214
|
+
const vOther = new Vector("vOther", randint(-3, 4, [vAxis.x.evaluate()]).toTree(), randint(-3, 4, [vAxis.y.evaluate()]).toTree());
|
|
215
|
+
const nameVPool = coinFlip() ? ["v_1", "v_2"] : ["u", "v", "w"];
|
|
216
|
+
const [strNameV1, strNameV2] = randomMany(nameVPool, 2);
|
|
217
|
+
const isVec1OnAxis = coinFlip();
|
|
218
|
+
const [vec1, vec2] = isVec1OnAxis
|
|
219
|
+
? [
|
|
220
|
+
new Vector(strNameV1, vAxis.x, vAxis.y),
|
|
221
|
+
new Vector(strNameV2, vOther.x, vOther.y),
|
|
222
|
+
]
|
|
223
|
+
: [
|
|
224
|
+
new Vector(strNameV1, vOther.x, vOther.y),
|
|
225
|
+
new Vector(strNameV2, vAxis.x, vAxis.y),
|
|
226
|
+
];
|
|
227
|
+
const point1A = new Point("P1", randint(0, 3), randint(0, 3));
|
|
228
|
+
const point2A = isSameStartPoint
|
|
229
|
+
? point1A
|
|
230
|
+
: new Point("P2", randint(0, 3), randint(0, 3));
|
|
231
|
+
return {
|
|
232
|
+
vecIds1: vec1.toIdentifiers(),
|
|
233
|
+
vecIds2: vec2.toIdentifiers(),
|
|
234
|
+
pointIds1A: point1A.toIdentifiers(),
|
|
235
|
+
pointIds2A: point2A.toIdentifiers(),
|
|
236
|
+
isVec1OnAxis,
|
|
237
|
+
isOnAxisX,
|
|
238
|
+
};
|
|
239
|
+
}
|
|
240
|
+
function isValidIdentifiers(identifiersCandidate) {
|
|
241
|
+
// const [vec1, vec2] = getHydratedVecs(identifiers);
|
|
242
|
+
const [point1A, point1B, point2A, point2B] = getHydratedPoints(identifiersCandidate);
|
|
243
|
+
function getCoordsFrame(arrPoint) {
|
|
244
|
+
const arrX = arrPoint.map((point) => point.x.evaluate());
|
|
245
|
+
const xMax = Math.max(...arrX);
|
|
246
|
+
const xMin = Math.min(...arrX);
|
|
247
|
+
const arrY = arrPoint.map((point) => point.x.evaluate());
|
|
248
|
+
const yMax = Math.max(...arrY);
|
|
249
|
+
const yMin = Math.min(...arrY);
|
|
250
|
+
return [xMin, xMax, yMin, yMax];
|
|
251
|
+
}
|
|
252
|
+
function isInSmallCoordsFrame(points) {
|
|
253
|
+
const [xMin, xMax, yMin, yMax] = getCoordsFrame(points);
|
|
254
|
+
const dx = xMax - xMin;
|
|
255
|
+
const dy = yMax - yMin;
|
|
256
|
+
const isValidXWise = 4 <= dx && dx <= 7;
|
|
257
|
+
const isValidYWise = 3 <= dy && dy <= 7;
|
|
258
|
+
return isValidXWise && isValidYWise;
|
|
259
|
+
}
|
|
260
|
+
const isValidFrameWise = () => isInSmallCoordsFrame([point1A, point1B, point2A, point2B]);
|
|
261
|
+
const isValidPointWise = () => {
|
|
262
|
+
if (!isSameStartPoint) {
|
|
263
|
+
return !(point1A.x.evaluate() === point2A.x.evaluate() &&
|
|
264
|
+
point1A.y.evaluate() === point2A.y.evaluate());
|
|
265
|
+
}
|
|
266
|
+
else {
|
|
267
|
+
return true;
|
|
268
|
+
}
|
|
269
|
+
};
|
|
270
|
+
return isValidPointWise() && isValidFrameWise();
|
|
271
|
+
}
|
|
272
|
+
let identifiers;
|
|
273
|
+
let counter = -1;
|
|
274
|
+
let isValid = false;
|
|
275
|
+
while (!isValid && counter < 100) {
|
|
276
|
+
counter++;
|
|
277
|
+
const identifiersCandidate = createRandomIdentifiers();
|
|
278
|
+
isValid = isValidIdentifiers(identifiersCandidate);
|
|
279
|
+
if (isValid) {
|
|
280
|
+
identifiers = identifiersCandidate;
|
|
281
|
+
}
|
|
282
|
+
}
|
|
283
|
+
if (!isValid) {
|
|
284
|
+
const pointIds1A = new Point("P1A", 0, 0).toIdentifiers();
|
|
285
|
+
const identifiersDefault = {
|
|
286
|
+
vecIds1: new Vector("v_1", (1).toTree(), (0).toTree()).toIdentifiers(),
|
|
287
|
+
vecIds2: new Vector("v_2", (2).toTree(), (3).toTree()).toIdentifiers(),
|
|
288
|
+
pointIds1A: pointIds1A,
|
|
289
|
+
pointIds2A: isSameStartPoint
|
|
290
|
+
? pointIds1A
|
|
291
|
+
: new Point("P2A", 1, -2).toIdentifiers(),
|
|
292
|
+
isVec1OnAxis: true,
|
|
293
|
+
isOnAxisX: true,
|
|
294
|
+
};
|
|
295
|
+
identifiers = identifiersDefault;
|
|
296
|
+
}
|
|
297
|
+
return getQuestionFromIdentifiers(identifiers, opts);
|
|
298
|
+
};
|
|
299
|
+
const getQuestionFromIdentifiers = (identifiers, opts) => {
|
|
300
|
+
const question = {
|
|
301
|
+
answer: getAnswer(identifiers, opts),
|
|
302
|
+
instruction: getInstruction(identifiers, opts),
|
|
303
|
+
keys: getKeys(identifiers, opts),
|
|
304
|
+
answerFormat: "tex",
|
|
305
|
+
identifiers,
|
|
306
|
+
hint: getHint(identifiers, opts),
|
|
307
|
+
correction: getCorrection(identifiers, opts),
|
|
308
|
+
ggbOptions: getGGBOptions(identifiers, opts),
|
|
309
|
+
correctionGgbOptions: getCorrectionGGBOptions(identifiers, opts),
|
|
310
|
+
options: opts,
|
|
311
|
+
};
|
|
312
|
+
return question;
|
|
313
|
+
};
|
|
314
|
+
const optsDefault = {
|
|
315
|
+
isSameStartPoint: false,
|
|
316
|
+
};
|
|
317
|
+
const options = [
|
|
318
|
+
{
|
|
319
|
+
id: "isSameStartPoint",
|
|
320
|
+
label: "Rapports positifs uniquement",
|
|
321
|
+
type: GeneratorOptionType.checkbox,
|
|
322
|
+
target: GeneratorOptionTarget.generation,
|
|
323
|
+
defaultValue: optsDefault.isSameStartPoint,
|
|
324
|
+
},
|
|
325
|
+
];
|
|
326
|
+
export const scalarProductOfVectsOnGrid1 = {
|
|
327
|
+
id: "scalarProductOfVectsOnGrid1",
|
|
328
|
+
connector: "=",
|
|
329
|
+
label: "Produit scalaire de deux vecteurs sur un quadrillage ($1$)",
|
|
330
|
+
isSingleStep: true,
|
|
331
|
+
generator: (nb, opts) => getDistinctQuestions(() => getScalarProductOfVectsOnGrid1Question(opts), nb),
|
|
332
|
+
options,
|
|
333
|
+
qcmTimer: 60,
|
|
334
|
+
freeTimer: 60,
|
|
335
|
+
ggbTimer: 60,
|
|
336
|
+
getPropositions,
|
|
337
|
+
isAnswerValid,
|
|
338
|
+
subject: "Mathématiques",
|
|
339
|
+
getAnswer,
|
|
340
|
+
getGGBOptions,
|
|
341
|
+
getInstruction,
|
|
342
|
+
hasGeogebra: true,
|
|
343
|
+
getQuestionFromIdentifiers,
|
|
344
|
+
getHint,
|
|
345
|
+
getCorrection,
|
|
346
|
+
hasHintAndCorrection: true,
|
|
347
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { Exercise } from "../../../../../exercises/exercise.js";
|
|
2
|
+
import { PointIdentifiers } from "../../../../../math/geometry/point.js";
|
|
3
|
+
type Identifiers = {
|
|
4
|
+
pointIds: PointIdentifiers[];
|
|
5
|
+
};
|
|
6
|
+
export declare const scalarProductParallelogramDiagonalPlus: Exercise<Identifiers>;
|
|
7
|
+
export {};
|
|
8
|
+
//# sourceMappingURL=scalarProductParallelogramDiagonalPlus.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"scalarProductParallelogramDiagonalPlus.d.ts","sourceRoot":"","sources":["../../../../../../src/exercises/math/geometry/vectors/scalarProduct/scalarProductParallelogramDiagonalPlus.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAgBT,MAAM,6BAA6B,CAAC;AAIrC,OAAO,EAGL,gBAAgB,EACjB,MAAM,8BAA8B,CAAC;AAkBtC,KAAK,WAAW,GAAG;IACjB,QAAQ,EAAE,gBAAgB,EAAE,CAAC;CAC9B,CAAC;AA2UF,eAAO,MAAM,sCAAsC,EAAE,QAAQ,CAAC,WAAW,CAuBxE,CAAC"}
|
package/lib/exercises/math/geometry/vectors/scalarProduct/scalarProductParallelogramDiagonalPlus.js
ADDED
|
@@ -0,0 +1,301 @@
|
|
|
1
|
+
import { addValidProp, shuffleProps, tryToAddWrongProp, propWhile, } from "../../../../../exercises/exercise.js";
|
|
2
|
+
import { getDistinctQuestions } from "../../../../../exercises/utils/getDistinctQuestions.js";
|
|
3
|
+
import { blueMain, greenMain, purpleMain, red } from "../../../../../geogebra/colors.js";
|
|
4
|
+
import { GeogebraConstructor } from "../../../../../geogebra/geogebraConstructor.js";
|
|
5
|
+
import { Point, PointConstructor, } from "../../../../../math/geometry/point.js";
|
|
6
|
+
import { VectorConstructor } from "../../../../../math/geometry/vector.js";
|
|
7
|
+
import { randfloat } from "../../../../../math/utils/random/randfloat.js";
|
|
8
|
+
import { round } from "../../../../../math/utils/round.js";
|
|
9
|
+
import { sqrt } from "../../../../../tree/nodes/functions/sqrtNode.js";
|
|
10
|
+
import { add } from "../../../../../tree/nodes/operators/addNode.js";
|
|
11
|
+
import { multiply } from "../../../../../tree/nodes/operators/multiplyNode.js";
|
|
12
|
+
import { power } from "../../../../../tree/nodes/operators/powerNode.js";
|
|
13
|
+
import { substract } from "../../../../../tree/nodes/operators/substractNode.js";
|
|
14
|
+
import { parseAlgebraic } from "../../../../../tree/parsers/latexParser.js";
|
|
15
|
+
import { probaFlip } from "../../../../../utils/alea/probaFlip.js";
|
|
16
|
+
import { random } from "../../../../../utils/alea/random.js";
|
|
17
|
+
import { zip } from "../../../../../utils/arrays/arrayZip.js";
|
|
18
|
+
import { handleVEAError } from "../../../../../utils/errors/handleVEAError.js";
|
|
19
|
+
import { alignTex } from "../../../../../utils/latex/alignTex.js";
|
|
20
|
+
const precision = 2;
|
|
21
|
+
const getHydrated = (identifiers) => {
|
|
22
|
+
const { pointIds } = identifiers;
|
|
23
|
+
const [A, B, C, D] = pointIds.map((pointIds) => PointConstructor.fromIdentifiers(pointIds));
|
|
24
|
+
const AB = round(A.distanceTo(B), precision);
|
|
25
|
+
const AD = round(A.distanceTo(D), precision);
|
|
26
|
+
const BD = round(B.distanceTo(D), precision);
|
|
27
|
+
return {
|
|
28
|
+
points: [A, B, C, D],
|
|
29
|
+
AB,
|
|
30
|
+
AD,
|
|
31
|
+
BD,
|
|
32
|
+
};
|
|
33
|
+
};
|
|
34
|
+
const getInstruction = (identifiers) => {
|
|
35
|
+
const { AB, AD, BD } = getHydrated(identifiers);
|
|
36
|
+
return `Soit $ABCD$ un parallélogramme dont on connaît les longueurs suivantes :
|
|
37
|
+
|
|
38
|
+
${zip(["AB", "AD", "BD"], [AB, AD, BD]).map(([name, valueLength]) => `- $${name} = ${valueLength.frenchify()}$`).join(`
|
|
39
|
+
|
|
40
|
+
`)}
|
|
41
|
+
|
|
42
|
+
Combien le segment $AC$ mesure-t-il ?
|
|
43
|
+
Donner une valeur approchée en degrés avec $${precision}$ décimales.`;
|
|
44
|
+
};
|
|
45
|
+
const getAnswerStuff = (identifiers) => {
|
|
46
|
+
const { AB, AD, BD } = getHydrated(identifiers);
|
|
47
|
+
const nodeACSquared = substract(multiply(2, add(power(AB, 2), power(AD, 2))), power(BD, 2));
|
|
48
|
+
const nodeAC = sqrt(nodeACSquared);
|
|
49
|
+
return {
|
|
50
|
+
nodeAC,
|
|
51
|
+
};
|
|
52
|
+
};
|
|
53
|
+
const getAnswerNode = (identifiers) => {
|
|
54
|
+
return getAnswerStuff(identifiers).nodeAC;
|
|
55
|
+
};
|
|
56
|
+
const getAnswer = (identifiers) => {
|
|
57
|
+
return round(getAnswerNode(identifiers).evaluate(), precision).frenchify();
|
|
58
|
+
};
|
|
59
|
+
const getHint = () => {
|
|
60
|
+
const [u, v] = ["AB", "AD"].map((name) => `\\overrightarrow{${name}}`);
|
|
61
|
+
return `Utilise les égalités suivantes :
|
|
62
|
+
|
|
63
|
+
$$
|
|
64
|
+
AC^2 = {\\lVert ${u} + ${v} \\rVert}^2
|
|
65
|
+
$$
|
|
66
|
+
|
|
67
|
+
$$
|
|
68
|
+
DB^2 = {\\lVert ${u} - ${v} \\rVert}^2
|
|
69
|
+
$$
|
|
70
|
+
|
|
71
|
+
`;
|
|
72
|
+
};
|
|
73
|
+
const getCorrection = (identifiers) => {
|
|
74
|
+
const [u, v, uPlusV, uMinusV] = ["AB", "AD", "AC", "DB"].map((name) => `\\overrightarrow{${name}}`);
|
|
75
|
+
return `$ABCD$ est un parallélogramme. Par conséquent :
|
|
76
|
+
|
|
77
|
+
- $${uPlusV} = ${u} + ${v}$
|
|
78
|
+
|
|
79
|
+
- $${uMinusV} = ${u} - ${v}$
|
|
80
|
+
|
|
81
|
+
Ainsi :
|
|
82
|
+
|
|
83
|
+
${alignTex([
|
|
84
|
+
["{AC}^2", "=", `{\\lVert ${u} + ${v} \\rVert}^2`],
|
|
85
|
+
[
|
|
86
|
+
"",
|
|
87
|
+
"=",
|
|
88
|
+
`{\\lVert ${u} \\rVert}^2 + {\\lVert ${v} \\rVert}^2 + 2 ${u} \\cdot ${v}`,
|
|
89
|
+
],
|
|
90
|
+
])}
|
|
91
|
+
|
|
92
|
+
${alignTex([
|
|
93
|
+
["{DB}^2", "=", `{\\lVert ${u} - ${v} \\rVert}^2`],
|
|
94
|
+
[
|
|
95
|
+
"",
|
|
96
|
+
"=",
|
|
97
|
+
`{\\lVert ${u} \\rVert}^2 + {\\lVert ${v} \\rVert}^2 - 2 ${u} \\cdot ${v}`,
|
|
98
|
+
],
|
|
99
|
+
])}
|
|
100
|
+
|
|
101
|
+
On additionne :
|
|
102
|
+
|
|
103
|
+
$$
|
|
104
|
+
{AC}^2 + {DB}^2 = 2 \\left( {AB}^2 + {AD}^2 \\right)
|
|
105
|
+
$$
|
|
106
|
+
|
|
107
|
+
Donc :
|
|
108
|
+
|
|
109
|
+
$$
|
|
110
|
+
AC = \\sqrt{ 2 \\left( {AB}^2 + {AD}^2 \\right) - {DB}^2 }
|
|
111
|
+
$$
|
|
112
|
+
|
|
113
|
+
On arrondit à la toute fin :
|
|
114
|
+
|
|
115
|
+
$$
|
|
116
|
+
AC \\approx ${getAnswer(identifiers)}
|
|
117
|
+
$$
|
|
118
|
+
|
|
119
|
+
`;
|
|
120
|
+
};
|
|
121
|
+
const getCorrectionGGBOptions = (identifiers) => {
|
|
122
|
+
const { points } = getHydrated(identifiers);
|
|
123
|
+
const [u, v] = ["u", "v"].map((name) => `\\overrightarrow{${name}}`);
|
|
124
|
+
const ggb = new GeogebraConstructor({
|
|
125
|
+
commands: [
|
|
126
|
+
//points
|
|
127
|
+
...points.flatMap((point) => point.toGGBCommand()),
|
|
128
|
+
//u
|
|
129
|
+
`u = Vector(A,B)`,
|
|
130
|
+
`SetColor(u, "${blueMain}")`,
|
|
131
|
+
`SetCaption(u, "$\\small ${u}$")`,
|
|
132
|
+
`ShowLabel(u, true)`,
|
|
133
|
+
//v
|
|
134
|
+
`v = Vector(A,D)`,
|
|
135
|
+
`SetColor(v, "${red}")`,
|
|
136
|
+
`SetCaption(v, "$\\small ${v}$")`,
|
|
137
|
+
`ShowLabel(v, true)`,
|
|
138
|
+
//u - v
|
|
139
|
+
`uMinusV = Vector(D,B)`,
|
|
140
|
+
`SetColor(uMinusV, "${purpleMain}")`,
|
|
141
|
+
// `SetCaption(uMinusV, "$\\small ${u} - ${v}$")`,
|
|
142
|
+
// `ShowLabel(uMinusV, true)`,
|
|
143
|
+
//u + v
|
|
144
|
+
`uPlusV = Vector(A,C)`,
|
|
145
|
+
`SetColor(uPlusV, "${greenMain}")`,
|
|
146
|
+
`SetCaption(uPlusV, "$\\small ${u} + ${v}$")`,
|
|
147
|
+
`ShowLabel(uPlusV, true)`,
|
|
148
|
+
],
|
|
149
|
+
hideAxes: true,
|
|
150
|
+
});
|
|
151
|
+
return ggb.getOptions({
|
|
152
|
+
coords: ggb.getCoordsForPoints(points),
|
|
153
|
+
});
|
|
154
|
+
};
|
|
155
|
+
const getGGBOptions = (identifiers) => {
|
|
156
|
+
const { points } = getHydrated(identifiers);
|
|
157
|
+
const ggb = new GeogebraConstructor({
|
|
158
|
+
commands: [
|
|
159
|
+
//points
|
|
160
|
+
...points.flatMap((point) => point.toGGBCommand()),
|
|
161
|
+
//parallelogram ABCD
|
|
162
|
+
`Pol = Polygon(${points.map((point) => point.name).join(",")})`,
|
|
163
|
+
//segment BD
|
|
164
|
+
`segBD = Segment(B,D)`,
|
|
165
|
+
`SetLineStyle(segBD, 2)`,
|
|
166
|
+
],
|
|
167
|
+
hideAxes: true,
|
|
168
|
+
});
|
|
169
|
+
return ggb.getOptions({
|
|
170
|
+
coords: ggb.getCoordsForPoints(points),
|
|
171
|
+
});
|
|
172
|
+
};
|
|
173
|
+
const getPropositions = (n, { answer, ...identifiers }) => {
|
|
174
|
+
const propositions = [];
|
|
175
|
+
addValidProp(propositions, answer);
|
|
176
|
+
const { AB, AD, BD } = getHydrated(identifiers);
|
|
177
|
+
const arrValueWrong = [];
|
|
178
|
+
//student: forgets to sqrt
|
|
179
|
+
if (probaFlip(0.1)) {
|
|
180
|
+
const nodeACSquared = substract(multiply(2, add(power(AB, 2), power(AD, 2))), power(BD, 2));
|
|
181
|
+
const vWrong = nodeACSquared.evaluate();
|
|
182
|
+
arrValueWrong.push(vWrong);
|
|
183
|
+
tryToAddWrongProp(propositions, round(vWrong, precision).frenchify());
|
|
184
|
+
}
|
|
185
|
+
//student: wrong formula: wrong factor
|
|
186
|
+
{
|
|
187
|
+
const nodeACSquared = substract(multiply(1, add(power(AB, 2), power(AD, 2))), power(BD, 2));
|
|
188
|
+
if (nodeACSquared.evaluate() >= 0) {
|
|
189
|
+
const nodeWrong = sqrt(nodeACSquared);
|
|
190
|
+
const vWrong = nodeWrong.evaluate();
|
|
191
|
+
arrValueWrong.push(vWrong);
|
|
192
|
+
tryToAddWrongProp(propositions, round(vWrong, precision).frenchify());
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
//student: wrong formula: add instead of sub
|
|
196
|
+
{
|
|
197
|
+
const nodeACSquared = add(multiply(2, add(power(AB, 2), power(AD, 2))), power(BD, 2));
|
|
198
|
+
const nodeWrong = sqrt(nodeACSquared);
|
|
199
|
+
const vWrong = nodeWrong.evaluate();
|
|
200
|
+
arrValueWrong.push(vWrong);
|
|
201
|
+
tryToAddWrongProp(propositions, round(vWrong, precision).frenchify());
|
|
202
|
+
}
|
|
203
|
+
//student: pythagore in ABC
|
|
204
|
+
{
|
|
205
|
+
const nodeWrong = sqrt(add(power(AB, 2), power(AD, 2)));
|
|
206
|
+
const vWrong = nodeWrong.evaluate();
|
|
207
|
+
arrValueWrong.push(vWrong);
|
|
208
|
+
tryToAddWrongProp(propositions, round(vWrong, precision).frenchify());
|
|
209
|
+
}
|
|
210
|
+
//student: scalar AB+AD instead of ||vecAB + vecAD||
|
|
211
|
+
{
|
|
212
|
+
const nodeWrong = add(AB, AD);
|
|
213
|
+
const vWrong = nodeWrong.evaluate();
|
|
214
|
+
arrValueWrong.push(vWrong);
|
|
215
|
+
tryToAddWrongProp(propositions, round(vWrong, precision).frenchify());
|
|
216
|
+
}
|
|
217
|
+
//terror: around answer, _most of the time_
|
|
218
|
+
{
|
|
219
|
+
const value = (() => {
|
|
220
|
+
const vAnswer = getAnswerNode(identifiers).evaluate();
|
|
221
|
+
if (probaFlip(0.6)) {
|
|
222
|
+
return vAnswer;
|
|
223
|
+
}
|
|
224
|
+
else {
|
|
225
|
+
return random([...arrValueWrong, vAnswer]);
|
|
226
|
+
}
|
|
227
|
+
})();
|
|
228
|
+
[...Array(2).keys()].forEach(() => {
|
|
229
|
+
const valueAnswerOffsetted = value + randfloat(-1.6, 1.6, 2, [0]);
|
|
230
|
+
if (valueAnswerOffsetted > 0) {
|
|
231
|
+
tryToAddWrongProp(propositions, round(valueAnswerOffsetted, precision).frenchify());
|
|
232
|
+
}
|
|
233
|
+
});
|
|
234
|
+
}
|
|
235
|
+
propWhile(propositions, n, () => {
|
|
236
|
+
tryToAddWrongProp(propositions, randfloat(7, 30, 2).frenchify());
|
|
237
|
+
});
|
|
238
|
+
return shuffleProps(propositions, n);
|
|
239
|
+
};
|
|
240
|
+
const getKeys = () => {
|
|
241
|
+
return [];
|
|
242
|
+
};
|
|
243
|
+
const isAnswerValid = (ans, { answer }) => {
|
|
244
|
+
try {
|
|
245
|
+
const parsed = parseAlgebraic(ans);
|
|
246
|
+
return parsed.simplify().toTex() === answer;
|
|
247
|
+
}
|
|
248
|
+
catch (err) {
|
|
249
|
+
return handleVEAError(err);
|
|
250
|
+
}
|
|
251
|
+
};
|
|
252
|
+
const getScalarProductParallelogramDiagonalPlusQuestion = () => {
|
|
253
|
+
// B C
|
|
254
|
+
// A D
|
|
255
|
+
const [xA, yA] = [randfloat(0, 10, 2), randfloat(0, 10, 2)];
|
|
256
|
+
const [xB, yB] = [randfloat(0, 10, 2, [xA]), randfloat(14, 24, 2)];
|
|
257
|
+
const [xC, yC] = [randfloat(14, 24, 2), randfloat(14, 24, 2)];
|
|
258
|
+
const [A, B, C] = zip(["A", "B", "C"], [
|
|
259
|
+
[xA, yA],
|
|
260
|
+
[xB, yB],
|
|
261
|
+
[xC, yC],
|
|
262
|
+
]).map(([pointName, [x, y]]) => new Point(pointName, x, y));
|
|
263
|
+
const vecBC = VectorConstructor.fromPoints(B, C);
|
|
264
|
+
const D = vecBC.getEndPoint(A, "D");
|
|
265
|
+
const identifiers = {
|
|
266
|
+
pointIds: [A, B, C, D].map((point) => point.toIdentifiers()),
|
|
267
|
+
};
|
|
268
|
+
return getQuestionFromIdentifiers(identifiers);
|
|
269
|
+
};
|
|
270
|
+
const getQuestionFromIdentifiers = (identifiers, opts) => {
|
|
271
|
+
return {
|
|
272
|
+
answer: getAnswer(identifiers, opts),
|
|
273
|
+
instruction: getInstruction(identifiers, opts),
|
|
274
|
+
keys: getKeys(identifiers, opts),
|
|
275
|
+
answerFormat: "tex",
|
|
276
|
+
identifiers,
|
|
277
|
+
hint: getHint(identifiers, opts),
|
|
278
|
+
correction: getCorrection(identifiers, opts),
|
|
279
|
+
correctionGgbOptions: getCorrectionGGBOptions(identifiers, opts),
|
|
280
|
+
ggbOptions: getGGBOptions(identifiers, opts),
|
|
281
|
+
};
|
|
282
|
+
};
|
|
283
|
+
export const scalarProductParallelogramDiagonalPlus = {
|
|
284
|
+
id: "scalarProductParallelogramDiagonalPlus",
|
|
285
|
+
connector: "=",
|
|
286
|
+
label: "$ABCD$ étant un parallélogramme avec $AB$, $AD$ et $BD$ donnés, calculer $AC$",
|
|
287
|
+
isSingleStep: true,
|
|
288
|
+
generator: (nb, opts) => getDistinctQuestions(() => getScalarProductParallelogramDiagonalPlusQuestion(opts), nb),
|
|
289
|
+
qcmTimer: 60,
|
|
290
|
+
freeTimer: 60,
|
|
291
|
+
getPropositions,
|
|
292
|
+
isAnswerValid,
|
|
293
|
+
subject: "Mathématiques",
|
|
294
|
+
getInstruction,
|
|
295
|
+
getHint,
|
|
296
|
+
getCorrection,
|
|
297
|
+
hasHintAndCorrection: true,
|
|
298
|
+
getAnswer,
|
|
299
|
+
getQuestionFromIdentifiers,
|
|
300
|
+
hasGeogebra: true,
|
|
301
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Exercise } from "../../../../exercises/exercise.js";
|
|
2
|
+
import { NodeIdentifiers } from "../../../../tree/nodes/nodeConstructor.js";
|
|
3
|
+
type Identifiers = {
|
|
4
|
+
valuesIds: NodeIdentifiers[];
|
|
5
|
+
probasIds: NodeIdentifiers[];
|
|
6
|
+
};
|
|
7
|
+
export declare const findValueForFairRandomVariable: Exercise<Identifiers>;
|
|
8
|
+
export {};
|
|
9
|
+
//# sourceMappingURL=findValueForFairRandomVariable.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"findValueForFairRandomVariable.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/probaStat/randomVariable/findValueForFairRandomVariable.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAcT,MAAM,6BAA6B,CAAC;AAOrC,OAAO,EACL,eAAe,EAEhB,MAAM,qCAAqC,CAAC;AAQ7C,KAAK,WAAW,GAAG;IACjB,SAAS,EAAE,eAAe,EAAE,CAAC;IAC7B,SAAS,EAAE,eAAe,EAAE,CAAC;CAC9B,CAAC;AA0HF,eAAO,MAAM,8BAA8B,EAAE,QAAQ,CAAC,WAAW,CAmBhE,CAAC"}
|