math-exercises 3.0.56 → 3.0.58
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/calcul/operations/operationsPriorities.d.ts +2 -0
- package/lib/exercises/math/calcul/operations/operationsPriorities.d.ts.map +1 -1
- package/lib/exercises/math/calcul/operations/operationsPriorities.js +46 -36
- package/lib/exercises/math/calculLitteral/equation/choseOperationToSolveEquation.d.ts.map +1 -1
- package/lib/exercises/math/calculLitteral/equation/choseOperationToSolveEquation.js +65 -13
- package/lib/exercises/math/calculLitteral/equation/multiplicationEquation.d.ts.map +1 -1
- package/lib/exercises/math/calculLitteral/equation/multiplicationEquation.js +1 -4
- package/lib/exercises/math/calculLitteral/factorisation/facto1.d.ts +16 -0
- package/lib/exercises/math/calculLitteral/factorisation/facto1.d.ts.map +1 -0
- package/lib/exercises/math/calculLitteral/factorisation/facto1.js +184 -0
- package/lib/exercises/math/calculLitteral/factorisation/factoType1Exercise.d.ts.map +1 -1
- package/lib/exercises/math/calculLitteral/factorisation/factoType1Exercise.js +43 -0
- package/lib/exercises/math/calculLitteral/factorisation/index.d.ts +1 -1
- package/lib/exercises/math/calculLitteral/factorisation/index.d.ts.map +1 -1
- package/lib/exercises/math/calculLitteral/factorisation/index.js +1 -1
- package/lib/exercises/math/calculLitteral/systems/basicNiceValuesSystemResolution.d.ts.map +1 -1
- package/lib/exercises/math/calculLitteral/systems/basicNiceValuesSystemResolution.js +23 -0
- package/lib/exercises/math/calculLitteral/systems/basicSystemResolution.d.ts.map +1 -1
- package/lib/exercises/math/calculLitteral/systems/basicSystemResolution.js +23 -0
- package/lib/exercises/math/calculLitteral/systems/verifySystemSolution.d.ts.map +1 -1
- package/lib/exercises/math/calculLitteral/systems/verifySystemSolution.js +49 -0
- package/lib/exercises/math/conversion/capacityConversion.d.ts.map +1 -1
- package/lib/exercises/math/conversion/capacityConversion.js +68 -12
- package/lib/exercises/math/conversion/hoursToDecimal.d.ts.map +1 -1
- package/lib/exercises/math/conversion/hoursToDecimal.js +73 -15
- package/lib/exercises/math/conversion/lengthConversion.d.ts.map +1 -1
- package/lib/exercises/math/conversion/lengthConversion.js +55 -6
- package/lib/exercises/math/conversion/massConversion.d.ts.map +1 -1
- package/lib/exercises/math/conversion/massConversion.js +72 -16
- package/lib/exercises/math/conversion/volumeConversion.d.ts.map +1 -1
- package/lib/exercises/math/conversion/volumeConversion.js +72 -12
- package/lib/exercises/math/derivation/convexity/convexityQuadrinomials.d.ts +8 -0
- package/lib/exercises/math/derivation/convexity/convexityQuadrinomials.d.ts.map +1 -0
- package/lib/exercises/math/derivation/convexity/convexityQuadrinomials.js +102 -0
- package/lib/exercises/math/derivation/convexity/convexityTrinomials.d.ts +7 -0
- package/lib/exercises/math/derivation/convexity/convexityTrinomials.d.ts.map +1 -0
- package/lib/exercises/math/derivation/convexity/convexityTrinomials.js +52 -0
- package/lib/exercises/math/derivation/convexity/index.d.ts +4 -0
- package/lib/exercises/math/derivation/convexity/index.d.ts.map +1 -0
- package/lib/exercises/math/derivation/convexity/index.js +3 -0
- package/lib/exercises/math/derivation/convexity/inflexionPointQuadrinomials.d.ts +7 -0
- package/lib/exercises/math/derivation/convexity/inflexionPointQuadrinomials.d.ts.map +1 -0
- package/lib/exercises/math/derivation/convexity/inflexionPointQuadrinomials.js +134 -0
- package/lib/exercises/math/derivation/derivative/exp/expDerivativeFour.d.ts +8 -0
- package/lib/exercises/math/derivation/derivative/exp/expDerivativeFour.d.ts.map +1 -0
- package/lib/exercises/math/derivation/derivative/exp/expDerivativeFour.js +79 -0
- package/lib/exercises/math/derivation/derivative/exp/expDerivativeOne.d.ts +8 -0
- package/lib/exercises/math/derivation/derivative/exp/expDerivativeOne.d.ts.map +1 -0
- package/lib/exercises/math/derivation/derivative/exp/expDerivativeOne.js +85 -0
- package/lib/exercises/math/derivation/derivative/exp/expDerivativeThree.d.ts +8 -0
- package/lib/exercises/math/derivation/derivative/exp/expDerivativeThree.d.ts.map +1 -0
- package/lib/exercises/math/derivation/derivative/exp/expDerivativeThree.js +86 -0
- package/lib/exercises/math/derivation/derivative/exp/expDerivativeTwo.d.ts +8 -0
- package/lib/exercises/math/derivation/derivative/exp/expDerivativeTwo.d.ts.map +1 -0
- package/lib/exercises/math/derivation/derivative/exp/expDerivativeTwo.js +76 -0
- package/lib/exercises/math/derivation/derivative/exp/index.d.ts +6 -0
- package/lib/exercises/math/derivation/derivative/exp/index.d.ts.map +1 -0
- package/lib/exercises/math/derivation/derivative/exp/index.js +5 -0
- package/lib/exercises/math/derivation/derivative/exp/secondDerivativeOfExpoFunction.d.ts +7 -0
- package/lib/exercises/math/derivation/derivative/exp/secondDerivativeOfExpoFunction.d.ts.map +1 -0
- package/lib/exercises/math/derivation/derivative/exp/secondDerivativeOfExpoFunction.js +84 -0
- package/lib/exercises/math/derivation/derivative/index.d.ts +6 -27
- package/lib/exercises/math/derivation/derivative/index.d.ts.map +1 -1
- package/lib/exercises/math/derivation/derivative/index.js +6 -27
- package/lib/exercises/math/derivation/derivative/ln/index.d.ts +4 -0
- package/lib/exercises/math/derivation/derivative/ln/index.d.ts.map +1 -0
- package/lib/exercises/math/derivation/derivative/ln/index.js +3 -0
- package/lib/exercises/math/derivation/derivative/ln/lnDerivativeOne.d.ts +8 -0
- package/lib/exercises/math/derivation/derivative/ln/lnDerivativeOne.d.ts.map +1 -0
- package/lib/exercises/math/derivation/derivative/ln/lnDerivativeOne.js +81 -0
- package/lib/exercises/math/derivation/derivative/ln/lnDerivativeThree.d.ts +8 -0
- package/lib/exercises/math/derivation/derivative/ln/lnDerivativeThree.d.ts.map +1 -0
- package/lib/exercises/math/derivation/derivative/ln/lnDerivativeThree.js +103 -0
- package/lib/exercises/math/derivation/derivative/ln/lnDerivativeTwo.d.ts +8 -0
- package/lib/exercises/math/derivation/derivative/ln/lnDerivativeTwo.d.ts.map +1 -0
- package/lib/exercises/math/derivation/derivative/ln/lnDerivativeTwo.js +77 -0
- package/lib/exercises/math/derivation/derivative/polynomial/constanteDerivative.d.ts +10 -0
- package/lib/exercises/math/derivation/derivative/polynomial/constanteDerivative.d.ts.map +1 -0
- package/lib/exercises/math/derivation/derivative/polynomial/constanteDerivative.js +71 -0
- package/lib/exercises/math/derivation/derivative/polynomial/firstDegreeDerivative.d.ts +11 -0
- package/lib/exercises/math/derivation/derivative/polynomial/firstDegreeDerivative.d.ts.map +1 -0
- package/lib/exercises/math/derivation/derivative/polynomial/firstDegreeDerivative.js +88 -0
- package/lib/exercises/math/derivation/derivative/polynomial/index.d.ts +8 -0
- package/lib/exercises/math/derivation/derivative/polynomial/index.d.ts.map +1 -0
- package/lib/exercises/math/derivation/derivative/polynomial/index.js +7 -0
- package/lib/exercises/math/derivation/derivative/polynomial/secondDegreeDerivative.d.ts +10 -0
- package/lib/exercises/math/derivation/derivative/polynomial/secondDegreeDerivative.d.ts.map +1 -0
- package/lib/exercises/math/derivation/derivative/polynomial/secondDegreeDerivative.js +115 -0
- package/lib/exercises/math/derivation/derivative/polynomial/secondDerivativeOfThirdDegreeFunction.d.ts +10 -0
- package/lib/exercises/math/derivation/derivative/polynomial/secondDerivativeOfThirdDegreeFunction.d.ts.map +1 -0
- package/lib/exercises/math/derivation/derivative/polynomial/secondDerivativeOfThirdDegreeFunction.js +80 -0
- package/lib/exercises/math/derivation/derivative/polynomial/secondDerivativeOfTrinom.d.ts +9 -0
- package/lib/exercises/math/derivation/derivative/polynomial/secondDerivativeOfTrinom.d.ts.map +1 -0
- package/lib/exercises/math/derivation/derivative/polynomial/secondDerivativeOfTrinom.js +67 -0
- package/lib/exercises/math/derivation/derivative/polynomial/thirdDegreeDerivative.d.ts +10 -0
- package/lib/exercises/math/derivation/derivative/polynomial/thirdDegreeDerivative.d.ts.map +1 -0
- package/lib/exercises/math/derivation/derivative/polynomial/thirdDegreeDerivative.js +134 -0
- package/lib/exercises/math/derivation/derivative/polynomial/usualderivative.d.ts +11 -0
- package/lib/exercises/math/derivation/derivative/polynomial/usualderivative.d.ts.map +1 -0
- package/lib/exercises/math/derivation/derivative/polynomial/usualderivative.js +97 -0
- package/lib/exercises/math/derivation/derivative/power/index.d.ts +3 -0
- package/lib/exercises/math/derivation/derivative/power/index.d.ts.map +1 -0
- package/lib/exercises/math/derivation/derivative/power/index.js +2 -0
- package/lib/exercises/math/derivation/derivative/power/powerCompositionDerivation.d.ts +9 -0
- package/lib/exercises/math/derivation/derivative/power/powerCompositionDerivation.d.ts.map +1 -0
- package/lib/exercises/math/derivation/derivative/power/powerCompositionDerivation.js +122 -0
- package/lib/exercises/math/derivation/derivative/power/powerFunctionDerivative.d.ts +8 -0
- package/lib/exercises/math/derivation/derivative/power/powerFunctionDerivative.d.ts.map +1 -0
- package/lib/exercises/math/derivation/derivative/power/powerFunctionDerivative.js +118 -0
- package/lib/exercises/math/derivation/derivative/sqrt/index.d.ts +3 -0
- package/lib/exercises/math/derivation/derivative/sqrt/index.d.ts.map +1 -0
- package/lib/exercises/math/derivation/derivative/sqrt/index.js +3 -0
- package/lib/exercises/math/derivation/derivative/sqrt/rootFunctionDerivative.d.ts +7 -0
- package/lib/exercises/math/derivation/derivative/sqrt/rootFunctionDerivative.d.ts.map +1 -0
- package/lib/exercises/math/derivation/derivative/sqrt/rootFunctionDerivative.js +115 -0
- package/lib/exercises/math/derivation/derivative/sqrt/sqrtCompositionDerivation.d.ts +8 -0
- package/lib/exercises/math/derivation/derivative/sqrt/sqrtCompositionDerivation.d.ts.map +1 -0
- package/lib/exercises/math/derivation/derivative/sqrt/sqrtCompositionDerivation.js +77 -0
- package/lib/exercises/math/derivation/derivative/sqrt/sqrtProductDerivative.d.ts +8 -0
- package/lib/exercises/math/derivation/derivative/sqrt/sqrtProductDerivative.d.ts.map +1 -0
- package/lib/exercises/math/derivation/derivative/sqrt/sqrtProductDerivative.js +85 -0
- package/lib/exercises/math/derivation/derivative/trigo/cosCompositionDerivation.d.ts +8 -0
- package/lib/exercises/math/derivation/derivative/trigo/cosCompositionDerivation.d.ts.map +1 -0
- package/lib/exercises/math/derivation/derivative/trigo/cosCompositionDerivation.js +81 -0
- package/lib/exercises/math/derivation/derivative/trigo/cosSecondDegreeDerivative.d.ts +7 -0
- package/lib/exercises/math/derivation/derivative/trigo/cosSecondDegreeDerivative.d.ts.map +1 -0
- package/lib/exercises/math/derivation/derivative/trigo/cosSecondDegreeDerivative.js +103 -0
- package/lib/exercises/math/derivation/derivative/trigo/index.d.ts +5 -0
- package/lib/exercises/math/derivation/derivative/trigo/index.d.ts.map +1 -0
- package/lib/exercises/math/derivation/derivative/trigo/index.js +4 -0
- package/lib/exercises/math/derivation/derivative/trigo/sinCompositionDerivation.d.ts +8 -0
- package/lib/exercises/math/derivation/derivative/trigo/sinCompositionDerivation.d.ts.map +1 -0
- package/lib/exercises/math/derivation/derivative/trigo/sinCompositionDerivation.js +70 -0
- package/lib/exercises/math/derivation/derivative/trigo/sinSecondDegreeDerivative.d.ts +7 -0
- package/lib/exercises/math/derivation/derivative/trigo/sinSecondDegreeDerivative.d.ts.map +1 -0
- package/lib/exercises/math/derivation/derivative/trigo/sinSecondDegreeDerivative.js +91 -0
- package/lib/exercises/math/derivation/derivativeNumberCalcul.d.ts.map +1 -1
- package/lib/exercises/math/derivation/derivativeNumberCalcul.js +4 -2
- package/lib/exercises/math/derivation/index.d.ts +2 -0
- package/lib/exercises/math/derivation/index.d.ts.map +1 -1
- package/lib/exercises/math/derivation/index.js +2 -0
- package/lib/exercises/math/derivation/variations/index.d.ts +2 -0
- package/lib/exercises/math/derivation/variations/index.d.ts.map +1 -0
- package/lib/exercises/math/derivation/variations/index.js +1 -0
- package/lib/exercises/math/derivation/variations/thirdDegreeFunctionVariation.d.ts +11 -0
- package/lib/exercises/math/derivation/variations/thirdDegreeFunctionVariation.d.ts.map +1 -0
- package/lib/exercises/math/derivation/variations/thirdDegreeFunctionVariation.js +168 -0
- package/lib/exercises/math/equaDiff/equaDiffAyPlusB.d.ts.map +1 -1
- package/lib/exercises/math/equaDiff/equaDiffAyPlusB.js +39 -22
- package/lib/exercises/math/equaDiff/equaDiffCheckSolutionFirstOrder.d.ts.map +1 -1
- package/lib/exercises/math/equaDiff/equaDiffCheckSolutionFirstOrder.js +7 -1
- package/lib/exercises/math/equaDiff/equaDiffGeneralForme.d.ts.map +1 -1
- package/lib/exercises/math/equaDiff/equaDiffGeneralForme.js +38 -15
- package/lib/exercises/math/equaDiff/equaDiffGeneralFormeWithIC.d.ts.map +1 -1
- package/lib/exercises/math/equaDiff/equaDiffGeneralFormeWithIC.js +29 -8
- package/lib/exercises/math/equaDiff/exponentialDifferentialEquationWithIC.d.ts +8 -0
- package/lib/exercises/math/equaDiff/exponentialDifferentialEquationWithIC.d.ts.map +1 -0
- package/lib/exercises/math/equaDiff/exponentialDifferentialEquationWithIC.js +86 -0
- package/lib/exercises/math/equaDiff/index.d.ts +1 -1
- package/lib/exercises/math/equaDiff/index.d.ts.map +1 -1
- package/lib/exercises/math/equaDiff/index.js +1 -1
- package/lib/exercises/math/functions/affines/signFunction.d.ts.map +1 -1
- package/lib/exercises/math/functions/affines/signFunction.js +23 -11
- package/lib/exercises/math/functions/exponential/expEquation.d.ts.map +1 -1
- package/lib/exercises/math/functions/exponential/expEquation.js +3 -0
- package/lib/exercises/math/functions/exponential/expFactorization.d.ts.map +1 -1
- package/lib/exercises/math/functions/exponential/expFactorization.js +3 -0
- package/lib/exercises/math/functions/exponential/expSimplifiying.d.ts.map +1 -1
- package/lib/exercises/math/functions/exponential/expSimplifiying.js +83 -45
- package/lib/exercises/math/geometry/cartesian/cartesianEquationOfLine.d.ts.map +1 -1
- package/lib/exercises/math/geometry/cartesian/cartesianEquationOfLine.js +12 -5
- package/lib/exercises/math/geometry/euclidianConstructions/buildRhombus.d.ts +2 -0
- package/lib/exercises/math/geometry/euclidianConstructions/buildRhombus.d.ts.map +1 -0
- package/lib/exercises/math/geometry/euclidianConstructions/buildRhombus.js +63 -0
- package/lib/exercises/math/geometry/lines/cartesianEquationToReduced.d.ts.map +1 -1
- package/lib/exercises/math/geometry/lines/cartesianEquationToReduced.js +68 -29
- package/lib/exercises/math/geometry/lines/cartesianEquationsIntersection.d.ts.map +1 -1
- package/lib/exercises/math/geometry/lines/cartesianEquationsIntersection.js +56 -4
- package/lib/exercises/math/geometry/lines/drawLineFromCartesianEquation.d.ts.map +1 -1
- package/lib/exercises/math/geometry/lines/drawLineFromCartesianEquation.js +71 -25
- package/lib/exercises/math/limits/polynomLimit.d.ts +1 -1
- package/lib/exercises/math/limits/polynomLimit.d.ts.map +1 -1
- package/lib/exercises/math/limits/polynomLimit.js +28 -9
- package/lib/exercises/math/limits/polynomLimitNoFI.d.ts +1 -1
- package/lib/exercises/math/limits/polynomLimitNoFI.d.ts.map +1 -1
- package/lib/exercises/math/limits/polynomLimitNoFI.js +29 -10
- package/lib/exercises/math/powers/calculateNegativePower.d.ts.map +1 -1
- package/lib/exercises/math/powers/calculateNegativePower.js +59 -16
- package/lib/exercises/math/powers/decimalToScientific.d.ts.map +1 -1
- package/lib/exercises/math/powers/decimalToScientific.js +55 -11
- package/lib/exercises/math/powers/index.d.ts +1 -0
- package/lib/exercises/math/powers/index.d.ts.map +1 -1
- package/lib/exercises/math/powers/index.js +1 -0
- package/lib/exercises/math/powers/powersDivision.d.ts +5 -2
- package/lib/exercises/math/powers/powersDivision.d.ts.map +1 -1
- package/lib/exercises/math/powers/powersDivision.js +68 -53
- package/lib/exercises/math/powers/powersMixOperations.d.ts +1 -0
- package/lib/exercises/math/powers/powersMixOperations.d.ts.map +1 -1
- package/lib/exercises/math/powers/powersMixOperations.js +88 -17
- package/lib/exercises/math/powers/powersOfTenMixOperations.d.ts +10 -0
- package/lib/exercises/math/powers/powersOfTenMixOperations.d.ts.map +1 -0
- package/lib/exercises/math/powers/powersOfTenMixOperations.js +129 -0
- package/lib/exercises/math/powers/powersOfTenToDecimal.d.ts.map +1 -1
- package/lib/exercises/math/powers/powersOfTenToDecimal.js +32 -3
- package/lib/exercises/math/powers/powersProduct.d.ts.map +1 -1
- package/lib/exercises/math/powers/powersProduct.js +1 -0
- package/lib/exercises/math/powers/scientificToDecimal.d.ts.map +1 -1
- package/lib/exercises/math/powers/scientificToDecimal.js +50 -10
- package/lib/exercises/math/primitive/klogUPrimitive.js +1 -1
- package/lib/exercises/math/primitive/logarithmePrimitive.js +1 -1
- package/lib/exercises/math/primitive/polynomialPrimitive.d.ts.map +1 -1
- package/lib/exercises/math/primitive/polynomialPrimitive.js +1 -0
- package/lib/exercises/math/probaStat/stats1var/averageList.d.ts.map +1 -1
- package/lib/exercises/math/probaStat/stats1var/averageList.js +4 -4
- package/lib/exercises/math/probaStat/stats1var/averageWithTable.d.ts.map +1 -1
- package/lib/exercises/math/probaStat/stats1var/averageWithTable.js +42 -11
- package/lib/exercises/math/probaStat/stats1var/choseReasoningForIndicator.d.ts.map +1 -1
- package/lib/exercises/math/probaStat/stats1var/choseReasoningForIndicator.js +8 -20
- package/lib/exercises/math/probaStat/stats1var/etendueList.d.ts.map +1 -1
- package/lib/exercises/math/probaStat/stats1var/etendueList.js +4 -6
- package/lib/exercises/math/probaStat/stats1var/interquartilesList.d.ts.map +1 -1
- package/lib/exercises/math/probaStat/stats1var/interquartilesList.js +4 -4
- package/lib/exercises/math/probaStat/stats1var/interquartilesTable.d.ts.map +1 -1
- package/lib/exercises/math/probaStat/stats1var/interquartilesTable.js +4 -4
- package/lib/exercises/math/probaStat/stats1var/marginalAndConditionalFrequency.d.ts.map +1 -1
- package/lib/exercises/math/probaStat/stats1var/marginalAndConditionalFrequency.js +13 -9
- package/lib/exercises/math/probaStat/stats1var/median.d.ts.map +1 -1
- package/lib/exercises/math/probaStat/stats1var/median.js +19 -14
- package/lib/exercises/math/probaStat/stats1var/medianList.d.ts.map +1 -1
- package/lib/exercises/math/probaStat/stats1var/medianList.js +3 -0
- package/lib/exercises/math/probaStat/stats1var/quartiles.d.ts.map +1 -1
- package/lib/exercises/math/probaStat/stats1var/quartiles.js +16 -11
- package/lib/exercises/math/probaStat/stats1var/quartilesList.d.ts.map +1 -1
- package/lib/exercises/math/probaStat/stats1var/quartilesList.js +18 -14
- package/lib/exercises/math/probaStat/stats1var/standardDeviationList.d.ts.map +1 -1
- package/lib/exercises/math/probaStat/stats1var/standardDeviationList.js +4 -4
- package/lib/exercises/math/probaStat/stats1var/standardDeviationTable.d.ts.map +1 -1
- package/lib/exercises/math/probaStat/stats1var/standardDeviationTable.js +4 -4
- package/lib/exercises/math/probaStat/stats1var/varianceList.d.ts.map +1 -1
- package/lib/exercises/math/probaStat/stats1var/varianceList.js +4 -4
- package/lib/exercises/math/probaStat/stats1var/varianceTable.d.ts.map +1 -1
- package/lib/exercises/math/probaStat/stats1var/varianceTable.js +4 -4
- package/lib/exercises/math/sequences/geometric/geometricFirstTermsGeneralSum.d.ts.map +1 -1
- package/lib/exercises/math/sequences/geometric/geometricFirstTermsGeneralSum.js +40 -2
- package/lib/exercises/math/sequences/geometric/geometricFirstTermsSum.d.ts.map +1 -1
- package/lib/exercises/math/sequences/geometric/geometricFirstTermsSum.js +32 -0
- package/lib/exercises/math/trigonometry/trigonometry.d.ts.map +1 -1
- package/lib/exercises/math/trigonometry/trigonometry.js +67 -1
- package/lib/exercises/math/trigonometry/trigonometryAngleCalcul.d.ts.map +1 -1
- package/lib/exercises/math/trigonometry/trigonometryAngleCalcul.js +89 -0
- package/lib/exercises/pc/index.d.ts +5 -5
- package/lib/exercises/pc/index.d.ts.map +1 -1
- package/lib/exercises/pc/index.js +5 -5
- package/lib/index.d.ts +56 -45
- package/lib/index.d.ts.map +1 -1
- package/lib/math/geometry/angle.d.ts.map +1 -1
- package/lib/math/geometry/angle.js +0 -5
- package/lib/math/geometry/vector.d.ts +1 -0
- package/lib/math/geometry/vector.d.ts.map +1 -1
- package/lib/math/geometry/vector.js +19 -0
- package/lib/math/numbers/decimals/decimal.d.ts +1 -0
- package/lib/math/numbers/decimals/decimal.d.ts.map +1 -1
- package/lib/math/numbers/decimals/decimal.js +2 -0
- package/lib/math/systems/generalSystem.d.ts +6 -1
- package/lib/math/systems/generalSystem.d.ts.map +1 -1
- package/lib/math/systems/generalSystem.js +137 -0
- package/lib/math/utils/arithmetic/lcm.js +1 -1
- package/lib/playground.d.ts.map +1 -1
- package/lib/playground.js +4 -34
- package/lib/tree/nodes/algebraicNode.d.ts +1 -0
- package/lib/tree/nodes/algebraicNode.d.ts.map +1 -1
- package/lib/tree/nodes/equations/equalNode.d.ts +7 -1
- package/lib/tree/nodes/equations/equalNode.d.ts.map +1 -1
- package/lib/tree/nodes/equations/equalNode.js +17 -9
- package/lib/tree/nodes/functions/logNode.js +2 -4
- package/lib/tree/nodes/operators/addNode.js +1 -1
- package/lib/tree/nodes/operators/fractionNode.d.ts.map +1 -1
- package/lib/tree/nodes/operators/fractionNode.js +35 -11
- package/lib/tree/nodes/operators/multiplyNode.d.ts.map +1 -1
- package/lib/tree/nodes/operators/multiplyNode.js +4 -3
- package/lib/tree/nodes/operators/powerNode.d.ts.map +1 -1
- package/lib/tree/nodes/operators/powerNode.js +5 -0
- package/lib/tree/nodes/sets/intervalNode.d.ts.map +1 -1
- package/lib/tree/nodes/sets/intervalNode.js +3 -1
- package/lib/tree/parsers/latexParser.js +6 -2
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"angle.d.ts","sourceRoot":"","sources":["../../../src/math/geometry/angle.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,mCAAmC,CAAC;AAMlE,OAAO,EAAE,KAAK,EAAoB,gBAAgB,EAAE,MAAM,YAAY,CAAC;AACvE,OAAO,EACL,eAAe,EAEhB,MAAM,qCAAqC,CAAC;AAK7C,8BAAsB,gBAAgB;IACpC,MAAM,CAAC,eAAe,CAAC,WAAW,EAAE,gBAAgB;CAUrD;AACD,KAAK,UAAU,GAAG;IAChB,eAAe,CAAC,EAAE,aAAa,CAAC;IAChC,eAAe,CAAC,EAAE,aAAa,CAAC;CACjC,CAAC;AAEF,KAAK,qBAAqB,GAAG;IAC3B,eAAe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points[1]);
|
|
94
94
|
const aPointIndexOnLine = a.points.findIndex((p, i) => i !== 1 && line.includes(p, 0.00000001));
|
|
95
95
|
const thisPointIndexOnLine = this.points.findIndex((p, i) => i !== 1 && line.includes(p, 0.00000001));
|
|
96
|
-
console.log(aPointIndexOnLine, thisPointIndexOnLine);
|
|
97
96
|
if (aPointIndexOnLine < 0 || thisPointIndexOnLine < 0)
|
|
98
97
|
return false;
|
|
99
|
-
console.log("ok so far");
|
|
100
98
|
const vecs = [
|
|
101
99
|
[
|
|
102
100
|
VectorConstructor.fromPoints(this.points[1], this.points[thisPointIndexOnLine]),
|
|
@@ -123,13 +121,11 @@ export class Angle {
|
|
|
123
121
|
const line = new Line(this.points[1], a.points[1]);
|
|
124
122
|
const aPointIndexOnLine = a.points.findIndex((p, i) => i !== 1 && line.includes(p, 0.0000001));
|
|
125
123
|
const thisPointIndexOnLine = this.points.findIndex((p, i) => i !== 1 && line.includes(p, 0.0000001));
|
|
126
|
-
console.log(aPointIndexOnLine, thisPointIndexOnLine);
|
|
127
124
|
if (aPointIndexOnLine < 0 || thisPointIndexOnLine < 0)
|
|
128
125
|
return false;
|
|
129
126
|
//angle non plat
|
|
130
127
|
if (line.includes(a.points[2 - aPointIndexOnLine], 0.0000001))
|
|
131
128
|
return false;
|
|
132
|
-
console.log("ok so far");
|
|
133
129
|
const vecs = [
|
|
134
130
|
[
|
|
135
131
|
VectorConstructor.fromPoints(this.points[1], this.points[thisPointIndexOnLine]),
|
|
@@ -146,7 +142,6 @@ export class Angle {
|
|
|
146
142
|
isSummitOpposite(a) {
|
|
147
143
|
if (!this.hasSameApex(a))
|
|
148
144
|
return false;
|
|
149
|
-
console.log("has same ap");
|
|
150
145
|
const vecs = [
|
|
151
146
|
[
|
|
152
147
|
VectorConstructor.fromPoints(this.points[1], this.points[0]),
|
|
@@ -37,6 +37,7 @@ export declare class Vector {
|
|
|
37
37
|
scalarProduct(v: Vector): AlgebraicNode;
|
|
38
38
|
scalarProductNumber(v: Vector): number;
|
|
39
39
|
toUnited(): Vector;
|
|
40
|
+
toPrimeColinear(name?: string): Vector;
|
|
40
41
|
add(v: Vector): Vector;
|
|
41
42
|
substract(v: Vector): Vector;
|
|
42
43
|
getNorm(): AlgebraicNode;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vector.d.ts","sourceRoot":"","sources":["../../../src/math/geometry/vector.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,mCAAmC,CAAC;AAGlE,OAAO,EACL,eAAe,EAEhB,MAAM,qCAAqC,CAAC;
|
|
1
|
+
{"version":3,"file":"vector.d.ts","sourceRoot":"","sources":["../../../src/math/geometry/vector.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,mCAAmC,CAAC;AAGlE,OAAO,EACL,eAAe,EAEhB,MAAM,qCAAqC,CAAC;AAoB7C,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AACnC,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAEvC,8BAAsB,iBAAiB;IACrC,MAAM,CAAC,UAAU,CAAC,MAAM,EAAE,KAAK,EAAE,GAAG,EAAE,KAAK,GAAG,MAAM;IAOpD,MAAM,CAAC,aAAa,CAAC,MAAM,EAAE,KAAK,EAAE,GAAG,EAAE,KAAK,GAAG,MAAM;IAOvD,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,MAAM,EAAE,SAAS,UAAQ,GAAG,MAAM;IAOtD,MAAM,CAAC,WAAW,CAAC,OAAO,EAAE,OAAO;IAGnC,MAAM,CAAC,eAAe,CAAC,WAAW,EAAE,iBAAiB;CAOtD;AAED,MAAM,MAAM,iBAAiB,GAAG;IAC9B,IAAI,EAAE,MAAM,CAAC;IACb,CAAC,EAAE,eAAe,CAAC;IACnB,CAAC,EAAE,eAAe,CAAC;CACpB,CAAC;AAEF,qBAAa,MAAM;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,EAAE,MAAM,CAAC;IACZ,CAAC,EAAE,aAAa,CAAC;IACjB,CAAC,EAAE,aAAa,CAAC;gBACL,IAAI,EAAE,MAAM,EAAE,CAAC,EAAE,aAAa,EAAE,CAAC,EAAE,aAAa;IAO5D,QAAQ;IAIR,KAAK,IAAI,MAAM;IAIf,aAAa,IAAI,iBAAiB;IAOlC,eAAe,IAAI,MAAM;IAMzB,QAAQ,IAAI,MAAM;IAIlB,oBAAoB,IAAI,MAAM;IAG9B,aAAa;IAGb,iBAAiB,IAAI,MAAM;IAM3B,UAAU,CAAC,CAAC,EAAE,MAAM,GAAG,OAAO;IAK9B,sBAAsB,CAAC,CAAC,EAAE,MAAM,GAAG,OAAO;IAI1C,kBAAkB,CAAC,CAAC,EAAE,MAAM,GAAG,OAAO;IAItC,WAAW,CAAC,CAAC,EAAE,MAAM,GAAG,aAAa;IAIrC,KAAK,CAAC,CAAC,EAAE,aAAa,EAAE,IAAI,CAAC,EAAE,MAAM;IAOrC,QAAQ;IAGR,aAAa,CAAC,CAAC,EAAE,MAAM;IAIvB,mBAAmB,CAAC,CAAC,EAAE,MAAM;IAO7B,QAAQ;IAGR,eAAe,CAAC,IAAI,CAAC,EAAE,MAAM;IAwB7B,GAAG,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM;IAWtB,SAAS,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM;IAG5B,OAAO,IAAI,aAAa;IAUxB,WAAW,CAAC,UAAU,EAAE,KAAK,EAAE,IAAI,CAAC,EAAE,MAAM;IAO5C,MAAM,CAAC,CAAC,EAAE,MAAM;IAIhB,YAAY;IAMZ,YAAY;IAOZ,aAAa;IAIb,MAAM;CAGP"}
|
|
@@ -8,6 +8,8 @@ import { frac } from "../../tree/nodes/operators/fractionNode.js";
|
|
|
8
8
|
import { MultiplyNode, multiply, } from "../../tree/nodes/operators/multiplyNode.js";
|
|
9
9
|
import { SquareNode } from "../../tree/nodes/operators/powerNode.js";
|
|
10
10
|
import { SubstractNode, substract, } from "../../tree/nodes/operators/substractNode.js";
|
|
11
|
+
import { isInt } from "../../utils/isInt.js";
|
|
12
|
+
import { gcd } from "../utils/arithmetic/gcd.js";
|
|
11
13
|
import { randint } from "../utils/random/randint.js";
|
|
12
14
|
import { Point } from "./point.js";
|
|
13
15
|
export class VectorConstructor {
|
|
@@ -103,6 +105,23 @@ export class Vector {
|
|
|
103
105
|
toUnited() {
|
|
104
106
|
return this.times(frac(1, this.x));
|
|
105
107
|
}
|
|
108
|
+
toPrimeColinear(name) {
|
|
109
|
+
//si u(x,y) alors renvoit le vecteur v(x',y') ou x'=x/gcd(x,y) et y'=y/gcd(x,y) (both positif)
|
|
110
|
+
if (!isNumberNode(this.x) ||
|
|
111
|
+
!isNumberNode(this.y) ||
|
|
112
|
+
!isInt(this.x.value) ||
|
|
113
|
+
!isInt(this.y.value)) {
|
|
114
|
+
throw new Error("toPrimeColinear general unimplemented");
|
|
115
|
+
}
|
|
116
|
+
let x = this.x.value;
|
|
117
|
+
let y = this.y.value;
|
|
118
|
+
if (x < 0 && y < 0) {
|
|
119
|
+
x *= -1;
|
|
120
|
+
y *= -1;
|
|
121
|
+
}
|
|
122
|
+
const pgcd = gcd(x, y);
|
|
123
|
+
return new Vector(name ?? this.name, (x / pgcd).toTree(), (y / pgcd).toTree());
|
|
124
|
+
}
|
|
106
125
|
add(v) {
|
|
107
126
|
const x = v.x;
|
|
108
127
|
const y = v.y;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"decimal.d.ts","sourceRoot":"","sources":["../../../../src/math/numbers/decimals/decimal.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,UAAU,EAAE,MAAM,wCAAwC,CAAC;AACpE,OAAO,EAAE,WAAW,EAAE,MAAM,yCAAyC,CAAC;AACtE,OAAO,EAAE,YAAY,EAAE,MAAM,4CAA4C,CAAC;AAE1E,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAClD,OAAO,EAAE,QAAQ,EAAE,M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SAAS,CAAC,EAAE,MAAM,GAAG,OAAO;IAMpE,MAAM,CAAC,SAAS,CAAC,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,GAAG,OAAO;IAK/D,MAAM,CAAC,gBAAgB,CAAC,SAAS,CAAC,EAAE,MAAM,GAAG,OAAO;CAMrD;AAED,qBAAa,OAAQ,YAAW,MAAM;IACpC,KAAK,EAAE,MAAM,CAAC;IACd,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,aAAsB;IAC1B,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,EAAE,MAAM,CAAC;IACpB,kBAAkB,EAAE,MAAM,CAAC;gBACf,KAAK,EAAE,MAAM,GAAG,MAAM;IASlC,KAAK,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM;IASxB,MAAM,CAAC,CAAC,EAAE,MAAM;IAIhB;;;;OAIG;IACH,KAAK,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM;IAIhC,oBAAoB,CAAC,KAAK,EAAE,MAAM;IAiClC,gBAAgB;IA6BhB,oBAAoB,CAAC,QAAQ,CAAC,EAAE,MAAM;IAuCtC,cAAc,CAAC,IAAI,EAAE,MAAM;IAS3B,UAAU;IAMV,MAAM;IAIN,aAAa;IAIb,YAAY,CAAC,UAAU,EAAE,MAAM;IAS/B,YAAY,CAAC,UAAU,EAAE,MAAM;CAShC"}
|
|
@@ -47,6 +47,7 @@ export class Decimal {
|
|
|
47
47
|
precision;
|
|
48
48
|
intPart; // can be -0
|
|
49
49
|
decimalPart;
|
|
50
|
+
tenthExponentBelow;
|
|
50
51
|
constructor(value) {
|
|
51
52
|
this.value = Number(value);
|
|
52
53
|
this.tex = value + "";
|
|
@@ -54,6 +55,7 @@ export class Decimal {
|
|
|
54
55
|
this.intPart = Number(intPartString);
|
|
55
56
|
this.decimalPart = decimalPartString || "";
|
|
56
57
|
this.precision = this.decimalPart.length;
|
|
58
|
+
this.tenthExponentBelow = Math.floor(Math.log10(this.value));
|
|
57
59
|
}
|
|
58
60
|
times(n) {
|
|
59
61
|
if (typeof n === "number")
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { AlgebraicNode } from "../../tree/nodes/algebraicNode.js";
|
|
1
|
+
import { AlgebraicNode, SimplifyOptions } from "../../tree/nodes/algebraicNode.js";
|
|
2
|
+
import { EqualNode } from "../../tree/nodes/equations/equalNode.js";
|
|
2
3
|
import { NodeIdentifiers } from "../../tree/nodes/nodeConstructor.js";
|
|
3
4
|
export declare abstract class GeneralSystemConstructor {
|
|
4
5
|
static random(): GeneralSystem;
|
|
@@ -12,11 +13,15 @@ export declare class GeneralSystem {
|
|
|
12
13
|
coeffs: AlgebraicNode[][];
|
|
13
14
|
constructor(coeffs: (AlgebraicNode | number)[][]);
|
|
14
15
|
toIdentifiers(): GeneralSystemIdentifiers;
|
|
16
|
+
simplify(opts?: SimplifyOptions): GeneralSystem;
|
|
17
|
+
getEqualNodes(): EqualNode[];
|
|
15
18
|
checkCouple(x: AlgebraicNode, y: AlgebraicNode): boolean;
|
|
19
|
+
multiplyEquation(nodes: AlgebraicNode[]): GeneralSystem;
|
|
16
20
|
solve(): {
|
|
17
21
|
x: AlgebraicNode;
|
|
18
22
|
y: AlgebraicNode;
|
|
19
23
|
};
|
|
20
24
|
toTex(): string;
|
|
25
|
+
toCorrectionTex(): string;
|
|
21
26
|
}
|
|
22
27
|
//# sourceMappingURL=generalSystem.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generalSystem.d.ts","sourceRoot":"","sources":["../../../src/math/systems/generalSystem.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"generalSystem.d.ts","sourceRoot":"","sources":["../../../src/math/systems/generalSystem.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,aAAa,EACb,eAAe,EAChB,MAAM,mCAAmC,CAAC;AAC3C,OAAO,EAAS,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAC3E,OAAO,EACL,eAAe,EAEhB,MAAM,qCAAqC,CAAC;AAkB7C,8BAAsB,wBAAwB;IAC5C,MAAM,CAAC,MAAM;IAeb,MAAM,CAAC,UAAU;IAiBjB,MAAM,CAAC,eAAe,CAAC,GAAG,EAAE,wBAAwB;CAKrD;AAED,MAAM,MAAM,wBAAwB,GAAG;IACrC,SAAS,EAAE,eAAe,EAAE,EAAE,CAAC;CAChC,CAAC;AAEF,qBAAa,aAAa;IACxB,MAAM,EAAE,aAAa,EAAE,EAAE,CAAC;gBAId,MAAM,EAAE,CAAC,aAAa,GAAG,MAAM,CAAC,EAAE,EAAE;IAKhD,aAAa,IAAI,wBAAwB;IAKzC,QAAQ,CAAC,IAAI,CAAC,EAAE,eAAe;IAM/B,aAAa;IAQb,WAAW,CAAC,CAAC,EAAE,aAAa,EAAE,CAAC,EAAE,aAAa;IAQ9C,gBAAgB,CAAC,KAAK,EAAE,aAAa,EAAE;IAUvC,KAAK;;;;IAoDL,KAAK;IAaL,eAAe;CAgIhB"}
|
|
@@ -1,9 +1,12 @@
|
|
|
1
|
+
import { equal, EqualNode } from "../../tree/nodes/equations/equalNode.js";
|
|
1
2
|
import { reifyAlgebraic, } from "../../tree/nodes/nodeConstructor.js";
|
|
2
3
|
import { AddNode, add } from "../../tree/nodes/operators/addNode.js";
|
|
3
4
|
import { frac } from "../../tree/nodes/operators/fractionNode.js";
|
|
4
5
|
import { multiply, } from "../../tree/nodes/operators/multiplyNode.js";
|
|
5
6
|
import { substract, } from "../../tree/nodes/operators/substractNode.js";
|
|
6
7
|
import { doWhile } from "../../utils/doWhile.js";
|
|
8
|
+
import { alignTex } from "../../utils/latex/alignTex.js";
|
|
9
|
+
import { lcm } from "../utils/arithmetic/lcm.js";
|
|
7
10
|
import { randint } from "../utils/random/randint.js";
|
|
8
11
|
export class GeneralSystemConstructor {
|
|
9
12
|
static random() {
|
|
@@ -48,12 +51,34 @@ export class GeneralSystem {
|
|
|
48
51
|
coeffsIds: this.coeffs.map((row) => row.map((e) => e.toIdentifiers())),
|
|
49
52
|
};
|
|
50
53
|
}
|
|
54
|
+
simplify(opts) {
|
|
55
|
+
const simpCoeffs = this.coeffs.map((row) => row.map((c) => c.simplify(opts)));
|
|
56
|
+
return new GeneralSystem(simpCoeffs);
|
|
57
|
+
}
|
|
58
|
+
getEqualNodes() {
|
|
59
|
+
const [a, b, c] = this.coeffs[0];
|
|
60
|
+
const [d, e, f] = this.coeffs[1];
|
|
61
|
+
return [
|
|
62
|
+
new EqualNode(add(multiply(a, "x"), multiply(b, "y")), c),
|
|
63
|
+
new EqualNode(add(multiply(d, "x"), multiply(e, "y")), f),
|
|
64
|
+
];
|
|
65
|
+
}
|
|
51
66
|
checkCouple(x, y) {
|
|
52
67
|
const [a, b, c] = this.coeffs[0];
|
|
53
68
|
const [d, e, f] = this.coeffs[1];
|
|
54
69
|
return (add(multiply(a, x), multiply(b, y)).simplify().equals(c.simplify()) &&
|
|
55
70
|
add(multiply(d, x), multiply(e, y)).simplify().equals(f.simplify()));
|
|
56
71
|
}
|
|
72
|
+
multiplyEquation(nodes) {
|
|
73
|
+
return new GeneralSystem([
|
|
74
|
+
nodes[0].evaluate() !== 1
|
|
75
|
+
? this.coeffs[0].map((c) => multiply(c, nodes[0]))
|
|
76
|
+
: this.coeffs[0],
|
|
77
|
+
nodes[1].evaluate() !== 1
|
|
78
|
+
? this.coeffs[1].map((c) => multiply(c, nodes[1]))
|
|
79
|
+
: this.coeffs[1],
|
|
80
|
+
]);
|
|
81
|
+
}
|
|
57
82
|
solve() {
|
|
58
83
|
if (this.coeffs.length !== 2)
|
|
59
84
|
throw Error("General system resolution not implemented yet");
|
|
@@ -110,4 +135,116 @@ ${add(multiply(this.coeffs[0][0], "x"), multiply(this.coeffs[0][1], "y")).toTex(
|
|
|
110
135
|
${new AddNode(multiply(this.coeffs[1][0], "x"), multiply(this.coeffs[1][1], "y")).toTex()}=${this.coeffs[1][2].toTex()}
|
|
111
136
|
\\end{matrix}\\right.`;
|
|
112
137
|
}
|
|
138
|
+
toCorrectionTex() {
|
|
139
|
+
let [equa1, equa2] = this.getEqualNodes();
|
|
140
|
+
const coeffs1 = this.coeffs[0];
|
|
141
|
+
const coeffs2 = this.coeffs[1];
|
|
142
|
+
let corr = "";
|
|
143
|
+
const unitCoeffIndex = [
|
|
144
|
+
coeffs1[0],
|
|
145
|
+
coeffs1[1],
|
|
146
|
+
coeffs2[0],
|
|
147
|
+
coeffs2[1],
|
|
148
|
+
].findIndex((e) => Math.abs(e.evaluate()) === 1);
|
|
149
|
+
//si une var est à coeff |1|, substitution
|
|
150
|
+
//sinon, cl :
|
|
151
|
+
const solveBySub = unitCoeffIndex > -1;
|
|
152
|
+
if (solveBySub) {
|
|
153
|
+
const isFirstEqua = unitCoeffIndex < 2;
|
|
154
|
+
const isX = unitCoeffIndex % 2 === 0;
|
|
155
|
+
const varName = isX ? "x" : "y";
|
|
156
|
+
const varName2 = isX ? "y" : "x";
|
|
157
|
+
const isolated = isFirstEqua
|
|
158
|
+
? equa1.isolate(varName)
|
|
159
|
+
: equa2.isolate(varName);
|
|
160
|
+
corr += `
|
|
161
|
+
|
|
162
|
+
On peut isoler $${varName}$ dans la ${isFirstEqua ? "première" : "deuxième"} équation :
|
|
163
|
+
|
|
164
|
+
$$
|
|
165
|
+
${isolated.toTex()}
|
|
166
|
+
$$`;
|
|
167
|
+
const substituted = (isFirstEqua ? equa2 : equa1).toDetailedEvaluation({
|
|
168
|
+
[varName]: isolated.rightChild,
|
|
169
|
+
});
|
|
170
|
+
const subSimp = substituted.simplify({
|
|
171
|
+
towardsDistribute: true,
|
|
172
|
+
forbidFactorize: true,
|
|
173
|
+
});
|
|
174
|
+
const isolated2 = subSimp.isolate(isX ? "y" : "x");
|
|
175
|
+
const varFinal = isolated.toDetailedEvaluation({
|
|
176
|
+
[varName2]: isolated2.rightChild,
|
|
177
|
+
});
|
|
178
|
+
const varFinalSimp = varFinal.simplify();
|
|
179
|
+
corr += `
|
|
180
|
+
|
|
181
|
+
On peut alors remplacer $${varName}$ dans la ${isFirstEqua ? "deuxième" : "première"} équation, pour en déduire $${isX ? "y" : "x"}$ :
|
|
182
|
+
|
|
183
|
+
${alignTex([[substituted.toTex()], [subSimp.toTex()], [isolated2.toTex()]])}
|
|
184
|
+
|
|
185
|
+
On a donc :
|
|
186
|
+
|
|
187
|
+
${alignTex([[isolated.toTex()], [varFinal.toTex()], [varFinalSimp.toTex()]])}
|
|
188
|
+
`;
|
|
189
|
+
}
|
|
190
|
+
else {
|
|
191
|
+
const coeffsEv = [coeffs1[0], coeffs1[1], coeffs2[0], coeffs2[1]].map((e) => e.evaluate());
|
|
192
|
+
const ppcms = [
|
|
193
|
+
lcm(coeffsEv[0], coeffsEv[2]),
|
|
194
|
+
lcm(coeffsEv[1], coeffsEv[3]),
|
|
195
|
+
];
|
|
196
|
+
const minPpcm = Math.min(...ppcms);
|
|
197
|
+
const isX = minPpcm === ppcms[0];
|
|
198
|
+
let firstEquaMultiple = minPpcm / Math.abs(coeffsEv[isX ? 0 : 1]);
|
|
199
|
+
let secondEquaMultiple = minPpcm / Math.abs(coeffsEv[isX ? 2 : 3]);
|
|
200
|
+
const areSameSign = coeffsEv[isX ? 0 : 1] * coeffsEv[isX ? 2 : 3] > 0;
|
|
201
|
+
if (areSameSign) {
|
|
202
|
+
firstEquaMultiple *= -1;
|
|
203
|
+
}
|
|
204
|
+
const shouldHandleFirst = firstEquaMultiple !== 1;
|
|
205
|
+
const shouldHandleSecond = secondEquaMultiple !== 1;
|
|
206
|
+
const sysMultiplied = this.multiplyEquation([
|
|
207
|
+
firstEquaMultiple.toTree(),
|
|
208
|
+
secondEquaMultiple.toTree(),
|
|
209
|
+
]).simplify();
|
|
210
|
+
if (shouldHandleFirst || shouldHandleSecond) {
|
|
211
|
+
corr += `
|
|
212
|
+
|
|
213
|
+
On multiple la ${shouldHandleFirst
|
|
214
|
+
? `première équation par $${firstEquaMultiple}$`
|
|
215
|
+
: `second équation par $${secondEquaMultiple}$`} ${shouldHandleFirst && shouldHandleSecond
|
|
216
|
+
? ` et la deuxième équation par $${secondEquaMultiple}$`
|
|
217
|
+
: ""} :
|
|
218
|
+
|
|
219
|
+
$$
|
|
220
|
+
${sysMultiplied.toTex()}
|
|
221
|
+
$$
|
|
222
|
+
|
|
223
|
+
`;
|
|
224
|
+
}
|
|
225
|
+
const equaMul = sysMultiplied.getEqualNodes();
|
|
226
|
+
const added = equal(add(equaMul[0].leftChild, equaMul[1].leftChild), add(equaMul[0].rightChild, equaMul[1].rightChild)).simplify();
|
|
227
|
+
const varName = isX ? "y" : "x";
|
|
228
|
+
const isolated = added.isolate(varName);
|
|
229
|
+
const sub = equa1.toDetailedEvaluation({
|
|
230
|
+
[varName]: isolated.rightChild,
|
|
231
|
+
});
|
|
232
|
+
const subSimp = sub.simplify({
|
|
233
|
+
forbidFactorize: true,
|
|
234
|
+
forceDistributeFractions: true,
|
|
235
|
+
towardsDistribute: true,
|
|
236
|
+
});
|
|
237
|
+
const subSimpToIsolateButWeShouldnt = sub.simplify({});
|
|
238
|
+
const isolated2 = subSimpToIsolateButWeShouldnt.isolate(isX ? "x" : "y");
|
|
239
|
+
corr += `On peut alors additionner les deux équations pour éliminer une des variables et isoler l'autre :
|
|
240
|
+
|
|
241
|
+
${alignTex([[added.toTex()], [isolated.toTex()]])}
|
|
242
|
+
|
|
243
|
+
On remplace maintenant dans la première équation :
|
|
244
|
+
|
|
245
|
+
${alignTex([[sub.toTex()], [subSimp.toTex()], [isolated2.toTex()]])}
|
|
246
|
+
`;
|
|
247
|
+
}
|
|
248
|
+
return corr;
|
|
249
|
+
}
|
|
113
250
|
}
|
package/lib/playground.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"playground.d.ts","sourceRoot":"","sources":["../src/playground.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"playground.d.ts","sourceRoot":"","sources":["../src/playground.ts"],"names":[],"mappings":"AAiCA,eAAO,MAAM,UAAU,YAItB,CAAC"}
|
package/lib/playground.js
CHANGED
|
@@ -1,36 +1,6 @@
|
|
|
1
|
+
import { parseAlgebraic } from "./tree/parsers/latexParser.js";
|
|
1
2
|
export const playground = () => {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
// const allowedNumbers = []
|
|
6
|
-
// const min = 0
|
|
7
|
-
// const max = 100
|
|
8
|
-
// const inAscendingOrder = coinFlip()
|
|
9
|
-
// try {
|
|
10
|
-
// const parsed = parseAlgebraic(ans)
|
|
11
|
-
// const parsedRes = valueParser(res)
|
|
12
|
-
// if(parsedRes === false){
|
|
13
|
-
// return "Résultat incompris"
|
|
14
|
-
// }
|
|
15
|
-
// const simp = parsed.simplify()
|
|
16
|
-
// if(simp.evaluate() !== parsedRes){
|
|
17
|
-
// //assert résultat est bon
|
|
18
|
-
// return "Mauvais calcul"
|
|
19
|
-
// }
|
|
20
|
-
// if(parsedRes>max || parsedRes < min){
|
|
21
|
-
// return "Pas dans l'intervalle"
|
|
22
|
-
// }
|
|
23
|
-
// const usedNumbers = []
|
|
24
|
-
// if(usedNumbers.some((e)=>)){
|
|
25
|
-
// return "Vous ne pouvez utiliser chaque nombre qu'une fois"
|
|
26
|
-
// }
|
|
27
|
-
// if(usedNumbers.length !== allowedNumbers.length){
|
|
28
|
-
// return "Vous devez utiliser tous ces nombres et uniquement ceux ci"
|
|
29
|
-
// }
|
|
30
|
-
//assert tous les nombres utilisés
|
|
31
|
-
//assert pas d'autre nombres utilisés
|
|
32
|
-
//assert utilisés dans l'ordre croissant
|
|
33
|
-
// } catch(err){
|
|
34
|
-
// return "Erreur de syntaxe"
|
|
35
|
-
// }
|
|
3
|
+
const a = "AB";
|
|
4
|
+
const parsed = parseAlgebraic(a);
|
|
5
|
+
console.log(parsed);
|
|
36
6
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"algebraicNode.d.ts","sourceRoot":"","sources":["../../../src/tree/nodes/algebraicNode.ts"],"names":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C,EAAE,eAAe,KAAK,MAAM,CAAC;IAC5E,oBAAoB,EAAE,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,aAAa,CAAC,KAAK,aAAa,CAAC;IAC7E,iBAAiB,EAAE,CAAC,IAAI,CAAC,EAAE,WAAW,KAAK,aAAa,EAAE,CAAC;IAC3D,QAAQ,EAAE,CAAC,IAAI,CAAC,EAAE,eAAe,KAAK,aAAa,CAAC;IACpD,MAAM,EAAE,CAAC,IAAI,EAAE,aAAa,KAAK,OAAO,CAAC;IACzC,SAAS,EAAE,OAAO,CAAC;IACnB,UAAU,EAAE,CAAC,OAAO,CAAC,EAAE,MAAM,KAAK,aAAa,CAAC;CACjD;AACD,8BAAsB,cAAc;;IAElC,OAAO,CAAC,MAAM,CAAC,QAAQ;CAGxB;AACD,eAAO,MAAM,eAAe,SAAU,IAAI,KAAG,IAAI,IAAI,aACX,CAAC"}
|
|
@@ -12,6 +12,10 @@ export declare abstract class EqualNodeConstructor {
|
|
|
12
12
|
static fromIdentifiers(identifiers: EqualNodeIdentifiers): EqualNode;
|
|
13
13
|
}
|
|
14
14
|
export declare const isEqualNode: (node: AlgebraicNode) => node is EqualNode;
|
|
15
|
+
type IsolateOptions = {
|
|
16
|
+
simpOpts?: SimplifyOptions;
|
|
17
|
+
steps?: string[];
|
|
18
|
+
};
|
|
15
19
|
export declare class EqualNode implements AlgebraicNode {
|
|
16
20
|
leftChild: AlgebraicNode;
|
|
17
21
|
rightChild: AlgebraicNode;
|
|
@@ -27,11 +31,13 @@ export declare class EqualNode implements AlgebraicNode {
|
|
|
27
31
|
simplify(opts?: SimplifyOptions): EqualNode;
|
|
28
32
|
shuffle(): EqualNode;
|
|
29
33
|
reverse(): EqualNode;
|
|
30
|
-
isolate(varName: string): EqualNode;
|
|
34
|
+
isolate(varName: string, opts?: IsolateOptions): EqualNode;
|
|
31
35
|
derivative(varName?: string): AlgebraicNode;
|
|
32
36
|
equals(node: AlgebraicNode): boolean;
|
|
33
37
|
evaluate(vars?: Record<string, number>, opts?: EvaluateOptions): number;
|
|
34
38
|
toDetailedEvaluation(vars: Record<string, AlgebraicNode>): EqualNode;
|
|
39
|
+
isVerified(): boolean;
|
|
35
40
|
}
|
|
36
41
|
export declare const equationResolutionTex: (a: AlgebraicNode, b: AlgebraicNode, c: AlgebraicNode, d: AlgebraicNode) => string | string[];
|
|
42
|
+
export {};
|
|
37
43
|
//# sourceMappingURL=equalNode.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"equalNode.d.ts","sourceRoot":"","sources":["../../../../src/tree/nodes/equations/equalNode.ts"],"names":[],"mappings":"AAKA,OAAO,EACL,aAAa,EACb,eAAe,EACf,eAAe,EAChB,MAAM,qBAAqB,CAAC;AAG7B,OAAO,EAAE,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAC5D,OAAO,EAEL,eAAe,EAEhB,MAAM,uBAAuB,CAAC;AAQ/B,eAAO,MAAM,KAAK,MACb,aAAa,GAAG,MAAM,GAAG,MAAM,KAC/B,aAAa,GAAG,MAAM,GAAG,MAAM,cAOnC,CAAC;AAEF,MAAM,MAAM,oBAAoB,GAAG;IACjC,EAAE,EAAE,OAAO,CAAC,KAAK,CAAC;IAClB,SAAS,EAAE,eAAe,CAAC;IAC3B,UAAU,EAAE,eAAe,CAAC;IAC5B,IAAI,CAAC,EAAE,WAAW,CAAC;CACpB,CAAC;AAEF,8BAAsB,oBAAoB;IACxC,MAAM,CAAC,eAAe,CAAC,WAAW,EAAE,oBAAoB,GAAG,SAAS;CAOrE;AAED,eAAO,MAAM,WAAW,SAAU,aAAa,KAAG,IAAI,IAAI,SACzB,CAAC;AAElC,qBAAa,SAAU,YAAW,aAAa;IAC7C,SAAS,EAAE,aAAa,CAAC;IACzB,UAAU,EAAE,aAAa,CAAC;IAC1B,IAAI,CAAC,EAAE,WAAW,CAAC;IACnB,IAAI,EAAE,QAAQ,CAAC;IACf,SAAS,EAAE,OA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AC;CAClB,CAAC;AACF,qBAAa,SAAU,YAAW,aAAa;IAC7C,SAAS,EAAE,aAAa,CAAC;IACzB,UAAU,EAAE,aAAa,CAAC;IAC1B,IAAI,CAAC,EAAE,WAAW,CAAC;IACnB,IAAI,EAAE,QAAQ,CAAC;IACf,SAAS,EAAE,OAAO,CAAC;gBAEjB,SAAS,EAAE,aAAa,EACxB,UAAU,EAAE,aAAa,EACzB,IAAI,CAAC,EAAE,WAAW;IASpB,aAAa,IAAI,oBAAoB;IAQrC,iBAAiB,CAAC,IAAI,CAAC,EAAE,WAAW;IAmBpC,cAAc,CAAC,IAAI,CAAC,EAAE,WAAW,GAAG,MAAM,EAAE;IAM5C,YAAY,IAAI,MAAM;IAGtB,KAAK,IAAI,MAAM;IAIf,QAAQ,CAAC,IAAI,CAAC,EAAE,eAAe;IAQ/B,OAAO;IAIP,OAAO;IAIP,OAAO,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,cAAc;IAsG9C,UAAU,CAAC,OAAO,CAAC,EAAE,MAAM,GAAG,aAAa;IAG3C,MAAM,CAAC,IAAI,EAAE,aAAa,GAAG,OAAO;IAGpC,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,EAAE,IAAI,CAAC,EAAE,eAAe,GAAG,MAAM;IAGvE,oBAAoB,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,aAAa,CAAC,GAAG,SAAS;IAMpE,UAAU;CAIX;AAED,eAAO,MAAM,qBAAqB,MAC7B,aAAa,KACb,aAAa,KACb,aAAa,KACb,aAAa,sBA2DjB,CAAC"}
|
|
@@ -77,7 +77,7 @@ export class EqualNode {
|
|
|
77
77
|
reverse() {
|
|
78
78
|
return new EqualNode(this.rightChild, this.leftChild, this.opts);
|
|
79
79
|
}
|
|
80
|
-
isolate(varName) {
|
|
80
|
+
isolate(varName, opts) {
|
|
81
81
|
//! bcp d'erreurs ne sont pas gérées, n'utiliser qu'en contexte sain
|
|
82
82
|
//! ne gère que des équations de premier degré
|
|
83
83
|
//!régler le pb des monomNode : faudrait les virer en fait
|
|
@@ -91,8 +91,9 @@ export class EqualNode {
|
|
|
91
91
|
///simp et recur
|
|
92
92
|
/// si x est dénum, appliquer fct inverse
|
|
93
93
|
///simp et recur
|
|
94
|
+
const steps = opts?.steps;
|
|
94
95
|
let right = (0).toTree();
|
|
95
|
-
const simpOpts = {
|
|
96
|
+
const simpOpts = opts?.simpOpts ?? {
|
|
96
97
|
towardsDistribute: true,
|
|
97
98
|
forbidFactorize: true,
|
|
98
99
|
forceDistributeFractions: false,
|
|
@@ -101,6 +102,9 @@ export class EqualNode {
|
|
|
101
102
|
// let simp = new EqualNode(left, right);
|
|
102
103
|
let i = 0;
|
|
103
104
|
const recur = () => {
|
|
105
|
+
if (steps) {
|
|
106
|
+
steps.push(equal(left, right).toTex());
|
|
107
|
+
}
|
|
104
108
|
i++;
|
|
105
109
|
if (i > 100)
|
|
106
110
|
throw new Error("too many iterations in isolate");
|
|
@@ -134,12 +138,12 @@ export class EqualNode {
|
|
|
134
138
|
else if (isMultiplyNode(left)) {
|
|
135
139
|
const xIsLeft = hasVariableNode(left.leftChild, varName);
|
|
136
140
|
if (xIsLeft) {
|
|
137
|
-
right = frac(right, left.rightChild).simplify();
|
|
138
|
-
left = frac(left, left.rightChild).simplify();
|
|
141
|
+
right = frac(right, left.rightChild).simplify(simpOpts);
|
|
142
|
+
left = frac(left, left.rightChild).simplify(simpOpts);
|
|
139
143
|
}
|
|
140
144
|
else {
|
|
141
|
-
right = frac(right, left.leftChild).simplify();
|
|
142
|
-
left = frac(left, left.leftChild).simplify();
|
|
145
|
+
right = frac(right, left.leftChild).simplify(simpOpts);
|
|
146
|
+
left = frac(left, left.leftChild).simplify(simpOpts);
|
|
143
147
|
}
|
|
144
148
|
}
|
|
145
149
|
else if (isFractionNode(left)) {
|
|
@@ -161,11 +165,11 @@ export class EqualNode {
|
|
|
161
165
|
}
|
|
162
166
|
}
|
|
163
167
|
else if (isOppositeNode(left)) {
|
|
164
|
-
left = opposite(left).simplify();
|
|
165
|
-
right = opposite(right).simplify();
|
|
168
|
+
left = opposite(left).simplify(simpOpts);
|
|
169
|
+
right = opposite(right).simplify(simpOpts);
|
|
166
170
|
}
|
|
167
171
|
else {
|
|
168
|
-
throw new Error(
|
|
172
|
+
throw new Error(`Isolation only implemented for basic operations yet, var ${varName}, equa ${left.toTex()}=${right.toTex()}`);
|
|
169
173
|
}
|
|
170
174
|
recur();
|
|
171
175
|
};
|
|
@@ -190,6 +194,10 @@ export class EqualNode {
|
|
|
190
194
|
toDetailedEvaluation(vars) {
|
|
191
195
|
return new EqualNode(this.leftChild.toDetailedEvaluation(vars), this.rightChild.toDetailedEvaluation(vars));
|
|
192
196
|
}
|
|
197
|
+
isVerified() {
|
|
198
|
+
//!trèèèès basique, ca marhce pour mon cas en cours mais pas en général
|
|
199
|
+
return this.leftChild.simplify().equals(this.rightChild.simplify());
|
|
200
|
+
}
|
|
193
201
|
}
|
|
194
202
|
export const equationResolutionTex = (a, b, c, d) => {
|
|
195
203
|
//(+-a)x(+-b) = (+-c)x(+-d)
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
// import { log } from "mathjs";
|
|
2
2
|
import { NodeIds, NodeType } from "../node.js";
|
|
3
3
|
import { FunctionsIds, isFunctionNode } from "./functionNode.js";
|
|
4
|
-
import { isAbsNode } from "./absNode.js";
|
|
5
4
|
import { MultiplyNode } from "../operators/multiplyNode.js";
|
|
6
5
|
import { isPowerNode } from "../operators/powerNode.js";
|
|
7
6
|
import { NumberNode, isNumberNode } from "../numbers/numberNode.js";
|
|
@@ -38,9 +37,8 @@ export class LogNode {
|
|
|
38
37
|
if (!this.opts?.allowLnOfOne && tex === "1") {
|
|
39
38
|
return "0";
|
|
40
39
|
}
|
|
41
|
-
const shouldntUseBrackets = isAbsNode(this.child);
|
|
42
|
-
if (shouldntUseBrackets)
|
|
43
|
-
return `\\ln${tex}`;
|
|
40
|
+
// const shouldntUseBrackets = isAbsNode(this.child);
|
|
41
|
+
// if (shouldntUseBrackets) return `\\ln${tex}`;
|
|
44
42
|
else
|
|
45
43
|
return `\\ln\\left(${tex}\\right)`;
|
|
46
44
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fractionNode.d.ts","sourceRoot":"","sources":["../../../../src/tree/nodes/operators/fractionNode.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAChF,OAAO,EAAE,WAAW,EAAE,YAAY,EAAkB,MAAM,mBAAmB,CAAC;AAK9E,OAAO,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAKrE,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"fractionNode.d.ts","sourceRoot":"","sources":["../../../../src/tree/nodes/operators/fractionNode.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAChF,OAAO,EAAE,WAAW,EAAE,YAAY,EAAkB,MAAM,mBAAmB,CAAC;AAK9E,OAAO,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAKrE,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAMxD,wBAAgB,cAAc,CAAC,CAAC,EAAE,IAAI,GAAG,CAAC,IAAI,YAAY,CAEzD;AAED,eAAO,MAAM,IAAI,MACZ,aAAa,GAAG,MAAM,GAAG,MAAM,KAC/B,aAAa,GAAG,MAAM,GAAG,MAAM,SAC3B,WAAW,iBAOnB,CAAC;AAEF,MAAM,MAAM,uBAAuB,GAAG;IACpC,EAAE,EAAE,OAAO,CAAC,QAAQ,CAAC;IACrB,SAAS,EAAE,eAAe,CAAC;IAC3B,UAAU,EAAE,eAAe,CAAC;CAC7B,CAAC;AACF,qBAAa,YAAa,YAAW,YAAY;IAC/C,IAAI,CAAC,EAAE,WAAW,CAAC;IACnB;;;OAGG;IACH,EAAE,EAAE,WAAW,CAAC;IAChB,SAAS,EAAE,aAAa,CAAC;IACzB,UAAU,EAAE,aAAa,CAAC;IAC1B,IAAI,EAAE,QAAQ,CAAC;IACf,SAAS,EAAE,OAAO,CAAC;gBAEjB,SAAS,EAAE,aAAa,EACxB,UAAU,EAAE,aAAa,EACzB,IAAI,CAAC,EAAE,WAAW;IAiBpB,YAAY,IAAI,MAAM;IAItB,aAAa,IAAI,uBAAuB;IAQxC,UAAU;IAGV,iBAAiB,CAAC,IAAI,CAAC,EAAE,WAAW;IA+BpC,cAAc,CAAC,IAAI,CAAC,EAAE,WAAW,GAAG,MAAM,EAAE;IAG5C,SAAS;IAUT,KAAK,CAAC,OAAO,CAAC,EAAE,YAAY,GAAG,MAAM;IA6BrC,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC;IAMtC,QAAQ,CAAC,IAAI,CAAC,EAAE,eAAe,GAAG,aAAa;IAgM/C,MAAM,CAAC,IAAI,EAAE,aAAa,GAAG,OAAO;IAOpC,oBAAoB,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,aAAa,CAAC;IAOxD,mBAAmB;IAQnB,UAAU,CAAC,OAAO,CAAC,EAAE,MAAM,GAAG,SAAS,GAAG,aAAa;CAGxD"}
|
|
@@ -9,8 +9,9 @@ import { Rational } from "../../../math/numbers/rationals/rational.js";
|
|
|
9
9
|
import { operatorComposition } from "../../../tree/utilities/operatorComposition.js";
|
|
10
10
|
import { AddNode, isAddNode } from "./addNode.js";
|
|
11
11
|
import { PowerNode, isPowerNode } from "./powerNode.js";
|
|
12
|
-
import { SubstractNode, isSubstractNode } from "./substractNode.js";
|
|
12
|
+
import { SubstractNode, isSubstractNode, substract } from "./substractNode.js";
|
|
13
13
|
import { parseToMonomNode } from "../polynomials/monomNode.js";
|
|
14
|
+
import { ExpNode, isExpNode } from "../functions/expNode.js";
|
|
14
15
|
export function isFractionNode(a) {
|
|
15
16
|
return isOperatorNode(a) && a.id === OperatorIds.fraction;
|
|
16
17
|
}
|
|
@@ -225,20 +226,14 @@ export class FractionNode {
|
|
|
225
226
|
if (opts?.forceDistributeFractions &&
|
|
226
227
|
isNumberNode(denum) &&
|
|
227
228
|
parsedMonom) {
|
|
228
|
-
return new MultiplyNode(new FractionNode(parsedMonom.a, denum), parsedMonom.
|
|
229
|
+
return new MultiplyNode(new FractionNode(parsedMonom.a, denum), parsedMonom.toTree()).simplify(opts);
|
|
229
230
|
}
|
|
230
231
|
if (isFractionNode(denum) && isFractionNode(num)) {
|
|
231
232
|
return new MultiplyNode(num, new FractionNode(denum.rightChild, denum.leftChild)).simplify(opts);
|
|
232
233
|
}
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
isPowerNode(denum) &&
|
|
237
|
-
num.rightChild.isNumeric &&
|
|
238
|
-
denum.rightChild.isNumeric &&
|
|
239
|
-
num.rightChild.evaluate() === denum.rightChild.evaluate()) {
|
|
240
|
-
return new PowerNode(new FractionNode(num.leftChild, denum.leftChild), num.rightChild).simplify(opts);
|
|
241
|
-
}
|
|
234
|
+
const powerSimp = powerSimplify(num, denum, opts);
|
|
235
|
+
if (powerSimp)
|
|
236
|
+
return powerSimp;
|
|
242
237
|
if (num.equals(denum))
|
|
243
238
|
return new NumberNode(1);
|
|
244
239
|
return null;
|
|
@@ -312,3 +307,32 @@ export class FractionNode {
|
|
|
312
307
|
throw new Error("unimplemented derivative");
|
|
313
308
|
}
|
|
314
309
|
}
|
|
310
|
+
const powerSimplify = (num, denum, opts) => {
|
|
311
|
+
//!ya mieux à faire pour gérer tous les cas d'un coup
|
|
312
|
+
//!s'insiprer de multiply
|
|
313
|
+
if (isPowerNode(num) &&
|
|
314
|
+
isPowerNode(denum) &&
|
|
315
|
+
num.leftChild.evaluate() === denum.leftChild.evaluate()) {
|
|
316
|
+
return new PowerNode(num.leftChild, substract(num.rightChild, denum.rightChild)).simplify(opts);
|
|
317
|
+
}
|
|
318
|
+
if (isPowerNode(num) &&
|
|
319
|
+
isNumberNode(denum) &&
|
|
320
|
+
num.leftChild.evaluate() === denum.evaluate()) {
|
|
321
|
+
return new PowerNode(num.leftChild, substract(num.rightChild, 1)).simplify(opts);
|
|
322
|
+
}
|
|
323
|
+
if (isPowerNode(denum) &&
|
|
324
|
+
isNumberNode(num) &&
|
|
325
|
+
num.evaluate() === denum.leftChild.evaluate()) {
|
|
326
|
+
return new PowerNode(num, substract(1, denum.rightChild)).simplify(opts);
|
|
327
|
+
}
|
|
328
|
+
if (isPowerNode(num) &&
|
|
329
|
+
isPowerNode(denum) &&
|
|
330
|
+
num.rightChild.isNumeric &&
|
|
331
|
+
denum.rightChild.isNumeric &&
|
|
332
|
+
num.rightChild.evaluate() === denum.rightChild.evaluate()) {
|
|
333
|
+
return new PowerNode(new FractionNode(num.leftChild, denum.leftChild), num.rightChild).simplify(opts);
|
|
334
|
+
}
|
|
335
|
+
if (isExpNode(num) && isExpNode(denum)) {
|
|
336
|
+
return new ExpNode(substract(num.child, denum.child)).simplify(opts);
|
|
337
|
+
}
|
|
338
|
+
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"multiplyNode.d.ts","sourceRoot":"","sources":["../../../../src/tree/nodes/operators/multiplyNode.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAChF,OAAO,EACL,uBAAuB,EACvB,eAAe,EACf,WAAW,EAGZ,MAAM,mBAAmB,CAAC;AAY3B,OAAO,EACL,aAAa,EACb,eAAe,EAEhB,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"multiplyNode.d.ts","sourceRoot":"","sources":["../../../../src/tree/nodes/operators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