math-exercises 3.0.124 → 3.0.126
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/arithmetics/primeNumbers.d.ts +1 -1
- package/lib/exercises/math/calcul/arithmetics/primeNumbers.d.ts.map +1 -1
- package/lib/exercises/math/calcul/arithmetics/primeNumbers.js +20 -14
- package/lib/exercises/math/calcul/fractions/fractionsMix.js +1 -1
- package/lib/exercises/math/calcul/fractions/fractionsSumsPrimeDenominators.d.ts.map +1 -1
- package/lib/exercises/math/calcul/fractions/fractionsSumsPrimeDenominators.js +61 -1
- package/lib/exercises/math/calcul/mentalCaluls/index.d.ts +1 -0
- package/lib/exercises/math/calcul/mentalCaluls/index.d.ts.map +1 -1
- package/lib/exercises/math/calcul/mentalCaluls/index.js +1 -0
- package/lib/exercises/math/calcul/mentalCaluls/mentalProgramSolve.d.ts +15 -0
- package/lib/exercises/math/calcul/mentalCaluls/mentalProgramSolve.d.ts.map +1 -0
- package/lib/exercises/math/calcul/mentalCaluls/mentalProgramSolve.js +217 -0
- package/lib/exercises/math/calcul/ordering/compareA10N.d.ts +16 -0
- package/lib/exercises/math/calcul/ordering/compareA10N.d.ts.map +1 -0
- package/lib/exercises/math/calcul/ordering/compareA10N.js +327 -0
- package/lib/exercises/math/calcul/ordering/compareABUsingQuotient.d.ts +8 -0
- package/lib/exercises/math/calcul/ordering/compareABUsingQuotient.d.ts.map +1 -0
- package/lib/exercises/math/calcul/ordering/compareABUsingQuotient.js +221 -0
- package/lib/exercises/math/calcul/ordering/compareFracABWithFracAPlusCBPlusC.d.ts +9 -0
- package/lib/exercises/math/calcul/ordering/compareFracABWithFracAPlusCBPlusC.d.ts.map +1 -0
- package/lib/exercises/math/calcul/ordering/compareFracABWithFracAPlusCBPlusC.js +135 -0
- package/lib/exercises/math/calcul/ordering/compareFracAndDec.d.ts +29 -0
- package/lib/exercises/math/calcul/ordering/compareFracAndDec.d.ts.map +1 -0
- package/lib/exercises/math/calcul/ordering/compareFracAndDec.js +367 -0
- package/lib/exercises/math/calcul/ordering/comparePowersOfFracs.d.ts +12 -0
- package/lib/exercises/math/calcul/ordering/comparePowersOfFracs.d.ts.map +1 -0
- package/lib/exercises/math/calcul/ordering/comparePowersOfFracs.js +164 -0
- package/lib/exercises/math/calcul/ordering/compareWithSquareRoots.d.ts +9 -0
- package/lib/exercises/math/calcul/ordering/compareWithSquareRoots.d.ts.map +1 -0
- package/lib/exercises/math/calcul/ordering/compareWithSquareRoots.js +140 -0
- package/lib/exercises/math/calcul/ordering/index.d.ts +6 -0
- package/lib/exercises/math/calcul/ordering/index.d.ts.map +1 -1
- package/lib/exercises/math/calcul/ordering/index.js +6 -0
- package/lib/exercises/math/calcul/rounding/estimateAroundPow10NTimesAroundPow10N.d.ts +9 -0
- package/lib/exercises/math/calcul/rounding/estimateAroundPow10NTimesAroundPow10N.d.ts.map +1 -0
- package/lib/exercises/math/calcul/rounding/estimateAroundPow10NTimesAroundPow10N.js +84 -0
- package/lib/exercises/math/calcul/rounding/estimatePow10NPlusPow10MinusN.d.ts +8 -0
- package/lib/exercises/math/calcul/rounding/estimatePow10NPlusPow10MinusN.d.ts.map +1 -0
- package/lib/exercises/math/calcul/rounding/estimatePow10NPlusPow10MinusN.js +90 -0
- package/lib/exercises/math/calcul/rounding/index.d.ts +2 -0
- package/lib/exercises/math/calcul/rounding/index.d.ts.map +1 -1
- package/lib/exercises/math/calcul/rounding/index.js +2 -0
- package/lib/exercises/math/calculLitteral/equation/equationFromProblem.d.ts +13 -0
- package/lib/exercises/math/calculLitteral/equation/equationFromProblem.d.ts.map +1 -0
- package/lib/exercises/math/calculLitteral/equation/equationFromProblem.js +414 -0
- package/lib/exercises/math/calculLitteral/equation/index.d.ts +1 -0
- package/lib/exercises/math/calculLitteral/equation/index.d.ts.map +1 -1
- package/lib/exercises/math/calculLitteral/equation/index.js +1 -0
- package/lib/exercises/math/calculLitteral/factorisation/factorizeAX2PlusBX.d.ts +10 -0
- package/lib/exercises/math/calculLitteral/factorisation/factorizeAX2PlusBX.d.ts.map +1 -0
- package/lib/exercises/math/calculLitteral/factorisation/factorizeAX2PlusBX.js +70 -0
- package/lib/exercises/math/calculLitteral/factorisation/index.d.ts +1 -0
- package/lib/exercises/math/calculLitteral/factorisation/index.d.ts.map +1 -1
- package/lib/exercises/math/calculLitteral/factorisation/index.js +1 -0
- package/lib/exercises/math/calculLitteral/index.d.ts +2 -0
- package/lib/exercises/math/calculLitteral/index.d.ts.map +1 -1
- package/lib/exercises/math/calculLitteral/index.js +2 -0
- package/lib/exercises/math/calculLitteral/isolate/index.d.ts +2 -1
- package/lib/exercises/math/calculLitteral/isolate/index.d.ts.map +1 -1
- package/lib/exercises/math/calculLitteral/isolate/index.js +2 -1
- package/lib/exercises/math/calculLitteral/isolate/isolateUInInvXPlusInvYEqualsInvU.d.ts +8 -0
- package/lib/exercises/math/calculLitteral/isolate/isolateUInInvXPlusInvYEqualsInvU.d.ts.map +1 -0
- package/lib/exercises/math/calculLitteral/isolate/isolateUInInvXPlusInvYEqualsInvU.js +107 -0
- package/lib/exercises/math/calculLitteral/isolate/isolateXInInvXPlusInvYEqualsInvU.d.ts +7 -0
- package/lib/exercises/math/calculLitteral/isolate/isolateXInInvXPlusInvYEqualsInvU.d.ts.map +1 -0
- package/lib/exercises/math/calculLitteral/isolate/isolateXInInvXPlusInvYEqualsInvU.js +80 -0
- package/lib/exercises/math/calculLitteral/ordering/compareAMinusB.d.ts +10 -0
- package/lib/exercises/math/calculLitteral/ordering/compareAMinusB.d.ts.map +1 -0
- package/lib/exercises/math/calculLitteral/ordering/compareAMinusB.js +182 -0
- package/lib/exercises/math/calculLitteral/ordering/compareFromPiMinusFrac.d.ts +9 -0
- package/lib/exercises/math/calculLitteral/ordering/compareFromPiMinusFrac.d.ts.map +1 -0
- package/lib/exercises/math/calculLitteral/ordering/compareFromPiMinusFrac.js +144 -0
- package/lib/exercises/math/calculLitteral/ordering/index.d.ts +3 -0
- package/lib/exercises/math/calculLitteral/ordering/index.d.ts.map +1 -0
- package/lib/exercises/math/calculLitteral/ordering/index.js +2 -0
- package/lib/exercises/math/calculLitteral/simplifying/compareATimes0.d.ts +11 -0
- package/lib/exercises/math/calculLitteral/simplifying/compareATimes0.d.ts.map +1 -0
- package/lib/exercises/math/calculLitteral/simplifying/compareATimes0.js +120 -0
- package/lib/exercises/math/calculLitteral/simplifying/compareFracXA.d.ts +8 -0
- package/lib/exercises/math/calculLitteral/simplifying/compareFracXA.d.ts.map +1 -0
- package/lib/exercises/math/calculLitteral/simplifying/compareFracXA.js +67 -0
- package/lib/exercises/math/calculLitteral/simplifying/compareMinusA.d.ts +11 -0
- package/lib/exercises/math/calculLitteral/simplifying/compareMinusA.d.ts.map +1 -0
- package/lib/exercises/math/calculLitteral/simplifying/compareMinusA.js +114 -0
- package/lib/exercises/math/calculLitteral/simplifying/index.d.ts +5 -0
- package/lib/exercises/math/calculLitteral/simplifying/index.d.ts.map +1 -1
- package/lib/exercises/math/calculLitteral/simplifying/index.js +5 -0
- package/lib/exercises/math/calculLitteral/simplifying/pickSameAsAPercentOfB.d.ts +13 -0
- package/lib/exercises/math/calculLitteral/simplifying/pickSameAsAPercentOfB.d.ts.map +1 -0
- package/lib/exercises/math/calculLitteral/simplifying/pickSameAsAPercentOfB.js +125 -0
- package/lib/exercises/math/calculLitteral/simplifying/pickSameAsInverseOfFracAB.d.ts +14 -0
- package/lib/exercises/math/calculLitteral/simplifying/pickSameAsInverseOfFracAB.d.ts.map +1 -0
- package/lib/exercises/math/calculLitteral/simplifying/pickSameAsInverseOfFracAB.js +148 -0
- package/lib/exercises/math/calculLitteral/writing/writeLitExpFromFrenchExp.d.ts +5 -27
- package/lib/exercises/math/calculLitteral/writing/writeLitExpFromFrenchExp.d.ts.map +1 -1
- package/lib/exercises/math/calculLitteral/writing/writeLitExpFromFrenchExp.js +178 -241
- package/lib/exercises/math/conversion/index.d.ts +4 -0
- package/lib/exercises/math/conversion/index.d.ts.map +1 -1
- package/lib/exercises/math/conversion/index.js +4 -0
- package/lib/exercises/math/conversion/kmPerMinToKmPerHourConversion.d.ts +8 -0
- package/lib/exercises/math/conversion/kmPerMinToKmPerHourConversion.d.ts.map +1 -0
- package/lib/exercises/math/conversion/kmPerMinToKmPerHourConversion.js +98 -0
- package/lib/exercises/math/conversion/minutesToHours.d.ts +10 -0
- package/lib/exercises/math/conversion/minutesToHours.d.ts.map +1 -0
- package/lib/exercises/math/conversion/minutesToHours.js +150 -0
- package/lib/exercises/math/conversion/prefixToNumber.d.ts +15 -0
- package/lib/exercises/math/conversion/prefixToNumber.d.ts.map +1 -0
- package/lib/exercises/math/conversion/prefixToNumber.js +233 -0
- package/lib/exercises/math/conversion/secondsToHours.d.ts +10 -0
- package/lib/exercises/math/conversion/secondsToHours.d.ts.map +1 -0
- package/lib/exercises/math/conversion/secondsToHours.js +150 -0
- package/lib/exercises/math/conversion/volumeConversion.d.ts.map +1 -1
- package/lib/exercises/math/conversion/volumeConversion.js +7 -1
- package/lib/exercises/math/dataRepresentations/barChartInterpreting.d.ts +50 -0
- package/lib/exercises/math/dataRepresentations/barChartInterpreting.d.ts.map +1 -0
- package/lib/exercises/math/dataRepresentations/barChartInterpreting.js +517 -0
- package/lib/exercises/math/dataRepresentations/boxPlotInterpreting.d.ts +7 -0
- package/lib/exercises/math/dataRepresentations/boxPlotInterpreting.d.ts.map +1 -0
- package/lib/exercises/math/dataRepresentations/boxPlotInterpreting.js +223 -0
- package/lib/exercises/math/dataRepresentations/cartesianGraphExtremaReading.d.ts +10 -0
- package/lib/exercises/math/dataRepresentations/cartesianGraphExtremaReading.d.ts.map +1 -0
- package/lib/exercises/math/dataRepresentations/cartesianGraphExtremaReading.js +139 -0
- package/lib/exercises/math/dataRepresentations/dataToGraphGraphToData.d.ts +8 -0
- package/lib/exercises/math/dataRepresentations/dataToGraphGraphToData.d.ts.map +1 -0
- package/lib/exercises/math/dataRepresentations/dataToGraphGraphToData.js +133 -0
- package/lib/exercises/math/dataRepresentations/graphReading.d.ts +8 -0
- package/lib/exercises/math/dataRepresentations/graphReading.d.ts.map +1 -0
- package/lib/exercises/math/dataRepresentations/graphReading.js +136 -0
- package/lib/exercises/math/dataRepresentations/halfPieChartCommenting.d.ts +18 -0
- package/lib/exercises/math/dataRepresentations/halfPieChartCommenting.d.ts.map +1 -0
- package/lib/exercises/math/dataRepresentations/halfPieChartCommenting.js +228 -0
- package/lib/exercises/math/dataRepresentations/halfPieChartReading.d.ts +8 -0
- package/lib/exercises/math/dataRepresentations/halfPieChartReading.d.ts.map +1 -0
- package/lib/exercises/math/dataRepresentations/halfPieChartReading.js +213 -0
- package/lib/exercises/math/dataRepresentations/histogramReading.d.ts +9 -0
- package/lib/exercises/math/dataRepresentations/histogramReading.d.ts.map +1 -0
- package/lib/exercises/math/dataRepresentations/histogramReading.js +163 -0
- package/lib/exercises/math/dataRepresentations/index.d.ts +10 -0
- package/lib/exercises/math/dataRepresentations/index.d.ts.map +1 -1
- package/lib/exercises/math/dataRepresentations/index.js +10 -0
- package/lib/exercises/math/dataRepresentations/plausibleGraph.d.ts +9 -0
- package/lib/exercises/math/dataRepresentations/plausibleGraph.d.ts.map +1 -0
- package/lib/exercises/math/dataRepresentations/plausibleGraph.js +145 -0
- package/lib/exercises/math/dataRepresentations/scatterPlotCommenting.d.ts +9 -0
- package/lib/exercises/math/dataRepresentations/scatterPlotCommenting.d.ts.map +1 -0
- package/lib/exercises/math/dataRepresentations/scatterPlotCommenting.js +308 -0
- package/lib/exercises/math/derivation/derivative/exp/expDerivativeFour.d.ts.map +1 -1
- package/lib/exercises/math/derivation/derivative/exp/expDerivativeFour.js +10 -5
- package/lib/exercises/math/functions/affines/coordsOfPointOnAffineFindX.d.ts +8 -0
- package/lib/exercises/math/functions/affines/coordsOfPointOnAffineFindX.d.ts.map +1 -0
- package/lib/exercises/math/functions/affines/coordsOfPointOnAffineFindX.js +103 -0
- package/lib/exercises/math/functions/affines/coordsOfPointOnAffineFindY.d.ts +8 -0
- package/lib/exercises/math/functions/affines/coordsOfPointOnAffineFindY.d.ts.map +1 -0
- package/lib/exercises/math/functions/affines/coordsOfPointOnAffineFindY.js +100 -0
- package/lib/exercises/math/functions/affines/drawAffineFromLitExp.js +5 -5
- package/lib/exercises/math/functions/affines/drawAffineFromPointAndLeadingCoeff.d.ts +16 -0
- package/lib/exercises/math/functions/affines/drawAffineFromPointAndLeadingCoeff.d.ts.map +1 -0
- package/lib/exercises/math/functions/affines/drawAffineFromPointAndLeadingCoeff.js +215 -0
- package/lib/exercises/math/functions/affines/drawAffineFromProgCalc.d.ts +13 -0
- package/lib/exercises/math/functions/affines/drawAffineFromProgCalc.d.ts.map +1 -0
- package/lib/exercises/math/functions/affines/drawAffineFromProgCalc.js +206 -0
- package/lib/exercises/math/functions/affines/index.d.ts +7 -0
- package/lib/exercises/math/functions/affines/index.d.ts.map +1 -1
- package/lib/exercises/math/functions/affines/index.js +7 -0
- package/lib/exercises/math/functions/affines/recognizeExprAffine.d.ts +20 -0
- package/lib/exercises/math/functions/affines/recognizeExprAffine.d.ts.map +1 -0
- package/lib/exercises/math/functions/affines/recognizeExprAffine.js +284 -0
- package/lib/exercises/math/functions/affines/representationOfAffine.d.ts +13 -0
- package/lib/exercises/math/functions/affines/representationOfAffine.d.ts.map +1 -0
- package/lib/exercises/math/functions/affines/representationOfAffine.js +184 -0
- package/lib/exercises/math/functions/basics/coordsOfPointOnCurveFindY.d.ts +14 -0
- package/lib/exercises/math/functions/basics/coordsOfPointOnCurveFindY.d.ts.map +1 -0
- package/lib/exercises/math/functions/basics/coordsOfPointOnCurveFindY.js +216 -0
- package/lib/exercises/math/functions/basics/findZeroesProductQuotient.d.ts.map +1 -1
- package/lib/exercises/math/functions/basics/findZeroesProductQuotient.js +29 -2
- package/lib/exercises/math/functions/basics/index.d.ts +1 -0
- package/lib/exercises/math/functions/basics/index.d.ts.map +1 -1
- package/lib/exercises/math/functions/basics/index.js +1 -0
- package/lib/exercises/math/functions/basics/inverseImageFunctionGeogebra.d.ts.map +1 -1
- package/lib/exercises/math/functions/basics/inverseImageFunctionGeogebra.js +72 -61
- package/lib/exercises/math/functions/composition/functionComposition.d.ts +8 -0
- package/lib/exercises/math/functions/composition/functionComposition.d.ts.map +1 -0
- package/lib/exercises/math/functions/composition/functionComposition.js +238 -0
- package/lib/exercises/math/functions/composition/index.d.ts +2 -0
- package/lib/exercises/math/functions/composition/index.d.ts.map +1 -0
- package/lib/exercises/math/functions/composition/index.js +1 -0
- package/lib/exercises/math/functions/index.d.ts +1 -0
- package/lib/exercises/math/functions/index.d.ts.map +1 -1
- package/lib/exercises/math/functions/index.js +1 -0
- package/lib/exercises/math/functions/trinoms/roots/rootsFromDevForm.d.ts.map +1 -1
- package/lib/exercises/math/functions/trinoms/roots/rootsFromDevForm.js +41 -16
- package/lib/exercises/math/functions/trinoms/roots/rootsReading.d.ts.map +1 -1
- package/lib/exercises/math/functions/trinoms/roots/rootsReading.js +3 -2
- package/lib/exercises/math/functions/trinoms/sign/trinomSignFromFacto.d.ts +1 -0
- package/lib/exercises/math/functions/trinoms/sign/trinomSignFromFacto.d.ts.map +1 -1
- package/lib/exercises/math/functions/trinoms/sign/trinomSignFromFacto.js +21 -13
- package/lib/exercises/math/geometry/angles/anglesUsingIsParallel.d.ts +23 -0
- package/lib/exercises/math/geometry/angles/anglesUsingIsParallel.d.ts.map +1 -0
- package/lib/exercises/math/geometry/angles/anglesUsingIsParallel.js +448 -0
- package/lib/exercises/math/geometry/angles/index.js +2 -0
- package/lib/exercises/math/geometry/angles/isParallelUsingAngles.d.ts +23 -0
- package/lib/exercises/math/geometry/angles/isParallelUsingAngles.d.ts.map +1 -0
- package/lib/exercises/math/geometry/angles/isParallelUsingAngles.js +402 -0
- package/lib/exercises/math/geometry/cartesian/placeAbscissOnSemiLine.d.ts +9 -6
- package/lib/exercises/math/geometry/cartesian/placeAbscissOnSemiLine.d.ts.map +1 -1
- package/lib/exercises/math/geometry/cartesian/placeAbscissOnSemiLine.js +140 -60
- package/lib/exercises/math/geometry/convexity/convexityQuadrinomialsGeo.js +1 -1
- package/lib/exercises/math/geometry/perimeters/circleCircumference.d.ts.map +1 -1
- package/lib/exercises/math/geometry/perimeters/circleCircumference.js +15 -7
- package/lib/exercises/math/geometry/shapes/basicShapesNaming.d.ts.map +1 -1
- package/lib/exercises/math/geometry/shapes/basicShapesNaming.js +5 -3
- package/lib/exercises/math/geometry/vectors/colinearity/colinearityFromPicture.d.ts.map +1 -1
- package/lib/exercises/math/geometry/vectors/colinearity/colinearityFromPicture.js +121 -104
- package/lib/exercises/math/geometry/vectors/vectorRepresentative.d.ts.map +1 -1
- package/lib/exercises/math/geometry/vectors/vectorRepresentative.js +3 -2
- package/lib/exercises/math/percent/evolutions/evolutionToCM.js +2 -2
- package/lib/exercises/math/percent/findProportion.d.ts +6 -1
- package/lib/exercises/math/percent/findProportion.d.ts.map +1 -1
- package/lib/exercises/math/percent/findProportion.js +162 -45
- package/lib/exercises/math/powers/calculateNegativePower.d.ts +5 -1
- package/lib/exercises/math/powers/calculateNegativePower.d.ts.map +1 -1
- package/lib/exercises/math/powers/calculateNegativePower.js +93 -29
- package/lib/exercises/math/probaStat/basicProbas/index.d.ts +1 -0
- package/lib/exercises/math/probaStat/basicProbas/index.d.ts.map +1 -1
- package/lib/exercises/math/probaStat/basicProbas/index.js +1 -0
- package/lib/exercises/math/probaStat/basicProbas/possibleValuesForProba.d.ts +0 -1
- package/lib/exercises/math/probaStat/basicProbas/possibleValuesForProba.d.ts.map +1 -1
- package/lib/exercises/math/probaStat/basicProbas/possibleValuesForProba.js +42 -80
- package/lib/exercises/math/probaStat/conditionalProbaWriteFromFrench.d.ts +9 -0
- package/lib/exercises/math/probaStat/conditionalProbaWriteFromFrench.d.ts.map +1 -0
- package/lib/exercises/math/probaStat/conditionalProbaWriteFromFrench.js +217 -0
- package/lib/exercises/math/probaStat/index.d.ts +2 -0
- package/lib/exercises/math/probaStat/index.d.ts.map +1 -1
- package/lib/exercises/math/probaStat/index.js +2 -0
- package/lib/exercises/math/probaStat/probaAsSumOfProbas.d.ts +30 -0
- package/lib/exercises/math/probaStat/probaAsSumOfProbas.d.ts.map +1 -0
- package/lib/exercises/math/probaStat/probaAsSumOfProbas.js +548 -0
- package/lib/exercises/math/probaStat/probaFromTableNoContext.d.ts.map +1 -1
- package/lib/exercises/math/probaStat/probaFromTableNoContext.js +10 -2
- package/lib/exercises/math/probaStat/probaFromTableWithContext.d.ts.map +1 -1
- package/lib/exercises/math/probaStat/probaFromTableWithContext.js +2 -1
- package/lib/exercises/math/probaStat/stats1var/index.d.ts +2 -0
- package/lib/exercises/math/probaStat/stats1var/index.d.ts.map +1 -1
- package/lib/exercises/math/probaStat/stats1var/index.js +2 -0
- package/lib/exercises/math/probaStat/stats1var/interpretIndicatorsForLists.d.ts +9 -0
- package/lib/exercises/math/probaStat/stats1var/interpretIndicatorsForLists.d.ts.map +1 -0
- package/lib/exercises/math/probaStat/stats1var/interpretIndicatorsForLists.js +90 -0
- package/lib/exercises/math/probaStat/stats1var/plausibilityOfAverage.d.ts +10 -0
- package/lib/exercises/math/probaStat/stats1var/plausibilityOfAverage.d.ts.map +1 -0
- package/lib/exercises/math/probaStat/stats1var/plausibilityOfAverage.js +151 -0
- package/lib/exercises/math/probaStat/stats1var/quartilesList.d.ts +4 -1
- package/lib/exercises/math/probaStat/stats1var/quartilesList.d.ts.map +1 -1
- package/lib/exercises/math/probaStat/stats1var/quartilesList.js +46 -27
- package/lib/exercises/math/sequences/geometric/geometricFindExplicitFormula.d.ts.map +1 -1
- package/lib/exercises/math/sequences/geometric/geometricFindExplicitFormula.js +14 -2
- package/lib/exercises/math/sequences/geometric/geometricReasonUsage.d.ts +1 -0
- package/lib/exercises/math/sequences/geometric/geometricReasonUsage.d.ts.map +1 -1
- package/lib/exercises/math/sequences/geometric/geometricReasonUsage.js +43 -19
- package/lib/exercises/math/sequences/sequenceEvaluation.d.ts.map +1 -1
- package/lib/exercises/math/sequences/sequenceEvaluation.js +18 -1
- package/lib/exercises/pc/chemicalReactions/chemicalEquations.d.ts.map +1 -1
- package/lib/exercises/pc/chemicalReactions/chemicalEquations.js +17 -2
- package/lib/exercises/pc/electricity/calculateUEqualsRI.d.ts +7 -0
- package/lib/exercises/pc/electricity/calculateUEqualsRI.d.ts.map +1 -0
- package/lib/exercises/pc/electricity/calculateUEqualsRI.js +73 -0
- package/lib/exercises/pc/electricity/index.d.ts +1 -0
- package/lib/exercises/pc/electricity/index.d.ts.map +1 -1
- package/lib/exercises/pc/electricity/index.js +1 -0
- package/lib/exercises/pc/index.d.ts +1 -0
- package/lib/exercises/pc/index.d.ts.map +1 -1
- package/lib/exercises/pc/index.js +1 -0
- package/lib/exercises/pc/mole/molarMass.d.ts.map +1 -1
- package/lib/exercises/pc/mole/molarMass.js +7 -1
- package/lib/exercises/pc/moleculeFormula.d.ts.map +1 -1
- package/lib/exercises/pc/moleculeFormula.js +4 -3
- package/lib/exercises/pc/motion/averageSpeed.d.ts +9 -4
- package/lib/exercises/pc/motion/averageSpeed.d.ts.map +1 -1
- package/lib/exercises/pc/motion/averageSpeed.js +132 -61
- package/lib/exercises/pc/motion/averageSpeedCalculation.d.ts.map +1 -1
- package/lib/exercises/pc/motion/averageSpeedCalculation.js +10 -4
- package/lib/exercises/pc/optics/index.d.ts +2 -0
- package/lib/exercises/pc/optics/index.d.ts.map +1 -0
- package/lib/exercises/pc/optics/index.js +1 -0
- package/lib/exercises/pc/optics/lensFormula.d.ts +21 -0
- package/lib/exercises/pc/optics/lensFormula.d.ts.map +1 -0
- package/lib/exercises/pc/optics/lensFormula.js +415 -0
- package/lib/exercises/pc/recognizeRefractionOrReflectionAngles.d.ts +2 -2
- package/lib/exercises/pc/recognizeRefractionOrReflectionAngles.js +15 -15
- package/lib/exercises/pc/weight/calculateWeight.d.ts +8 -1
- package/lib/exercises/pc/weight/calculateWeight.d.ts.map +1 -1
- package/lib/exercises/pc/weight/calculateWeight.js +113 -38
- package/lib/exercises/utils/geogebra/toolBarConstructor.d.ts +1 -0
- package/lib/exercises/utils/geogebra/toolBarConstructor.d.ts.map +1 -1
- package/lib/exercises/utils/geogebra/toolBarConstructor.js +3 -1
- package/lib/geogebra/parsers/geogebraParser.d.ts +4 -0
- package/lib/geogebra/parsers/geogebraParser.d.ts.map +1 -1
- package/lib/geogebra/parsers/geogebraParser.js +17 -0
- package/lib/index.d.ts +392 -23
- package/lib/index.d.ts.map +1 -1
- package/lib/latexTester.d.ts.map +1 -1
- package/lib/latexTester.js +1 -0
- package/lib/math/geometry/CloudPoints.d.ts +10 -0
- package/lib/math/geometry/CloudPoints.d.ts.map +1 -1
- package/lib/math/geometry/CloudPoints.js +119 -0
- package/lib/math/geometry/line.d.ts +1 -0
- package/lib/math/geometry/line.d.ts.map +1 -1
- package/lib/math/geometry/line.js +10 -2
- 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 +12 -0
- package/lib/math/progCalc/progCalc.d.ts +46 -0
- package/lib/math/progCalc/progCalc.d.ts.map +1 -0
- package/lib/math/progCalc/progCalc.js +239 -0
- package/lib/math/utils/latex/realize.d.ts +12 -0
- package/lib/math/utils/latex/realize.d.ts.map +1 -0
- package/lib/math/utils/latex/realize.js +43 -0
- package/lib/pc/constants/molecularChemistry/molecule.d.ts +2 -0
- package/lib/pc/constants/molecularChemistry/molecule.d.ts.map +1 -1
- package/lib/pc/constants/molecularChemistry/molecule.js +52 -0
- package/lib/pc/units/timeUnits.d.ts +5 -3
- package/lib/pc/units/timeUnits.d.ts.map +1 -1
- package/lib/pc/units/timeUnits.js +25 -19
- package/lib/tests/questionTest.d.ts.map +1 -1
- package/lib/tests/questionTest.js +1 -1
- package/lib/tests/singleExo.test.js +3 -3
- package/lib/tree/nodes/algebraicNode.d.ts.map +1 -1
- package/lib/tree/nodes/operators/addNode.d.ts +4 -2
- package/lib/tree/nodes/operators/addNode.d.ts.map +1 -1
- package/lib/tree/nodes/operators/addNode.js +8 -17
- package/lib/tree/nodes/operators/fractionNode.d.ts +1 -1
- package/lib/tree/nodes/operators/fractionNode.d.ts.map +1 -1
- package/lib/tree/nodes/operators/fractionNode.js +5 -1
- package/lib/tree/nodes/operators/multiplyNode.d.ts +4 -2
- package/lib/tree/nodes/operators/multiplyNode.d.ts.map +1 -1
- package/lib/tree/nodes/operators/multiplyNode.js +8 -17
- package/lib/tree/nodes/operators/operatorNode.d.ts +3 -3
- package/lib/tree/nodes/operators/operatorNode.d.ts.map +1 -1
- package/lib/tree/nodes/variables/variableNode.d.ts +1 -1
- package/lib/tree/nodes/variables/variableNode.d.ts.map +1 -1
- package/lib/tree/utilities/nodeShuffler.d.ts +12 -0
- package/lib/tree/utilities/nodeShuffler.d.ts.map +1 -0
- package/lib/tree/utilities/nodeShuffler.js +123 -0
- package/lib/utils/arrays/getAllPicks.d.ts +2 -0
- package/lib/utils/arrays/getAllPicks.d.ts.map +1 -0
- package/lib/utils/arrays/getAllPicks.js +17 -0
- package/lib/utils/errors/handleVEAError.d.ts +1 -1
- package/lib/utils/errors/handleVEAError.d.ts.map +1 -1
- package/lib/utils/strings/decapitalize.d.ts +2 -0
- package/lib/utils/strings/decapitalize.d.ts.map +1 -0
- package/lib/utils/strings/decapitalize.js +3 -0
- package/package.json +1 -1
|
@@ -35,6 +35,58 @@ export class Molecule {
|
|
|
35
35
|
this.iupact = iupact;
|
|
36
36
|
this.type = type;
|
|
37
37
|
}
|
|
38
|
+
static electronegativityOrder = (() => {
|
|
39
|
+
const arrayOfAtoms = `Rn Xe Kr Ar Ne He
|
|
40
|
+
Fr Cs Rb K Na Li
|
|
41
|
+
Ra Ba Sr Ca Mg Be
|
|
42
|
+
Lr Ac Lu La Y Sc
|
|
43
|
+
Rf Hf Zr Ti
|
|
44
|
+
Db Ta Nb V
|
|
45
|
+
Sg W Mo Cr
|
|
46
|
+
Bh Re Tc Mn
|
|
47
|
+
Hs Os Ru Fe
|
|
48
|
+
Mt Ir Rh Co
|
|
49
|
+
Ds Pt Pd Ni
|
|
50
|
+
Rg Au Ag Cu
|
|
51
|
+
Hg Cd Zn
|
|
52
|
+
Tl In Ga Al B
|
|
53
|
+
Pb Sn Ge Si C
|
|
54
|
+
Bi Sb As P N H
|
|
55
|
+
Po Te Se S O
|
|
56
|
+
At I Br Cl F`
|
|
57
|
+
.replace(/\s/g, ",")
|
|
58
|
+
.split(",");
|
|
59
|
+
return Object.fromEntries(arrayOfAtoms.map((atom, i) => {
|
|
60
|
+
return [atom, i];
|
|
61
|
+
}));
|
|
62
|
+
})();
|
|
63
|
+
getRawFormula() {
|
|
64
|
+
const symboleForAtomsData = Object.fromEntries(this.atoms.map((atomsData) => [atomsData.atom.symbole, atomsData]));
|
|
65
|
+
const symbolsFirst = this.isOrganic ? ["C", "H", "O"] : [];
|
|
66
|
+
const arrayFirst = symbolsFirst
|
|
67
|
+
.map((symbole) => symboleForAtomsData[symbole])
|
|
68
|
+
.filter((atomsData) => !!atomsData);
|
|
69
|
+
const arrayRest = (() => {
|
|
70
|
+
const symboleForAtomsDataCopy = Object.assign(symboleForAtomsData, {});
|
|
71
|
+
symbolsFirst.forEach((symbole) => {
|
|
72
|
+
delete symboleForAtomsDataCopy[symbole];
|
|
73
|
+
});
|
|
74
|
+
return Object.values(symboleForAtomsDataCopy);
|
|
75
|
+
})().toSorted(({ atom: atom1 }, { atom: atom2 }) => Molecule.electronegativityOrder[atom1.symbole] -
|
|
76
|
+
Molecule.electronegativityOrder[atom2.symbole]);
|
|
77
|
+
const sortedArrayAtomsData = [...arrayFirst, ...arrayRest];
|
|
78
|
+
let rawFormula = ``;
|
|
79
|
+
for (let i = 0; i < sortedArrayAtomsData.length; i++) {
|
|
80
|
+
const atomData = sortedArrayAtomsData[i];
|
|
81
|
+
if (atomData.count > 1) {
|
|
82
|
+
rawFormula += `${atomData.atom.symbole}_{${atomData.count.frenchify()}}`;
|
|
83
|
+
}
|
|
84
|
+
else {
|
|
85
|
+
rawFormula += `${atomData.atom.symbole}`;
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
return rawFormula;
|
|
89
|
+
}
|
|
38
90
|
}
|
|
39
91
|
export const molecules = [
|
|
40
92
|
new Molecule("Dihydrogène", "H_2", 2.016, [{ name: "H", count: 2 }], false, "gas"),
|
|
@@ -1,13 +1,15 @@
|
|
|
1
|
+
import { AlgebraicNode } from "../../tree/nodes/algebraicNode.js";
|
|
1
2
|
import { Measure } from "../measure/measure.js";
|
|
2
3
|
import { BasicUnit } from "./interfaces/basicUnit.js";
|
|
3
|
-
export type TimeValues = "h" | "
|
|
4
|
+
export type TimeValues = "h" | "min" | "s" | "ms";
|
|
4
5
|
export declare class TimeUnit extends BasicUnit<TimeValues> {
|
|
5
6
|
static readonly h: TimeUnit;
|
|
6
|
-
static readonly
|
|
7
|
+
static readonly min: TimeUnit;
|
|
7
8
|
static readonly s: TimeUnit;
|
|
8
9
|
static readonly ms: TimeUnit;
|
|
9
10
|
className(): string;
|
|
10
11
|
convert(significantPart: number, exponent: number, convertToUnit: TimeValues): Measure<TimeValues>;
|
|
11
|
-
convertToMinute(
|
|
12
|
+
static convertToMinute(unit: TimeValues): AlgebraicNode;
|
|
13
|
+
static getConversionFactor(from: TimeValues, to: TimeValues): import("../../tree/nodes/operators/fractionNode.js").FractionNode;
|
|
12
14
|
}
|
|
13
15
|
//# sourceMappingURL=timeUnits.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"timeUnits.d.ts","sourceRoot":"","sources":["../../../src/pc/units/timeUnits.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAChD,OAAO,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAC;AAEtD,MAAM,MAAM,UAAU,GAAG,GAAG,GAAG,
|
|
1
|
+
{"version":3,"file":"timeUnits.d.ts","sourceRoot":"","sources":["../../../src/pc/units/timeUnits.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,mCAAmC,CAAC;AAGlE,OAAO,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAChD,OAAO,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAC;AAEtD,MAAM,MAAM,UAAU,GAAG,GAAG,GAAG,KAAK,GAAG,GAAG,GAAG,IAAI,CAAC;AAKlD,qBAAa,QAAS,SAAQ,SAAS,CAAC,UAAU,CAAC;IACjD,MAAM,CAAC,QAAQ,CAAC,CAAC,WAAqB;IACtC,MAAM,CAAC,QAAQ,CAAC,GAAG,WAAuB;IAC1C,MAAM,CAAC,QAAQ,CAAC,CAAC,WAAqB;IACtC,MAAM,CAAC,QAAQ,CAAC,EAAE,WAAsB;IAExC,SAAS,IAAI,MAAM;IAInB,OAAO,CACL,eAAe,EAAE,MAAM,EACvB,QAAQ,EAAE,MAAM,EAChB,aAAa,EAAE,UAAU,GACxB,OAAO,CAAC,UAAU,CAAC;IAiBtB,MAAM,CAAC,eAAe,CAAC,IAAI,EAAE,UAAU,GAAG,aAAa;IAavD,MAAM,CAAC,mBAAmB,CAAC,IAAI,EAAE,UAAU,EAAE,EAAE,EAAE,UAAU;CAG5D"}
|
|
@@ -1,38 +1,44 @@
|
|
|
1
|
+
import { frac } from "../../tree/nodes/operators/fractionNode.js";
|
|
2
|
+
import { multiply } from "../../tree/nodes/operators/multiplyNode.js";
|
|
1
3
|
import { Measure } from "../measure/measure.js";
|
|
2
4
|
import { BasicUnit } from "./interfaces/basicUnit.js";
|
|
3
|
-
const times = ["h", "
|
|
5
|
+
const times = ["h", "min", "s", "ms"];
|
|
4
6
|
// const timesValue = [1 / 60, 1, 60, 60000];
|
|
5
7
|
export class TimeUnit extends BasicUnit {
|
|
6
8
|
static h = new TimeUnit("h");
|
|
7
|
-
static
|
|
9
|
+
static min = new TimeUnit("min");
|
|
8
10
|
static s = new TimeUnit("s");
|
|
9
11
|
static ms = new TimeUnit("ms");
|
|
10
12
|
className() {
|
|
11
13
|
return "TimeUnit";
|
|
12
14
|
}
|
|
13
15
|
convert(significantPart, exponent, convertToUnit) {
|
|
14
|
-
const timeObjects = [TimeUnit.h, TimeUnit.
|
|
16
|
+
const timeObjects = [TimeUnit.h, TimeUnit.min, TimeUnit.s, TimeUnit.ms];
|
|
15
17
|
const unitIndex = times.findIndex((value) => convertToUnit === value);
|
|
16
|
-
if (!
|
|
18
|
+
if (!unitIndex) {
|
|
17
19
|
throw new Error(`cannot convert ${this.toTex()} to ${convertToUnit}.`);
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
20
|
+
}
|
|
21
|
+
else {
|
|
22
|
+
const timeObject = timeObjects[unitIndex];
|
|
23
|
+
const factor = TimeUnit.getConversionFactor(this.unit, convertToUnit);
|
|
24
|
+
//!TODO: precision loss here /!\
|
|
25
|
+
const significantPartTo = multiply(significantPart, factor).evaluate();
|
|
26
|
+
return new Measure(significantPartTo, exponent, timeObject);
|
|
27
|
+
}
|
|
24
28
|
}
|
|
25
|
-
convertToMinute(
|
|
26
|
-
switch (
|
|
29
|
+
static convertToMinute(unit) {
|
|
30
|
+
switch (unit) {
|
|
27
31
|
case "h":
|
|
28
|
-
return
|
|
29
|
-
case "
|
|
30
|
-
return
|
|
31
|
-
case "s
|
|
32
|
-
return
|
|
32
|
+
return (60).toTree();
|
|
33
|
+
case "min":
|
|
34
|
+
return (1).toTree();
|
|
35
|
+
case "s":
|
|
36
|
+
return frac(1, 60);
|
|
33
37
|
case "ms":
|
|
34
|
-
return
|
|
38
|
+
return frac(1, 60_000);
|
|
35
39
|
}
|
|
36
|
-
|
|
40
|
+
}
|
|
41
|
+
static getConversionFactor(from, to) {
|
|
42
|
+
return frac(TimeUnit.convertToMinute(from), TimeUnit.convertToMinute(to));
|
|
37
43
|
}
|
|
38
44
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"questionTest.d.ts","sourceRoot":"","sources":["../../src/tests/questionTest.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,6BAA6B,CAAC;AAKjE,eAAO,MAAM,YAAY,GACvB,KAAK,QAAQ,CAAC,MAAM,CAAC,EACrB,UAAU,QAAQ,CAAC,MAAM,CAAC;;;
|
|
1
|
+
{"version":3,"file":"questionTest.d.ts","sourceRoot":"","sources":["../../src/tests/questionTest.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,6BAA6B,CAAC;AAKjE,eAAO,MAAM,YAAY,GACvB,KAAK,QAAQ,CAAC,MAAM,CAAC,EACrB,UAAU,QAAQ,CAAC,MAAM,CAAC;;;CA0P3B,CAAC"}
|
|
@@ -195,7 +195,7 @@ export const questionTest = (exo, question) => {
|
|
|
195
195
|
if (prop.statement.includes("[object Object]"))
|
|
196
196
|
throw new Error(`exo ${exo.id} has invalid prop (objectObject) : ${prop}`);
|
|
197
197
|
if (!props.every((prop2) => prop2.id === prop.id || prop.statement !== prop2.statement))
|
|
198
|
-
throw new Error(`exo ${exo.id} has invalid prop (duplicate): ${prop}`);
|
|
198
|
+
throw new Error(`exo ${exo.id} has invalid prop (duplicate): ${prop.statement}`);
|
|
199
199
|
if (prop.format !== "raw") {
|
|
200
200
|
if (!latexTester(prop.statement, true))
|
|
201
201
|
throw new Error(`exo ${exo.id} has invalid prop (latex error): ${prop}`);
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import "../prototypesEnhancement.js";
|
|
2
2
|
import { exoTest } from "./exoTest.js";
|
|
3
|
-
import {
|
|
3
|
+
import { colinearityFromPicture, } from "../exercises/math/index.js";
|
|
4
4
|
try {
|
|
5
|
-
for (let i = 0; i <
|
|
6
|
-
exoTest(
|
|
5
|
+
for (let i = 0; i < 1000; i++)
|
|
6
|
+
exoTest(colinearityFromPicture);
|
|
7
7
|
}
|
|
8
8
|
catch (err) {
|
|
9
9
|
throw err;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"algebraicNode.d.ts","sourceRoot":"","sources":["../../../src/tree/nodes/algebraicNode.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAE9C,MAAM,MAAM,eAAe,GAAG;IAC5B,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,wBAAwB,CAAC,EAAE,OAAO,CAAC;IACnC,UAAU,CAAC,EAAE,OAAO,CAAC;IAErB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAC7B,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAC7B,kCAAkC,CAAC,EAAE,OAAO,CAAC;IAC7C,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,sBAAsB,CAAC,EAAE,OAAO,CAAC;IACjC,4BAA4B,CAAC,EAAE,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"algebraicNode.d.ts","sourceRoot":"","sources":["../../../src/tree/nodes/algebraicNode.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAE9C,MAAM,MAAM,eAAe,GAAG;IAC5B,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,wBAAwB,CAAC,EAAE,OAAO,CAAC;IACnC,UAAU,CAAC,EAAE,OAAO,CAAC;IAErB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAC7B,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAC7B,kCAAkC,CAAC,EAAE,OAAO,CAAC;IAC7C,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,sBAAsB,CAAC,EAAE,OAAO,CAAC;IACjC,4BAA4B,CAAC,EAAE,OAAO,CAAC;CAIxC,CAAC;AAEF,MAAM,MAAM,eAAe,GAAG;IAC5B,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB,CAAC;AACF,MAAM,WAAW,aAAc,SAAQ,IAAI;IACzC,QAAQ,EAAE,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,EAAE,IAAI,CAAC,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,EAAE,GAAG,CAAC,EAAE,OAAO,KAAK,aAAa,CAAC;IACnE,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,GAAI,MAAM,IAAI,KAAG,IAAI,IAAI,aACI,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Node, NodeIds, NodeOptions, NodeType, ToTexOptions } from "../node.js";
|
|
2
|
-
import { CommutativeOperatorNode,
|
|
2
|
+
import { CommutativeOperatorNode, OperatorIds } from "./operatorNode.js";
|
|
3
3
|
import { AlgebraicNode, SimplifyOptions } from "../algebraicNode.js";
|
|
4
4
|
export declare function isAddNode(a: Node): a is AddNode;
|
|
5
5
|
export declare const add: (a: AlgebraicNode | number | string, b: AlgebraicNode | number | string) => AddNode;
|
|
@@ -11,8 +11,10 @@ export declare class AddNode implements CommutativeOperatorNode {
|
|
|
11
11
|
opts?: NodeOptions;
|
|
12
12
|
isNumeric: boolean;
|
|
13
13
|
constructor(leftChild: AlgebraicNode, rightChild: AlgebraicNode, opts?: NodeOptions);
|
|
14
|
+
/**
|
|
15
|
+
* @deprecated This function is outdated. Use `NodeShuffler.shuffle` instead.
|
|
16
|
+
*/
|
|
14
17
|
shuffle: () => AddNode;
|
|
15
|
-
deepShuffle: (opts?: DeepShuffleOpts) => AddNode;
|
|
16
18
|
toMathString(): string;
|
|
17
19
|
toEquivalentNodes(opts?: NodeOptions): AlgebraicNode[];
|
|
18
20
|
toAllTexs(): string[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"addNode.d.ts","sourceRoot":"","sources":["../../../../src/tree/nodes/operators/addNode.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAChF,OAAO,EACL,uBAAuB,EACvB,
|
|
1
|
+
{"version":3,"file":"addNode.d.ts","sourceRoot":"","sources":["../../../../src/tree/nodes/operators/addNode.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAChF,OAAO,EACL,uBAAuB,EACvB,WAAW,EAEZ,MAAM,mBAAmB,CAAC;AAI3B,OAAO,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAerE,wBAAgB,SAAS,CAAC,CAAC,EAAE,IAAI,GAAG,CAAC,IAAI,OAAO,CAE/C;AAED,eAAO,MAAM,GAAG,GACd,GAAG,aAAa,GAAG,MAAM,GAAG,MAAM,EAClC,GAAG,aAAa,GAAG,MAAM,GAAG,MAAM,YAOnC,CAAC;AAEF,qBAAa,OAAQ,YAAW,uBAAuB;IACrD,EAAE,EAAE,WAAW,CAAC;IAChB,SAAS,EAAE,aAAa,CAAC;IACzB,UAAU,EAAE,aAAa,CAAC;IAC1B,IAAI,EAAE,QAAQ,CAAC;IACf,IAAI,CAAC,EAAE,WAAW,CAAC;IACnB,SAAS,EAAE,OAAO,CAAC;gBAEjB,SAAS,EAAE,aAAa,EACxB,UAAU,EAAE,aAAa,EACzB,IAAI,CAAC,EAAE,WAAW;IAUpB;;OAEG;IACH,OAAO,gBAIL;IAEF,YAAY,IAAI,MAAM;IAItB,iBAAiB,CAAC,IAAI,CAAC,EAAE,WAAW,GAAG,aAAa,EAAE;IAoCtD,SAAS,IAAI,MAAM,EAAE;IAIrB,cAAc,CAAC,IAAI,CAAC,EAAE,WAAW,GAAG,MAAM,EAAE;IAK5C,KAAK,CAAC,OAAO,CAAC,EAAE,YAAY,GAAG,MAAM;IAerC,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC;IAMtC,QAAQ,CAAC,IAAI,CAAC,EAAE,eAAe,EAAE,IAAI,UAAQ,GAAG,aAAa;IAsJ7D,aAAa;;;;;;;;;IAOb,MAAM,CAAC,IAAI,EAAE,aAAa,GAAG,OAAO;IAUpC,oBAAoB,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,aAAa,CAAC;IAMxD,UAAU,CAAC,OAAO,CAAC,EAAE,MAAM,GAAG,SAAS,GAAG,aAAa;IAMvD,mBAAmB,CAAC,IAAI,CAAC,EAAE,eAAe;CAK3C"}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
// import { add } from "mathjs";
|
|
2
2
|
import { NodeIds, NodeType } from "../node.js";
|
|
3
|
-
import { OperatorIds,
|
|
4
|
-
import { coinFlip } from "../../../utils/alea/coinFlip.js";
|
|
3
|
+
import { OperatorIds, isOperatorNode, } from "./operatorNode.js";
|
|
5
4
|
import { permute } from "../../../utils/arrays/permutations.js";
|
|
6
5
|
import { getCartesiansProducts } from "../../../utils/arrays/cartesianProducts.js";
|
|
7
6
|
import { operatorComposition } from "../../../tree/utilities/operatorComposition.js";
|
|
@@ -13,6 +12,7 @@ import { FractionNode, isFractionNode } from "./fractionNode.js";
|
|
|
13
12
|
import { colorize } from "../../../utils/latex/colorize.js";
|
|
14
13
|
import { round } from "../../../math/utils/round.js";
|
|
15
14
|
import { MonomNode, isMonom, parseToMonomNode, } from "../polynomials/monomNode.js";
|
|
15
|
+
import { shuffle } from "../../../utils/alea/shuffle.js";
|
|
16
16
|
export function isAddNode(a) {
|
|
17
17
|
return isOperatorNode(a) && a.id === OperatorIds.add;
|
|
18
18
|
}
|
|
@@ -36,22 +36,13 @@ export class AddNode {
|
|
|
36
36
|
this.opts = opts;
|
|
37
37
|
this.isNumeric = leftChild.isNumeric && rightChild.isNumeric;
|
|
38
38
|
}
|
|
39
|
+
/**
|
|
40
|
+
* @deprecated This function is outdated. Use `NodeShuffler.shuffle` instead.
|
|
41
|
+
*/
|
|
39
42
|
shuffle = () => {
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
return new AddNode(
|
|
43
|
-
};
|
|
44
|
-
deepShuffle = (opts) => {
|
|
45
|
-
const left = isCommutativeOperatorNode(this.leftChild)
|
|
46
|
-
? this.leftChild.deepShuffle(opts)
|
|
47
|
-
: this.leftChild;
|
|
48
|
-
const right = isCommutativeOperatorNode(this.rightChild)
|
|
49
|
-
? this.rightChild.deepShuffle(opts)
|
|
50
|
-
: this.rightChild;
|
|
51
|
-
if (coinFlip() && (!opts || opts?.nodeIdsToShuffle?.includes(this.id)))
|
|
52
|
-
return new AddNode(right, left, this.opts);
|
|
53
|
-
else
|
|
54
|
-
return new AddNode(left, right, this.opts);
|
|
43
|
+
// return NodeShuffler.shuffle(this); //this causes an import death loop
|
|
44
|
+
const shuffledChildren = shuffle([this.leftChild, this.rightChild]);
|
|
45
|
+
return new AddNode(shuffledChildren[0], shuffledChildren[1]);
|
|
55
46
|
};
|
|
56
47
|
toMathString() {
|
|
57
48
|
return `${this.leftChild.toMathString()} + (${this.rightChild.toMathString()})`;
|
|
@@ -33,6 +33,6 @@ export declare class FractionNode implements OperatorNode {
|
|
|
33
33
|
equals(node: AlgebraicNode): boolean;
|
|
34
34
|
toDetailedEvaluation(vars: Record<string, AlgebraicNode>): FractionNode;
|
|
35
35
|
toSimplificationTex(): string;
|
|
36
|
-
derivative(_varName?: string
|
|
36
|
+
derivative(_varName?: string): AlgebraicNode;
|
|
37
37
|
}
|
|
38
38
|
//# sourceMappingURL=fractionNode.d.ts.map
|
|
@@ -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;AAMxD,wBAAgB,cAAc,CAAC,CAAC,EAAE,IAAI,GAAG,CAAC,IAAI,YAAY,CAEzD;AAED,eAAO,MAAM,IAAI,GACf,GAAG,aAAa,GAAG,MAAM,GAAG,MAAM,EAClC,GAAG,aAAa,GAAG,MAAM,GAAG,MAAM,EAClC,OAAO,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;IAoBT,KAAK,CAAC,OAAO,CAAC,EAAE,YAAY,GAAG,MAAM;IA8BrC,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC;IAMtC,QAAQ,CAAC,IAAI,CAAC,EAAE,eAAe,EAAE,GAAG,UAAQ,GAAG,aAAa;
|
|
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,GACf,GAAG,aAAa,GAAG,MAAM,GAAG,MAAM,EAClC,GAAG,aAAa,GAAG,MAAM,GAAG,MAAM,EAClC,OAAO,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;IAoBT,KAAK,CAAC,OAAO,CAAC,EAAE,YAAY,GAAG,MAAM;IA8BrC,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC;IAMtC,QAAQ,CAAC,IAAI,CAAC,EAAE,eAAe,EAAE,GAAG,UAAQ,GAAG,aAAa;IA8M5D,MAAM,CAAC,IAAI,EAAE,aAAa,GAAG,OAAO;IAOpC,oBAAoB,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,aAAa,CAAC;IAOxD,mBAAmB;IAQnB,UAAU,CAAC,QAAQ,CAAC,EAAE,MAAM,GAAG,aAAa;CAG7C"}
|
|
@@ -262,8 +262,12 @@ export class FractionNode {
|
|
|
262
262
|
let counter = 0;
|
|
263
263
|
const simplifyIteration = () => {
|
|
264
264
|
counter++;
|
|
265
|
-
if (counter >
|
|
265
|
+
// if (opts?.nbMaxSteps && counter > opts?.nbMaxSteps) {
|
|
266
|
+
// return;
|
|
267
|
+
// }
|
|
268
|
+
if (counter > 1000) {
|
|
266
269
|
throw new Error(`should-throw Too many iterations in simplify, ${this.toTex()}`);
|
|
270
|
+
}
|
|
267
271
|
for (let i = 0; i < externalsNums.length; i++) {
|
|
268
272
|
const num = externalsNums[i];
|
|
269
273
|
for (let j = 0; j < externalsDenums.length; j++) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Node, NodeIds, NodeOptions, NodeType, ToTexOptions } from "../node.js";
|
|
2
|
-
import { CommutativeOperatorNode,
|
|
2
|
+
import { CommutativeOperatorNode, OperatorIds } from "./operatorNode.js";
|
|
3
3
|
import { AlgebraicNode, SimplifyOptions } from "../algebraicNode.js";
|
|
4
4
|
export declare function isMultiplyNode(a: Node): a is MultiplyNode;
|
|
5
5
|
export declare const multiply: (a: AlgebraicNode | number | string, b: AlgebraicNode | number | string, opts?: NodeOptions) => MultiplyNode;
|
|
@@ -12,8 +12,10 @@ export declare class MultiplyNode implements CommutativeOperatorNode {
|
|
|
12
12
|
type: NodeType;
|
|
13
13
|
isNumeric: boolean;
|
|
14
14
|
constructor(leftChild: AlgebraicNode, rightChild: AlgebraicNode, opts?: NodeOptions);
|
|
15
|
+
/**
|
|
16
|
+
* @deprecated This function is outdated. Use `NodeShuffler.shuffle` instead.
|
|
17
|
+
*/
|
|
15
18
|
shuffle: () => MultiplyNode;
|
|
16
|
-
deepShuffle: (opts?: DeepShuffleOpts) => MultiplyNode;
|
|
17
19
|
toReversed: () => MultiplyNode;
|
|
18
20
|
toMathString(): string;
|
|
19
21
|
toTex(options?: ToTexOptions): string;
|
|
@@ -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,
|
|
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,WAAW,EAEZ,MAAM,mBAAmB,CAAC;AAgB3B,OAAO,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAYrE,wBAAgB,cAAc,CAAC,CAAC,EAAE,IAAI,GAAG,CAAC,IAAI,YAAY,CAEzD;AAED,eAAO,MAAM,QAAQ,GACnB,GAAG,aAAa,GAAG,MAAM,GAAG,MAAM,EAClC,GAAG,aAAa,GAAG,MAAM,GAAG,MAAM,EAClC,OAAO,WAAW,iBAOnB,CAAC;AACF,eAAO,MAAM,iBAAiB,GAAI,KAAK,aAAa,EAAE,SAYrD,CAAC;AACF,qBAAa,YAAa,YAAW,uBAAuB;IAC1D,IAAI,CAAC,EAAE,WAAW,CAAC;IACnB,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;IAUpB;;OAEG;IACH,OAAO,qBAIL;IAEF,UAAU,qBAER;IACF,YAAY,IAAI,MAAM;IAItB,KAAK,CAAC,OAAO,CAAC,EAAE,YAAY,GAAG,MAAM;IAgFrC,SAAS;IAkDT,iBAAiB,CAAC,IAAI,CAAC,EAAE,WAAW,GAAG,YAAY,EAAE;IAyFrD,cAAc,CAAC,IAAI,CAAC,EAAE,WAAW,GAAG,MAAM,EAAE;IAG5C,aAAa;;;;;;;;;IAYb,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC;IAItC,IAAI;IAGJ,cAAc;IACd,QAAQ,CAAC,IAAI,CAAC,EAAE,eAAe,EAAE,GAAG,UAAQ,GAAG,aAAa;IAiK5D,mBAAmB,CAAC,IAAI,CAAC,EAAE,eAAe;IAM1C,MAAM,CAAC,IAAI,EAAE,aAAa;IAU1B,oBAAoB,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,aAAa,CAAC;IAQxD,UAAU,CAAC,OAAO,CAAC,EAAE,MAAM,GAAG,SAAS,GAAG,aAAa;CAMxD"}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
// import { multiply } from "mathjs";
|
|
2
2
|
import { NodeIds, NodeType } from "../node.js";
|
|
3
|
-
import { OperatorIds,
|
|
4
|
-
import { coinFlip } from "../../../utils/alea/coinFlip.js";
|
|
3
|
+
import { OperatorIds, isOperatorNode, } from "./operatorNode.js";
|
|
5
4
|
import { permute } from "../../../utils/arrays/permutations.js";
|
|
6
5
|
import { getCartesiansProducts, getFlatCartesianProducts, } from "../../../utils/arrays/cartesianProducts.js";
|
|
7
6
|
import { operatorComposition } from "../../../tree/utilities/operatorComposition.js";
|
|
@@ -19,6 +18,7 @@ import { colorize } from "../../../utils/latex/colorize.js";
|
|
|
19
18
|
import { isSubstractNode } from "./substractNode.js";
|
|
20
19
|
import { isConstantNode } from "../numbers/constantNode.js";
|
|
21
20
|
import { ExpNode, isExpNode } from "../functions/expNode.js";
|
|
21
|
+
import { shuffle } from "../../../utils/alea/shuffle.js";
|
|
22
22
|
export function isMultiplyNode(a) {
|
|
23
23
|
return isOperatorNode(a) && a.id === OperatorIds.multiply;
|
|
24
24
|
}
|
|
@@ -53,22 +53,13 @@ export class MultiplyNode {
|
|
|
53
53
|
this.opts = opts;
|
|
54
54
|
this.isNumeric = leftChild.isNumeric && rightChild.isNumeric;
|
|
55
55
|
}
|
|
56
|
+
/**
|
|
57
|
+
* @deprecated This function is outdated. Use `NodeShuffler.shuffle` instead.
|
|
58
|
+
*/
|
|
56
59
|
shuffle = () => {
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
return new MultiplyNode(
|
|
60
|
-
};
|
|
61
|
-
deepShuffle = (opts) => {
|
|
62
|
-
const left = isCommutativeOperatorNode(this.leftChild)
|
|
63
|
-
? this.leftChild.deepShuffle(opts)
|
|
64
|
-
: this.leftChild;
|
|
65
|
-
const right = isCommutativeOperatorNode(this.rightChild)
|
|
66
|
-
? this.rightChild.deepShuffle(opts)
|
|
67
|
-
: this.rightChild;
|
|
68
|
-
if (coinFlip() && (!opts || opts?.nodeIdsToShuffle?.includes(this.id)))
|
|
69
|
-
return new MultiplyNode(right, left, this.opts);
|
|
70
|
-
else
|
|
71
|
-
return new MultiplyNode(left, right, this.opts);
|
|
60
|
+
// return NodeShuffler.shuffle(this); //this causes an import death loop
|
|
61
|
+
const shuffledChildren = shuffle([this.leftChild, this.rightChild]);
|
|
62
|
+
return new MultiplyNode(shuffledChildren[0], shuffledChildren[1]);
|
|
72
63
|
};
|
|
73
64
|
toReversed = () => {
|
|
74
65
|
return new MultiplyNode(this.rightChild, this.leftChild, this.opts);
|
|
@@ -20,11 +20,11 @@ export interface OperatorNode extends AlgebraicNode {
|
|
|
20
20
|
export declare function isOperatorNode(a: Node): a is OperatorNode;
|
|
21
21
|
export declare function isCommutativeOperatorNode(a: Node): a is CommutativeOperatorNode;
|
|
22
22
|
export type DeepShuffleOpts = {
|
|
23
|
-
|
|
23
|
+
nodeTypesToShuffle: string[];
|
|
24
|
+
nodeTypesNoFurther: string[];
|
|
24
25
|
};
|
|
25
26
|
export interface CommutativeOperatorNode extends OperatorNode {
|
|
26
|
-
shuffle: () =>
|
|
27
|
-
deepShuffle: (opts?: DeepShuffleOpts) => CommutativeOperatorNode;
|
|
27
|
+
shuffle: () => AlgebraicNode;
|
|
28
28
|
toAllTexs: () => string[];
|
|
29
29
|
}
|
|
30
30
|
//# sourceMappingURL=operatorNode.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"operatorNode.d.ts","sourceRoot":"","sources":["../../../../src/tree/nodes/operators/operatorNode.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,EAAE,IAAI,EAAY,MAAM,YAAY,CAAC;AAE5C,oBAAY,WAAW;IACrB,GAAG,IAAA;IACH,SAAS,IAAA;IACT,QAAQ,IAAA;IACR,QAAQ,IAAA;IACR,MAAM,IAAA;IACN,KAAK,IAAA;IACL,KAAK,IAAA;IACL,QAAQ,IAAA;IACR,mBAAmB,IAAA;IACnB,MAAM,IAAA;CACP;AAED,MAAM,WAAW,YAAa,SAAQ,aAAa;IACjD,EAAE,EAAE,WAAW,CAAC;IAChB,SAAS,EAAE,aAAa,CAAC;IACzB,UAAU,EAAE,aAAa,CAAC;CAC3B;AACD,wBAAgB,cAAc,CAAC,CAAC,EAAE,IAAI,GAAG,CAAC,IAAI,YAAY,CAEzD;AAED,wBAAgB,yBAAyB,CACvC,CAAC,EAAE,IAAI,GACN,CAAC,IAAI,uBAAuB,CAI9B;AAED,MAAM,MAAM,eAAe,GAAG;IAC5B,
|
|
1
|
+
{"version":3,"file":"operatorNode.d.ts","sourceRoot":"","sources":["../../../../src/tree/nodes/operators/operatorNode.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,EAAE,IAAI,EAAY,MAAM,YAAY,CAAC;AAE5C,oBAAY,WAAW;IACrB,GAAG,IAAA;IACH,SAAS,IAAA;IACT,QAAQ,IAAA;IACR,QAAQ,IAAA;IACR,MAAM,IAAA;IACN,KAAK,IAAA;IACL,KAAK,IAAA;IACL,QAAQ,IAAA;IACR,mBAAmB,IAAA;IACnB,MAAM,IAAA;CACP;AAED,MAAM,WAAW,YAAa,SAAQ,aAAa;IACjD,EAAE,EAAE,WAAW,CAAC;IAChB,SAAS,EAAE,aAAa,CAAC;IACzB,UAAU,EAAE,aAAa,CAAC;CAC3B;AACD,wBAAgB,cAAc,CAAC,CAAC,EAAE,IAAI,GAAG,CAAC,IAAI,YAAY,CAEzD;AAED,wBAAgB,yBAAyB,CACvC,CAAC,EAAE,IAAI,GACN,CAAC,IAAI,uBAAuB,CAI9B;AAED,MAAM,MAAM,eAAe,GAAG;IAC5B,kBAAkB,EAAE,MAAM,EAAE,CAAC;IAC7B,kBAAkB,EAAE,MAAM,EAAE,CAAC;CAC9B,CAAC;AAEF,MAAM,WAAW,uBAAwB,SAAQ,YAAY;IAC3D,OAAO,EAAE,MAAM,aAAa,CAAC;IAE7B,SAAS,EAAE,MAAM,MAAM,EAAE,CAAC;CAC3B"}
|
|
@@ -19,6 +19,6 @@ export declare class VariableNode extends CAlgebraicNode implements AlgebraicNod
|
|
|
19
19
|
simplify(): this;
|
|
20
20
|
equals(node: AlgebraicNode): boolean;
|
|
21
21
|
toDetailedEvaluation(vars: Record<string, AlgebraicNode>): AlgebraicNode;
|
|
22
|
-
derivative(varName?: string
|
|
22
|
+
derivative(varName?: string): AlgebraicNode;
|
|
23
23
|
}
|
|
24
24
|
//# sourceMappingURL=variableNode.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"variableNode.d.ts","sourceRoot":"","sources":["../../../../src/tree/nodes/variables/variableNode.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACpE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAErD,wBAAgB,cAAc,CAAC,CAAC,EAAE,IAAI,GAAG,CAAC,IAAI,YAAY,CAEzD;AACD,qBAAa,YAAa,SAAQ,cAAe,YAAW,aAAa;IACvE,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,WAAqB;IACzB,SAAS,EAAE,OAAO,CAAC;gBACP,IAAI,EAAE,MAAM;IAMxB,aAAa;;;;IAMb,KAAK,IAAI,MAAM;IAGf,YAAY,IAAI,MAAM;IAGtB,QAAQ;IAGR,cAAc;IAGd,iBAAiB;IAIjB,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC;IAQtC,QAAQ;IAGR,MAAM,CAAC,IAAI,EAAE,aAAa;IAG1B,oBAAoB,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,aAAa,CAAC;IAGxD,UAAU,CAAC,OAAO,CAAC,EAAE,MAAM,GAAG,
|
|
1
|
+
{"version":3,"file":"variableNode.d.ts","sourceRoot":"","sources":["../../../../src/tree/nodes/variables/variableNode.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACpE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAErD,wBAAgB,cAAc,CAAC,CAAC,EAAE,IAAI,GAAG,CAAC,IAAI,YAAY,CAEzD;AACD,qBAAa,YAAa,SAAQ,cAAe,YAAW,aAAa;IACvE,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,WAAqB;IACzB,SAAS,EAAE,OAAO,CAAC;gBACP,IAAI,EAAE,MAAM;IAMxB,aAAa;;;;IAMb,KAAK,IAAI,MAAM;IAGf,YAAY,IAAI,MAAM;IAGtB,QAAQ;IAGR,cAAc;IAGd,iBAAiB;IAIjB,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC;IAQtC,QAAQ;IAGR,MAAM,CAAC,IAAI,EAAE,aAAa;IAG1B,oBAAoB,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,aAAa,CAAC;IAGxD,UAAU,CAAC,OAAO,CAAC,EAAE,MAAM,GAAG,aAAa;CAK5C"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { AlgebraicNode } from "../nodes/algebraicNode.js";
|
|
2
|
+
export type DeepShuffleOpts = {
|
|
3
|
+
nodeTypesToShuffle: string[];
|
|
4
|
+
nodeTypesNoFurther: string[];
|
|
5
|
+
};
|
|
6
|
+
export declare abstract class NodeShuffler {
|
|
7
|
+
static shuffle: <T extends AlgebraicNode>(algebraicNode: T, shuffleArrayIn?: number[]) => AlgebraicNode;
|
|
8
|
+
static deepShuffle: <T extends AlgebraicNode>(algebraicNode: T, deepShuffleOpts?: DeepShuffleOpts, shuffleArrayIn?: number[]) => AlgebraicNode;
|
|
9
|
+
private static getCreateNodeFromChildrenFunction;
|
|
10
|
+
static getChildren(algebraicNode: AlgebraicNode): AlgebraicNode[];
|
|
11
|
+
}
|
|
12
|
+
//# sourceMappingURL=nodeShuffler.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"nodeShuffler.d.ts","sourceRoot":"","sources":["../../../src/tree/utilities/nodeShuffler.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AA8B1D,MAAM,MAAM,eAAe,GAAG;IAC5B,kBAAkB,EAAE,MAAM,EAAE,CAAC;IAC7B,kBAAkB,EAAE,MAAM,EAAE,CAAC;CAC9B,CAAC;AAEF,8BAAsB,YAAY;IAChC,MAAM,CAAC,OAAO,GAAI,CAAC,SAAS,aAAa,EACvC,eAAe,CAAC,EAChB,iBAAiB,MAAM,EAAE,KACxB,aAAa,CAQd;IAGF,MAAM,CAAC,WAAW,GAAI,CAAC,SAAS,aAAa,EAC3C,eAAe,CAAC,EAChB,kBAAiB,eAGhB,EACD,iBAAiB,MAAM,EAAE,KACxB,aAAa,CAyBd;IAEF,OAAO,CAAC,MAAM,CAAC,iCAAiC,CAgF9C;IAEF,MAAM,CAAC,WAAW,CAAC,aAAa,EAAE,aAAa;CAShD"}
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
import { shuffle } from "../../utils/alea/shuffle.js";
|
|
2
|
+
import { abs } from "../nodes/functions/absNode.js";
|
|
3
|
+
import { arccos } from "../nodes/functions/arccosNode.js";
|
|
4
|
+
import { CosNode } from "../nodes/functions/cosNode.js";
|
|
5
|
+
import { FunctionsIds, isFunctionNode, } from "../nodes/functions/functionNode.js";
|
|
6
|
+
import { AddNode } from "../nodes/operators/addNode.js";
|
|
7
|
+
import { BinomialCoefficientNode } from "../nodes/operators/binomialCoefficientNode.js";
|
|
8
|
+
import { DivideNode } from "../nodes/operators/divideNode.js";
|
|
9
|
+
import { FractionNode } from "../nodes/operators/fractionNode.js";
|
|
10
|
+
import { MultiplyNode } from "../nodes/operators/multiplyNode.js";
|
|
11
|
+
import { PowerNode } from "../nodes/operators/powerNode.js";
|
|
12
|
+
import { SubstractNode } from "../nodes/operators/substractNode.js";
|
|
13
|
+
import { sin } from "../nodes/functions/sinNode.js";
|
|
14
|
+
import { sqrt } from "../nodes/functions/sqrtNode.js";
|
|
15
|
+
import { tan } from "../nodes/functions/tanNode.js";
|
|
16
|
+
import { ArcsinNode } from "../nodes/functions/arcSinNode.js";
|
|
17
|
+
import { ArctanNode } from "../nodes/functions/arctanNode.js";
|
|
18
|
+
import { ExpNode } from "../nodes/functions/expNode.js";
|
|
19
|
+
import { LogNode } from "../nodes/functions/logNode.js";
|
|
20
|
+
import { Log10Node } from "../nodes/functions/log10Node.js";
|
|
21
|
+
import { NodeConstructor } from "../nodes/nodeConstructor.js";
|
|
22
|
+
import { isOperatorNode, OperatorIds, } from "../nodes/operators/operatorNode.js";
|
|
23
|
+
import { opposite } from "../nodes/functions/oppositeNode.js";
|
|
24
|
+
export class NodeShuffler {
|
|
25
|
+
static shuffle = (algebraicNode, shuffleArrayIn) => {
|
|
26
|
+
const children = this.getChildren(algebraicNode);
|
|
27
|
+
const shuffleArray = shuffleArrayIn ?? shuffle([...Array(children.length).keys()]);
|
|
28
|
+
const shuffledChildren = shuffleArray.map((iTo) => children[iTo]);
|
|
29
|
+
return this.getCreateNodeFromChildrenFunction(algebraicNode)(shuffledChildren);
|
|
30
|
+
};
|
|
31
|
+
//commutative by default
|
|
32
|
+
static deepShuffle = (algebraicNode, deepShuffleOpts = {
|
|
33
|
+
nodeTypesToShuffle: ["AddNode", "MultiplyNode"],
|
|
34
|
+
nodeTypesNoFurther: [],
|
|
35
|
+
}, shuffleArrayIn) => {
|
|
36
|
+
const isCanBeTraversed = !deepShuffleOpts.nodeTypesNoFurther.includes(algebraicNode.constructor.name);
|
|
37
|
+
const children = this.getChildren(algebraicNode).map((childNode) => isCanBeTraversed
|
|
38
|
+
? this.deepShuffle(childNode, deepShuffleOpts, shuffleArrayIn)
|
|
39
|
+
: childNode);
|
|
40
|
+
const createNodeFromChildren = this.getCreateNodeFromChildrenFunction(algebraicNode);
|
|
41
|
+
if (children.length > 0) {
|
|
42
|
+
const isCanBeShuffled = (deepShuffleOpts?.nodeTypesToShuffle ?? []).includes(algebraicNode.constructor.name);
|
|
43
|
+
if (isCanBeShuffled) {
|
|
44
|
+
const shuffleArray = shuffleArrayIn ?? shuffle([...Array(children.length).keys()]);
|
|
45
|
+
const shuffledChildren = shuffleArray.map((iTo) => children[iTo]);
|
|
46
|
+
return createNodeFromChildren(shuffledChildren);
|
|
47
|
+
}
|
|
48
|
+
else {
|
|
49
|
+
createNodeFromChildren(children);
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
return createNodeFromChildren(children);
|
|
53
|
+
};
|
|
54
|
+
static getCreateNodeFromChildrenFunction = (algebraicNode) => {
|
|
55
|
+
if (isOperatorNode(algebraicNode)) {
|
|
56
|
+
switch (algebraicNode.id) {
|
|
57
|
+
case OperatorIds.binomialCoefficient:
|
|
58
|
+
return (children) => new BinomialCoefficientNode(children[0], children[1], algebraicNode.opts);
|
|
59
|
+
case OperatorIds.divide:
|
|
60
|
+
return (children) => new DivideNode(children[0], children[1]);
|
|
61
|
+
case OperatorIds.fraction:
|
|
62
|
+
return (children) => new FractionNode(children[0], children[1], algebraicNode.opts);
|
|
63
|
+
case OperatorIds.integral:
|
|
64
|
+
// throw new Error("unsupported node type: integral"); //need to do intelligent shuffle here
|
|
65
|
+
return () => NodeConstructor.fromIdentifiers(algebraicNode.toIdentifiers());
|
|
66
|
+
case OperatorIds.limit:
|
|
67
|
+
// throw new Error("unsupported node type: limit"); //need to do intelligent shuffle here
|
|
68
|
+
return () => NodeConstructor.fromIdentifiers(algebraicNode.toIdentifiers());
|
|
69
|
+
case OperatorIds.multiply:
|
|
70
|
+
return (children) => new MultiplyNode(children[0], children[1], algebraicNode.opts);
|
|
71
|
+
case OperatorIds.power:
|
|
72
|
+
case OperatorIds.square: //this is so nice
|
|
73
|
+
return (children) => new PowerNode(children[0], children[1], algebraicNode.opts);
|
|
74
|
+
case OperatorIds.substract:
|
|
75
|
+
return (children) => new SubstractNode(children[0], children[1], algebraicNode.opts);
|
|
76
|
+
case OperatorIds.add:
|
|
77
|
+
return (children) => new AddNode(children[0], children[1], algebraicNode.opts);
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
else if (isFunctionNode(algebraicNode)) {
|
|
81
|
+
switch (algebraicNode.id) {
|
|
82
|
+
case FunctionsIds.arccos:
|
|
83
|
+
return (children) => arccos(children[0]);
|
|
84
|
+
case FunctionsIds.arcsin:
|
|
85
|
+
return (children) => new ArcsinNode(children[0]);
|
|
86
|
+
case FunctionsIds.arctan:
|
|
87
|
+
return (children) => new ArctanNode(children[0]);
|
|
88
|
+
case FunctionsIds.cos:
|
|
89
|
+
return (children) => new CosNode(children[0]);
|
|
90
|
+
case FunctionsIds.exp:
|
|
91
|
+
return (children) => new ExpNode(children[0], algebraicNode.opts);
|
|
92
|
+
case FunctionsIds.log:
|
|
93
|
+
return (children) => new LogNode(children[0], algebraicNode.opts);
|
|
94
|
+
case FunctionsIds.log10:
|
|
95
|
+
return (children) => new Log10Node(children[0], algebraicNode.opts);
|
|
96
|
+
case FunctionsIds.opposite:
|
|
97
|
+
return (children) => opposite(children[0]);
|
|
98
|
+
case FunctionsIds.sin:
|
|
99
|
+
return (children) => sin(children[0]);
|
|
100
|
+
case FunctionsIds.sqrt:
|
|
101
|
+
return (children) => sqrt(children[0]);
|
|
102
|
+
case FunctionsIds.tan:
|
|
103
|
+
return (children) => tan(children[0]);
|
|
104
|
+
case FunctionsIds.abs:
|
|
105
|
+
return (children) => abs(children[0]);
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
else {
|
|
109
|
+
return () => NodeConstructor.fromIdentifiers(algebraicNode.toIdentifiers());
|
|
110
|
+
}
|
|
111
|
+
};
|
|
112
|
+
static getChildren(algebraicNode) {
|
|
113
|
+
if (isOperatorNode(algebraicNode)) {
|
|
114
|
+
return [algebraicNode.leftChild, algebraicNode.rightChild];
|
|
115
|
+
}
|
|
116
|
+
else if (isFunctionNode(algebraicNode)) {
|
|
117
|
+
return [algebraicNode.child];
|
|
118
|
+
}
|
|
119
|
+
else {
|
|
120
|
+
return [];
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getAllPicks.d.ts","sourceRoot":"","sources":["../../../src/utils/arrays/getAllPicks.ts"],"names":[],"mappings":"AAAA,wBAAgB,WAAW,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,GAAG,CAAC,EAAE,EAAE,CAoBhD"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export function getAllPicks(array) {
|
|
2
|
+
const result = [];
|
|
3
|
+
const generateSubsets = (current, index) => {
|
|
4
|
+
if (index === array.length) {
|
|
5
|
+
result.push([...current]);
|
|
6
|
+
return;
|
|
7
|
+
}
|
|
8
|
+
// Exclude the current element
|
|
9
|
+
generateSubsets(current, index + 1);
|
|
10
|
+
// Include the current element
|
|
11
|
+
current.push(array[index]);
|
|
12
|
+
generateSubsets(current, index + 1);
|
|
13
|
+
current.pop();
|
|
14
|
+
};
|
|
15
|
+
generateSubsets([], 0);
|
|
16
|
+
return result;
|
|
17
|
+
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const handleVEAError: (err:
|
|
1
|
+
export declare const handleVEAError: (err: unknown) => false;
|
|
2
2
|
//# sourceMappingURL=handleVEAError.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"handleVEAError.d.ts","sourceRoot":"","sources":["../../../src/utils/errors/handleVEAError.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,cAAc,GAAI,KAAK,
|
|
1
|
+
{"version":3,"file":"handleVEAError.d.ts","sourceRoot":"","sources":["../../../src/utils/errors/handleVEAError.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,cAAc,GAAI,KAAK,OAAO,KAAG,KAI7C,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"decapitalize.d.ts","sourceRoot":"","sources":["../../../src/utils/strings/decapitalize.ts"],"names":[],"mappings":"AAAA,wBAAgB,YAAY,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAEhD"}
|