math-exercises 3.0.171 → 3.0.172
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/exercises/math/derivation/variations/signVarTable3dDegree.js +38 -10
- package/lib/exercises/math/derivation/variations/signVarTableFromDerivativeGraph.d.ts.map +1 -1
- package/lib/exercises/math/derivation/variations/signVarTableFromDerivativeGraph.js +7 -4
- package/lib/exercises/math/derivation/variations/signVarTableFromGraph.d.ts.map +1 -1
- package/lib/exercises/math/derivation/variations/signVarTableFromGraph.js +2 -3
- package/lib/exercises/math/functions/variations/partialVarTableFromGraph.d.ts.map +1 -1
- package/lib/exercises/math/functions/variations/partialVarTableFromGraph.js +2 -1
- package/lib/exercises/math/functions/variations/varTableFromGraph.d.ts.map +1 -1
- package/lib/exercises/math/functions/variations/varTableFromGraph.js +2 -1
- package/lib/exercises/math/functions/variations/varTableFromSentences.d.ts.map +1 -1
- package/lib/exercises/math/functions/variations/varTableFromSentences.js +2 -1
- package/lib/exercises/math/geometry/circles/circleCenterAndRadiusFromEquation.d.ts.map +1 -1
- package/lib/exercises/math/geometry/circles/circleCenterAndRadiusFromEquation.js +0 -2
- package/lib/exercises/math/geometry/vectors/scalarProduct/alKashi/scalarProductAlKashiAngle.d.ts.map +1 -1
- package/lib/exercises/math/geometry/vectors/scalarProduct/alKashi/scalarProductAlKashiAngle.js +64 -60
- package/lib/exercises/math/geometry/vectors/scalarProduct/alKashi/scalarProductAlKashiBH.d.ts +1 -0
- package/lib/exercises/math/geometry/vectors/scalarProduct/alKashi/scalarProductAlKashiBH.d.ts.map +1 -1
- package/lib/exercises/math/geometry/vectors/scalarProduct/alKashi/scalarProductAlKashiBH.js +173 -47
- package/lib/exercises/math/geometry/vectors/scalarProduct/alKashi/scalarProductAlKashiSideLength.d.ts.map +1 -1
- package/lib/exercises/math/geometry/vectors/scalarProduct/alKashi/scalarProductAlKashiSideLength.js +112 -46
- package/lib/exercises/math/geometry/vectors/scalarProduct/alg/scalarProductInOrthonormalBasisIJ.d.ts.map +1 -1
- package/lib/exercises/math/geometry/vectors/scalarProduct/alg/scalarProductInOrthonormalBasisIJ.js +6 -0
- package/lib/exercises/math/geometry/vectors/scalarProduct/alg/scalarProductLamdbaULambdaV.d.ts.map +1 -1
- package/lib/exercises/math/geometry/vectors/scalarProduct/alg/scalarProductLamdbaULambdaV.js +60 -82
- package/lib/exercises/math/geometry/vectors/scalarProduct/angleFromScalarProduct.d.ts.map +1 -1
- package/lib/exercises/math/geometry/vectors/scalarProduct/angleFromScalarProduct.js +92 -6
- package/lib/exercises/math/geometry/vectors/scalarProduct/index.d.ts +6 -1
- package/lib/exercises/math/geometry/vectors/scalarProduct/index.d.ts.map +1 -1
- package/lib/exercises/math/geometry/vectors/scalarProduct/index.js +6 -1
- package/lib/exercises/math/geometry/vectors/scalarProduct/orth/scalarProductIsOrthogonalVecsBasisIJ.d.ts.map +1 -1
- package/lib/exercises/math/geometry/vectors/scalarProduct/orth/scalarProductIsOrthogonalVecsBasisIJ.js +6 -0
- package/lib/exercises/math/geometry/vectors/scalarProduct/orth/scalarProductIsOrthogonalVecsUsingCoords.js +1 -1
- package/lib/exercises/math/geometry/vectors/scalarProduct/orth/scalarProductIsPointOnCircle.d.ts.map +1 -1
- package/lib/exercises/math/geometry/vectors/scalarProduct/orth/scalarProductIsPointOnCircle.js +15 -5
- package/lib/exercises/math/geometry/vectors/scalarProduct/orth/scalarProductIsPointOnPerpendicularBisector.d.ts.map +1 -1
- package/lib/exercises/math/geometry/vectors/scalarProduct/orth/scalarProductIsPointOnPerpendicularBisector.js +18 -14
- package/lib/exercises/math/geometry/vectors/scalarProduct/orth/scalarProductIsRightTriangleUsingPointCoords.d.ts.map +1 -1
- package/lib/exercises/math/geometry/vectors/scalarProduct/orth/scalarProductIsRightTriangleUsingPointCoords.js +15 -5
- package/lib/exercises/math/geometry/vectors/scalarProduct/scalarProductComputeBH.d.ts.map +1 -1
- package/lib/exercises/math/geometry/vectors/scalarProduct/scalarProductComputeBH.js +38 -4
- package/lib/exercises/math/geometry/vectors/scalarProduct/scalarProductOfVectsOnGrid1.d.ts.map +1 -1
- package/lib/exercises/math/geometry/vectors/scalarProduct/scalarProductOfVectsOnGrid1.js +77 -26
- package/lib/exercises/math/geometry/vectors/scalarProduct/scalarProductParallelogramDiagonalPlus.d.ts.map +1 -1
- package/lib/exercises/math/geometry/vectors/scalarProduct/scalarProductParallelogramDiagonalPlus.js +6 -7
- package/lib/exercises/math/probaStat/basicProbas/calculateProbaFromProbaLaw.js +1 -1
- package/lib/exercises/math/probaStat/probaFromTableWithContext.d.ts.map +1 -1
- package/lib/exercises/math/probaStat/probaFromTableWithContext.js +3 -16
- package/lib/exercises/math/probaStat/randomVariable/decideWhichGameIsLessRisky.d.ts +14 -0
- package/lib/exercises/math/probaStat/randomVariable/decideWhichGameIsLessRisky.d.ts.map +1 -0
- package/lib/exercises/math/probaStat/randomVariable/decideWhichGameIsLessRisky.js +167 -0
- package/lib/exercises/math/probaStat/randomVariable/findValueForFairRandomVariable.d.ts.map +1 -1
- package/lib/exercises/math/probaStat/randomVariable/findValueForFairRandomVariable.js +29 -56
- package/lib/exercises/math/probaStat/randomVariable/index.d.ts +7 -0
- package/lib/exercises/math/probaStat/randomVariable/index.d.ts.map +1 -1
- package/lib/exercises/math/probaStat/randomVariable/index.js +8 -0
- package/lib/exercises/math/probaStat/randomVariable/isTableProbabilityLaw.d.ts.map +1 -1
- package/lib/exercises/math/probaStat/randomVariable/isTableProbabilityLaw.js +6 -6
- package/lib/exercises/math/probaStat/randomVariable/randomVariableAverage.js +1 -1
- package/lib/exercises/math/probaStat/randomVariable/randomVariableFindMissingProbabilityInLaw.d.ts +9 -0
- package/lib/exercises/math/probaStat/randomVariable/randomVariableFindMissingProbabilityInLaw.d.ts.map +1 -0
- package/lib/exercises/math/probaStat/randomVariable/randomVariableFindMissingProbabilityInLaw.js +116 -0
- package/lib/exercises/math/probaStat/randomVariable/randomVariableSituationAverage.d.ts +11 -0
- package/lib/exercises/math/probaStat/randomVariable/randomVariableSituationAverage.d.ts.map +1 -0
- package/lib/exercises/math/probaStat/randomVariable/randomVariableSituationAverage.js +112 -0
- package/lib/exercises/math/probaStat/randomVariable/randomVariableSituationComputeProbability.d.ts +9 -0
- package/lib/exercises/math/probaStat/randomVariable/randomVariableSituationComputeProbability.d.ts.map +1 -0
- package/lib/exercises/math/probaStat/randomVariable/randomVariableSituationComputeProbability.js +176 -0
- package/lib/exercises/math/probaStat/randomVariable/randomVariableSituationIsGameFavorable.d.ts +8 -0
- package/lib/exercises/math/probaStat/randomVariable/randomVariableSituationIsGameFavorable.d.ts.map +1 -0
- package/lib/exercises/math/probaStat/randomVariable/randomVariableSituationIsGameFavorable.js +94 -0
- package/lib/exercises/math/probaStat/randomVariable/randomVariableSituationProbabilityLaw.d.ts +9 -0
- package/lib/exercises/math/probaStat/randomVariable/randomVariableSituationProbabilityLaw.d.ts.map +1 -0
- package/lib/exercises/math/probaStat/randomVariable/randomVariableSituationProbabilityLaw.js +162 -0
- package/lib/exercises/math/probaStat/randomVariable/randomVariableSituationStandardDeviation.d.ts +8 -0
- package/lib/exercises/math/probaStat/randomVariable/randomVariableSituationStandardDeviation.d.ts.map +1 -0
- package/lib/exercises/math/probaStat/randomVariable/randomVariableSituationStandardDeviation.js +133 -0
- package/lib/exercises/math/probaStat/randomVariable/randomVariableSituationValues.d.ts +8 -0
- package/lib/exercises/math/probaStat/randomVariable/randomVariableSituationValues.d.ts.map +1 -0
- package/lib/exercises/math/probaStat/randomVariable/randomVariableSituationValues.js +211 -0
- package/lib/exercises/math/probaStat/randomVariable/randomVariableSituationVariance.d.ts +8 -0
- package/lib/exercises/math/probaStat/randomVariable/randomVariableSituationVariance.d.ts.map +1 -0
- package/lib/exercises/math/probaStat/randomVariable/randomVariableSituationVariance.js +113 -0
- package/lib/exercises/math/probaStat/randomVariable/randomVariableStandardDeviation.js +1 -1
- package/lib/exercises/math/probaStat/randomVariable/randomVariableVariance.js +1 -1
- package/lib/exercises/math/probaStat/randomVariable/utils/buildVAOfGivenAverage.d.ts +31 -0
- package/lib/exercises/math/probaStat/randomVariable/utils/buildVAOfGivenAverage.d.ts.map +1 -0
- package/lib/exercises/math/probaStat/randomVariable/utils/buildVAOfGivenAverage.js +192 -0
- package/lib/exercises/math/probaStat/randomVariable/utils/randomVariableSituations.d.ts +40 -11
- package/lib/exercises/math/probaStat/randomVariable/utils/randomVariableSituations.d.ts.map +1 -1
- package/lib/exercises/math/probaStat/randomVariable/utils/randomVariableSituations.js +172 -30
- package/lib/exercises/math/probaStat/stats1var/medianWithList.d.ts.map +1 -1
- package/lib/exercises/math/probaStat/stats1var/medianWithList.js +16 -2
- package/lib/exercises/math/trigonometry/circle/placeAssociateAngleOnCircle.d.ts.map +1 -1
- package/lib/exercises/math/trigonometry/circle/placeAssociateAngleOnCircle.js +0 -2
- package/lib/exercises/vea/rationalVEA.d.ts.map +1 -1
- package/lib/exercises/vea/rationalVEA.js +7 -3
- package/lib/exercises/vea/varLineVEA.d.ts.map +1 -1
- package/lib/exercises/vea/varLineVEA.js +2 -1
- package/lib/exercises/vea/varSignTableVEA.d.ts +8 -0
- package/lib/exercises/vea/varSignTableVEA.d.ts.map +1 -1
- package/lib/exercises/vea/varSignTableVEA.js +8 -0
- package/lib/exercises/vea/xTableLineVEA.d.ts +1 -0
- package/lib/exercises/vea/xTableLineVEA.d.ts.map +1 -1
- package/lib/exercises/vea/xTableLineVEA.js +1 -0
- package/lib/index.d.ts +79 -3
- package/lib/index.d.ts.map +1 -1
- package/lib/latexTester.d.ts.map +1 -1
- package/lib/latexTester.js +3 -1
- package/lib/math/geometry/angle.d.ts +2 -0
- package/lib/math/geometry/angle.d.ts.map +1 -1
- package/lib/math/geometry/angle.js +17 -0
- package/lib/math/geometry/segment.js +1 -1
- package/lib/math/numbers/reals/real.d.ts.map +1 -1
- package/lib/math/numbers/reals/real.js +4 -0
- package/lib/math/probability/randomVariable.d.ts +2 -1
- package/lib/math/probability/randomVariable.d.ts.map +1 -1
- package/lib/math/probability/randomVariable.js +7 -1
- package/lib/math/utils/arithmetic/primeFactors.d.ts +1 -1
- package/lib/math/utils/arithmetic/primeFactors.d.ts.map +1 -1
- package/lib/math/utils/arithmetic/primeFactors.js +23 -9
- package/lib/tests/exosTest.d.ts.map +1 -1
- package/lib/tests/exosTest.js +2 -0
- package/lib/tests/pdfs/mdTableToLatexTabular.js +1 -1
- package/lib/tree/nodes/algebraicNode.d.ts +1 -0
- package/lib/tree/nodes/algebraicNode.d.ts.map +1 -1
- package/lib/tree/nodes/complex/complexNode.d.ts +1 -0
- package/lib/tree/nodes/complex/complexNode.d.ts.map +1 -1
- package/lib/tree/nodes/complex/complexNode.js +3 -0
- package/lib/tree/nodes/equations/equalNode.d.ts +1 -0
- package/lib/tree/nodes/equations/equalNode.d.ts.map +1 -1
- package/lib/tree/nodes/equations/equalNode.js +3 -0
- package/lib/tree/nodes/equations/equationSolutionNode.d.ts +1 -0
- package/lib/tree/nodes/equations/equationSolutionNode.d.ts.map +1 -1
- package/lib/tree/nodes/equations/equationSolutionNode.js +3 -0
- package/lib/tree/nodes/equations/multiEqualNode.d.ts +1 -0
- package/lib/tree/nodes/equations/multiEqualNode.d.ts.map +1 -1
- package/lib/tree/nodes/equations/multiEqualNode.js +3 -0
- package/lib/tree/nodes/equations/notEqualNode.d.ts +1 -0
- package/lib/tree/nodes/equations/notEqualNode.d.ts.map +1 -1
- package/lib/tree/nodes/equations/notEqualNode.js +3 -0
- package/lib/tree/nodes/functions/absNode.d.ts +1 -0
- package/lib/tree/nodes/functions/absNode.d.ts.map +1 -1
- package/lib/tree/nodes/functions/absNode.js +7 -0
- package/lib/tree/nodes/functions/arcSinNode.d.ts +1 -0
- package/lib/tree/nodes/functions/arcSinNode.d.ts.map +1 -1
- package/lib/tree/nodes/functions/arcSinNode.js +7 -0
- package/lib/tree/nodes/functions/arccosNode.d.ts +1 -0
- package/lib/tree/nodes/functions/arccosNode.d.ts.map +1 -1
- package/lib/tree/nodes/functions/arccosNode.js +7 -0
- package/lib/tree/nodes/functions/arctanNode.d.ts +1 -0
- package/lib/tree/nodes/functions/arctanNode.d.ts.map +1 -1
- package/lib/tree/nodes/functions/arctanNode.js +7 -0
- package/lib/tree/nodes/functions/cosNode.d.ts +1 -0
- package/lib/tree/nodes/functions/cosNode.d.ts.map +1 -1
- package/lib/tree/nodes/functions/cosNode.js +7 -0
- package/lib/tree/nodes/functions/expNode.d.ts +1 -0
- package/lib/tree/nodes/functions/expNode.d.ts.map +1 -1
- package/lib/tree/nodes/functions/expNode.js +7 -0
- package/lib/tree/nodes/functions/factorialNode.d.ts +30 -0
- package/lib/tree/nodes/functions/factorialNode.d.ts.map +1 -0
- package/lib/tree/nodes/functions/factorialNode.js +79 -0
- package/lib/tree/nodes/functions/functionNode.d.ts +2 -1
- package/lib/tree/nodes/functions/functionNode.d.ts.map +1 -1
- package/lib/tree/nodes/functions/functionNode.js +1 -0
- package/lib/tree/nodes/functions/integralNode.d.ts +1 -0
- package/lib/tree/nodes/functions/integralNode.d.ts.map +1 -1
- package/lib/tree/nodes/functions/integralNode.js +7 -0
- package/lib/tree/nodes/functions/log10Node.d.ts +1 -0
- package/lib/tree/nodes/functions/log10Node.d.ts.map +1 -1
- package/lib/tree/nodes/functions/log10Node.js +7 -0
- package/lib/tree/nodes/functions/logNode.d.ts +1 -0
- package/lib/tree/nodes/functions/logNode.d.ts.map +1 -1
- package/lib/tree/nodes/functions/logNode.js +9 -0
- package/lib/tree/nodes/functions/oppositeNode.d.ts +1 -0
- package/lib/tree/nodes/functions/oppositeNode.d.ts.map +1 -1
- package/lib/tree/nodes/functions/oppositeNode.js +7 -0
- package/lib/tree/nodes/functions/sinNode.d.ts +1 -0
- package/lib/tree/nodes/functions/sinNode.d.ts.map +1 -1
- package/lib/tree/nodes/functions/sinNode.js +7 -0
- package/lib/tree/nodes/functions/sqrtNode.d.ts +1 -0
- package/lib/tree/nodes/functions/sqrtNode.d.ts.map +1 -1
- package/lib/tree/nodes/functions/sqrtNode.js +7 -0
- package/lib/tree/nodes/functions/tanNode.d.ts +1 -0
- package/lib/tree/nodes/functions/tanNode.d.ts.map +1 -1
- package/lib/tree/nodes/functions/tanNode.js +7 -0
- package/lib/tree/nodes/geometry/degree.d.ts +1 -0
- package/lib/tree/nodes/geometry/degree.d.ts.map +1 -1
- package/lib/tree/nodes/geometry/degree.js +7 -0
- package/lib/tree/nodes/geometry/lengthNode.d.ts +1 -0
- package/lib/tree/nodes/geometry/lengthNode.d.ts.map +1 -1
- package/lib/tree/nodes/geometry/lengthNode.js +7 -0
- package/lib/tree/nodes/geometry/pointNode.d.ts +1 -0
- package/lib/tree/nodes/geometry/pointNode.d.ts.map +1 -1
- package/lib/tree/nodes/geometry/pointNode.js +7 -0
- package/lib/tree/nodes/geometry/vectorNode.d.ts +1 -0
- package/lib/tree/nodes/geometry/vectorNode.d.ts.map +1 -1
- package/lib/tree/nodes/geometry/vectorNode.js +7 -0
- package/lib/tree/nodes/inequations/inequationNode.d.ts +1 -0
- package/lib/tree/nodes/inequations/inequationNode.d.ts.map +1 -1
- package/lib/tree/nodes/inequations/inequationNode.js +7 -0
- package/lib/tree/nodes/inequations/inequationSolutionNode.d.ts +1 -0
- package/lib/tree/nodes/inequations/inequationSolutionNode.d.ts.map +1 -1
- package/lib/tree/nodes/inequations/inequationSolutionNode.js +7 -0
- package/lib/tree/nodes/node.d.ts +2 -1
- package/lib/tree/nodes/node.d.ts.map +1 -1
- package/lib/tree/nodes/node.js +2 -0
- package/lib/tree/nodes/nodeConstructor.d.ts.map +1 -1
- package/lib/tree/nodes/nodeConstructor.js +4 -0
- package/lib/tree/nodes/numbers/percentNode.d.ts +1 -0
- package/lib/tree/nodes/numbers/percentNode.d.ts.map +1 -1
- package/lib/tree/nodes/numbers/percentNode.js +7 -0
- package/lib/tree/nodes/operators/addNode.d.ts +1 -0
- package/lib/tree/nodes/operators/addNode.d.ts.map +1 -1
- package/lib/tree/nodes/operators/addNode.js +7 -0
- package/lib/tree/nodes/operators/binomialCoefficientNode.d.ts +2 -1
- package/lib/tree/nodes/operators/binomialCoefficientNode.d.ts.map +1 -1
- package/lib/tree/nodes/operators/binomialCoefficientNode.js +18 -2
- package/lib/tree/nodes/operators/divideNode.d.ts +1 -0
- package/lib/tree/nodes/operators/divideNode.d.ts.map +1 -1
- package/lib/tree/nodes/operators/divideNode.js +7 -0
- package/lib/tree/nodes/operators/fractionNode.d.ts +1 -0
- package/lib/tree/nodes/operators/fractionNode.d.ts.map +1 -1
- package/lib/tree/nodes/operators/fractionNode.js +7 -0
- package/lib/tree/nodes/operators/limitNode.d.ts +1 -0
- package/lib/tree/nodes/operators/limitNode.d.ts.map +1 -1
- package/lib/tree/nodes/operators/limitNode.js +7 -0
- package/lib/tree/nodes/operators/multiplyNode.d.ts +1 -0
- package/lib/tree/nodes/operators/multiplyNode.d.ts.map +1 -1
- package/lib/tree/nodes/operators/multiplyNode.js +7 -0
- package/lib/tree/nodes/operators/powerNode.d.ts +1 -0
- package/lib/tree/nodes/operators/powerNode.d.ts.map +1 -1
- package/lib/tree/nodes/operators/powerNode.js +7 -0
- package/lib/tree/nodes/operators/substractNode.d.ts +1 -0
- package/lib/tree/nodes/operators/substractNode.d.ts.map +1 -1
- package/lib/tree/nodes/operators/substractNode.js +7 -0
- package/lib/tree/nodes/polynomials/monomNode.d.ts +1 -0
- package/lib/tree/nodes/polynomials/monomNode.d.ts.map +1 -1
- package/lib/tree/nodes/polynomials/monomNode.js +7 -0
- package/lib/tree/nodes/polynomials/trinomNode.d.ts +1 -0
- package/lib/tree/nodes/polynomials/trinomNode.d.ts.map +1 -1
- package/lib/tree/nodes/polynomials/trinomNode.js +7 -0
- package/lib/tree/nodes/sets/belongsNode.d.ts +1 -0
- package/lib/tree/nodes/sets/belongsNode.d.ts.map +1 -1
- package/lib/tree/nodes/sets/belongsNode.js +7 -0
- package/lib/tree/nodes/sets/discreteSetNode.d.ts +1 -0
- package/lib/tree/nodes/sets/discreteSetNode.d.ts.map +1 -1
- package/lib/tree/nodes/sets/discreteSetNode.js +7 -0
- package/lib/tree/nodes/sets/intervalNode.d.ts +1 -0
- package/lib/tree/nodes/sets/intervalNode.d.ts.map +1 -1
- package/lib/tree/nodes/sets/intervalNode.js +7 -0
- package/lib/tree/nodes/sets/unionIntervalNode.d.ts +1 -0
- package/lib/tree/nodes/sets/unionIntervalNode.d.ts.map +1 -1
- package/lib/tree/nodes/sets/unionIntervalNode.js +7 -0
- package/lib/tree/nodes/variables/variableNode.d.ts +1 -0
- package/lib/tree/nodes/variables/variableNode.d.ts.map +1 -1
- package/lib/tree/nodes/variables/variableNode.js +7 -0
- package/lib/tree/utilities/nodeShuffler.d.ts.map +1 -1
- package/lib/tree/utilities/nodeShuffler.js +3 -0
- package/lib/tree/utilities/nodeSimplifier.d.ts.map +1 -1
- package/lib/tree/utilities/nodeSimplifier.js +3 -0
- package/package.json +1 -1
|
@@ -9,6 +9,7 @@ import { Segment } from "../../../../../../math/geometry/segment.js";
|
|
|
9
9
|
import { Triangle, TriangleConstructor, } from "../../../../../../math/geometry/triangles/triangle.js";
|
|
10
10
|
import { VectorConstructor } from "../../../../../../math/geometry/vector.js";
|
|
11
11
|
import { randfloat } from "../../../../../../math/utils/random/randfloat.js";
|
|
12
|
+
import { randint } from "../../../../../../math/utils/random/randint.js";
|
|
12
13
|
import { round } from "../../../../../../math/utils/round.js";
|
|
13
14
|
import { abs } from "../../../../../../tree/nodes/functions/absNode.js";
|
|
14
15
|
import { arccos } from "../../../../../../tree/nodes/functions/arccosNode.js";
|
|
@@ -20,8 +21,9 @@ import { multiply } from "../../../../../../tree/nodes/operators/multiplyNode.js
|
|
|
20
21
|
import { power } from "../../../../../../tree/nodes/operators/powerNode.js";
|
|
21
22
|
import { substract } from "../../../../../../tree/nodes/operators/substractNode.js";
|
|
22
23
|
import { parseAlgebraic } from "../../../../../../tree/parsers/latexParser.js";
|
|
23
|
-
import {
|
|
24
|
+
import { probaLawFlip } from "../../../../../../utils/alea/probaLawFlip.js";
|
|
24
25
|
import { random } from "../../../../../../utils/alea/random.js";
|
|
26
|
+
import { shuffle } from "../../../../../../utils/alea/shuffle.js";
|
|
25
27
|
import { zip } from "../../../../../../utils/arrays/arrayZip.js";
|
|
26
28
|
import { arrayRotation } from "../../../../../../utils/arrays/rotation.js";
|
|
27
29
|
import { handleVEAError } from "../../../../../../utils/errors/handleVEAError.js";
|
|
@@ -43,21 +45,48 @@ const getHydrated = (identifiers) => {
|
|
|
43
45
|
};
|
|
44
46
|
};
|
|
45
47
|
const getInstruction = (identifiers) => {
|
|
48
|
+
const { sectorOfPointH } = identifiers;
|
|
46
49
|
const { triangle, sides, sideLengths } = getHydrated(identifiers);
|
|
47
50
|
return `Soit $${triangle.name}$ un triangle dont on connaît les longueurs des côtés :
|
|
48
51
|
|
|
49
52
|
${zip(sides, sideLengths).map(([segment, valueLength]) => `- $${segment.toInsideName()} = ${valueLength.frenchify()}$`).join(`
|
|
50
53
|
|
|
51
|
-
`)}
|
|
54
|
+
`)}
|
|
52
55
|
|
|
53
|
-
|
|
54
|
-
|
|
56
|
+
$H$ est le pied de la hauteur issue de $A$.
|
|
57
|
+
|
|
58
|
+
${(() => {
|
|
59
|
+
switch (sectorOfPointH) {
|
|
60
|
+
case "Entre $B$ et $C$":
|
|
61
|
+
return `On précise que $H$ appartient au segment $[BC]$.`;
|
|
62
|
+
case "Après $C$":
|
|
63
|
+
return `On précise que $H$ n'appartient pas au segment $[BC]$. $H$ est plus proche de $C$ que de $B$.`;
|
|
64
|
+
case "Avant $B$":
|
|
65
|
+
return `On précise que $H$ n'appartient pas au segment $[BC]$. $H$ est plus proche de $B$ que de $C$.`;
|
|
66
|
+
default:
|
|
67
|
+
throw new Error("Unsupported opts.sectorOfPointH: " + sectorOfPointH);
|
|
68
|
+
}
|
|
69
|
+
})()}
|
|
70
|
+
|
|
71
|
+
Calculer la longueur $BH$ (donner une valeur arrondie à $${precision}$ décimales).`;
|
|
55
72
|
};
|
|
56
73
|
const getAnswerStuff = (identifiers) => {
|
|
74
|
+
const { sectorOfPointH } = identifiers;
|
|
57
75
|
const { sideLengths } = getHydrated(identifiers);
|
|
58
76
|
const nodeCosAngle = frac(substract(add(power(sideLengths[1], 2), power(sideLengths[2], 2)), power(sideLengths[0], 2)), multiply(2, multiply(sideLengths[1], sideLengths[2])));
|
|
59
77
|
const nodeLengthBA = sideLengths[1];
|
|
60
|
-
const
|
|
78
|
+
const sign = (() => {
|
|
79
|
+
switch (sectorOfPointH) {
|
|
80
|
+
case "Entre $B$ et $C$":
|
|
81
|
+
case "Après $C$":
|
|
82
|
+
return +1;
|
|
83
|
+
case "Avant $B$":
|
|
84
|
+
return -1;
|
|
85
|
+
default:
|
|
86
|
+
throw new Error("Unsupported opts.sectorOfPointH: " + sectorOfPointH);
|
|
87
|
+
}
|
|
88
|
+
})();
|
|
89
|
+
const nodeLengthBH = multiply(sign, multiply(nodeLengthBA, nodeCosAngle));
|
|
61
90
|
return {
|
|
62
91
|
nodeCosAngle,
|
|
63
92
|
nodeLengthBH,
|
|
@@ -69,12 +98,41 @@ const getAnswerNode = (identifiers) => {
|
|
|
69
98
|
const getAnswer = (identifiers) => {
|
|
70
99
|
return round(getAnswerNode(identifiers).evaluate(), precision).frenchify();
|
|
71
100
|
};
|
|
72
|
-
const getHint = () => {
|
|
73
|
-
|
|
101
|
+
const getHint = (identifiers) => {
|
|
102
|
+
const { sides, angleNames } = getHydrated(identifiers);
|
|
103
|
+
const sideNames = sides
|
|
104
|
+
.map((segment) => segment.toInsideName())
|
|
105
|
+
.map((name) => {
|
|
106
|
+
return {
|
|
107
|
+
AB: "c",
|
|
108
|
+
AC: "b",
|
|
109
|
+
BC: "a",
|
|
110
|
+
}[name];
|
|
111
|
+
});
|
|
112
|
+
return `Premièrement, puisque $H$ est le projeté orthogonal de $A$ sur $(BC)$, tu peux écrire :
|
|
113
|
+
|
|
114
|
+
$$
|
|
115
|
+
\\overrightarrow{BA} \\cdot \\overrightarrow{BC} = \\overrightarrow{BH} \\cdot \\overrightarrow{BC}
|
|
116
|
+
$$
|
|
74
117
|
|
|
75
|
-
|
|
118
|
+
Deuxièmement, applique le théorème d'Al-Kashi dans le triangle $ABC$.
|
|
119
|
+
|
|
120
|
+
Rappel:
|
|
121
|
+
|
|
122
|
+
Si on utilise les notations suivantes :
|
|
123
|
+
|
|
124
|
+
$$
|
|
125
|
+
a \\ = \\ BC \\ ; \\ b \\ = \\ AC \\ ; \\ c \\ = \\ AB \\
|
|
126
|
+
$$
|
|
127
|
+
|
|
128
|
+
le théorème d'Al-Kashi s'écrit :
|
|
129
|
+
|
|
130
|
+
$$
|
|
131
|
+
${sideNames[0]}^2 = ${sideNames[1]}^2 + ${sideNames[2]}^2 - 2 ${sideNames[1]} ${sideNames[2]} \\cos(${angleNames[0]})
|
|
132
|
+
$$`;
|
|
76
133
|
};
|
|
77
134
|
const getCorrection = (identifiers) => {
|
|
135
|
+
const { sectorOfPointH } = identifiers;
|
|
78
136
|
const { sides, angleNames } = getHydrated(identifiers);
|
|
79
137
|
const sideNames = sides
|
|
80
138
|
.map((segment) => segment.toInsideName())
|
|
@@ -87,40 +145,94 @@ const getCorrection = (identifiers) => {
|
|
|
87
145
|
});
|
|
88
146
|
const nodeCosAngle = frac(substract(add(power(sideNames[1], 2), power(sideNames[2], 2)), power(sideNames[0], 2)), multiply(2, multiply(sideNames[1], sideNames[2])));
|
|
89
147
|
const { nodeLengthBH } = getAnswerStuff(identifiers);
|
|
90
|
-
return `
|
|
148
|
+
return `D'une part, par définition du produit scalaire :
|
|
91
149
|
|
|
92
|
-
|
|
150
|
+
$$
|
|
151
|
+
\\overrightarrow{BA} \\cdot \\overrightarrow{BC} = BA \\times BC \\times \\cos(${angleNames[0]})
|
|
152
|
+
$$
|
|
153
|
+
|
|
154
|
+
D'autre part, puisque $H$ est le projeté orthogonal de $A$ sur $(BC)$, on a :
|
|
93
155
|
|
|
94
156
|
$$
|
|
95
|
-
|
|
157
|
+
\\overrightarrow{BA} \\cdot \\overrightarrow{BC} = \\overrightarrow{BH} \\cdot \\overrightarrow{BC}
|
|
96
158
|
$$
|
|
97
159
|
|
|
160
|
+
${(() => {
|
|
161
|
+
switch (sectorOfPointH) {
|
|
162
|
+
case "Entre $B$ et $C$":
|
|
163
|
+
return `Les points $B$,$H$ et $C$ sont alignés dans cet ordre. Par conséquent :
|
|
164
|
+
|
|
98
165
|
$$
|
|
99
|
-
|
|
166
|
+
\\overrightarrow{BH} \\cdot \\overrightarrow{BC} = BH \\times BC
|
|
100
167
|
$$
|
|
101
168
|
|
|
169
|
+
`;
|
|
170
|
+
case "Après $C$":
|
|
171
|
+
return `Les points $B$,$C$ et $H$ sont alignés dans cet ordre. Par conséquent :
|
|
172
|
+
|
|
102
173
|
$$
|
|
103
|
-
\\
|
|
174
|
+
\\overrightarrow{BH} \\cdot \\overrightarrow{BC} = BH \\times BC
|
|
175
|
+
$$
|
|
176
|
+
|
|
177
|
+
`;
|
|
178
|
+
case "Avant $B$":
|
|
179
|
+
return `Les points $H$,$B$ et $C$ sont alignés dans cet ordre. Par conséquent :
|
|
180
|
+
|
|
181
|
+
$$
|
|
182
|
+
\\overrightarrow{BH} \\cdot \\overrightarrow{BC} = - BH \\times BC
|
|
104
183
|
$$
|
|
105
184
|
|
|
106
|
-
|
|
185
|
+
`;
|
|
186
|
+
default:
|
|
187
|
+
throw new Error("Unsupported opts.sectorOfPointH: " + sectorOfPointH);
|
|
188
|
+
}
|
|
189
|
+
})()}
|
|
190
|
+
|
|
191
|
+
|
|
192
|
+
On va calculer $\\cos(${angleNames[0]})$ en utilisant le théorème d'Al-Kashi dans le triangle $ABC$.
|
|
193
|
+
|
|
194
|
+
En utilisant les notations suivantes :
|
|
107
195
|
|
|
108
196
|
$$
|
|
109
|
-
\\
|
|
197
|
+
a \\ = \\ BC \\ ; \\ b \\ = \\ AC \\ ; \\ c \\ = \\ AB \\
|
|
110
198
|
$$
|
|
111
199
|
|
|
112
|
-
|
|
200
|
+
La formule d'Al-Kashi s'écrit :
|
|
201
|
+
|
|
202
|
+
$$
|
|
203
|
+
${sideNames[0]}^2 = ${sideNames[1]}^2 + ${sideNames[2]}^2 - 2 ${sideNames[1]} ${sideNames[2]} \\cos(${angleNames[0]})
|
|
204
|
+
$$
|
|
113
205
|
|
|
114
206
|
$$
|
|
115
|
-
\\
|
|
207
|
+
\\cos(${angleNames[0]}) = ${nodeCosAngle.toTex()}
|
|
116
208
|
$$
|
|
117
209
|
|
|
118
210
|
On a donc :
|
|
119
211
|
|
|
212
|
+
${(() => {
|
|
213
|
+
switch (sectorOfPointH) {
|
|
214
|
+
case "Entre $B$ et $C$":
|
|
215
|
+
case "Après $C$":
|
|
216
|
+
return `
|
|
217
|
+
|
|
120
218
|
$$
|
|
121
|
-
BH =
|
|
219
|
+
BH = BA \\times \\cos(${angleNames[0]})
|
|
122
220
|
$$
|
|
123
221
|
|
|
222
|
+
`;
|
|
223
|
+
case "Avant $B$":
|
|
224
|
+
return `
|
|
225
|
+
|
|
226
|
+
$$
|
|
227
|
+
BH = - BA \\times \\cos(${angleNames[0]})
|
|
228
|
+
$$
|
|
229
|
+
|
|
230
|
+
`;
|
|
231
|
+
default:
|
|
232
|
+
throw new Error("Unsupported opts.sectorOfPointH: " + sectorOfPointH);
|
|
233
|
+
}
|
|
234
|
+
})()}
|
|
235
|
+
|
|
124
236
|
$$
|
|
125
237
|
BH = ${nodeLengthBH.toTex()}
|
|
126
238
|
$$
|
|
@@ -192,10 +304,28 @@ const getGGBOptions = (identifiers) => {
|
|
|
192
304
|
});
|
|
193
305
|
};
|
|
194
306
|
const getPropositions = (n, { answer, ...identifiers }) => {
|
|
195
|
-
const
|
|
196
|
-
addValidProp(
|
|
307
|
+
const propositionsMandatory = [];
|
|
308
|
+
addValidProp(propositionsMandatory, answer);
|
|
197
309
|
const { sideLengths } = getHydrated(identifiers);
|
|
198
310
|
const [BC, BA, _] = sideLengths;
|
|
311
|
+
//around answer
|
|
312
|
+
{
|
|
313
|
+
const vAnswer = getAnswerStuff(identifiers).nodeLengthBH.evaluate();
|
|
314
|
+
const createOffset = probaLawFlip([
|
|
315
|
+
[() => randfloat(0, 0.5, 2, [0]), 0.4],
|
|
316
|
+
[() => randfloat(-0.5, 0, 2, [0]), 0.4],
|
|
317
|
+
[() => randfloat(-0.5, 0.5, 2, [0]), 0.2],
|
|
318
|
+
]);
|
|
319
|
+
const nbAroundAnswer = randint(1, 3);
|
|
320
|
+
const arrOffset = [...Array(nbAroundAnswer).keys()].map(createOffset);
|
|
321
|
+
arrOffset.forEach((vOffset) => {
|
|
322
|
+
const valueAnswerOffsetted = vAnswer + vOffset;
|
|
323
|
+
if (valueAnswerOffsetted > 0) {
|
|
324
|
+
tryToAddWrongProp(propositionsMandatory, round(valueAnswerOffsetted, precision).frenchify());
|
|
325
|
+
}
|
|
326
|
+
});
|
|
327
|
+
}
|
|
328
|
+
const propositionsFiller = [];
|
|
199
329
|
const arrValueWrong = [];
|
|
200
330
|
//student: sign error
|
|
201
331
|
{
|
|
@@ -204,7 +334,7 @@ const getPropositions = (n, { answer, ...identifiers }) => {
|
|
|
204
334
|
const nodeLengthBH = multiply(nodeLengthBA, abs(nodeCosAngle));
|
|
205
335
|
const vWrong = nodeLengthBH.evaluate();
|
|
206
336
|
arrValueWrong.push(vWrong);
|
|
207
|
-
tryToAddWrongProp(
|
|
337
|
+
tryToAddWrongProp(propositionsFiller, round(vWrong, precision).frenchify());
|
|
208
338
|
}
|
|
209
339
|
//student: computes AH instead of BH
|
|
210
340
|
{
|
|
@@ -213,7 +343,7 @@ const getPropositions = (n, { answer, ...identifiers }) => {
|
|
|
213
343
|
const nodeLengthAH = multiply(nodeLengthBA, abs(sin(arccos(nodeCosAngle))));
|
|
214
344
|
const vWrong = nodeLengthAH.evaluate();
|
|
215
345
|
arrValueWrong.push(vWrong);
|
|
216
|
-
tryToAddWrongProp(
|
|
346
|
+
tryToAddWrongProp(propositionsFiller, round(vWrong, precision).frenchify());
|
|
217
347
|
}
|
|
218
348
|
//student: pythagore with BA and BC
|
|
219
349
|
{
|
|
@@ -221,31 +351,28 @@ const getPropositions = (n, { answer, ...identifiers }) => {
|
|
|
221
351
|
const nodeWrong = sqrt(substract(power(BA, 2), power(BC, 2)));
|
|
222
352
|
const vWrong = nodeWrong.evaluate();
|
|
223
353
|
arrValueWrong.push(vWrong);
|
|
224
|
-
tryToAddWrongProp(
|
|
354
|
+
tryToAddWrongProp(propositionsFiller, round(vWrong, precision).frenchify());
|
|
225
355
|
}
|
|
226
356
|
}
|
|
227
|
-
//terror: around
|
|
357
|
+
//terror: around wrong
|
|
228
358
|
{
|
|
229
|
-
const value = (
|
|
230
|
-
const vAnswer = getAnswerStuff(identifiers).nodeLengthBH.evaluate();
|
|
231
|
-
if (probaFlip(0.6)) {
|
|
232
|
-
return vAnswer;
|
|
233
|
-
}
|
|
234
|
-
else {
|
|
235
|
-
return random([...arrValueWrong, vAnswer]);
|
|
236
|
-
}
|
|
237
|
-
})();
|
|
359
|
+
const value = random([...arrValueWrong]);
|
|
238
360
|
[...Array(2).keys()].forEach(() => {
|
|
239
361
|
const valueAnswerOffsetted = value + randfloat(-1.2, 1.2, 2, [0]);
|
|
240
362
|
if (valueAnswerOffsetted > 0) {
|
|
241
|
-
tryToAddWrongProp(
|
|
363
|
+
tryToAddWrongProp(propositionsFiller, round(valueAnswerOffsetted, precision).frenchify());
|
|
242
364
|
}
|
|
243
365
|
});
|
|
244
366
|
}
|
|
245
|
-
propWhile(
|
|
246
|
-
tryToAddWrongProp(
|
|
367
|
+
propWhile(propositionsFiller, n, () => {
|
|
368
|
+
tryToAddWrongProp(propositionsFiller, randfloat(2, 20, 2, [0, 20]).frenchify());
|
|
247
369
|
});
|
|
248
|
-
return
|
|
370
|
+
return shuffle([
|
|
371
|
+
...propositionsMandatory,
|
|
372
|
+
...shuffleProps(propositionsFiller.filter((propositionFiller) => !propositionsMandatory
|
|
373
|
+
.map((proposition) => proposition.statement)
|
|
374
|
+
.includes(propositionFiller.statement)), n - propositionsMandatory.length),
|
|
375
|
+
]);
|
|
249
376
|
};
|
|
250
377
|
const getKeys = () => {
|
|
251
378
|
return [];
|
|
@@ -260,11 +387,8 @@ const isAnswerValid = (ans, { answer }) => {
|
|
|
260
387
|
}
|
|
261
388
|
};
|
|
262
389
|
const getScalarProductAlKashiBHQuestion = (optsIn) => {
|
|
263
|
-
const arrayedOptions = optsIn ??
|
|
264
|
-
const
|
|
265
|
-
sectorOfPointH: random(arrayedOptions.sectorOfPointH),
|
|
266
|
-
};
|
|
267
|
-
const { sectorOfPointH } = opts;
|
|
390
|
+
const arrayedOptions = optsIn ?? arrayedOptsDefault;
|
|
391
|
+
const sectorOfPointH = random(arrayedOptions.sectorOfPointH);
|
|
268
392
|
function createRandomPoints() {
|
|
269
393
|
const offsetBtoC = 10;
|
|
270
394
|
const pointB = new Point("B", randfloat(0, 10), randfloat(0, 10));
|
|
@@ -284,7 +408,7 @@ const getScalarProductAlKashiBHQuestion = (optsIn) => {
|
|
|
284
408
|
case "Avant $B$":
|
|
285
409
|
return multiply((-1).toTree(), nodeOffsetDtoE);
|
|
286
410
|
default:
|
|
287
|
-
throw new Error("Unsupported
|
|
411
|
+
throw new Error("Unsupported sectorOfPointH: " + sectorOfPointH);
|
|
288
412
|
}
|
|
289
413
|
})();
|
|
290
414
|
const pointD = vecBCUnited.times(nodeOffsetBtoD).getEndPoint(pointB);
|
|
@@ -356,6 +480,7 @@ const getScalarProductAlKashiBHQuestion = (optsIn) => {
|
|
|
356
480
|
const [B, A, C, H] = pointsCandidate;
|
|
357
481
|
const triangle = new Triangle([A, B, C]);
|
|
358
482
|
identifiers = {
|
|
483
|
+
sectorOfPointH,
|
|
359
484
|
triangleIds: triangle.toIdentifiers(),
|
|
360
485
|
pointIdsH: H.toIdentifiers(),
|
|
361
486
|
};
|
|
@@ -377,7 +502,7 @@ const getScalarProductAlKashiBHQuestion = (optsIn) => {
|
|
|
377
502
|
case "Avant $B$":
|
|
378
503
|
return new Point("A", 5, 7);
|
|
379
504
|
default:
|
|
380
|
-
throw new Error("Unsupported opts.sectorOfPointH: " +
|
|
505
|
+
throw new Error("Unsupported opts.sectorOfPointH: " + sectorOfPointH);
|
|
381
506
|
}
|
|
382
507
|
})();
|
|
383
508
|
const vecBC = VectorConstructor.fromPoints(pointB, pointC);
|
|
@@ -390,6 +515,7 @@ const getScalarProductAlKashiBHQuestion = (optsIn) => {
|
|
|
390
515
|
const [B, A, C, H] = [pointB, pointA, pointC, pointH];
|
|
391
516
|
const triangle = new Triangle([A, B, C]);
|
|
392
517
|
const identifiersDefault = {
|
|
518
|
+
sectorOfPointH,
|
|
393
519
|
triangleIds: triangle.toIdentifiers(),
|
|
394
520
|
pointIdsH: H.toIdentifiers(),
|
|
395
521
|
};
|
|
@@ -411,7 +537,7 @@ const getQuestionFromIdentifiers = (identifiers, opts) => {
|
|
|
411
537
|
options: opts,
|
|
412
538
|
};
|
|
413
539
|
};
|
|
414
|
-
const
|
|
540
|
+
const arrayedOptsDefault = {
|
|
415
541
|
sectorOfPointH: ["Entre $B$ et $C$"],
|
|
416
542
|
};
|
|
417
543
|
const options = [
|
|
@@ -421,13 +547,13 @@ const options = [
|
|
|
421
547
|
target: GeneratorOptionTarget.generation,
|
|
422
548
|
type: GeneratorOptionType.multiselect,
|
|
423
549
|
values: ["Entre $B$ et $C$", "Après $C$", "Avant $B$"],
|
|
424
|
-
defaultValue:
|
|
550
|
+
defaultValue: arrayedOptsDefault.sectorOfPointH,
|
|
425
551
|
},
|
|
426
552
|
];
|
|
427
553
|
export const scalarProductAlKashiBH = {
|
|
428
554
|
id: "scalarProductAlKashiBH",
|
|
429
555
|
connector: "=",
|
|
430
|
-
label: "Connaissant les longueurs de trois côtés d'un triangle $ABC$, calculer $BH$ ($H$ étant le pied de la hauteur issue de $A$)",
|
|
556
|
+
label: "Connaissant les longueurs de trois côtés d'un triangle $ABC$, calculer $BH$ ($H$ étant le pied de la hauteur issue de $A$) grâce au théorème d'Al-Kashi",
|
|
431
557
|
isSingleStep: true,
|
|
432
558
|
generator: (nb, opts) => getDistinctQuestions(() => getScalarProductAlKashiBHQuestion(opts), nb),
|
|
433
559
|
options,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"scalarProductAlKashiSideLength.d.ts","sourceRoot":"","sources":["../../../../../../../src/exercises/math/geometry/vectors/scalarProduct/alKashi/scalarProductAlKashiSideLength.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,
|
|
1
|
+
{"version":3,"file":"scalarProductAlKashiSideLength.d.ts","sourceRoot":"","sources":["../../../../../../../src/exercises/math/geometry/vectors/scalarProduct/alKashi/scalarProductAlKashiSideLength.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAeT,MAAM,6BAA6B,CAAC;AAIrC,OAAO,EAGL,mBAAmB,EACpB,MAAM,2CAA2C,CAAC;AAqEnD,KAAK,WAAW,GAAG;IACjB,WAAW,EAAE,mBAAmB,CAAC;IACjC,SAAS,EAAE,MAAM,CAAC;CACnB,CAAC;AAuXF,eAAO,MAAM,8BAA8B,EAAE,QAAQ,CAAC,WAAW,CAsBhE,CAAC"}
|
package/lib/exercises/math/geometry/vectors/scalarProduct/alKashi/scalarProductAlKashiSideLength.js
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { addValidProp, shuffleProps, tryToAddWrongProp, propWhile, } from "../../../../../../exercises/exercise.js";
|
|
2
2
|
import { getDistinctQuestions } from "../../../../../../exercises/utils/getDistinctQuestions.js";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
3
|
+
import { Angle } from "../../../../../../math/geometry/angle.js";
|
|
4
|
+
import { Point } from "../../../../../../math/geometry/point.js";
|
|
5
|
+
import { Triangle, TriangleConstructor, } from "../../../../../../math/geometry/triangles/triangle.js";
|
|
6
|
+
import { Vector } from "../../../../../../math/geometry/vector.js";
|
|
5
7
|
import { randfloat } from "../../../../../../math/utils/random/randfloat.js";
|
|
6
8
|
import { randint } from "../../../../../../math/utils/random/randint.js";
|
|
7
9
|
import { round } from "../../../../../../math/utils/round.js";
|
|
@@ -16,9 +18,25 @@ import { substract } from "../../../../../../tree/nodes/operators/substractNode.
|
|
|
16
18
|
import { parseAlgebraic } from "../../../../../../tree/parsers/latexParser.js";
|
|
17
19
|
import { probaFlip } from "../../../../../../utils/alea/probaFlip.js";
|
|
18
20
|
import { random } from "../../../../../../utils/alea/random.js";
|
|
21
|
+
import { shuffle } from "../../../../../../utils/alea/shuffle.js";
|
|
19
22
|
import { arrayRotation } from "../../../../../../utils/arrays/rotation.js";
|
|
20
23
|
import { handleVEAError } from "../../../../../../utils/errors/handleVEAError.js";
|
|
21
24
|
const precision = 2;
|
|
25
|
+
const createVector = (from, to, name, precision = 5) => {
|
|
26
|
+
return new Vector(name, round(substract(to.x, from.x).evaluate(), precision).toTree(), round(substract(to.y, from.y).evaluate(), precision).toTree());
|
|
27
|
+
};
|
|
28
|
+
const createPoint = (x, y, name, precision = 5) => {
|
|
29
|
+
return new Point(name, round(x, precision), round(y, precision));
|
|
30
|
+
};
|
|
31
|
+
const degreesToRadians = (angleInDegrees, precision) => {
|
|
32
|
+
const oneOver180 = 0.00555555555555555;
|
|
33
|
+
return round(multiply(multiply(angleInDegrees, PiNode), oneOver180).evaluate(), precision);
|
|
34
|
+
};
|
|
35
|
+
const rotatePoint = (target, angle, center, name, precision = 2) => {
|
|
36
|
+
const vSrc = createVector(center, target, "vSrc", precision);
|
|
37
|
+
const vRotated = vSrc.rotate(angle, "vRotated");
|
|
38
|
+
return createPoint(add(center.x, vRotated.x).evaluate(), add(center.y, vRotated.y).evaluate(), name, precision);
|
|
39
|
+
};
|
|
22
40
|
const getHydrated = (identifiers) => {
|
|
23
41
|
const { indexSide } = identifiers;
|
|
24
42
|
const indexAngle = indexSide;
|
|
@@ -42,12 +60,11 @@ ${triangle.sides
|
|
|
42
60
|
|
|
43
61
|
`)}
|
|
44
62
|
|
|
45
|
-
- $${triangle.angles[indexAngle].toTexMini()}
|
|
63
|
+
- $${triangle.angles[indexAngle].toTexMini()} = ${triangle.angles[indexAngle]
|
|
46
64
|
.evaluate()
|
|
47
65
|
.frenchify()} {}^{\\circ} $
|
|
48
66
|
|
|
49
|
-
|
|
50
|
-
Donner une valeur approchée en degrés avec $${precision}$ décimales.`;
|
|
67
|
+
Calculer la longueur $${triangle.sides[indexSide].toTex()}$ (donner une valeur arrondie à $${precision}$ décimales).`;
|
|
51
68
|
};
|
|
52
69
|
const getAnswerStuff = (identifiers) => {
|
|
53
70
|
const { indexSide } = identifiers;
|
|
@@ -55,24 +72,57 @@ const getAnswerStuff = (identifiers) => {
|
|
|
55
72
|
const { triangle, sides } = getHydrated(identifiers);
|
|
56
73
|
const nodeAngleInDegrees = triangle.angles[indexAngle].evaluate().toTree();
|
|
57
74
|
const nodeAngleInRadians = multiply(nodeAngleInDegrees, frac(PiNode, 180));
|
|
75
|
+
//"nodeStr"
|
|
76
|
+
const nodeStrLengthSquared = substract(add(power(sides[1].getLengthNode(), 2), power(sides[2].getLengthNode(), 2)), multiply(2, multiply(multiply(sides[1].getLengthNode(), sides[2].getLengthNode()), cos(multiply(nodeAngleInDegrees, "{}^{\\circ}".toTree())))));
|
|
77
|
+
const nodeStrLength = sqrt(nodeStrLengthSquared.simplify());
|
|
78
|
+
//"true" nodes
|
|
58
79
|
const nodeLengthSquared = substract(add(power(sides[1].getLengthNode(), 2), power(sides[2].getLengthNode(), 2)), multiply(2, multiply(multiply(sides[1].getLengthNode(), sides[2].getLengthNode()), cos(nodeAngleInRadians))));
|
|
59
80
|
const nodeLength = sqrt(nodeLengthSquared);
|
|
81
|
+
const lengthRounded = round(nodeLength.evaluate(), precision);
|
|
60
82
|
return {
|
|
61
|
-
|
|
83
|
+
nodeStrLengthSquared,
|
|
84
|
+
nodeStrLength,
|
|
62
85
|
nodeLength,
|
|
86
|
+
lengthRounded,
|
|
63
87
|
};
|
|
64
88
|
};
|
|
65
89
|
const getAnswerNode = (identifiers) => {
|
|
66
|
-
return getAnswerStuff(identifiers).
|
|
90
|
+
return getAnswerStuff(identifiers).lengthRounded.toTree();
|
|
67
91
|
};
|
|
68
92
|
const getAnswer = (identifiers) => {
|
|
69
93
|
return round(getAnswerNode(identifiers).evaluate(), precision).frenchify();
|
|
70
94
|
};
|
|
71
95
|
const getHint = (identifiers) => {
|
|
72
|
-
const { triangle } = getHydrated(identifiers);
|
|
96
|
+
const { sides, triangle } = getHydrated(identifiers);
|
|
73
97
|
const { indexSide } = identifiers;
|
|
74
98
|
const indexAngle = indexSide;
|
|
75
|
-
|
|
99
|
+
const sideNames = arrayRotation(sides, indexAngle)
|
|
100
|
+
.map((segment) => segment.toInsideName())
|
|
101
|
+
.map((name) => {
|
|
102
|
+
return {
|
|
103
|
+
AB: "c",
|
|
104
|
+
AC: "b",
|
|
105
|
+
BC: "a",
|
|
106
|
+
BA: "c",
|
|
107
|
+
CA: "b",
|
|
108
|
+
CB: "a",
|
|
109
|
+
}[name];
|
|
110
|
+
});
|
|
111
|
+
return `Applique le théorème d'Al Kashi dans le triangle $ABC$ pour l'angle $${triangle.angles[indexAngle].toTexMini()}$.
|
|
112
|
+
|
|
113
|
+
Rappel:
|
|
114
|
+
|
|
115
|
+
Si on utilise les notations suivantes :
|
|
116
|
+
|
|
117
|
+
$$
|
|
118
|
+
a \\ = \\ BC \\ ; \\ b \\ = \\ AC \\ ; \\ c \\ = \\ AB \\
|
|
119
|
+
$$
|
|
120
|
+
|
|
121
|
+
le théorème d'Al-Kashi s'écrit :
|
|
122
|
+
|
|
123
|
+
$$
|
|
124
|
+
${sideNames[0]}^2 = ${sideNames[1]}^2 + ${sideNames[2]}^2 - 2 ${sideNames[1]} ${sideNames[2]} \\cos(${triangle.angles[indexAngle].toTexMini()})
|
|
125
|
+
$$`;
|
|
76
126
|
};
|
|
77
127
|
const getCorrection = (identifiers) => {
|
|
78
128
|
const { indexSide } = identifiers;
|
|
@@ -85,10 +135,13 @@ const getCorrection = (identifiers) => {
|
|
|
85
135
|
AB: "c",
|
|
86
136
|
AC: "b",
|
|
87
137
|
BC: "a",
|
|
138
|
+
BA: "c",
|
|
139
|
+
CA: "b",
|
|
140
|
+
CB: "a",
|
|
88
141
|
}[name];
|
|
89
142
|
});
|
|
90
143
|
const angleNames = arrayRotation(triangle.angles, indexAngle).map((angle) => angle.toTexMini());
|
|
91
|
-
const {
|
|
144
|
+
const { nodeStrLengthSquared, nodeStrLength } = getAnswerStuff(identifiers);
|
|
92
145
|
return `On applique le théorème d'Al Kashi dans le triangle $ABC$.
|
|
93
146
|
|
|
94
147
|
On utilise les notations suivantes :
|
|
@@ -97,25 +150,21 @@ $$
|
|
|
97
150
|
a \\ = \\ BC \\ ; \\ b \\ = \\ AC \\ ; \\ c \\ = \\ AB \\
|
|
98
151
|
$$
|
|
99
152
|
|
|
100
|
-
|
|
101
|
-
${sideNames[0]}^2 = ${sideNames[1]}^2 + ${sideNames[2]}^2 - 2 ${sideNames[1]} ${sideNames[2]} \\cos(${angleNames[0]})
|
|
102
|
-
$$
|
|
103
|
-
|
|
104
|
-
Avant de prendre le cosinus, il faut convertir l'angle en radians :
|
|
153
|
+
Avec ces notations, d'après le théorème d'Al-Kashi :
|
|
105
154
|
|
|
106
155
|
$$
|
|
107
|
-
${
|
|
156
|
+
${sideNames[0]}^2 = ${sideNames[1]}^2 + ${sideNames[2]}^2 - 2 ${sideNames[1]} ${sideNames[2]} \\cos(${angleNames[0]})
|
|
108
157
|
$$
|
|
109
158
|
|
|
110
159
|
$$
|
|
111
|
-
${sideNames[0]}^2 = ${
|
|
160
|
+
${sideNames[0]}^2 = ${nodeStrLengthSquared.toTex()}
|
|
112
161
|
$$
|
|
113
162
|
|
|
114
163
|
$$
|
|
115
|
-
${sideNames[0]} = ${
|
|
164
|
+
${sideNames[0]} = ${nodeStrLength.toTex()}
|
|
116
165
|
$$
|
|
117
166
|
|
|
118
|
-
|
|
167
|
+
À l’aide de la calculatrice réglée en degrés, on calcule et, comme d'habitude, on arrondit à la toute fin :
|
|
119
168
|
|
|
120
169
|
$$
|
|
121
170
|
${sideNames[0]} \\approx ${getAnswer(identifiers)}
|
|
@@ -123,28 +172,6 @@ $$
|
|
|
123
172
|
|
|
124
173
|
`;
|
|
125
174
|
};
|
|
126
|
-
//too helpful for student ?
|
|
127
|
-
const getGGBOptions = (identifiers) => {
|
|
128
|
-
const { triangle } = getHydrated(identifiers);
|
|
129
|
-
// const { indexAngle } = identifiers;
|
|
130
|
-
// const angle = arrayRotation(triangle.angles, indexAngle)[0];
|
|
131
|
-
const ggb = new GeogebraConstructor({
|
|
132
|
-
commands: [
|
|
133
|
-
//triangle
|
|
134
|
-
...triangle.commands,
|
|
135
|
-
// //angle
|
|
136
|
-
// `Ang = Angle(${angle.points
|
|
137
|
-
// .reverse()
|
|
138
|
-
// .map((point) => point.name)
|
|
139
|
-
// .join(",")})`,
|
|
140
|
-
// `ShowLabel(Ang, false)`,
|
|
141
|
-
],
|
|
142
|
-
hideAxes: true,
|
|
143
|
-
});
|
|
144
|
-
return ggb.getOptions({
|
|
145
|
-
coords: ggb.getCoordsForPoints(triangle.points),
|
|
146
|
-
});
|
|
147
|
-
};
|
|
148
175
|
const getPropositions = (n, { answer, ...identifiers }) => {
|
|
149
176
|
const propositions = [];
|
|
150
177
|
addValidProp(propositions, answer);
|
|
@@ -212,8 +239,49 @@ const isAnswerValid = (ans, { answer }) => {
|
|
|
212
239
|
}
|
|
213
240
|
};
|
|
214
241
|
const getScalarProductAlKashiSideLengthQuestion = () => {
|
|
215
|
-
|
|
216
|
-
|
|
242
|
+
function createNiceTriangle(pointNames, minAngle = 20, isIntSidesAroundAngleA = false, precision = 1) {
|
|
243
|
+
let A;
|
|
244
|
+
let B;
|
|
245
|
+
let C;
|
|
246
|
+
const anglesAreNice = () => {
|
|
247
|
+
const values = [
|
|
248
|
+
new Angle([C, B, A]).evaluate(),
|
|
249
|
+
new Angle([A, C, B]).evaluate(),
|
|
250
|
+
new Angle([B, A, C]).evaluate(),
|
|
251
|
+
];
|
|
252
|
+
if (minAngle)
|
|
253
|
+
return values.every((v) => v > minAngle && v < 180 - minAngle);
|
|
254
|
+
return values.every((v) => v > 20 && v < 110);
|
|
255
|
+
};
|
|
256
|
+
let counter = 0;
|
|
257
|
+
do {
|
|
258
|
+
counter++;
|
|
259
|
+
if (counter > 1000)
|
|
260
|
+
throw new Error("createNiceTriangle: too many iterations");
|
|
261
|
+
//angle A
|
|
262
|
+
const angleAInDegrees = randint(minAngle, 180 - 2 * minAngle);
|
|
263
|
+
const angleAInRadians = degreesToRadians(angleAInDegrees, 8);
|
|
264
|
+
//AB and AC
|
|
265
|
+
const [AB, AC] = [0, 1].map(() => isIntSidesAroundAngleA ? randint(5, 15) : randfloat(5, 15, precision));
|
|
266
|
+
//A,B,C
|
|
267
|
+
A = new Point(pointNames[0], randfloat(-5, 6, 1), randfloat(-5, 6, 1));
|
|
268
|
+
B = (() => {
|
|
269
|
+
const pointBRaw = new Point(pointNames[1], add(A.x, AB), A.y);
|
|
270
|
+
return rotatePoint(pointBRaw, angleAInRadians, A, pointBRaw.name, 5);
|
|
271
|
+
})();
|
|
272
|
+
C = new Point(pointNames[2], add(A.x, AC), A.y);
|
|
273
|
+
} while (!anglesAreNice());
|
|
274
|
+
return new Triangle([A, B, C], {
|
|
275
|
+
sidesLengths: [
|
|
276
|
+
round(B.distanceTo(C), 5).toTree(),
|
|
277
|
+
round(A.distanceTo(C), isIntSidesAroundAngleA ? 0 : 1).toTree(),
|
|
278
|
+
round(A.distanceTo(B), isIntSidesAroundAngleA ? 0 : 1).toTree(),
|
|
279
|
+
],
|
|
280
|
+
});
|
|
281
|
+
}
|
|
282
|
+
const pointNames = shuffle(["A", "B", "C"]);
|
|
283
|
+
const triangle = createNiceTriangle(pointNames);
|
|
284
|
+
const indexSide = 0;
|
|
217
285
|
const identifiers = {
|
|
218
286
|
triangleIds: triangle.toIdentifiers(),
|
|
219
287
|
indexSide,
|
|
@@ -229,13 +297,12 @@ const getQuestionFromIdentifiers = (identifiers) => {
|
|
|
229
297
|
identifiers,
|
|
230
298
|
hint: getHint(identifiers),
|
|
231
299
|
correction: getCorrection(identifiers),
|
|
232
|
-
ggbOptions: getGGBOptions(identifiers),
|
|
233
300
|
};
|
|
234
301
|
};
|
|
235
302
|
export const scalarProductAlKashiSideLength = {
|
|
236
303
|
id: "scalarProductAlKashiSideLength",
|
|
237
304
|
connector: "=",
|
|
238
|
-
label: "Connaissant un angle entre deux longueurs, calculer le côté opposé",
|
|
305
|
+
label: "Connaissant un angle entre deux longueurs, calculer le côté opposé grâce au théorème d'Al-Kashi",
|
|
239
306
|
isSingleStep: true,
|
|
240
307
|
generator: (nb, opts) => getDistinctQuestions(() => getScalarProductAlKashiSideLengthQuestion(opts), nb),
|
|
241
308
|
qcmTimer: 60,
|
|
@@ -249,5 +316,4 @@ export const scalarProductAlKashiSideLength = {
|
|
|
249
316
|
hasHintAndCorrection: true,
|
|
250
317
|
getAnswer,
|
|
251
318
|
getQuestionFromIdentifiers,
|
|
252
|
-
hasGeogebra: true,
|
|
253
319
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"scalarProductInOrthonormalBasisIJ.d.ts","sourceRoot":"","sources":["../../../../../../../src/exercises/math/geometry/vectors/scalarProduct/alg/scalarProductInOrthonormalBasisIJ.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAeT,MAAM,6BAA6B,CAAC;AAIrC,OAAO,EAEL,eAAe,EAChB,MAAM,qCAAqC,CAAC;AAQ7C,KAAK,WAAW,GAAG;IACjB,QAAQ,EAAE,eAAe,EAAE,CAAC;IAC5B,QAAQ,EAAE,eAAe,EAAE,CAAC;CAC7B,CAAC;
|
|
1
|
+
{"version":3,"file":"scalarProductInOrthonormalBasisIJ.d.ts","sourceRoot":"","sources":["../../../../../../../src/exercises/math/geometry/vectors/scalarProduct/alg/scalarProductInOrthonormalBasisIJ.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAeT,MAAM,6BAA6B,CAAC;AAIrC,OAAO,EAEL,eAAe,EAChB,MAAM,qCAAqC,CAAC;AAQ7C,KAAK,WAAW,GAAG;IACjB,QAAQ,EAAE,eAAe,EAAE,CAAC;IAC5B,QAAQ,EAAE,eAAe,EAAE,CAAC;CAC7B,CAAC;AAqQF,eAAO,MAAM,iCAAiC,EAAE,QAAQ,CAAC,WAAW,CAsBnE,CAAC"}
|
package/lib/exercises/math/geometry/vectors/scalarProduct/alg/scalarProductInOrthonormalBasisIJ.js
CHANGED
|
@@ -127,6 +127,12 @@ $$
|
|
|
127
127
|
${i} \\cdot ${j} = ${j} \\cdot ${i} = 0
|
|
128
128
|
$$
|
|
129
129
|
|
|
130
|
+
On a :
|
|
131
|
+
|
|
132
|
+
$$
|
|
133
|
+
${i} \\cdot ${i} = ${j} \\cdot ${j} = 1
|
|
134
|
+
$$
|
|
135
|
+
|
|
130
136
|
On peut donc calculer le produit scalaire en utilisant les coordonnées dans la base $(${i},${j})$ de la même manière que lorsque l'on travaille dans la base canonique du plan.
|
|
131
137
|
|
|
132
138
|
${alignTex([
|