math-exercises 3.0.213 → 3.0.215
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/arithmetic/findLeftInHugeNumberDivision.d.ts +9 -0
- package/lib/exercises/math/arithmetic/findLeftInHugeNumberDivision.d.ts.map +1 -0
- package/lib/exercises/math/arithmetic/findLeftInHugeNumberDivision.js +194 -0
- package/lib/exercises/math/arithmetic/findMissingNumberToMakeNumberDivisibleBy9.d.ts +8 -0
- package/lib/exercises/math/arithmetic/findMissingNumberToMakeNumberDivisibleBy9.d.ts.map +1 -0
- package/lib/exercises/math/arithmetic/findMissingNumberToMakeNumberDivisibleBy9.js +121 -0
- package/lib/exercises/math/arithmetic/hasDiophantianEquationSolution.js +4 -4
- package/lib/exercises/math/arithmetic/index.d.ts +7 -0
- package/lib/exercises/math/arithmetic/index.d.ts.map +1 -1
- package/lib/exercises/math/arithmetic/index.js +7 -0
- package/lib/exercises/math/arithmetic/isBigNumberPrime.d.ts +7 -0
- package/lib/exercises/math/arithmetic/isBigNumberPrime.d.ts.map +1 -0
- package/lib/exercises/math/arithmetic/isBigNumberPrime.js +107 -0
- package/lib/exercises/math/arithmetic/numberOfEndingZerosOfBigProduct.d.ts +8 -0
- package/lib/exercises/math/arithmetic/numberOfEndingZerosOfBigProduct.d.ts.map +1 -0
- package/lib/exercises/math/arithmetic/numberOfEndingZerosOfBigProduct.js +139 -0
- package/lib/exercises/math/arithmetic/pgcdFromEuclid.d.ts +8 -0
- package/lib/exercises/math/arithmetic/pgcdFromEuclid.d.ts.map +1 -0
- package/lib/exercises/math/arithmetic/pgcdFromEuclid.js +123 -0
- package/lib/exercises/math/arithmetic/solveDiophantianEquationByUsingPrimality.d.ts +7 -0
- package/lib/exercises/math/arithmetic/solveDiophantianEquationByUsingPrimality.d.ts.map +1 -0
- package/lib/exercises/math/arithmetic/solveDiophantianEquationByUsingPrimality.js +117 -0
- package/lib/exercises/math/arithmetic/whichDayInXDays.d.ts +8 -0
- package/lib/exercises/math/arithmetic/whichDayInXDays.d.ts.map +1 -0
- package/lib/exercises/math/arithmetic/whichDayInXDays.js +81 -0
- package/lib/exercises/math/calcul/fractions/fractionsSumFillInTheBlank.d.ts +15 -0
- package/lib/exercises/math/calcul/fractions/fractionsSumFillInTheBlank.d.ts.map +1 -0
- package/lib/exercises/math/calcul/fractions/fractionsSumFillInTheBlank.js +256 -0
- package/lib/exercises/math/calcul/fractions/index.d.ts +1 -0
- package/lib/exercises/math/calcul/fractions/index.d.ts.map +1 -1
- package/lib/exercises/math/calcul/fractions/index.js +1 -0
- package/lib/exercises/math/calcul/index.d.ts +1 -0
- package/lib/exercises/math/calcul/index.d.ts.map +1 -1
- package/lib/exercises/math/calcul/index.js +1 -0
- package/lib/exercises/math/calcul/mentalCaluls/index.d.ts +3 -0
- package/lib/exercises/math/calcul/mentalCaluls/index.d.ts.map +1 -1
- package/lib/exercises/math/calcul/mentalCaluls/index.js +3 -0
- package/lib/exercises/math/calcul/mentalCaluls/mentalMultiplication101AndFriends.d.ts +10 -0
- package/lib/exercises/math/calcul/mentalCaluls/mentalMultiplication101AndFriends.d.ts.map +1 -0
- package/lib/exercises/math/calcul/mentalCaluls/mentalMultiplication101AndFriends.js +264 -0
- package/lib/exercises/math/calcul/mentalCaluls/mentalMultiplication11AndFriends.d.ts +10 -0
- package/lib/exercises/math/calcul/mentalCaluls/mentalMultiplication11AndFriends.d.ts.map +1 -0
- package/lib/exercises/math/calcul/mentalCaluls/mentalMultiplication11AndFriends.js +264 -0
- package/lib/exercises/math/calcul/mentalCaluls/mentalMultiplicationTable.d.ts +11 -0
- package/lib/exercises/math/calcul/mentalCaluls/mentalMultiplicationTable.d.ts.map +1 -0
- package/lib/exercises/math/calcul/mentalCaluls/mentalMultiplicationTable.js +141 -0
- package/lib/exercises/math/calcul/ratio/index.d.ts +1 -0
- package/lib/exercises/math/calcul/ratio/index.d.ts.map +1 -1
- package/lib/exercises/math/calcul/ratio/index.js +1 -0
- package/lib/exercises/math/calcul/ratio/partsUsingRatio.d.ts +13 -0
- package/lib/exercises/math/calcul/ratio/partsUsingRatio.d.ts.map +1 -0
- package/lib/exercises/math/calcul/ratio/partsUsingRatio.js +237 -0
- package/lib/exercises/math/calcul/relatives/index.d.ts +2 -0
- package/lib/exercises/math/calcul/relatives/index.d.ts.map +1 -0
- package/lib/exercises/math/calcul/relatives/index.js +1 -0
- package/lib/exercises/math/calcul/relatives/relativesAddAndSub.d.ts +17 -0
- package/lib/exercises/math/calcul/relatives/relativesAddAndSub.d.ts.map +1 -0
- package/lib/exercises/math/calcul/relatives/relativesAddAndSub.js +448 -0
- package/lib/exercises/math/calculLitteral/factorisation/factoByXK.d.ts +10 -0
- package/lib/exercises/math/calculLitteral/factorisation/factoByXK.d.ts.map +1 -0
- package/lib/exercises/math/calculLitteral/factorisation/factoByXK.js +190 -0
- package/lib/exercises/math/calculLitteral/factorisation/index.d.ts +1 -0
- package/lib/exercises/math/calculLitteral/factorisation/index.d.ts.map +1 -1
- package/lib/exercises/math/calculLitteral/factorisation/index.js +1 -0
- package/lib/exercises/math/complex/algebraic/addComplex.d.ts +10 -0
- package/lib/exercises/math/complex/algebraic/addComplex.d.ts.map +1 -0
- package/lib/exercises/math/complex/algebraic/addComplex.js +125 -0
- package/lib/exercises/math/complex/algebraic/conjugateComplex.d.ts +8 -0
- package/lib/exercises/math/complex/algebraic/conjugateComplex.d.ts.map +1 -0
- package/lib/exercises/math/complex/algebraic/conjugateComplex.js +105 -0
- package/lib/exercises/math/complex/algebraic/conjugateDivideComplex.d.ts +8 -0
- package/lib/exercises/math/complex/algebraic/conjugateDivideComplex.d.ts.map +1 -0
- package/lib/exercises/math/complex/algebraic/conjugateDivideComplex.js +137 -0
- package/lib/exercises/math/complex/algebraic/conjugateMultiplyComplex.d.ts +8 -0
- package/lib/exercises/math/complex/algebraic/conjugateMultiplyComplex.d.ts.map +1 -0
- package/lib/exercises/math/complex/algebraic/conjugateMultiplyComplex.js +116 -0
- package/lib/exercises/math/complex/algebraic/divideComplex.d.ts +8 -0
- package/lib/exercises/math/complex/algebraic/divideComplex.d.ts.map +1 -0
- package/lib/exercises/math/complex/algebraic/divideComplex.js +128 -0
- package/lib/exercises/math/complex/algebraic/index.d.ts +11 -0
- package/lib/exercises/math/complex/algebraic/index.d.ts.map +1 -0
- package/lib/exercises/math/complex/algebraic/index.js +10 -0
- package/lib/exercises/math/complex/algebraic/inverseComplex.d.ts +8 -0
- package/lib/exercises/math/complex/algebraic/inverseComplex.d.ts.map +1 -0
- package/lib/exercises/math/complex/algebraic/inverseComplex.js +95 -0
- package/lib/exercises/math/complex/algebraic/linearCombinaisonComplex.d.ts +10 -0
- package/lib/exercises/math/complex/algebraic/linearCombinaisonComplex.d.ts.map +1 -0
- package/lib/exercises/math/complex/algebraic/linearCombinaisonComplex.js +105 -0
- package/lib/exercises/math/complex/algebraic/moduloFromAlgebraicComplex.d.ts +8 -0
- package/lib/exercises/math/complex/algebraic/moduloFromAlgebraicComplex.d.ts.map +1 -0
- package/lib/exercises/math/complex/algebraic/moduloFromAlgebraicComplex.js +93 -0
- package/lib/exercises/math/complex/algebraic/mutiplyComplex.d.ts +8 -0
- package/lib/exercises/math/complex/algebraic/mutiplyComplex.d.ts.map +1 -0
- package/lib/exercises/math/complex/algebraic/mutiplyComplex.js +106 -0
- package/lib/exercises/math/complex/algebraic/reAndIm.d.ts +9 -0
- package/lib/exercises/math/complex/algebraic/reAndIm.d.ts.map +1 -0
- package/lib/exercises/math/complex/algebraic/reAndIm.js +92 -0
- package/lib/exercises/math/complex/geometric/complexAlgebraicFromModuloAndArg.d.ts +9 -0
- package/lib/exercises/math/complex/geometric/complexAlgebraicFromModuloAndArg.d.ts.map +1 -0
- package/lib/exercises/math/complex/geometric/complexAlgebraicFromModuloAndArg.js +151 -0
- package/lib/exercises/math/complex/geometric/complexDistance.d.ts +11 -0
- package/lib/exercises/math/complex/geometric/complexDistance.d.ts.map +1 -0
- package/lib/exercises/math/complex/geometric/complexDistance.js +125 -0
- package/lib/exercises/math/complex/geometric/complexGeomAffixAlgFromPoint.d.ts +9 -0
- package/lib/exercises/math/complex/geometric/complexGeomAffixAlgFromPoint.d.ts.map +1 -0
- package/lib/exercises/math/complex/geometric/complexGeomAffixAlgFromPoint.js +326 -0
- package/lib/exercises/math/complex/geometric/complexGeomAffixExpFromCenteredRegularPolygon.d.ts +10 -0
- package/lib/exercises/math/complex/geometric/complexGeomAffixExpFromCenteredRegularPolygon.d.ts.map +1 -0
- package/lib/exercises/math/complex/geometric/complexGeomAffixExpFromCenteredRegularPolygon.js +459 -0
- package/lib/exercises/math/complex/geometric/complexGeomAffixExpFromPoint.d.ts +14 -0
- package/lib/exercises/math/complex/geometric/complexGeomAffixExpFromPoint.d.ts.map +1 -0
- package/lib/exercises/math/complex/geometric/complexGeomAffixExpFromPoint.js +539 -0
- package/lib/exercises/math/complex/geometric/complexGeomAffixTrigFromPoint.d.ts +13 -0
- package/lib/exercises/math/complex/geometric/complexGeomAffixTrigFromPoint.d.ts.map +1 -0
- package/lib/exercises/math/complex/geometric/complexGeomAffixTrigFromPoint.js +485 -0
- package/lib/exercises/math/complex/geometric/complexGeomApproxOfCosArgOrSinArgFromPointAndAffixTrig.d.ts +12 -0
- package/lib/exercises/math/complex/geometric/complexGeomApproxOfCosArgOrSinArgFromPointAndAffixTrig.d.ts.map +1 -0
- package/lib/exercises/math/complex/geometric/complexGeomApproxOfCosArgOrSinArgFromPointAndAffixTrig.js +224 -0
- package/lib/exercises/math/complex/geometric/complexGeomArgumentOfFracCBABFromFigure.d.ts +11 -0
- package/lib/exercises/math/complex/geometric/complexGeomArgumentOfFracCBABFromFigure.d.ts.map +1 -0
- package/lib/exercises/math/complex/geometric/complexGeomArgumentOfFracCBABFromFigure.js +448 -0
- package/lib/exercises/math/complex/geometric/complexGeomFindPointFromAffixExp.d.ts +11 -0
- package/lib/exercises/math/complex/geometric/complexGeomFindPointFromAffixExp.d.ts.map +1 -0
- package/lib/exercises/math/complex/geometric/complexGeomFindPointFromAffixExp.js +223 -0
- package/lib/exercises/math/complex/geometric/complexGeomFindPointFromPowerOfUnitRootFromFigure.d.ts +11 -0
- package/lib/exercises/math/complex/geometric/complexGeomFindPointFromPowerOfUnitRootFromFigure.d.ts.map +1 -0
- package/lib/exercises/math/complex/geometric/complexGeomFindPointFromPowerOfUnitRootFromFigure.js +348 -0
- package/lib/exercises/math/complex/geometric/complexGeomPlaceAffixPoint.d.ts +8 -0
- package/lib/exercises/math/complex/geometric/complexGeomPlaceAffixPoint.d.ts.map +1 -0
- package/lib/exercises/math/complex/geometric/complexGeomPlaceAffixPoint.js +86 -0
- package/lib/exercises/math/complex/geometric/complexGeomPlacePointFromZAPlusZ.d.ts +11 -0
- package/lib/exercises/math/complex/geometric/complexGeomPlacePointFromZAPlusZ.d.ts.map +1 -0
- package/lib/exercises/math/complex/geometric/complexGeomPlacePointFromZAPlusZ.js +311 -0
- package/lib/exercises/math/complex/geometric/complexGeomPlacePointFromZATimesZ.d.ts +11 -0
- package/lib/exercises/math/complex/geometric/complexGeomPlacePointFromZATimesZ.d.ts.map +1 -0
- package/lib/exercises/math/complex/geometric/complexGeomPlacePointFromZATimesZ.js +345 -0
- package/lib/exercises/math/complex/geometric/complexGeomPlacePointFromZATransformed.d.ts +16 -0
- package/lib/exercises/math/complex/geometric/complexGeomPlacePointFromZATransformed.d.ts.map +1 -0
- package/lib/exercises/math/complex/geometric/complexGeomPlacePointFromZATransformed.js +729 -0
- package/lib/exercises/math/complex/geometric/complexGeomPlacePointWithAffixInU.d.ts +11 -0
- package/lib/exercises/math/complex/geometric/complexGeomPlacePointWithAffixInU.d.ts.map +1 -0
- package/lib/exercises/math/complex/geometric/complexGeomPlacePointWithAffixInU.js +253 -0
- package/lib/exercises/math/complex/geometric/index.d.ts +12 -0
- package/lib/exercises/math/complex/geometric/index.d.ts.map +1 -0
- package/lib/exercises/math/complex/geometric/index.js +19 -0
- package/lib/exercises/math/complex/index.d.ts +4 -10
- package/lib/exercises/math/complex/index.d.ts.map +1 -1
- package/lib/exercises/math/complex/index.js +4 -11
- package/lib/exercises/math/complex/polynomials/factorizePolynomialInC.d.ts +10 -0
- package/lib/exercises/math/complex/polynomials/factorizePolynomialInC.d.ts.map +1 -0
- package/lib/exercises/math/complex/polynomials/factorizePolynomialInC.js +176 -0
- package/lib/exercises/math/complex/polynomials/index.d.ts +4 -0
- package/lib/exercises/math/complex/polynomials/index.d.ts.map +1 -0
- package/lib/exercises/math/complex/polynomials/index.js +3 -0
- package/lib/exercises/math/complex/polynomials/solveSecondDegreeInComplex.d.ts +10 -0
- package/lib/exercises/math/complex/polynomials/solveSecondDegreeInComplex.d.ts.map +1 -0
- package/lib/exercises/math/complex/polynomials/solveSecondDegreeInComplex.js +190 -0
- package/lib/exercises/math/complex/polynomials/solveZSquareEqualsA.d.ts +11 -0
- package/lib/exercises/math/complex/polynomials/solveZSquareEqualsA.d.ts.map +1 -0
- package/lib/exercises/math/complex/polynomials/solveZSquareEqualsA.js +158 -0
- package/lib/exercises/math/complex/unitRoots/giveNUnitRoot.d.ts +7 -0
- package/lib/exercises/math/complex/unitRoots/giveNUnitRoot.d.ts.map +1 -0
- package/lib/exercises/math/complex/unitRoots/giveNUnitRoot.js +122 -0
- package/lib/exercises/math/complex/unitRoots/giveOneSolutionToComplexPowNEqualsOne.d.ts +8 -0
- package/lib/exercises/math/complex/unitRoots/giveOneSolutionToComplexPowNEqualsOne.d.ts.map +1 -0
- package/lib/exercises/math/complex/unitRoots/giveOneSolutionToComplexPowNEqualsOne.js +138 -0
- package/lib/exercises/math/complex/unitRoots/index.d.ts +3 -0
- package/lib/exercises/math/complex/unitRoots/index.d.ts.map +1 -0
- package/lib/exercises/math/complex/unitRoots/index.js +2 -0
- package/lib/exercises/math/conversion/clock/clockReading.d.ts +12 -0
- package/lib/exercises/math/conversion/clock/clockReading.d.ts.map +1 -0
- package/lib/exercises/math/conversion/clock/clockReading.js +385 -0
- package/lib/exercises/math/conversion/clock/clockReadingPlusTimeOperation.d.ts +2 -0
- package/lib/exercises/math/conversion/clock/clockReadingPlusTimeOperation.d.ts.map +1 -0
- package/lib/exercises/math/conversion/clock/clockReadingPlusTimeOperation.js +521 -0
- package/lib/exercises/math/conversion/clock/clockWritingByManipulatingNeedles.d.ts +2 -0
- package/lib/exercises/math/conversion/clock/clockWritingByManipulatingNeedles.d.ts.map +1 -0
- package/lib/exercises/math/conversion/clock/clockWritingByManipulatingNeedles.js +359 -0
- package/lib/exercises/math/conversion/clock/dateTimeOperationAdd.d.ts +16 -0
- package/lib/exercises/math/conversion/clock/dateTimeOperationAdd.d.ts.map +1 -0
- package/lib/exercises/math/conversion/clock/dateTimeOperationAdd.js +319 -0
- package/lib/exercises/math/conversion/clock/index.d.ts +3 -0
- package/lib/exercises/math/conversion/clock/index.d.ts.map +1 -0
- package/lib/exercises/math/conversion/clock/index.js +4 -0
- package/lib/exercises/math/conversion/index.d.ts +1 -0
- package/lib/exercises/math/conversion/index.d.ts.map +1 -1
- package/lib/exercises/math/conversion/index.js +1 -0
- package/lib/exercises/math/geometry/angles/angleNatureFromFigure.d.ts +11 -0
- package/lib/exercises/math/geometry/angles/angleNatureFromFigure.d.ts.map +1 -0
- package/lib/exercises/math/geometry/angles/angleNatureFromFigure.js +233 -0
- package/lib/exercises/math/geometry/angles/angleNatureFromMeasure.d.ts +10 -0
- package/lib/exercises/math/geometry/angles/angleNatureFromMeasure.d.ts.map +1 -0
- package/lib/exercises/math/geometry/angles/angleNatureFromMeasure.js +137 -0
- package/lib/exercises/math/geometry/angles/index.d.ts +2 -0
- package/lib/exercises/math/geometry/angles/index.d.ts.map +1 -1
- package/lib/exercises/math/geometry/angles/index.js +2 -0
- package/lib/exercises/math/geometry/circles/buildCircleFromRadius.d.ts +9 -0
- package/lib/exercises/math/geometry/circles/buildCircleFromRadius.d.ts.map +1 -0
- package/lib/exercises/math/geometry/circles/buildCircleFromRadius.js +187 -0
- package/lib/exercises/math/geometry/circles/index.d.ts +1 -0
- package/lib/exercises/math/geometry/circles/index.d.ts.map +1 -1
- package/lib/exercises/math/geometry/circles/index.js +1 -0
- package/lib/exercises/math/geometry/lines/buildParallelFromLineAndPoint.d.ts +11 -0
- package/lib/exercises/math/geometry/lines/buildParallelFromLineAndPoint.d.ts.map +1 -0
- package/lib/exercises/math/geometry/lines/buildParallelFromLineAndPoint.js +154 -0
- package/lib/exercises/math/geometry/lines/buildPerpendicularFromLineAndPoint.d.ts +11 -0
- package/lib/exercises/math/geometry/lines/buildPerpendicularFromLineAndPoint.d.ts.map +1 -0
- package/lib/exercises/math/geometry/lines/buildPerpendicularFromLineAndPoint.js +157 -0
- package/lib/exercises/math/geometry/lines/index.d.ts +2 -0
- package/lib/exercises/math/geometry/lines/index.d.ts.map +1 -1
- package/lib/exercises/math/geometry/lines/index.js +2 -0
- package/lib/exercises/math/geometry/triangles/index.d.ts +2 -0
- package/lib/exercises/math/geometry/triangles/index.d.ts.map +1 -1
- package/lib/exercises/math/geometry/triangles/index.js +2 -1
- package/lib/exercises/math/geometry/triangles/traceHeightInTriangle.d.ts +13 -0
- package/lib/exercises/math/geometry/triangles/traceHeightInTriangle.d.ts.map +1 -0
- package/lib/exercises/math/geometry/triangles/traceHeightInTriangle.js +271 -0
- package/lib/exercises/math/geometry/triangles/traceMedianInTriangle.d.ts +8 -0
- package/lib/exercises/math/geometry/triangles/traceMedianInTriangle.d.ts.map +1 -1
- package/lib/exercises/math/geometry/triangles/traceMedianInTriangle.js +284 -53
- package/lib/exercises/math/geometry/vectors/constructions/index.d.ts +1 -0
- package/lib/exercises/math/geometry/vectors/constructions/index.d.ts.map +1 -1
- package/lib/exercises/math/geometry/vectors/constructions/index.js +1 -0
- package/lib/exercises/math/geometry/vectors/constructions/traceVectorSumFromVecs.d.ts +8 -0
- package/lib/exercises/math/geometry/vectors/constructions/traceVectorSumFromVecs.d.ts.map +1 -0
- package/lib/exercises/math/geometry/vectors/constructions/traceVectorSumFromVecs.js +165 -0
- package/lib/exercises/math/geometry/volumes/index.d.ts +1 -0
- package/lib/exercises/math/geometry/volumes/index.d.ts.map +1 -1
- package/lib/exercises/math/geometry/volumes/index.js +1 -0
- package/lib/exercises/math/geometry/volumes/volumeOfCylinder.d.ts +8 -0
- package/lib/exercises/math/geometry/volumes/volumeOfCylinder.d.ts.map +1 -0
- package/lib/exercises/math/geometry/volumes/volumeOfCylinder.js +157 -0
- package/lib/exercises/math/spaceGeometry/basis/index.d.ts +1 -0
- package/lib/exercises/math/spaceGeometry/basis/index.d.ts.map +1 -1
- package/lib/exercises/math/spaceGeometry/basis/index.js +1 -0
- package/lib/exercises/math/spaceGeometry/basis/spaceSegmentLengthInRectangularPrism.d.ts +18 -0
- package/lib/exercises/math/spaceGeometry/basis/spaceSegmentLengthInRectangularPrism.d.ts.map +1 -0
- package/lib/exercises/math/spaceGeometry/basis/spaceSegmentLengthInRectangularPrism.js +538 -0
- package/lib/exercises/math/trigonometry/formulas/trigoAdditionFormulaUsage.d.ts.map +1 -1
- package/lib/exercises/math/trigonometry/formulas/trigoAdditionFormulaUsage.js +6 -5
- package/lib/exercises/math/trigonometry/triangle/trigonometrySohcahtoaCalcul.js +1 -1
- package/lib/exercises/utils/geogebra/toolBarConstructor.d.ts +1 -0
- package/lib/exercises/utils/geogebra/toolBarConstructor.d.ts.map +1 -1
- package/lib/exercises/utils/geogebra/toolBarConstructor.js +2 -0
- package/lib/geogebra/parsers/geogebraParser.d.ts +3 -0
- package/lib/geogebra/parsers/geogebraParser.d.ts.map +1 -1
- package/lib/geogebra/parsers/geogebraParser.js +27 -0
- package/lib/index.d.ts +213 -23
- package/lib/index.d.ts.map +1 -1
- package/lib/latexTester.js +2 -0
- package/lib/math/geometry/angle.d.ts.map +1 -1
- package/lib/math/geometry/angle.js +3 -0
- package/lib/math/geometry/segment.d.ts +1 -1
- package/lib/math/geometry/segment.d.ts.map +1 -1
- package/lib/math/geometry/segment.js +5 -2
- package/lib/math/utils/geometry/angleBetweenPoints.d.ts +4 -0
- package/lib/math/utils/geometry/angleBetweenPoints.d.ts.map +1 -0
- package/lib/math/utils/geometry/angleBetweenPoints.js +58 -0
- package/lib/math/utils/geometry/angleNWSE.d.ts +3 -0
- package/lib/math/utils/geometry/angleNWSE.d.ts.map +1 -0
- package/lib/math/utils/geometry/angleNWSE.js +56 -0
- package/lib/tests/singleExo.test.d.ts.map +1 -1
- package/lib/tests/singleExo.test.js +2 -2
- package/lib/utils/strings/frenchDays.d.ts +2 -0
- package/lib/utils/strings/frenchDays.d.ts.map +1 -0
- package/lib/utils/strings/frenchDays.js +9 -0
- package/package.json +1 -1
|
@@ -0,0 +1,448 @@
|
|
|
1
|
+
import { getDistinctQuestions } from "../../../../exercises/utils/getDistinctQuestions.js";
|
|
2
|
+
import { defaultArrayedOptsWhereNeeded } from "../../../../exercises/utils/options/arrayedOptions.js";
|
|
3
|
+
import { randint } from "../../../../math/utils/random/randint.js";
|
|
4
|
+
import { isOppositeNode } from "../../../../tree/nodes/functions/oppositeNode.js";
|
|
5
|
+
import { isNumberNode } from "../../../../tree/nodes/numbers/numberNode.js";
|
|
6
|
+
import { add } from "../../../../tree/nodes/operators/addNode.js";
|
|
7
|
+
import { substract } from "../../../../tree/nodes/operators/substractNode.js";
|
|
8
|
+
import { parseAlgebraic } from "../../../../tree/parsers/latexParser.js";
|
|
9
|
+
import { NodeComparator } from "../../../../tree/utilities/nodeComparator.js";
|
|
10
|
+
import { random } from "../../../../utils/alea/random.js";
|
|
11
|
+
import { alignTex } from "../../../../utils/latex/alignTex.js";
|
|
12
|
+
import { GeneratorOptionTarget, GeneratorOptionType, addValidProp, propWhile, shuffleProps, tryToAddWrongProp, } from "../../../exercise.js";
|
|
13
|
+
const getStatementNode = (identifiers) => {
|
|
14
|
+
const { a, b, opType } = identifiers;
|
|
15
|
+
switch (opType) {
|
|
16
|
+
case "addition": {
|
|
17
|
+
return add(a, b);
|
|
18
|
+
}
|
|
19
|
+
case "soustraction": {
|
|
20
|
+
return substract(a, b);
|
|
21
|
+
}
|
|
22
|
+
default:
|
|
23
|
+
throw new Error("Unsupported opType: " + opType);
|
|
24
|
+
}
|
|
25
|
+
};
|
|
26
|
+
const getStartStatement = (identifiers) => {
|
|
27
|
+
const { explicitWriting } = identifiers;
|
|
28
|
+
return getStatementNode(identifiers).toTex({
|
|
29
|
+
explicitNumberWriting: explicitWriting,
|
|
30
|
+
});
|
|
31
|
+
};
|
|
32
|
+
const getInstruction = (identifiers, opts) => {
|
|
33
|
+
return `Calculer :
|
|
34
|
+
|
|
35
|
+
$$
|
|
36
|
+
${getStartStatement(identifiers, opts)}
|
|
37
|
+
$$`;
|
|
38
|
+
};
|
|
39
|
+
const getAnswer = (identifiers) => {
|
|
40
|
+
const { explicitWriting } = identifiers;
|
|
41
|
+
const nodeInstruction = getStatementNode(identifiers);
|
|
42
|
+
return nodeInstruction
|
|
43
|
+
.simplify({ towardsDistribute: true })
|
|
44
|
+
.toTex({ explicitNumberWriting: explicitWriting });
|
|
45
|
+
};
|
|
46
|
+
const getHint = (identifiers) => {
|
|
47
|
+
const { a, b, opType } = identifiers;
|
|
48
|
+
const [texA, texB] = [a, b].map((v) => v.toTree().toTex({ explicitNumberWriting: true }));
|
|
49
|
+
switch (opType) {
|
|
50
|
+
case "addition": {
|
|
51
|
+
if (a > 0 && b > 0) {
|
|
52
|
+
return `Les nombres $${texA}$ et $${texB}$ sont tous les deux positifs.
|
|
53
|
+
Tu peux effectuer l'opération comme avec des entiers naturels, puisque $${texA}=${a}$ et que $${texB}=${b}$.`;
|
|
54
|
+
}
|
|
55
|
+
else if (a < 0 && b < 0) {
|
|
56
|
+
return `Les nombres $${texA}$ et $${texB}$ sont tous les deux négatifs.
|
|
57
|
+
Quand on ajoute un nombre négatif à un nombre négatif, le résultat est davantage négatif.
|
|
58
|
+
Exemple :
|
|
59
|
+
|
|
60
|
+
$$
|
|
61
|
+
(-10) \\ + \\ (-6) \\ = \\ (-16)
|
|
62
|
+
$$
|
|
63
|
+
|
|
64
|
+
`;
|
|
65
|
+
}
|
|
66
|
+
else if (a < 0 && b > 0) {
|
|
67
|
+
const [vAbsA, vAbsB] = [a, b].map((v) => Math.abs(v));
|
|
68
|
+
if (vAbsA > vAbsB) {
|
|
69
|
+
return `Les nombres $${texA}$ et $${texB}$ sont de signes différents.
|
|
70
|
+
$${vAbsA} > ${vAbsB}$ donc le résultat sera négatif.`;
|
|
71
|
+
}
|
|
72
|
+
else if (vAbsA < vAbsB) {
|
|
73
|
+
return `Les nombres $${texA}$ et $${texB}$ sont de signes différents.
|
|
74
|
+
$${vAbsA} < ${vAbsB}$ donc le résultat sera positif.`;
|
|
75
|
+
}
|
|
76
|
+
else {
|
|
77
|
+
return `La somme d'un nombre et de son opposé vaut $0$.`;
|
|
78
|
+
}
|
|
79
|
+
// } else if (a > 0 && b < 0) {
|
|
80
|
+
}
|
|
81
|
+
else {
|
|
82
|
+
const [vAbsA, vAbsB] = [a, b].map((v) => Math.abs(v));
|
|
83
|
+
if (vAbsA > vAbsB) {
|
|
84
|
+
return `Les nombres $${texA}$ et $${texB}$ sont de signes différents.
|
|
85
|
+
$${vAbsA} > ${vAbsB}$ donc le résultat sera positif.`;
|
|
86
|
+
}
|
|
87
|
+
else if (vAbsA < vAbsB) {
|
|
88
|
+
return `Les nombres $${texA}$ et $${texB}$ sont de signes différents.
|
|
89
|
+
$${vAbsA} < ${vAbsB}$ donc le résultat sera négatif.`;
|
|
90
|
+
}
|
|
91
|
+
else {
|
|
92
|
+
return `La somme d'un nombre et de son opposé vaut $0$.`;
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
case "soustraction": {
|
|
97
|
+
if (a > 0 && b > 0) {
|
|
98
|
+
if (a > b) {
|
|
99
|
+
return `Les nombres $${texA}$ et $${texB}$ sont tous les deux positifs.
|
|
100
|
+
Tu peux effectuer l'opération comme avec des entiers naturels, puisque $${texA}=${a}$, que $${texB}=${b}$ et que $${a}>${b}$.`;
|
|
101
|
+
}
|
|
102
|
+
else {
|
|
103
|
+
return `Les nombres $${texA}$ et $${texB}$ sont tous les deux positifs.
|
|
104
|
+
On a $${texA}=${a}$, que $${texB}=${b}$ et que $${a}<${b}$. Le résultat sera donc négatif.
|
|
105
|
+
Utilise le fait que $${b} = ${a} + ${b - a}$ pour trouver le résultat.`;
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
else if (a < 0 && b < 0) {
|
|
109
|
+
const [vAbsA, vAbsB] = [a, b].map((v) => Math.abs(v));
|
|
110
|
+
if (vAbsA > vAbsB) {
|
|
111
|
+
return `Les nombres $${texA}$ et $${texB}$ sont tous les deux négatifs.
|
|
112
|
+
On a $${vAbsA}>${vAbsB}$. Le résultat sera donc négatif (comme $${texA}$), mais sa valeur absolue sera moins grande que $${vAbsA}$.
|
|
113
|
+
|
|
114
|
+
Voici un exemple :
|
|
115
|
+
$$
|
|
116
|
+
(-16) \\ - \\ (-6) \\ = \\ (-10)
|
|
117
|
+
$$
|
|
118
|
+
|
|
119
|
+
`;
|
|
120
|
+
}
|
|
121
|
+
else {
|
|
122
|
+
return `Les nombres $${texA}$ et $${texB}$ sont tous les deux négatifs.
|
|
123
|
+
On a $${vAbsA}<${vAbsB}$. Le résultat sera donc positif.
|
|
124
|
+
|
|
125
|
+
Voici un exemple :
|
|
126
|
+
$$
|
|
127
|
+
(-10) \\ - \\ (-16) \\ = \\ (+6)
|
|
128
|
+
$$
|
|
129
|
+
|
|
130
|
+
`;
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
else {
|
|
134
|
+
return `Soustraire un nombre, c'est ajouter son opposé.
|
|
135
|
+
Autrement dit, soustraire $${b}$, c'est ajouter $${-b}$.`;
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
default:
|
|
139
|
+
throw new Error("Unsupported opType: " + opType);
|
|
140
|
+
}
|
|
141
|
+
};
|
|
142
|
+
const getCorrection = (identifiers) => {
|
|
143
|
+
const { a, b, opType, explicitWriting } = identifiers;
|
|
144
|
+
const [texA, texB] = [a, b].map((v) => v.toTree().toTex({ explicitNumberWriting: true }));
|
|
145
|
+
return `${(() => {
|
|
146
|
+
switch (opType) {
|
|
147
|
+
case "addition": {
|
|
148
|
+
if (a > 0 && b > 0) {
|
|
149
|
+
return `Les nombres $${texA}$ et $${texB}$ sont tous les deux positifs.
|
|
150
|
+
On peut effectuer l'opération comme avec des entiers naturels, puisque $${texA}=${a}$ et que $${texB}=${b}$.
|
|
151
|
+
|
|
152
|
+
$$
|
|
153
|
+
${getStatementNode(identifiers).toTex({
|
|
154
|
+
explicitNumberWriting: explicitWriting,
|
|
155
|
+
})} = ${getAnswer(identifiers)}
|
|
156
|
+
$$
|
|
157
|
+
|
|
158
|
+
`;
|
|
159
|
+
}
|
|
160
|
+
else if (a < 0 && b < 0) {
|
|
161
|
+
return `Les nombres $${texA}$ et $${texB}$ sont tous les deux négatifs.
|
|
162
|
+
Quand on ajoute un nombre négatif à un nombre négatif, le résultat est davantage négatif.
|
|
163
|
+
|
|
164
|
+
$$
|
|
165
|
+
${getStatementNode(identifiers).toTex({
|
|
166
|
+
explicitNumberWriting: explicitWriting,
|
|
167
|
+
})} = ${getAnswer(identifiers)}
|
|
168
|
+
$$
|
|
169
|
+
|
|
170
|
+
`;
|
|
171
|
+
}
|
|
172
|
+
else if (a < 0 && b > 0) {
|
|
173
|
+
const [vAbsA, vAbsB] = [a, b].map((v) => Math.abs(v));
|
|
174
|
+
if (vAbsA > vAbsB) {
|
|
175
|
+
return `Les nombres $${texA}$ et $${texB}$ sont de signes différents.
|
|
176
|
+
$${vAbsA} > ${vAbsB}$ donc le résultat sera négatif.
|
|
177
|
+
|
|
178
|
+
$$
|
|
179
|
+
${getStatementNode(identifiers).toTex({
|
|
180
|
+
explicitNumberWriting: explicitWriting,
|
|
181
|
+
})} = ${getAnswer(identifiers)}
|
|
182
|
+
$$
|
|
183
|
+
|
|
184
|
+
`;
|
|
185
|
+
}
|
|
186
|
+
else if (vAbsA < vAbsB) {
|
|
187
|
+
return `Les nombres $${texA}$ et $${texB}$ sont de signes différents.
|
|
188
|
+
$${vAbsA} < ${vAbsB}$ donc le résultat sera positif.
|
|
189
|
+
|
|
190
|
+
$$
|
|
191
|
+
${getStatementNode(identifiers).toTex({
|
|
192
|
+
explicitNumberWriting: explicitWriting,
|
|
193
|
+
})} = ${getAnswer(identifiers)}
|
|
194
|
+
$$
|
|
195
|
+
|
|
196
|
+
`;
|
|
197
|
+
}
|
|
198
|
+
else {
|
|
199
|
+
return `La somme d'un nombre et de son opposé vaut $0$.
|
|
200
|
+
|
|
201
|
+
$$
|
|
202
|
+
${getStatementNode(identifiers).toTex({
|
|
203
|
+
explicitNumberWriting: explicitWriting,
|
|
204
|
+
})} = ${getAnswer(identifiers)}
|
|
205
|
+
$$
|
|
206
|
+
|
|
207
|
+
`;
|
|
208
|
+
}
|
|
209
|
+
// } else if (a > 0 && b < 0) {
|
|
210
|
+
}
|
|
211
|
+
else {
|
|
212
|
+
const [vAbsA, vAbsB] = [a, b].map((v) => Math.abs(v));
|
|
213
|
+
if (vAbsA > vAbsB) {
|
|
214
|
+
return `Les nombres $${texA}$ et $${texB}$ sont de signes différents.
|
|
215
|
+
$${vAbsA} > ${vAbsB}$ donc le résultat sera positif.
|
|
216
|
+
|
|
217
|
+
$$
|
|
218
|
+
${getStatementNode(identifiers).toTex({
|
|
219
|
+
explicitNumberWriting: explicitWriting,
|
|
220
|
+
})} = ${getAnswer(identifiers)}
|
|
221
|
+
$$
|
|
222
|
+
|
|
223
|
+
`;
|
|
224
|
+
}
|
|
225
|
+
else if (vAbsA < vAbsB) {
|
|
226
|
+
return `Les nombres $${texA}$ et $${texB}$ sont de signes différents.
|
|
227
|
+
$${vAbsA} < ${vAbsB}$ donc le résultat sera négatif.
|
|
228
|
+
|
|
229
|
+
$$
|
|
230
|
+
${getStatementNode(identifiers).toTex({
|
|
231
|
+
explicitNumberWriting: explicitWriting,
|
|
232
|
+
})} = ${getAnswer(identifiers)}
|
|
233
|
+
$$
|
|
234
|
+
|
|
235
|
+
`;
|
|
236
|
+
}
|
|
237
|
+
else {
|
|
238
|
+
return `La somme d'un nombre et de son opposé vaut $0$.
|
|
239
|
+
|
|
240
|
+
$$
|
|
241
|
+
${getStatementNode(identifiers).toTex({
|
|
242
|
+
explicitNumberWriting: explicitWriting,
|
|
243
|
+
})} = ${getAnswer(identifiers)}
|
|
244
|
+
$$
|
|
245
|
+
|
|
246
|
+
`;
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
case "soustraction": {
|
|
251
|
+
if (a > 0 && b > 0) {
|
|
252
|
+
if (a > b) {
|
|
253
|
+
return `Les nombres $${texA}$ et $${texB}$ sont tous les deux positifs.
|
|
254
|
+
On peut effectuer l'opération comme avec des entiers naturels, puisque $${texA}=${a}$, que $${texB}=${b}$ et que $${a}>${b}$.
|
|
255
|
+
|
|
256
|
+
$$
|
|
257
|
+
${getStatementNode(identifiers).toTex({
|
|
258
|
+
explicitNumberWriting: explicitWriting,
|
|
259
|
+
})} = ${getAnswer(identifiers)}
|
|
260
|
+
$$
|
|
261
|
+
|
|
262
|
+
`;
|
|
263
|
+
}
|
|
264
|
+
else {
|
|
265
|
+
return `Les nombres $${texA}$ et $${texB}$ sont tous les deux positifs.
|
|
266
|
+
On a $${texA}=${a}$, que $${texB}=${b}$ et que $${a}<${b}$. Le résultat sera donc négatif.
|
|
267
|
+
On utilise le fait que $${b} = ${a} + ${b - a}$ pour trouver le résultat :
|
|
268
|
+
|
|
269
|
+
$$
|
|
270
|
+
${getStatementNode(identifiers).toTex({
|
|
271
|
+
explicitNumberWriting: explicitWriting,
|
|
272
|
+
})} = ${getAnswer(identifiers)}
|
|
273
|
+
$$
|
|
274
|
+
|
|
275
|
+
`;
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
else if (a < 0 && b < 0) {
|
|
279
|
+
const [vAbsA, vAbsB] = [a, b].map((v) => Math.abs(v));
|
|
280
|
+
if (vAbsA > vAbsB) {
|
|
281
|
+
return `Les nombres $${texA}$ et $${texB}$ sont tous les deux négatifs.
|
|
282
|
+
On a $${vAbsA}>${vAbsB}$. Le résultat sera donc négatif (comme $${texA}$), mais sa valeur absolue sera moins grande que $${vAbsA}$.
|
|
283
|
+
|
|
284
|
+
$$
|
|
285
|
+
${getStatementNode(identifiers).toTex({
|
|
286
|
+
explicitNumberWriting: explicitWriting,
|
|
287
|
+
})} = ${getAnswer(identifiers)}
|
|
288
|
+
$$
|
|
289
|
+
|
|
290
|
+
`;
|
|
291
|
+
}
|
|
292
|
+
else {
|
|
293
|
+
return `Les nombres $${texA}$ et $${texB}$ sont tous les deux négatifs.
|
|
294
|
+
On a $${vAbsA}<${vAbsB}$. Le résultat sera donc positif.
|
|
295
|
+
|
|
296
|
+
$$
|
|
297
|
+
${getStatementNode(identifiers).toTex({
|
|
298
|
+
explicitNumberWriting: explicitWriting,
|
|
299
|
+
})} = ${getAnswer(identifiers)}
|
|
300
|
+
$$
|
|
301
|
+
|
|
302
|
+
`;
|
|
303
|
+
}
|
|
304
|
+
}
|
|
305
|
+
else {
|
|
306
|
+
return `Soustraire un nombre, c'est ajouter son opposé.
|
|
307
|
+
Autrement dit, soustraire $${b}$, c'est ajouter $${-b}$.
|
|
308
|
+
|
|
309
|
+
${alignTex([
|
|
310
|
+
[
|
|
311
|
+
getStatementNode(identifiers).toTex({
|
|
312
|
+
explicitNumberWriting: explicitWriting,
|
|
313
|
+
}),
|
|
314
|
+
"=",
|
|
315
|
+
getStatementNode({ ...identifiers, opType: "addition", b: -b }).toTex({
|
|
316
|
+
explicitNumberWriting: true,
|
|
317
|
+
}),
|
|
318
|
+
],
|
|
319
|
+
["", "=", getAnswer(identifiers)],
|
|
320
|
+
])}
|
|
321
|
+
|
|
322
|
+
`;
|
|
323
|
+
}
|
|
324
|
+
}
|
|
325
|
+
default:
|
|
326
|
+
throw new Error("Unsupported opType: " + opType);
|
|
327
|
+
}
|
|
328
|
+
})()}`;
|
|
329
|
+
};
|
|
330
|
+
const getPropositions = (n, { answer, ...identifiers }) => {
|
|
331
|
+
const propositions = [];
|
|
332
|
+
addValidProp(propositions, answer);
|
|
333
|
+
//student: add <-> sub
|
|
334
|
+
{
|
|
335
|
+
const { opType } = identifiers;
|
|
336
|
+
const opTypeWrong = opType === "addition" ? "soustraction" : "addition";
|
|
337
|
+
const identifiersWrong = {
|
|
338
|
+
...identifiers,
|
|
339
|
+
opType: opTypeWrong,
|
|
340
|
+
};
|
|
341
|
+
tryToAddWrongProp(propositions, getAnswer(identifiersWrong));
|
|
342
|
+
}
|
|
343
|
+
//student: a -> |a|, b -> |b|
|
|
344
|
+
{
|
|
345
|
+
const { a, b } = identifiers;
|
|
346
|
+
const aWrong = Math.abs(a);
|
|
347
|
+
const bWrong = Math.abs(b);
|
|
348
|
+
const identifiersWrong = {
|
|
349
|
+
...identifiers,
|
|
350
|
+
a: aWrong,
|
|
351
|
+
b: bWrong,
|
|
352
|
+
};
|
|
353
|
+
tryToAddWrongProp(propositions, getAnswer(identifiersWrong));
|
|
354
|
+
}
|
|
355
|
+
propWhile(propositions, n, () => {
|
|
356
|
+
const { explicitWriting } = identifiers;
|
|
357
|
+
const randomOffset = randint(-9, 10, [0]);
|
|
358
|
+
const wrongAnswer = parseAlgebraic(answer).evaluate() + randomOffset;
|
|
359
|
+
tryToAddWrongProp(propositions, wrongAnswer.toTree().toTex({ explicitNumberWriting: explicitWriting }));
|
|
360
|
+
});
|
|
361
|
+
return shuffleProps(propositions, n);
|
|
362
|
+
};
|
|
363
|
+
const isAnswerValid = (ans, { answer }) => {
|
|
364
|
+
if (ans === answer) {
|
|
365
|
+
return true;
|
|
366
|
+
}
|
|
367
|
+
else {
|
|
368
|
+
const nodeAns = parseAlgebraic(ans);
|
|
369
|
+
const isCandidateAns = (nodeAns) => {
|
|
370
|
+
return (isNumberNode(nodeAns) ||
|
|
371
|
+
(isOppositeNode(nodeAns) && isNumberNode(nodeAns.child)));
|
|
372
|
+
};
|
|
373
|
+
if (!isCandidateAns(nodeAns)) {
|
|
374
|
+
return false;
|
|
375
|
+
}
|
|
376
|
+
const nodeAnswer = parseAlgebraic(answer);
|
|
377
|
+
return NodeComparator.isEqualViaSub(nodeAns, nodeAnswer);
|
|
378
|
+
}
|
|
379
|
+
};
|
|
380
|
+
const getRelativesAddAndSubQuestion = (optsIn) => {
|
|
381
|
+
const arrayedOpts = defaultArrayedOptsWhereNeeded(optsIn, arrayedOptsDefault);
|
|
382
|
+
const opts = {
|
|
383
|
+
...(optsIn ?? optsDefault),
|
|
384
|
+
opType: random(arrayedOpts.opType),
|
|
385
|
+
};
|
|
386
|
+
const explicitWriting = opts.explicitWriting === "Explicite (parenthèses autour de chaque nombre)";
|
|
387
|
+
const a = randint(-9, 10, [0]);
|
|
388
|
+
const b = !explicitWriting && opts.opType === "addition"
|
|
389
|
+
? randint(1, 10, [0])
|
|
390
|
+
: randint(-9, 10, [0]);
|
|
391
|
+
const identifiers = { a, b, opType: opts.opType, explicitWriting };
|
|
392
|
+
return getQuestionFromIdentifiers(identifiers, opts);
|
|
393
|
+
};
|
|
394
|
+
const getQuestionFromIdentifiers = (identifiers, opts) => {
|
|
395
|
+
const question = {
|
|
396
|
+
instruction: getInstruction(identifiers, opts),
|
|
397
|
+
startStatement: getStartStatement(identifiers, opts),
|
|
398
|
+
answer: getAnswer(identifiers, opts),
|
|
399
|
+
keys: [],
|
|
400
|
+
answerFormat: "tex",
|
|
401
|
+
identifiers,
|
|
402
|
+
hint: getHint(identifiers),
|
|
403
|
+
correction: getCorrection(identifiers),
|
|
404
|
+
};
|
|
405
|
+
return question;
|
|
406
|
+
};
|
|
407
|
+
const optsDefault = {
|
|
408
|
+
explicitWriting: "Explicite (parenthèses autour de chaque nombre)",
|
|
409
|
+
};
|
|
410
|
+
const arrayedOptsDefault = {
|
|
411
|
+
opType: ["addition"],
|
|
412
|
+
};
|
|
413
|
+
const options = [
|
|
414
|
+
{
|
|
415
|
+
id: "explicitWriting",
|
|
416
|
+
label: "Type d'écriture",
|
|
417
|
+
target: GeneratorOptionTarget.instruction,
|
|
418
|
+
type: GeneratorOptionType.select,
|
|
419
|
+
values: ["Explicite (parenthèses autour de chaque nombre)", "Simplifiée"],
|
|
420
|
+
defaultValue: optsDefault.explicitWriting,
|
|
421
|
+
},
|
|
422
|
+
{
|
|
423
|
+
id: "opType",
|
|
424
|
+
label: "Type d'opération",
|
|
425
|
+
target: GeneratorOptionTarget.generation,
|
|
426
|
+
type: GeneratorOptionType.multiselect,
|
|
427
|
+
values: ["addition", "soustraction"],
|
|
428
|
+
defaultValue: arrayedOptsDefault.opType,
|
|
429
|
+
},
|
|
430
|
+
];
|
|
431
|
+
export const relativesAddAndSub = {
|
|
432
|
+
id: "relativesAddAndSub",
|
|
433
|
+
connector: "=",
|
|
434
|
+
label: "Addition ou soustraction de nombres relatifs",
|
|
435
|
+
isSingleStep: true,
|
|
436
|
+
generator: (nb, opts) => getDistinctQuestions(() => getRelativesAddAndSubQuestion(opts), nb),
|
|
437
|
+
options,
|
|
438
|
+
qcmTimer: 60,
|
|
439
|
+
freeTimer: 60,
|
|
440
|
+
getPropositions,
|
|
441
|
+
isAnswerValid,
|
|
442
|
+
subject: "Mathématiques",
|
|
443
|
+
getInstruction,
|
|
444
|
+
getAnswer,
|
|
445
|
+
getStartStatement,
|
|
446
|
+
getQuestionFromIdentifiers,
|
|
447
|
+
hasHintAndCorrection: true,
|
|
448
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"factoByXK.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calculLitteral/factorisation/factoByXK.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAgBT,MAAM,6BAA6B,CAAC;AAcrC,KAAK,WAAW,GAAG;IACjB,CAAC,EAAE,MAAM,CAAC;IACV,EAAE,EAAE,MAAM,CAAC;IACX,CAAC,EAAE,MAAM,CAAC;IACV,EAAE,EAAE,MAAM,CAAC;CACZ,CAAC;AA4MF,eAAO,MAAM,SAAS,EAAE,QAAQ,CAAC,WAAW,CAc3C,CAAC"}
|
|
@@ -0,0 +1,190 @@
|
|
|
1
|
+
import { addValidProp, shuffleProps, tryToAddWrongProp, propWhile, } from "../../../../exercises/exercise.js";
|
|
2
|
+
import { getDistinctQuestions } from "../../../../exercises/utils/getDistinctQuestions.js";
|
|
3
|
+
import { AffineConstructor } from "../../../../math/polynomials/affine.js";
|
|
4
|
+
import { gcd } from "../../../../math/utils/arithmetic/gcd.js";
|
|
5
|
+
import { randint } from "../../../../math/utils/random/randint.js";
|
|
6
|
+
import { add } from "../../../../tree/nodes/operators/addNode.js";
|
|
7
|
+
import { multiply } from "../../../../tree/nodes/operators/multiplyNode.js";
|
|
8
|
+
import { power } from "../../../../tree/nodes/operators/powerNode.js";
|
|
9
|
+
import { parseAlgebraic } from "../../../../tree/parsers/latexParser.js";
|
|
10
|
+
import { random } from "../../../../utils/alea/random.js";
|
|
11
|
+
import { handleVEAError } from "../../../../utils/errors/handleVEAError.js";
|
|
12
|
+
import { alignTex } from "../../../../utils/latex/alignTex.js";
|
|
13
|
+
const getHydrated = (identifiers) => {
|
|
14
|
+
const { a, b, k1, k2 } = identifiers;
|
|
15
|
+
const nodeMonomA = multiply(a, power("x".toTree(), k1)).simplify();
|
|
16
|
+
const nodeMonomB = multiply(b, power("x".toTree(), k2)).simplify();
|
|
17
|
+
const nodeSum = add(nodeMonomA, nodeMonomB);
|
|
18
|
+
return {
|
|
19
|
+
nodeMonomA,
|
|
20
|
+
nodeMonomB,
|
|
21
|
+
nodeSum,
|
|
22
|
+
};
|
|
23
|
+
};
|
|
24
|
+
const getStatementNode = (identifiers) => {
|
|
25
|
+
const { nodeSum } = getHydrated(identifiers);
|
|
26
|
+
return nodeSum;
|
|
27
|
+
};
|
|
28
|
+
const getInstruction = (identifiers) => {
|
|
29
|
+
const statement = getStatementNode(identifiers);
|
|
30
|
+
return `Factoriser :
|
|
31
|
+
|
|
32
|
+
$$
|
|
33
|
+
${statement.toTex()}
|
|
34
|
+
$$`;
|
|
35
|
+
};
|
|
36
|
+
const getAnswerNode = (identifiers) => {
|
|
37
|
+
const { a, b, k1, k2 } = identifiers;
|
|
38
|
+
let pgcd = gcd(a, b);
|
|
39
|
+
if (a < 0 && b < 0)
|
|
40
|
+
pgcd = -pgcd;
|
|
41
|
+
const strK1K2 = `${k1}${k2}`;
|
|
42
|
+
switch (strK1K2) {
|
|
43
|
+
case "11": {
|
|
44
|
+
return multiply(a + b, "x");
|
|
45
|
+
}
|
|
46
|
+
case "12": {
|
|
47
|
+
const affine = add(a / pgcd, multiply(b / pgcd, "x"));
|
|
48
|
+
return multiply(multiply(pgcd, "x"), affine);
|
|
49
|
+
}
|
|
50
|
+
case "21": {
|
|
51
|
+
const affine = add(multiply(a / pgcd, "x"), b / pgcd);
|
|
52
|
+
return multiply(multiply(pgcd, "x"), affine);
|
|
53
|
+
}
|
|
54
|
+
case "22": {
|
|
55
|
+
return multiply(a + b, power("x", 2));
|
|
56
|
+
}
|
|
57
|
+
default:
|
|
58
|
+
throw new Error("Unsupported strK1K2: " + strK1K2);
|
|
59
|
+
}
|
|
60
|
+
};
|
|
61
|
+
const getAnswer = (identifiers) => {
|
|
62
|
+
return getAnswerNode(identifiers).toTex();
|
|
63
|
+
};
|
|
64
|
+
const getHint = (identifiers) => {
|
|
65
|
+
const { nodeMonomA, nodeMonomB } = getHydrated(identifiers);
|
|
66
|
+
return `Repère le facteur commun : c'est le terme qui apparaît à la fois dans $${nodeMonomA.toTex()}$ et dans $${nodeMonomB.toTex()}$.`;
|
|
67
|
+
};
|
|
68
|
+
const getCorrection = (identifiers) => {
|
|
69
|
+
const { a, b, k1, k2 } = identifiers;
|
|
70
|
+
const { nodeMonomA, nodeMonomB } = getHydrated(identifiers);
|
|
71
|
+
const answer = getAnswer(identifiers);
|
|
72
|
+
const statement = getStatementNode(identifiers).toTex();
|
|
73
|
+
let pgcd = gcd(a, b);
|
|
74
|
+
if (a < 0 && b < 0)
|
|
75
|
+
pgcd = -pgcd;
|
|
76
|
+
const [nodeCommon, nodeDetailed] = (() => {
|
|
77
|
+
const strK1K2 = `${k1}${k2}`;
|
|
78
|
+
switch (strK1K2) {
|
|
79
|
+
case "11": {
|
|
80
|
+
const nodeCommon = "x".toTree();
|
|
81
|
+
const nodeDetailed = multiply(nodeCommon, add(a, b));
|
|
82
|
+
return [nodeCommon, nodeDetailed];
|
|
83
|
+
}
|
|
84
|
+
case "12": {
|
|
85
|
+
const nodeCommon = multiply(pgcd, "x");
|
|
86
|
+
const nodeDetailed = add(multiply(nodeCommon, a / pgcd), multiply(nodeCommon, multiply(b / pgcd, "x").simplify(), {
|
|
87
|
+
toTexOptions: { forceTimesSign: true, noPropagation: true },
|
|
88
|
+
}));
|
|
89
|
+
return [nodeCommon, nodeDetailed];
|
|
90
|
+
}
|
|
91
|
+
case "21": {
|
|
92
|
+
const nodeCommon = multiply(pgcd, "x");
|
|
93
|
+
const nodeDetailed = add(multiply(nodeCommon, multiply(a / pgcd, "x").simplify(), {
|
|
94
|
+
toTexOptions: { forceTimesSign: true, noPropagation: true },
|
|
95
|
+
}), multiply(nodeCommon, b / pgcd));
|
|
96
|
+
return [nodeCommon, nodeDetailed];
|
|
97
|
+
}
|
|
98
|
+
case "22": {
|
|
99
|
+
const nodeCommon = power("x", 2);
|
|
100
|
+
const nodeDetailed = multiply(nodeCommon, add(a, b));
|
|
101
|
+
return [nodeCommon, nodeDetailed];
|
|
102
|
+
}
|
|
103
|
+
default:
|
|
104
|
+
throw new Error("Unsupported strK1K2: " + strK1K2);
|
|
105
|
+
}
|
|
106
|
+
})();
|
|
107
|
+
const detailed = nodeDetailed.toTex();
|
|
108
|
+
return `Le terme $${nodeCommon.toTex()}$ apparaît à la fois dans $${nodeMonomA.toTex()}$ et dans $${nodeMonomB.toTex()}$.
|
|
109
|
+
|
|
110
|
+
On peut donc factoriser l'expression par $${nodeCommon.toTex()}$ :
|
|
111
|
+
|
|
112
|
+
${alignTex([
|
|
113
|
+
["", "", statement],
|
|
114
|
+
["", "=", detailed],
|
|
115
|
+
["", "=", answer],
|
|
116
|
+
])}
|
|
117
|
+
`;
|
|
118
|
+
};
|
|
119
|
+
const getPropositions = (n, { answer, ...identifiers }) => {
|
|
120
|
+
const propositions = [];
|
|
121
|
+
addValidProp(propositions, answer);
|
|
122
|
+
[
|
|
123
|
+
[1, 1],
|
|
124
|
+
[1, 2],
|
|
125
|
+
[2, 1],
|
|
126
|
+
[2, 2],
|
|
127
|
+
].forEach(([k1, k2]) => {
|
|
128
|
+
const identifiersWrong = { ...identifiers, k1, k2 };
|
|
129
|
+
tryToAddWrongProp(propositions, getAnswer(identifiersWrong));
|
|
130
|
+
});
|
|
131
|
+
propWhile(propositions, n, () => {
|
|
132
|
+
tryToAddWrongProp(propositions, multiply("x", AffineConstructor.random().toTree()).toTex());
|
|
133
|
+
});
|
|
134
|
+
return shuffleProps(propositions, n);
|
|
135
|
+
};
|
|
136
|
+
const getKeys = () => {
|
|
137
|
+
return ["x"];
|
|
138
|
+
};
|
|
139
|
+
const isAnswerValid = (ans, { answer }) => {
|
|
140
|
+
try {
|
|
141
|
+
const nodeAnswer = parseAlgebraic(answer);
|
|
142
|
+
return nodeAnswer.toAllValidTexs().some((tex) => ans === tex);
|
|
143
|
+
}
|
|
144
|
+
catch (err) {
|
|
145
|
+
return handleVEAError(err);
|
|
146
|
+
}
|
|
147
|
+
};
|
|
148
|
+
const getFactoByXKQuestion = () => {
|
|
149
|
+
const a = randint(-10, 10, [0], { favor: { value: 1, proba: 0.3 } });
|
|
150
|
+
const b = randint(-10, 10, [0, -a, a], a !== 1 ? { favor: { value: 1, proba: 0.3 } } : undefined);
|
|
151
|
+
const [k1, k2] = random([
|
|
152
|
+
[1, 1],
|
|
153
|
+
[1, 2],
|
|
154
|
+
[2, 1],
|
|
155
|
+
[2, 2],
|
|
156
|
+
]);
|
|
157
|
+
const identifiers = {
|
|
158
|
+
a,
|
|
159
|
+
b,
|
|
160
|
+
k1,
|
|
161
|
+
k2,
|
|
162
|
+
};
|
|
163
|
+
return getQuestionFromIdentifiers(identifiers);
|
|
164
|
+
};
|
|
165
|
+
const getQuestionFromIdentifiers = (identifiers) => {
|
|
166
|
+
const question = {
|
|
167
|
+
answer: getAnswer(identifiers),
|
|
168
|
+
instruction: getInstruction(identifiers),
|
|
169
|
+
keys: getKeys(identifiers),
|
|
170
|
+
answerFormat: "tex",
|
|
171
|
+
identifiers,
|
|
172
|
+
hint: getHint(identifiers),
|
|
173
|
+
correction: getCorrection(identifiers),
|
|
174
|
+
};
|
|
175
|
+
return question;
|
|
176
|
+
};
|
|
177
|
+
export const factoByXK = {
|
|
178
|
+
id: "factoByXK",
|
|
179
|
+
connector: "=",
|
|
180
|
+
label: "Factorisation du type $ax^k + bx^{k'}$",
|
|
181
|
+
isSingleStep: false,
|
|
182
|
+
generator: (nb, opts) => getDistinctQuestions(() => getFactoByXKQuestion(opts), nb),
|
|
183
|
+
qcmTimer: 60,
|
|
184
|
+
freeTimer: 60,
|
|
185
|
+
getPropositions,
|
|
186
|
+
isAnswerValid,
|
|
187
|
+
subject: "Mathématiques",
|
|
188
|
+
getQuestionFromIdentifiers,
|
|
189
|
+
hasHintAndCorrection: true,
|
|
190
|
+
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calculLitteral/factorisation/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAC;AACjC,cAAc,kBAAkB,CAAC;AACjC,cAAc,kBAAkB,CAAC;AACjC,cAAc,aAAa,CAAC;AAC5B,cAAc,6BAA6B,CAAC;AAC5C,cAAc,qCAAqC,CAAC;AACpD,cAAc,iBAAiB,CAAC;AAChC,cAAc,eAAe,CAAC;AAE9B,cAAc,iBAAiB,CAAC;AAChC,cAAc,iBAAiB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calculLitteral/factorisation/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAC;AACjC,cAAc,kBAAkB,CAAC;AACjC,cAAc,kBAAkB,CAAC;AACjC,cAAc,aAAa,CAAC;AAC5B,cAAc,6BAA6B,CAAC;AAC5C,cAAc,qCAAqC,CAAC;AACpD,cAAc,iBAAiB,CAAC;AAChC,cAAc,eAAe,CAAC;AAE9B,cAAc,iBAAiB,CAAC;AAChC,cAAc,iBAAiB,CAAC;AAChC,cAAc,gBAAgB,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Exercise } from "../../../../exercises/exercise.js";
|
|
2
|
+
type Identifiers = {
|
|
3
|
+
z1Re: number;
|
|
4
|
+
z1Im: number;
|
|
5
|
+
z2Re: number;
|
|
6
|
+
z2Im: number;
|
|
7
|
+
};
|
|
8
|
+
export declare const addComplex: Exercise<Identifiers>;
|
|
9
|
+
export {};
|
|
10
|
+
//# sourceMappingURL=addComplex.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"addComplex.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/complex/algebraic/addComplex.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAcT,MAAM,6BAA6B,CAAC;AASrC,KAAK,WAAW,GAAG;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;CACd,CAAC;AAwHF,eAAO,MAAM,UAAU,EAAE,QAAQ,CAAC,WAAW,CAa5C,CAAC"}
|