math-exercises 3.0.177 → 3.0.179
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/derivative/derivativeEquationSolving1.d.ts +14 -0
- package/lib/exercises/math/derivation/derivative/derivativeEquationSolving1.d.ts.map +1 -0
- package/lib/exercises/math/derivation/derivative/derivativeEquationSolving1.js +283 -0
- package/lib/exercises/math/derivation/derivative/derivativeEquationSolving3.d.ts +15 -0
- package/lib/exercises/math/derivation/derivative/derivativeEquationSolving3.d.ts.map +1 -0
- package/lib/exercises/math/derivation/derivative/derivativeEquationSolving3.js +296 -0
- package/lib/exercises/math/derivation/derivative/exp/expDerivativeOne.js +3 -3
- package/lib/exercises/math/derivation/derivative/exp/expDerivativeProductFExp.d.ts +14 -0
- package/lib/exercises/math/derivation/derivative/exp/expDerivativeProductFExp.d.ts.map +1 -0
- package/lib/exercises/math/derivation/derivative/exp/expDerivativeProductFExp.js +346 -0
- package/lib/exercises/math/derivation/derivative/exp/expDerivativeQuotientFExp.d.ts +15 -0
- package/lib/exercises/math/derivation/derivative/exp/expDerivativeQuotientFExp.d.ts.map +1 -0
- package/lib/exercises/math/derivation/derivative/exp/expDerivativeQuotientFExp.js +435 -0
- package/lib/exercises/math/derivation/derivative/valueDerivativeFromFunctionExpression.d.ts +13 -0
- package/lib/exercises/math/derivation/derivative/valueDerivativeFromFunctionExpression.d.ts.map +1 -0
- package/lib/exercises/math/derivation/derivative/valueDerivativeFromFunctionExpression.js +326 -0
- package/lib/exercises/math/derivation/derivativeNumber/signOfDerivativeNumberFromFunctionCurve.d.ts +14 -0
- package/lib/exercises/math/derivation/derivativeNumber/signOfDerivativeNumberFromFunctionCurve.d.ts.map +1 -0
- package/lib/exercises/math/derivation/derivativeNumber/signOfDerivativeNumberFromFunctionCurve.js +181 -0
- package/lib/exercises/math/derivation/derivativeNumber/valueTableImageAndDerivativeFromFunctionExpression.d.ts +10 -0
- package/lib/exercises/math/derivation/derivativeNumber/valueTableImageAndDerivativeFromFunctionExpression.d.ts.map +1 -0
- package/lib/exercises/math/derivation/derivativeNumber/valueTableImageAndDerivativeFromFunctionExpression.js +272 -0
- package/lib/exercises/math/derivation/problems/index.d.ts +5 -0
- package/lib/exercises/math/derivation/problems/index.d.ts.map +1 -0
- package/lib/exercises/math/derivation/problems/index.js +4 -0
- package/lib/exercises/math/derivation/problems/problemMaximizeBoxVolumeFindX.d.ts +8 -0
- package/lib/exercises/math/derivation/problems/problemMaximizeBoxVolumeFindX.d.ts.map +1 -0
- package/lib/exercises/math/derivation/problems/problemMaximizeBoxVolumeFindX.js +171 -0
- package/lib/exercises/math/derivation/problems/problemMaximizeProfitFindProduction.d.ts +15 -0
- package/lib/exercises/math/derivation/problems/problemMaximizeProfitFindProduction.d.ts.map +1 -0
- package/lib/exercises/math/derivation/problems/problemMaximizeProfitFindProduction.js +328 -0
- package/lib/exercises/math/derivation/problems/problemMovementOnLineFindSpeedAtPoint.d.ts +13 -0
- package/lib/exercises/math/derivation/problems/problemMovementOnLineFindSpeedAtPoint.d.ts.map +1 -0
- package/lib/exercises/math/derivation/problems/problemMovementOnLineFindSpeedAtPoint.js +275 -0
- package/lib/exercises/math/derivation/problems/problemProjectileHeightFindAbscissa.d.ts +8 -0
- package/lib/exercises/math/derivation/problems/problemProjectileHeightFindAbscissa.d.ts.map +1 -0
- package/lib/exercises/math/derivation/problems/problemProjectileHeightFindAbscissa.js +137 -0
- package/lib/exercises/math/derivation/tangent/derivativeEquationSolvingByManipulatingLineY.d.ts +10 -0
- package/lib/exercises/math/derivation/tangent/derivativeEquationSolvingByManipulatingLineY.d.ts.map +1 -0
- package/lib/exercises/math/derivation/tangent/derivativeEquationSolvingByManipulatingLineY.js +478 -0
- package/lib/exercises/math/derivation/tangent/derivativeEquationSolvingByManipulatingLineYAndSlope.d.ts +10 -0
- package/lib/exercises/math/derivation/tangent/derivativeEquationSolvingByManipulatingLineYAndSlope.d.ts.map +1 -0
- package/lib/exercises/math/derivation/tangent/derivativeEquationSolvingByManipulatingLineYAndSlope.js +499 -0
- package/lib/exercises/math/derivation/tangent/derivativeEquationSolvingByManipulatingPoint.d.ts +10 -0
- package/lib/exercises/math/derivation/tangent/derivativeEquationSolvingByManipulatingPoint.d.ts.map +1 -0
- package/lib/exercises/math/derivation/tangent/derivativeEquationSolvingByManipulatingPoint.js +240 -0
- package/lib/exercises/math/derivation/tangent/derivativeReadingByManipulatingBuildingTangent.d.ts +12 -0
- package/lib/exercises/math/derivation/tangent/derivativeReadingByManipulatingBuildingTangent.d.ts.map +1 -0
- package/lib/exercises/math/derivation/tangent/derivativeReadingByManipulatingBuildingTangent.js +436 -0
- package/lib/exercises/math/derivation/tangent/derivativeReadingByManipulatingPoint.d.ts +12 -0
- package/lib/exercises/math/derivation/tangent/derivativeReadingByManipulatingPoint.d.ts.map +1 -0
- package/lib/exercises/math/derivation/tangent/derivativeReadingByManipulatingPoint.js +219 -0
- package/lib/exercises/math/derivation/tangent/derivativeReadingByManipulatingSecant.d.ts +13 -0
- package/lib/exercises/math/derivation/tangent/derivativeReadingByManipulatingSecant.d.ts.map +1 -0
- package/lib/exercises/math/derivation/tangent/derivativeReadingByManipulatingSecant.js +273 -0
- package/lib/exercises/math/derivation/tangent/placePointsOfDerivativeFromGraph.d.ts +18 -0
- package/lib/exercises/math/derivation/tangent/placePointsOfDerivativeFromGraph.d.ts.map +1 -0
- package/lib/exercises/math/derivation/tangent/placePointsOfDerivativeFromGraph.js +295 -0
- package/lib/exercises/math/derivation/tangent/tangentEquationFromFunctionExpression.d.ts +13 -0
- package/lib/exercises/math/derivation/tangent/tangentEquationFromFunctionExpression.d.ts.map +1 -0
- package/lib/exercises/math/derivation/tangent/tangentEquationFromFunctionExpression.js +388 -0
- package/lib/exercises/math/derivation/tangent/tangentEquationFromGraph.d.ts +9 -0
- package/lib/exercises/math/derivation/tangent/tangentEquationFromGraph.d.ts.map +1 -0
- package/lib/exercises/math/derivation/tangent/tangentEquationFromGraph.js +308 -0
- package/lib/exercises/math/derivation/variations/findAbscissaOfExtremaFromFunctionExpression.d.ts +14 -0
- package/lib/exercises/math/derivation/variations/findAbscissaOfExtremaFromFunctionExpression.d.ts.map +1 -0
- package/lib/exercises/math/derivation/variations/findAbscissaOfExtremaFromFunctionExpression.js +439 -0
- package/lib/exercises/math/derivation/variations/findExtremaFromFunctionExpression.d.ts +14 -0
- package/lib/exercises/math/derivation/variations/findExtremaFromFunctionExpression.d.ts.map +1 -0
- package/lib/exercises/math/derivation/variations/findExtremaFromFunctionExpression.js +547 -0
- package/lib/exercises/math/derivation/variations/plausibleDerivativeGraphFromFunctionGraphByManipulatingPolynomial.d.ts +15 -0
- package/lib/exercises/math/derivation/variations/plausibleDerivativeGraphFromFunctionGraphByManipulatingPolynomial.d.ts.map +1 -0
- package/lib/exercises/math/derivation/variations/plausibleDerivativeGraphFromFunctionGraphByManipulatingPolynomial.js +537 -0
- package/lib/exercises/math/derivation/variations/plausibleFunctionGraphFromDerivativeGraphByManipulatingPolynomial.d.ts +15 -0
- package/lib/exercises/math/derivation/variations/plausibleFunctionGraphFromDerivativeGraphByManipulatingPolynomial.d.ts.map +1 -0
- package/lib/exercises/math/derivation/variations/plausibleFunctionGraphFromDerivativeGraphByManipulatingPolynomial.js +639 -0
- package/lib/exercises/math/derivation/variations/readExtremaAbscissFromDerivativeCurve.js +1 -1
- package/lib/exercises/math/derivation/variations/signVarTableFromFunctionExpression.d.ts +14 -0
- package/lib/exercises/math/derivation/variations/signVarTableFromFunctionExpression.d.ts.map +1 -0
- package/lib/exercises/math/derivation/variations/signVarTableFromFunctionExpression.js +530 -0
- package/lib/exercises/math/derivation/variations/signVarTableProductFExp.d.ts +10 -0
- package/lib/exercises/math/derivation/variations/signVarTableProductFExp.d.ts.map +1 -0
- package/lib/exercises/math/derivation/variations/signVarTableProductFExp.js +451 -0
- package/lib/exercises/math/derivation/variations/signVarTableQuotientFExp.d.ts +11 -0
- package/lib/exercises/math/derivation/variations/signVarTableQuotientFExp.d.ts.map +1 -0
- package/lib/exercises/math/derivation/variations/signVarTableQuotientFExp.js +514 -0
- package/lib/exercises/math/functions/composition/index.d.ts +0 -1
- package/lib/exercises/math/functions/composition/index.d.ts.map +1 -1
- package/lib/exercises/math/functions/composition/index.js +1 -1
- package/lib/exercises/math/functions/exponential/algebraic/index.d.ts +0 -1
- package/lib/exercises/math/functions/exponential/algebraic/index.d.ts.map +1 -1
- package/lib/exercises/math/functions/exponential/algebraic/index.js +1 -1
- package/lib/exercises/math/functions/trinoms/sign/index.d.ts +1 -0
- package/lib/exercises/math/functions/trinoms/sign/index.d.ts.map +1 -1
- package/lib/exercises/math/functions/trinoms/sign/index.js +1 -0
- package/lib/exercises/math/functions/trinoms/sign/signOfProductOfAffineAndTrinom.d.ts +8 -0
- package/lib/exercises/math/functions/trinoms/sign/signOfProductOfAffineAndTrinom.d.ts.map +1 -0
- package/lib/exercises/math/functions/trinoms/sign/signOfProductOfAffineAndTrinom.js +226 -0
- package/lib/exercises/math/geometry/angles/parallelogramFourthAngle.d.ts.map +1 -1
- package/lib/exercises/math/geometry/angles/parallelogramFourthAngle.js +10 -10
- package/lib/exercises/math/geometry/quadrilaterals/parallelogramAngles.js +8 -8
- package/lib/exercises/math/geometry/triangles/similar/isSimilarTrianglesWithAngles.js +6 -6
- package/lib/exercises/math/geometry/triangles/triangleThirdAngleValue.js +8 -8
- package/lib/exercises/math/geometry/vectors/scalarProduct/alKashi/scalarProductAlKashiAngle.js +1 -1
- package/lib/exercises/math/geometry/vectors/scalarProduct/alKashi/scalarProductAlKashiSideLength.js +2 -2
- package/lib/exercises/math/geometry/vectors/scalarProduct/angleFromScalarProduct.js +2 -2
- package/lib/exercises/math/geometry/vectors/scalarProduct/scalarProductOrthoInSquare.d.ts.map +1 -1
- package/lib/exercises/math/geometry/vectors/scalarProduct/scalarProductOrthoInSquare.js +32 -17
- package/lib/exercises/math/probaStat/conditional/conditionalProbaFromTableWithContext.d.ts +13 -0
- package/lib/exercises/math/probaStat/conditional/conditionalProbaFromTableWithContext.d.ts.map +1 -0
- package/lib/exercises/math/probaStat/conditional/conditionalProbaFromTableWithContext.js +195 -0
- package/lib/exercises/math/probaStat/conditional/conditionalProbaWriteFromFrench.d.ts +9 -0
- package/lib/exercises/math/probaStat/conditional/conditionalProbaWriteFromFrench.d.ts.map +1 -0
- package/lib/exercises/math/probaStat/conditional/conditionalProbaWriteFromFrench.js +220 -0
- package/lib/exercises/math/probaStat/conditional/conditionalProbability.d.ts +15 -0
- package/lib/exercises/math/probaStat/conditional/conditionalProbability.d.ts.map +1 -0
- package/lib/exercises/math/probaStat/conditional/conditionalProbability.js +332 -0
- package/lib/exercises/math/probaStat/conditional/fillTableConditionalProbabilitySituation.d.ts +8 -0
- package/lib/exercises/math/probaStat/conditional/fillTableConditionalProbabilitySituation.d.ts.map +1 -0
- package/lib/exercises/math/probaStat/conditional/fillTableConditionalProbabilitySituation.js +222 -0
- package/lib/exercises/math/probaStat/conditional/index.d.ts +5 -0
- package/lib/exercises/math/probaStat/conditional/index.d.ts.map +1 -0
- package/lib/exercises/math/probaStat/conditional/index.js +4 -0
- package/lib/exercises/math/probaStat/index.d.ts +1 -2
- package/lib/exercises/math/probaStat/index.d.ts.map +1 -1
- package/lib/exercises/math/probaStat/index.js +1 -2
- package/lib/exercises/math/probaStat/probaFromTableWithContext.d.ts +1 -0
- package/lib/exercises/math/probaStat/probaFromTableWithContext.d.ts.map +1 -1
- package/lib/exercises/math/probaStat/probaFromTableWithContext.js +26 -199
- package/lib/exercises/math/probaStat/randomVariable/index.d.ts.map +1 -1
- package/lib/exercises/math/probaStat/randomVariable/index.js +1 -0
- package/lib/exercises/math/probaStat/randomVariable/randomVariableSituationProbabilityLaw.d.ts.map +1 -1
- package/lib/exercises/math/probaStat/randomVariable/randomVariableSituationProbabilityLaw.js +6 -2
- package/lib/exercises/math/probaStat/randomVariable/utils/randomVariableSituations.d.ts.map +1 -1
- package/lib/exercises/math/probaStat/randomVariable/utils/randomVariableSituations.js +6 -5
- package/lib/exercises/math/probaStat/trees/buildTreeFromSituation.d.ts.map +1 -1
- package/lib/exercises/math/probaStat/trees/buildTreeFromSituation.js +4 -27
- package/lib/exercises/math/probaStat/twoEventsSituations.d.ts +29 -0
- package/lib/exercises/math/probaStat/twoEventsSituations.d.ts.map +1 -0
- package/lib/exercises/math/probaStat/twoEventsSituations.js +145 -0
- package/lib/exercises/math/python/index.d.ts +1 -0
- package/lib/exercises/math/python/index.d.ts.map +1 -1
- package/lib/exercises/math/python/index.js +1 -0
- package/lib/exercises/math/python/sequences/pySequenceThresholdInstructionCompletion.d.ts.map +1 -1
- package/lib/exercises/math/python/sequences/pySequenceThresholdInstructionCompletion.js +11 -8
- package/lib/exercises/math/sequences/arithmetic/arithmeticFindExplicitFormulaFromTwoTerms.d.ts.map +1 -1
- package/lib/exercises/math/sequences/arithmetic/arithmeticFindExplicitFormulaFromTwoTerms.js +4 -3
- package/lib/exercises/math/sequences/arithmetic/index.d.ts +4 -3
- package/lib/exercises/math/sequences/arithmetic/index.d.ts.map +1 -1
- package/lib/exercises/math/sequences/arithmetic/index.js +4 -3
- package/lib/exercises/math/sequences/arithmetic/situations/arithmeticFindExplicitFormulaFromSituation.d.ts.map +1 -1
- package/lib/exercises/math/sequences/arithmetic/situations/arithmeticFindExplicitFormulaFromSituation.js +3 -2
- package/lib/exercises/math/sequences/arithmetic/situations/arithmeticFindRankFromSituation.d.ts.map +1 -1
- package/lib/exercises/math/sequences/arithmetic/situations/arithmeticFindRankFromSituation.js +8 -6
- package/lib/exercises/math/sequences/arithmetic/situations/arithmeticFindThresholdFromSituation.d.ts.map +1 -1
- package/lib/exercises/math/sequences/arithmetic/situations/arithmeticFindThresholdFromSituation.js +6 -5
- package/lib/exercises/math/sequences/arithmetic/situations/index.d.ts +0 -2
- package/lib/exercises/math/sequences/arithmetic/situations/index.d.ts.map +1 -1
- package/lib/exercises/math/sequences/arithmetic/situations/index.js +2 -2
- package/lib/exercises/math/sequences/arithmetic/sum/arithmeticComputeSumWithDots.d.ts +1 -0
- package/lib/exercises/math/sequences/arithmetic/sum/arithmeticComputeSumWithDots.d.ts.map +1 -1
- package/lib/exercises/math/sequences/arithmetic/sum/arithmeticComputeSumWithDots.js +65 -14
- package/lib/exercises/math/sequences/arithmetic/sum/index.d.ts +0 -1
- package/lib/exercises/math/sequences/arithmetic/sum/index.d.ts.map +1 -1
- package/lib/exercises/math/sequences/arithmetic/sum/index.js +1 -1
- package/lib/exercises/math/sequences/explicitFormulaUsage.d.ts +4 -1
- package/lib/exercises/math/sequences/explicitFormulaUsage.d.ts.map +1 -1
- package/lib/exercises/math/sequences/explicitFormulaUsage.js +47 -7
- package/lib/exercises/math/sequences/geometric/geometricFindExplicitFormulaFromTwoConsecutiveTerms.d.ts +14 -0
- package/lib/exercises/math/sequences/geometric/geometricFindExplicitFormulaFromTwoConsecutiveTerms.d.ts.map +1 -0
- package/lib/exercises/math/sequences/geometric/geometricFindExplicitFormulaFromTwoConsecutiveTerms.js +291 -0
- package/lib/exercises/math/sequences/geometric/geometricFindExplicitFormulaFromTwoTerms.d.ts.map +1 -1
- package/lib/exercises/math/sequences/geometric/geometricFindExplicitFormulaFromTwoTerms.js +4 -3
- package/lib/exercises/math/sequences/geometric/geometricFindRandomTermFromTwoConsecutiveTerms.d.ts +15 -0
- package/lib/exercises/math/sequences/geometric/geometricFindRandomTermFromTwoConsecutiveTerms.d.ts.map +1 -0
- package/lib/exercises/math/sequences/geometric/geometricFindRandomTermFromTwoConsecutiveTerms.js +249 -0
- package/lib/exercises/math/sequences/geometric/geometricFindRandomTermFromTwoTerms.js +2 -2
- package/lib/exercises/math/sequences/geometric/index.d.ts +3 -2
- package/lib/exercises/math/sequences/geometric/index.d.ts.map +1 -1
- package/lib/exercises/math/sequences/geometric/index.js +6 -2
- package/lib/exercises/math/sequences/geometric/situations/geometricFindExplicitFormulaFromSituation.d.ts.map +1 -1
- package/lib/exercises/math/sequences/geometric/situations/geometricFindExplicitFormulaFromSituation.js +3 -2
- package/lib/exercises/math/sequences/geometric/situations/geometricFindTermFromSituation.js +1 -1
- package/lib/exercises/math/sequences/geometric/situations/index.d.ts +0 -1
- package/lib/exercises/math/sequences/geometric/situations/index.d.ts.map +1 -1
- package/lib/exercises/math/sequences/geometric/situations/index.js +1 -1
- package/lib/exercises/math/sequences/geometric/sum/geometricComputeSumWithDots.js +2 -2
- package/lib/exercises/math/sequences/graph/placeFirstSequencePoints.js +2 -2
- package/lib/exercises/math/sequences/index.d.ts +1 -0
- package/lib/exercises/math/sequences/index.d.ts.map +1 -1
- package/lib/exercises/math/sequences/index.js +1 -0
- package/lib/exercises/math/sequences/recurrenceFormulaUsage.d.ts +5 -1
- package/lib/exercises/math/sequences/recurrenceFormulaUsage.d.ts.map +1 -1
- package/lib/exercises/math/sequences/recurrenceFormulaUsage.js +89 -9
- package/lib/exercises/math/sequences/seqArithmGeom/seqArithmGeomRecurrenceFormulaUsage.d.ts.map +1 -1
- package/lib/exercises/math/sequences/seqArithmGeom/seqArithmGeomRecurrenceFormulaUsage.js +5 -9
- package/lib/exercises/math/spaceGeometry/sphere/sphereLatLonReading.2d.js +1 -1
- package/lib/exercises/math/trigonometry/circle/associatePoint.d.ts.map +1 -1
- package/lib/exercises/math/trigonometry/circle/associatePoint.js +55 -6
- package/lib/exercises/math/trigonometry/circle/selectQuadrantOnTrigoCircle.d.ts.map +1 -1
- package/lib/exercises/math/trigonometry/circle/selectQuadrantOnTrigoCircle.js +5 -6
- package/lib/exercises/math/trigonometry/functions/associateAngleSimplification.d.ts.map +1 -1
- package/lib/exercises/math/trigonometry/functions/associateAngleSimplification.js +1 -3
- package/lib/exercises/math/trigonometry/triangle/trigonometryAngleCalcul.js +2 -2
- package/lib/exercises/pc/snellDescartes.js +2 -2
- package/lib/exercises/vea/polynomialVEA.d.ts +2 -0
- package/lib/exercises/vea/polynomialVEA.d.ts.map +1 -0
- package/lib/exercises/vea/polynomialVEA.js +17 -0
- package/lib/exercises/vea/valueTableVEA.d.ts +8 -0
- package/lib/exercises/vea/valueTableVEA.d.ts.map +1 -0
- package/lib/exercises/vea/valueTableVEA.js +12 -0
- package/lib/index.d.ts +152 -41
- package/lib/index.d.ts.map +1 -1
- package/lib/latexTester.d.ts.map +1 -1
- package/lib/latexTester.js +9 -6
- package/lib/math/polynomials/affine.d.ts +1 -0
- package/lib/math/polynomials/affine.d.ts.map +1 -1
- package/lib/math/polynomials/affine.js +5 -0
- package/lib/math/utils/arithmetic/primeFactors.js +1 -1
- package/lib/math/utils/functions/functionComposition.d.ts.map +1 -1
- package/lib/math/utils/functions/functionComposition.js +18 -1
- package/lib/math/utils/polynomial/polynomialInterpolationUtils.d.ts +19 -0
- package/lib/math/utils/polynomial/polynomialInterpolationUtils.d.ts.map +1 -0
- package/lib/math/utils/polynomial/polynomialInterpolationUtils.js +53 -0
- package/lib/math/utils/polynomial/polynomialUtils.d.ts +37 -0
- package/lib/math/utils/polynomial/polynomialUtils.d.ts.map +1 -0
- package/lib/math/utils/polynomial/polynomialUtils.js +223 -0
- package/lib/math/utils/sequences/situations/seqArithmeticSituations.d.ts +18 -4
- package/lib/math/utils/sequences/situations/seqArithmeticSituations.d.ts.map +1 -1
- package/lib/math/utils/sequences/situations/seqArithmeticSituations.js +434 -333
- package/lib/math/utils/sequences/situations/seqArithmeticUtils.d.ts.map +1 -1
- package/lib/math/utils/sequences/situations/seqArithmeticUtils.js +3 -1
- package/lib/math/utils/sequences/situations/seqGeometricSituations.d.ts +5 -0
- package/lib/math/utils/sequences/situations/seqGeometricSituations.d.ts.map +1 -1
- package/lib/math/utils/sequences/situations/seqGeometricSituations.js +58 -25
- package/lib/prototypesEnhancement.d.ts +1 -0
- package/lib/prototypesEnhancement.d.ts.map +1 -1
- package/lib/prototypesEnhancement.js +3 -0
- package/lib/tests/pdfs/mdCodeToLatex.d.ts.map +1 -1
- package/lib/tests/pdfs/mdCodeToLatex.js +8 -15
- package/lib/tests/questionTest.d.ts.map +1 -1
- package/lib/tests/questionTest.js +6 -3
- package/lib/tree/nodes/geometry/degree.js +1 -1
- package/lib/tree/nodes/operators/multiplyNode.d.ts.map +1 -1
- package/lib/tree/nodes/operators/multiplyNode.js +1 -1
- package/lib/tree/nodes/operators/substractNode.d.ts.map +1 -1
- package/lib/tree/nodes/operators/substractNode.js +2 -1
- package/lib/tree/parsers/degreeParser.js +2 -2
- package/lib/tree/utilities/nodeUtils.d.ts +6 -0
- package/lib/tree/utilities/nodeUtils.d.ts.map +1 -0
- package/lib/tree/utilities/nodeUtils.js +24 -0
- package/lib/utils/strings/prependArticle.d.ts +2 -0
- package/lib/utils/strings/prependArticle.d.ts.map +1 -0
- package/lib/utils/strings/prependArticle.js +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,537 @@
|
|
|
1
|
+
import { GeneratorOptionTarget, GeneratorOptionType, } from "../../../../exercises/exercise.js";
|
|
2
|
+
import { getDistinctQuestions } from "../../../../exercises/utils/getDistinctQuestions.js";
|
|
3
|
+
import { blueMain, greenMain } from "../../../../geogebra/colors.js";
|
|
4
|
+
import { GeogebraConstructor } from "../../../../geogebra/geogebraConstructor.js";
|
|
5
|
+
import { ggbPointToCoords } from "../../../../geogebra/parsers/ggbPointToCoords.js";
|
|
6
|
+
import { parseGGBPoints } from "../../../../geogebra/parsers/parseGGBPoints.js";
|
|
7
|
+
import { Point, PointConstructor, } from "../../../../math/geometry/point.js";
|
|
8
|
+
import { createIntegratedPolynomialNode, createNodeFPolynomialFromRoots, } from "../../../../math/utils/polynomial/polynomialUtils.js";
|
|
9
|
+
import { randfloat } from "../../../../math/utils/random/randfloat.js";
|
|
10
|
+
import { randint } from "../../../../math/utils/random/randint.js";
|
|
11
|
+
import { NodeConstructor, } from "../../../../tree/nodes/nodeConstructor.js";
|
|
12
|
+
import { frac } from "../../../../tree/nodes/operators/fractionNode.js";
|
|
13
|
+
import { multiply } from "../../../../tree/nodes/operators/multiplyNode.js";
|
|
14
|
+
import { coinFlip } from "../../../../utils/alea/coinFlip.js";
|
|
15
|
+
import { random, randomMany } from "../../../../utils/alea/random.js";
|
|
16
|
+
import { zip } from "../../../../utils/arrays/arrayZip.js";
|
|
17
|
+
import { average } from "../../../../utils/average.js";
|
|
18
|
+
import { joinanded } from "../../../../utils/strings/joinanded.js";
|
|
19
|
+
function getXMinXMax(arrX, typeF) {
|
|
20
|
+
if (typeF === "degré $3$ monotone") {
|
|
21
|
+
const [x] = arrX;
|
|
22
|
+
return { xMin: x - 4, xMax: x + 4 };
|
|
23
|
+
}
|
|
24
|
+
else {
|
|
25
|
+
if (arrX.length === 0) {
|
|
26
|
+
return { xMin: -5, xMax: +5 };
|
|
27
|
+
}
|
|
28
|
+
else if (arrX.length === 1) {
|
|
29
|
+
const [x] = arrX;
|
|
30
|
+
return { xMin: x - 4, xMax: x + 4 };
|
|
31
|
+
}
|
|
32
|
+
else {
|
|
33
|
+
return { xMin: Math.min(...arrX) - 2, xMax: Math.max(...arrX) + 2 };
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
function getArrXControl(arrX, typeF) {
|
|
38
|
+
if (typeF === "degré $3$ monotone") {
|
|
39
|
+
const [x] = arrX;
|
|
40
|
+
return [x - 2, x, x + 2];
|
|
41
|
+
}
|
|
42
|
+
else {
|
|
43
|
+
if (arrX.length === 0) {
|
|
44
|
+
return [-3, 0, 3];
|
|
45
|
+
}
|
|
46
|
+
else if (arrX.length === 1) {
|
|
47
|
+
const [x] = arrX;
|
|
48
|
+
return [x - 2, x, x + 2];
|
|
49
|
+
}
|
|
50
|
+
else {
|
|
51
|
+
return [
|
|
52
|
+
...arrX,
|
|
53
|
+
...zip(arrX.slice(0, -1), arrX.slice(1)).map(([x1, x2]) => average([x1, x2])),
|
|
54
|
+
].toSorted((x1, x2) => x1 - x2);
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
function getCoordsFrame(nodeF, xMin, xMax) {
|
|
59
|
+
const stepX = 0.05;
|
|
60
|
+
const arrX = [...Array(Math.floor((xMax - xMin) / stepX)).keys()].map((i) => xMin + i * stepX);
|
|
61
|
+
const yForXMin = nodeF.evaluate({ x: xMin });
|
|
62
|
+
const { yMin, yMax } = arrX.slice(1).reduce((acc, x) => {
|
|
63
|
+
const { yMin, yMax } = acc;
|
|
64
|
+
const y = nodeF.evaluate({ x });
|
|
65
|
+
if (y < yMin) {
|
|
66
|
+
acc.yMin = y;
|
|
67
|
+
}
|
|
68
|
+
else if (y > yMax) {
|
|
69
|
+
acc.yMax = y;
|
|
70
|
+
}
|
|
71
|
+
return acc;
|
|
72
|
+
}, { yMin: yForXMin, yMax: yForXMin });
|
|
73
|
+
return {
|
|
74
|
+
xMin,
|
|
75
|
+
xMax,
|
|
76
|
+
yMin,
|
|
77
|
+
yMax,
|
|
78
|
+
};
|
|
79
|
+
}
|
|
80
|
+
const createFStuff = (typeF) => {
|
|
81
|
+
//f'(x) = a(x-x1)...(x-xn)
|
|
82
|
+
//=> f'(x1) = ... = f'(xn) = 0
|
|
83
|
+
function createRandomArrX(nbX) {
|
|
84
|
+
const poolX = [...Array(11).keys()].map((i) => i - 5);
|
|
85
|
+
return randomMany(poolX, nbX).toSorted((v1, v2) => v1 - v2);
|
|
86
|
+
}
|
|
87
|
+
function createRandomNodeFFromDerivative(nodeDerivative) {
|
|
88
|
+
const nodeC = (randint(-6, 7) / 2.0).toTree();
|
|
89
|
+
return createIntegratedPolynomialNode(nodeDerivative, nodeC);
|
|
90
|
+
}
|
|
91
|
+
function createRandomNodeFFromZerosOfDerivative(arrX) {
|
|
92
|
+
const arrNodeX = arrX.map((x) => x.toTree());
|
|
93
|
+
const nodeDerivativeRaw = createNodeFPolynomialFromRoots((1).toTree(), arrNodeX);
|
|
94
|
+
const nodeFRaw = createRandomNodeFFromDerivative(nodeDerivativeRaw);
|
|
95
|
+
const maxAmplitude = Math.max(...arrX.map((x) => nodeFRaw.evaluate({ x })), 1);
|
|
96
|
+
const a = (((coinFlip() ? -1 : 1) * 1.0) / maxAmplitude) * randfloat(1, 3, 1);
|
|
97
|
+
return multiply(a, nodeFRaw);
|
|
98
|
+
}
|
|
99
|
+
const { arrX, nodeF } = (() => {
|
|
100
|
+
switch (typeF) {
|
|
101
|
+
case "constante": {
|
|
102
|
+
const arrX = [];
|
|
103
|
+
const arrNodeX = arrX.map((x) => x.toTree());
|
|
104
|
+
const nodeDerivative = createNodeFPolynomialFromRoots((0).toTree(), arrNodeX);
|
|
105
|
+
const nodeF = createRandomNodeFFromDerivative(nodeDerivative);
|
|
106
|
+
return { arrX, nodeF };
|
|
107
|
+
}
|
|
108
|
+
case "affine": {
|
|
109
|
+
const arrX = createRandomArrX(0);
|
|
110
|
+
const arrNodeX = arrX.map((x) => x.toTree());
|
|
111
|
+
const a = ((coinFlip() ? -1 : 1) * randint(1, 10)) / 2.0;
|
|
112
|
+
const nodeDerivative = createNodeFPolynomialFromRoots(a.toTree(), arrNodeX);
|
|
113
|
+
const nodeF = createRandomNodeFFromDerivative(nodeDerivative);
|
|
114
|
+
return { arrX, nodeF };
|
|
115
|
+
}
|
|
116
|
+
case "degré $2$": {
|
|
117
|
+
const arrX = createRandomArrX(1);
|
|
118
|
+
const nodeF = createRandomNodeFFromZerosOfDerivative(arrX);
|
|
119
|
+
return { arrX, nodeF };
|
|
120
|
+
}
|
|
121
|
+
case "degré $3$ monotone": {
|
|
122
|
+
const arrX = (() => {
|
|
123
|
+
const [x] = createRandomArrX(1);
|
|
124
|
+
return [x, x];
|
|
125
|
+
})();
|
|
126
|
+
const nodeF = createRandomNodeFFromZerosOfDerivative(arrX);
|
|
127
|
+
return { arrX, nodeF };
|
|
128
|
+
}
|
|
129
|
+
case "degré $3$ non-monotone": {
|
|
130
|
+
const arrX = createRandomArrX(2);
|
|
131
|
+
const nodeF = createRandomNodeFFromZerosOfDerivative(arrX);
|
|
132
|
+
return { arrX, nodeF };
|
|
133
|
+
}
|
|
134
|
+
case "degré $4$": {
|
|
135
|
+
const arrX = createRandomArrX(3);
|
|
136
|
+
const nodeF = createRandomNodeFFromZerosOfDerivative(arrX);
|
|
137
|
+
return { arrX, nodeF };
|
|
138
|
+
}
|
|
139
|
+
default:
|
|
140
|
+
throw new Error("Unsupported typeF: " + typeF);
|
|
141
|
+
}
|
|
142
|
+
})();
|
|
143
|
+
return { arrX, nodeF };
|
|
144
|
+
};
|
|
145
|
+
const getInstruction = (identifiers) => {
|
|
146
|
+
const { pointIds } = identifiers;
|
|
147
|
+
return `Ci-dessous est tracée en bleu la courbe $\\mathcal C_f$ de la fonction $f$.
|
|
148
|
+
|
|
149
|
+
En manipulant les points ${joinanded(pointIds.map((pointIds) => `$${pointIds.name}$`), ", ", " et ")},
|
|
150
|
+
construire une courbe plausible pour $f'$.`;
|
|
151
|
+
};
|
|
152
|
+
const getAnswerPoints = (identifiers) => {
|
|
153
|
+
const { nodeIdsF, nodeIdsAbscissa, typeF, pointIds } = identifiers;
|
|
154
|
+
const nodeF = NodeConstructor.fromIdentifiers(nodeIdsF);
|
|
155
|
+
const nodeDerivative = nodeF.derivative();
|
|
156
|
+
const arrNodeX = nodeIdsAbscissa.map((nodeIds) => NodeConstructor.fromIdentifiers(nodeIds));
|
|
157
|
+
const arrX = arrNodeX.map((node) => node.evaluate());
|
|
158
|
+
const arrXControl = getArrXControl(arrX, typeF);
|
|
159
|
+
const pointCoordsAnswer = zip(pointIds, arrXControl).map(([pointIds, x]) => {
|
|
160
|
+
const y = nodeDerivative.evaluate({ x });
|
|
161
|
+
return new Point(pointIds.name, x, y);
|
|
162
|
+
});
|
|
163
|
+
return pointCoordsAnswer;
|
|
164
|
+
};
|
|
165
|
+
const getGGBAnswer = (identifiers) => {
|
|
166
|
+
return getAnswerPoints(identifiers).flatMap((point) => {
|
|
167
|
+
return point.toGGBCommand({
|
|
168
|
+
isFixed: true,
|
|
169
|
+
isSelectionnable: true,
|
|
170
|
+
showLabel: true,
|
|
171
|
+
style: 0,
|
|
172
|
+
size: 5,
|
|
173
|
+
});
|
|
174
|
+
});
|
|
175
|
+
};
|
|
176
|
+
const getHint = () => {
|
|
177
|
+
return `Aux abscisses où la fonction $f$ est croissante, sa dérivée $f'$ est positive.
|
|
178
|
+
Aux abscisses où la fonction $f$ est décroissante, sa dérivée $f'$ est négative.
|
|
179
|
+
Ailleurs, sa dérivée $f'$ est nulle.`;
|
|
180
|
+
};
|
|
181
|
+
const getCorrection = () => {
|
|
182
|
+
return `Dans un premier temps :
|
|
183
|
+
Soit $S$ l'ensemble des abscisses $x$ où la tangente à $C_f$ est horizontale.
|
|
184
|
+
Pour tout $x$ dans $S$, on a $f'(x)=0$.
|
|
185
|
+
Pour chaque $x$ dans $S$, on peut placer un point de contrôle aux coordonées $(x, 0)$.
|
|
186
|
+
Dans un second temps :
|
|
187
|
+
Aux abscisses où la fonction $f$ est croissante, sa dérivée $f'$ est positive.
|
|
188
|
+
Aux abscisses où la fonction $f$ est décroissante, sa dérivée $f'$ est négative.
|
|
189
|
+
On place donc les points de contrôle restants pour garantir cela.`;
|
|
190
|
+
};
|
|
191
|
+
const getCorrectionGGBOptions = (identifiers) => {
|
|
192
|
+
const { nodeIdsAbscissa, nodeIdsF, typeF } = identifiers;
|
|
193
|
+
const nodeF = NodeConstructor.fromIdentifiers(nodeIdsF);
|
|
194
|
+
const nodeDerivative = nodeF.derivative();
|
|
195
|
+
const arrNodeX = nodeIdsAbscissa.map((nodeIds) => NodeConstructor.fromIdentifiers(nodeIds));
|
|
196
|
+
const arrX = arrNodeX.map((node) => node.evaluate());
|
|
197
|
+
const commands = [
|
|
198
|
+
`f(x) = ${nodeF.toMathString()}`,
|
|
199
|
+
`SetColor(f, "${blueMain}")`,
|
|
200
|
+
`SetCaption(f, "$\\mathcal C_f$")`,
|
|
201
|
+
`ShowLabel(f, true)`,
|
|
202
|
+
`f'(x) = ${nodeDerivative.toMathString()}`,
|
|
203
|
+
`SetColor(f', "${greenMain}")`,
|
|
204
|
+
`SetCaption(f', "$\\mathcal C_{f'}$")`,
|
|
205
|
+
`ShowLabel(f', true)`,
|
|
206
|
+
...getGGBAnswer(identifiers),
|
|
207
|
+
];
|
|
208
|
+
const ggb = new GeogebraConstructor({
|
|
209
|
+
commands,
|
|
210
|
+
yAxis: {
|
|
211
|
+
hideNumbers: true,
|
|
212
|
+
},
|
|
213
|
+
});
|
|
214
|
+
const { xMin, xMax } = getXMinXMax(arrX, typeF);
|
|
215
|
+
const { yMin, yMax } = getCoordsFrame(nodeF, xMin, xMax);
|
|
216
|
+
return ggb.getOptions({
|
|
217
|
+
coords: ggb.getAdaptedCoords({
|
|
218
|
+
xMin,
|
|
219
|
+
xMax,
|
|
220
|
+
yMin: Math.min(yMin, -2),
|
|
221
|
+
yMax,
|
|
222
|
+
}),
|
|
223
|
+
});
|
|
224
|
+
};
|
|
225
|
+
const getStudentGGBOptions = (identifiers) => {
|
|
226
|
+
const { nodeIdsAbscissa, nodeIdsF, pointIds, typeF } = identifiers;
|
|
227
|
+
const nodeF = NodeConstructor.fromIdentifiers(nodeIdsF);
|
|
228
|
+
const arrPoint = pointIds.map((pointIds) => PointConstructor.fromIdentifiers(pointIds));
|
|
229
|
+
const arrNodeX = nodeIdsAbscissa.map((nodeIds) => NodeConstructor.fromIdentifiers(nodeIds));
|
|
230
|
+
const arrX = arrNodeX.map((node) => node.evaluate());
|
|
231
|
+
const commands = [
|
|
232
|
+
`f(x) = ${nodeF.toMathString()}`,
|
|
233
|
+
`SetColor(f, "${blueMain}")`,
|
|
234
|
+
`SetCaption(f, "$\\mathcal C_f$")`,
|
|
235
|
+
`ShowLabel(f, true)`,
|
|
236
|
+
//control points
|
|
237
|
+
...arrPoint.flatMap((point) => point.toGGBCommand({
|
|
238
|
+
isFixed: false,
|
|
239
|
+
isSelectionnable: true,
|
|
240
|
+
showLabel: true,
|
|
241
|
+
style: 0,
|
|
242
|
+
size: 5,
|
|
243
|
+
})),
|
|
244
|
+
//Polynomial
|
|
245
|
+
`pol = Polynomial({${arrPoint.map((point) => point.name).join(",")}})`,
|
|
246
|
+
];
|
|
247
|
+
const studentGGB = new GeogebraConstructor({
|
|
248
|
+
commands,
|
|
249
|
+
yAxis: {
|
|
250
|
+
hideNumbers: true,
|
|
251
|
+
},
|
|
252
|
+
interactiveObjects: arrPoint.map((point) => point.name),
|
|
253
|
+
customToolBar: "0",
|
|
254
|
+
});
|
|
255
|
+
const { xMin, xMax } = getXMinXMax(arrX, typeF);
|
|
256
|
+
const { yMin, yMax } = getCoordsFrame(nodeF, xMin, xMax);
|
|
257
|
+
return studentGGB.getOptions({
|
|
258
|
+
coords: studentGGB.getAdaptedCoords({
|
|
259
|
+
xMin,
|
|
260
|
+
xMax,
|
|
261
|
+
yMin: Math.min(yMin, -2),
|
|
262
|
+
yMax,
|
|
263
|
+
}),
|
|
264
|
+
});
|
|
265
|
+
};
|
|
266
|
+
const isGGBAnswerValid = (ggbAns, { ggbAnswer: _ggbAnswer, ...identifiers }) => {
|
|
267
|
+
const { typeF } = identifiers;
|
|
268
|
+
const pointCoordsAns = parseGGBPoints(ggbAns)
|
|
269
|
+
.map((p) => ggbPointToCoords(p))
|
|
270
|
+
.toSorted(({ x: x1 }, { x: x2 }) => x1 - x2);
|
|
271
|
+
const pointCoordsAnswer = getAnswerPoints(identifiers).map((point) => {
|
|
272
|
+
return { x: point.x.evaluate(), y: point.y.evaluate() };
|
|
273
|
+
});
|
|
274
|
+
switch (typeF) {
|
|
275
|
+
case "constante": {
|
|
276
|
+
return pointCoordsAns.every(({ y: yAns }) => yAns === 0);
|
|
277
|
+
}
|
|
278
|
+
case "affine": {
|
|
279
|
+
const yAnswer = pointCoordsAnswer[0].y;
|
|
280
|
+
const yAns0 = pointCoordsAns[0].y;
|
|
281
|
+
return pointCoordsAns.every(({ y: yAns }) => yAns === yAns0 && yAns * yAnswer > 0);
|
|
282
|
+
}
|
|
283
|
+
case "degré $3$ monotone":
|
|
284
|
+
case "degré $2$": {
|
|
285
|
+
return zip(pointCoordsAns, pointCoordsAnswer).every(([{ x: xAns, y: yAns }, { x: xAnswer, y: yAnswer }], i) => {
|
|
286
|
+
if (i % 2 === 1) {
|
|
287
|
+
const isZeroMatching = xAns === xAnswer && yAns === yAnswer; /*=== 0*/
|
|
288
|
+
return isZeroMatching;
|
|
289
|
+
}
|
|
290
|
+
else {
|
|
291
|
+
//x between zeros of f (guaranteed by sortingXAsc) and y with same sign
|
|
292
|
+
const isSignMatching = yAns * yAnswer > 0;
|
|
293
|
+
return isSignMatching;
|
|
294
|
+
}
|
|
295
|
+
});
|
|
296
|
+
}
|
|
297
|
+
case "degré $3$ non-monotone":
|
|
298
|
+
case "degré $4$": {
|
|
299
|
+
return zip(pointCoordsAns, pointCoordsAnswer).every(([{ x: xAns, y: yAns }, { x: xAnswer, y: yAnswer }], i) => {
|
|
300
|
+
if (i % 2 === 0) {
|
|
301
|
+
const isZeroMatching = xAns === xAnswer && yAns === yAnswer; /*=== 0*/
|
|
302
|
+
return isZeroMatching;
|
|
303
|
+
}
|
|
304
|
+
else {
|
|
305
|
+
//x between zeros of f (guaranteed by sortingXAsc) and y with same sign
|
|
306
|
+
const isSignMatching = yAns * yAnswer > 0;
|
|
307
|
+
return isSignMatching;
|
|
308
|
+
}
|
|
309
|
+
});
|
|
310
|
+
}
|
|
311
|
+
default:
|
|
312
|
+
throw new Error("Unsupported typeF: " + typeF);
|
|
313
|
+
}
|
|
314
|
+
};
|
|
315
|
+
const getPlausibleDerivativeGraphFromFunctionGraphByManipulatingPolynomialQuestion = (optsIn) => {
|
|
316
|
+
const arrayedOptions = optsIn ?? arrayedOptsDefault;
|
|
317
|
+
const typeF = random(arrayedOptions.typeF);
|
|
318
|
+
const [arrX, nodeF] = (() => {
|
|
319
|
+
let arrX;
|
|
320
|
+
let nodeF;
|
|
321
|
+
let isValid = false;
|
|
322
|
+
let counter = -1;
|
|
323
|
+
while (!isValid && counter < 100) {
|
|
324
|
+
counter++;
|
|
325
|
+
const { arrX: arrXCandidate, nodeF: nodeFCandidate } = createFStuff(typeF);
|
|
326
|
+
const isReadable = (arrX, nodeF) => {
|
|
327
|
+
const isInFrame = () => {
|
|
328
|
+
const { xMin, xMax } = getXMinXMax(arrX, typeF);
|
|
329
|
+
const { yMin, yMax } = getCoordsFrame(nodeF, xMin, xMax);
|
|
330
|
+
return frac(yMax - yMin, xMax - xMin).evaluate() <= 0.666;
|
|
331
|
+
};
|
|
332
|
+
const isCurveOk = () => {
|
|
333
|
+
switch (typeF) {
|
|
334
|
+
case "constante":
|
|
335
|
+
case "affine":
|
|
336
|
+
case "degré $3$ monotone":
|
|
337
|
+
return true;
|
|
338
|
+
default: {
|
|
339
|
+
const isWavyEnough = () => {
|
|
340
|
+
return zip(arrX.slice(0, -1), arrX.slice(1)).every(([x1, x2]) => {
|
|
341
|
+
const [y1, y2] = [x1, x2].map((x) => nodeF.evaluate({ x }));
|
|
342
|
+
return Math.abs(y2 - y1) >= 0.777;
|
|
343
|
+
});
|
|
344
|
+
};
|
|
345
|
+
const isWavyAlternate = () => {
|
|
346
|
+
const nodeDerivative = nodeF.derivative();
|
|
347
|
+
const arrXMid = zip(arrX.slice(0, -1), arrX.slice(1)).map(([x1, x2]) => average([x1, x2]));
|
|
348
|
+
const arrXNonZero = [
|
|
349
|
+
arrX[0] - 2,
|
|
350
|
+
...arrXMid,
|
|
351
|
+
arrX[arrX.length - 1] + 2,
|
|
352
|
+
];
|
|
353
|
+
return zip(arrXNonZero.slice(0, -1), arrXNonZero.slice(1)).every(([x1, x2]) => {
|
|
354
|
+
const [y1, y2] = [x1, x2].map((x) => nodeDerivative.evaluate({ x }));
|
|
355
|
+
return y1 * y2 < 0;
|
|
356
|
+
});
|
|
357
|
+
};
|
|
358
|
+
return isWavyAlternate() && isWavyEnough();
|
|
359
|
+
}
|
|
360
|
+
}
|
|
361
|
+
};
|
|
362
|
+
return isCurveOk() && isInFrame();
|
|
363
|
+
};
|
|
364
|
+
isValid = isReadable(arrXCandidate, nodeFCandidate);
|
|
365
|
+
if (isValid) {
|
|
366
|
+
arrX = arrXCandidate;
|
|
367
|
+
nodeF = nodeFCandidate;
|
|
368
|
+
}
|
|
369
|
+
}
|
|
370
|
+
if (!isValid) {
|
|
371
|
+
const nodeIdsFDefault = {
|
|
372
|
+
id: 3,
|
|
373
|
+
leftChild: {
|
|
374
|
+
id: 0,
|
|
375
|
+
leftChild: {
|
|
376
|
+
id: 2,
|
|
377
|
+
leftChild: {
|
|
378
|
+
id: 7,
|
|
379
|
+
value: -20,
|
|
380
|
+
},
|
|
381
|
+
rightChild: {
|
|
382
|
+
id: 5,
|
|
383
|
+
leftChild: {
|
|
384
|
+
id: 10,
|
|
385
|
+
name: "x",
|
|
386
|
+
},
|
|
387
|
+
rightChild: {
|
|
388
|
+
id: 7,
|
|
389
|
+
value: 3,
|
|
390
|
+
},
|
|
391
|
+
},
|
|
392
|
+
},
|
|
393
|
+
rightChild: {
|
|
394
|
+
id: 2,
|
|
395
|
+
leftChild: {
|
|
396
|
+
id: 7,
|
|
397
|
+
value: 30,
|
|
398
|
+
},
|
|
399
|
+
rightChild: {
|
|
400
|
+
id: 0,
|
|
401
|
+
leftChild: {
|
|
402
|
+
id: 0,
|
|
403
|
+
leftChild: {
|
|
404
|
+
id: 2,
|
|
405
|
+
leftChild: {
|
|
406
|
+
id: 7,
|
|
407
|
+
value: 3,
|
|
408
|
+
},
|
|
409
|
+
rightChild: {
|
|
410
|
+
id: 5,
|
|
411
|
+
leftChild: {
|
|
412
|
+
id: 10,
|
|
413
|
+
name: "x",
|
|
414
|
+
},
|
|
415
|
+
rightChild: {
|
|
416
|
+
id: 7,
|
|
417
|
+
value: 2,
|
|
418
|
+
},
|
|
419
|
+
},
|
|
420
|
+
},
|
|
421
|
+
rightChild: {
|
|
422
|
+
id: 2,
|
|
423
|
+
leftChild: {
|
|
424
|
+
id: 7,
|
|
425
|
+
value: 20,
|
|
426
|
+
},
|
|
427
|
+
rightChild: {
|
|
428
|
+
id: 10,
|
|
429
|
+
name: "x",
|
|
430
|
+
},
|
|
431
|
+
},
|
|
432
|
+
},
|
|
433
|
+
rightChild: {
|
|
434
|
+
id: 7,
|
|
435
|
+
value: -40,
|
|
436
|
+
},
|
|
437
|
+
},
|
|
438
|
+
},
|
|
439
|
+
},
|
|
440
|
+
rightChild: {
|
|
441
|
+
id: 7,
|
|
442
|
+
value: 600,
|
|
443
|
+
},
|
|
444
|
+
};
|
|
445
|
+
nodeF = NodeConstructor.fromIdentifiers(nodeIdsFDefault);
|
|
446
|
+
arrX = [-2, 5];
|
|
447
|
+
}
|
|
448
|
+
return [arrX, nodeF];
|
|
449
|
+
})();
|
|
450
|
+
const arrXControl = getArrXControl(arrX, typeF);
|
|
451
|
+
const { xMin, xMax } = getXMinXMax(arrX, typeF);
|
|
452
|
+
const { yMin, yMax } = getCoordsFrame(nodeF, xMin, xMax);
|
|
453
|
+
const pointCenter = new Point("O", average([xMin, xMax]), average([yMin, yMax]));
|
|
454
|
+
const pointNames = "ABCDEFGHIJKLMNO".split("");
|
|
455
|
+
const arrPoint = arrXControl.map((_, i) => {
|
|
456
|
+
const sector = i % 4;
|
|
457
|
+
const distance = 1 + Math.floor(i / 4);
|
|
458
|
+
const [factorX, factorY] = (() => {
|
|
459
|
+
switch (sector) {
|
|
460
|
+
case 0:
|
|
461
|
+
return [1, 1];
|
|
462
|
+
case 1:
|
|
463
|
+
return [-1, 1];
|
|
464
|
+
case 2:
|
|
465
|
+
return [-1, -1];
|
|
466
|
+
case 3:
|
|
467
|
+
return [1, -1];
|
|
468
|
+
default:
|
|
469
|
+
throw new Error("Unsupported sector: " + sector);
|
|
470
|
+
}
|
|
471
|
+
})();
|
|
472
|
+
const [x, y] = [factorX, factorY].map((factor) => factor * distance);
|
|
473
|
+
return new Point(pointNames[i], pointCenter.x.evaluate() + x, pointCenter.y.evaluate() + y);
|
|
474
|
+
});
|
|
475
|
+
const identifiers = {
|
|
476
|
+
nodeIdsF: nodeF.toIdentifiers(),
|
|
477
|
+
pointIds: arrPoint.map((point) => point.toIdentifiers()),
|
|
478
|
+
nodeIdsAbscissa: arrX.map((x) => x.toTree().toIdentifiers()),
|
|
479
|
+
typeF,
|
|
480
|
+
};
|
|
481
|
+
return getQuestionFromIdentifiers(identifiers);
|
|
482
|
+
};
|
|
483
|
+
const getQuestionFromIdentifiers = (identifiers, opts) => {
|
|
484
|
+
return {
|
|
485
|
+
ggbAnswer: getGGBAnswer(identifiers),
|
|
486
|
+
instruction: getInstruction(identifiers, opts),
|
|
487
|
+
studentGgbOptions: getStudentGGBOptions(identifiers),
|
|
488
|
+
answerFormat: "tex",
|
|
489
|
+
keys: [],
|
|
490
|
+
hint: getHint(identifiers, opts),
|
|
491
|
+
correction: getCorrection(identifiers, opts),
|
|
492
|
+
correctionGgbOptions: getCorrectionGGBOptions(identifiers, opts),
|
|
493
|
+
identifiers,
|
|
494
|
+
};
|
|
495
|
+
};
|
|
496
|
+
const arrayedOptsDefault = {
|
|
497
|
+
typeF: [
|
|
498
|
+
"constante",
|
|
499
|
+
"affine",
|
|
500
|
+
"degré $2$",
|
|
501
|
+
"degré $3$ monotone",
|
|
502
|
+
"degré $3$ non-monotone",
|
|
503
|
+
"degré $4$",
|
|
504
|
+
],
|
|
505
|
+
};
|
|
506
|
+
const options = [
|
|
507
|
+
{
|
|
508
|
+
id: "typeF",
|
|
509
|
+
label: "Type de fonction $f$",
|
|
510
|
+
target: GeneratorOptionTarget.generation,
|
|
511
|
+
type: GeneratorOptionType.multiselect,
|
|
512
|
+
values: [
|
|
513
|
+
"constante",
|
|
514
|
+
"affine",
|
|
515
|
+
"degré $2$",
|
|
516
|
+
"degré $3$ monotone",
|
|
517
|
+
"degré $3$ non-monotone",
|
|
518
|
+
"degré $4$",
|
|
519
|
+
],
|
|
520
|
+
defaultValue: arrayedOptsDefault.typeF,
|
|
521
|
+
},
|
|
522
|
+
];
|
|
523
|
+
export const plausibleDerivativeGraphFromFunctionGraphByManipulatingPolynomial = {
|
|
524
|
+
id: "plausibleDerivativeGraphFromFunctionGraphByManipulatingPolynomial",
|
|
525
|
+
connector: "=",
|
|
526
|
+
label: "À partir de la courbe d'une fonction, construire une courbe plausible pour sa dérivée",
|
|
527
|
+
isSingleStep: false,
|
|
528
|
+
generator: (nb, opts) => getDistinctQuestions(() => getPlausibleDerivativeGraphFromFunctionGraphByManipulatingPolynomialQuestion(opts), nb),
|
|
529
|
+
options,
|
|
530
|
+
qcmTimer: 60,
|
|
531
|
+
freeTimer: 60,
|
|
532
|
+
isGGBAnswerValid,
|
|
533
|
+
subject: "Mathématiques",
|
|
534
|
+
getQuestionFromIdentifiers,
|
|
535
|
+
hasHintAndCorrection: true,
|
|
536
|
+
answerType: "GGB",
|
|
537
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { Exercise } from "../../../../exercises/exercise.js";
|
|
2
|
+
import { PointIdentifiers } from "../../../../math/geometry/point.js";
|
|
3
|
+
import { NodeIdentifiers } from "../../../../tree/nodes/nodeConstructor.js";
|
|
4
|
+
type Identifiers = {
|
|
5
|
+
nodeIdsF: NodeIdentifiers;
|
|
6
|
+
pointIds: PointIdentifiers[];
|
|
7
|
+
nodeIdsAbscissa: NodeIdentifiers[];
|
|
8
|
+
typeF: string;
|
|
9
|
+
};
|
|
10
|
+
type Options = {
|
|
11
|
+
typeF: string;
|
|
12
|
+
};
|
|
13
|
+
export declare const plausibleFunctionGraphFromDerivativeGraphByManipulatingPolynomial: Exercise<Identifiers, Options>;
|
|
14
|
+
export {};
|
|
15
|
+
//# sourceMappingURL=plausibleFunctionGraphFromDerivativeGraphByManipulatingPolynomial.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plausibleFunctionGraphFromDerivativeGraphByManipulatingPolynomial.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/derivation/variations/plausibleFunctionGraphFromDerivativeGraphByManipulatingPolynomial.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAYT,MAAM,6BAA6B,CAAC;AAKrC,OAAO,EAGL,gBAAgB,EACjB,MAAM,8BAA8B,CAAC;AAYtC,OAAO,EAEL,eAAe,EAChB,MAAM,qCAAqC,CAAC;AAkK7C,KAAK,WAAW,GAAG;IACjB,QAAQ,EAAE,eAAe,CAAC;IAC1B,QAAQ,EAAE,gBAAgB,EAAE,CAAC;IAC7B,eAAe,EAAE,eAAe,EAAE,CAAC;IACnC,KAAK,EAAE,MAAM,CAAC;CACf,CAAC;AAokBF,KAAK,OAAO,GAAG;IACb,KAAK,EAAE,MAAM,CAAC;CACf,CAAC;AAkCF,eAAO,MAAM,iEAAiE,EAAE,QAAQ,CACtF,WAAW,EACX,OAAO,CAuBR,CAAC"}
|