math-exercises 3.0.214 → 3.0.216
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/exercises/math/arithmetic/findLeftInHugeNumberDivision.d.ts +9 -0
- package/lib/exercises/math/arithmetic/findLeftInHugeNumberDivision.d.ts.map +1 -0
- package/lib/exercises/math/arithmetic/findLeftInHugeNumberDivision.js +194 -0
- package/lib/exercises/math/arithmetic/findMissingNumberToMakeNumberDivisibleBy9.d.ts +8 -0
- package/lib/exercises/math/arithmetic/findMissingNumberToMakeNumberDivisibleBy9.d.ts.map +1 -0
- package/lib/exercises/math/arithmetic/findMissingNumberToMakeNumberDivisibleBy9.js +121 -0
- package/lib/exercises/math/arithmetic/index.d.ts +7 -0
- package/lib/exercises/math/arithmetic/index.d.ts.map +1 -1
- package/lib/exercises/math/arithmetic/index.js +7 -0
- package/lib/exercises/math/arithmetic/isBigNumberPrime.d.ts +7 -0
- package/lib/exercises/math/arithmetic/isBigNumberPrime.d.ts.map +1 -0
- package/lib/exercises/math/arithmetic/isBigNumberPrime.js +107 -0
- package/lib/exercises/math/arithmetic/numberOfEndingZerosOfBigProduct.d.ts +8 -0
- package/lib/exercises/math/arithmetic/numberOfEndingZerosOfBigProduct.d.ts.map +1 -0
- package/lib/exercises/math/arithmetic/numberOfEndingZerosOfBigProduct.js +139 -0
- package/lib/exercises/math/arithmetic/pgcdFromEuclid.d.ts +8 -0
- package/lib/exercises/math/arithmetic/pgcdFromEuclid.d.ts.map +1 -0
- package/lib/exercises/math/arithmetic/pgcdFromEuclid.js +123 -0
- package/lib/exercises/math/arithmetic/solveDiophantianEquationByUsingPrimality.d.ts +7 -0
- package/lib/exercises/math/arithmetic/solveDiophantianEquationByUsingPrimality.d.ts.map +1 -0
- package/lib/exercises/math/arithmetic/solveDiophantianEquationByUsingPrimality.js +117 -0
- package/lib/exercises/math/arithmetic/whichDayInXDays.d.ts +8 -0
- package/lib/exercises/math/arithmetic/whichDayInXDays.d.ts.map +1 -0
- package/lib/exercises/math/arithmetic/whichDayInXDays.js +82 -0
- package/lib/exercises/math/calcul/fractions/fractionsSumFillInTheBlank.d.ts +15 -0
- package/lib/exercises/math/calcul/fractions/fractionsSumFillInTheBlank.d.ts.map +1 -0
- package/lib/exercises/math/calcul/fractions/fractionsSumFillInTheBlank.js +256 -0
- package/lib/exercises/math/calcul/fractions/index.d.ts +1 -0
- package/lib/exercises/math/calcul/fractions/index.d.ts.map +1 -1
- package/lib/exercises/math/calcul/fractions/index.js +1 -0
- package/lib/exercises/math/calcul/index.d.ts +1 -0
- package/lib/exercises/math/calcul/index.d.ts.map +1 -1
- package/lib/exercises/math/calcul/index.js +1 -0
- package/lib/exercises/math/calcul/mentalCaluls/index.d.ts +3 -0
- package/lib/exercises/math/calcul/mentalCaluls/index.d.ts.map +1 -1
- package/lib/exercises/math/calcul/mentalCaluls/index.js +3 -0
- package/lib/exercises/math/calcul/mentalCaluls/mentalMultiplication101AndFriends.d.ts +10 -0
- package/lib/exercises/math/calcul/mentalCaluls/mentalMultiplication101AndFriends.d.ts.map +1 -0
- package/lib/exercises/math/calcul/mentalCaluls/mentalMultiplication101AndFriends.js +264 -0
- package/lib/exercises/math/calcul/mentalCaluls/mentalMultiplication11AndFriends.d.ts +10 -0
- package/lib/exercises/math/calcul/mentalCaluls/mentalMultiplication11AndFriends.d.ts.map +1 -0
- package/lib/exercises/math/calcul/mentalCaluls/mentalMultiplication11AndFriends.js +264 -0
- package/lib/exercises/math/calcul/mentalCaluls/mentalMultiplicationTable.d.ts +11 -0
- package/lib/exercises/math/calcul/mentalCaluls/mentalMultiplicationTable.d.ts.map +1 -0
- package/lib/exercises/math/calcul/mentalCaluls/mentalMultiplicationTable.js +141 -0
- package/lib/exercises/math/calcul/ratio/index.d.ts +1 -0
- package/lib/exercises/math/calcul/ratio/index.d.ts.map +1 -1
- package/lib/exercises/math/calcul/ratio/index.js +1 -0
- package/lib/exercises/math/calcul/ratio/partsUsingRatio.d.ts +13 -0
- package/lib/exercises/math/calcul/ratio/partsUsingRatio.d.ts.map +1 -0
- package/lib/exercises/math/calcul/ratio/partsUsingRatio.js +237 -0
- package/lib/exercises/math/calcul/relatives/index.d.ts +2 -0
- package/lib/exercises/math/calcul/relatives/index.d.ts.map +1 -0
- package/lib/exercises/math/calcul/relatives/index.js +1 -0
- package/lib/exercises/math/calcul/relatives/relativesAddAndSub.d.ts +17 -0
- package/lib/exercises/math/calcul/relatives/relativesAddAndSub.d.ts.map +1 -0
- package/lib/exercises/math/calcul/relatives/relativesAddAndSub.js +448 -0
- package/lib/exercises/math/calculLitteral/factorisation/factoByXK.d.ts +10 -0
- package/lib/exercises/math/calculLitteral/factorisation/factoByXK.d.ts.map +1 -0
- package/lib/exercises/math/calculLitteral/factorisation/factoByXK.js +190 -0
- package/lib/exercises/math/calculLitteral/factorisation/index.d.ts +1 -0
- package/lib/exercises/math/calculLitteral/factorisation/index.d.ts.map +1 -1
- package/lib/exercises/math/calculLitteral/factorisation/index.js +1 -0
- package/lib/exercises/math/complex/algebraic/addComplex.d.ts +10 -0
- package/lib/exercises/math/complex/algebraic/addComplex.d.ts.map +1 -0
- package/lib/exercises/math/complex/algebraic/addComplex.js +125 -0
- package/lib/exercises/math/complex/algebraic/conjugateComplex.d.ts +8 -0
- package/lib/exercises/math/complex/algebraic/conjugateComplex.d.ts.map +1 -0
- package/lib/exercises/math/complex/algebraic/conjugateComplex.js +105 -0
- package/lib/exercises/math/complex/algebraic/conjugateDivideComplex.d.ts +8 -0
- package/lib/exercises/math/complex/algebraic/conjugateDivideComplex.d.ts.map +1 -0
- package/lib/exercises/math/complex/algebraic/conjugateDivideComplex.js +137 -0
- package/lib/exercises/math/complex/algebraic/conjugateMultiplyComplex.d.ts +8 -0
- package/lib/exercises/math/complex/algebraic/conjugateMultiplyComplex.d.ts.map +1 -0
- package/lib/exercises/math/complex/algebraic/conjugateMultiplyComplex.js +116 -0
- package/lib/exercises/math/complex/algebraic/divideComplex.d.ts +8 -0
- package/lib/exercises/math/complex/algebraic/divideComplex.d.ts.map +1 -0
- package/lib/exercises/math/complex/algebraic/divideComplex.js +128 -0
- package/lib/exercises/math/complex/algebraic/index.d.ts +11 -0
- package/lib/exercises/math/complex/algebraic/index.d.ts.map +1 -0
- package/lib/exercises/math/complex/algebraic/index.js +10 -0
- package/lib/exercises/math/complex/algebraic/inverseComplex.d.ts +8 -0
- package/lib/exercises/math/complex/algebraic/inverseComplex.d.ts.map +1 -0
- package/lib/exercises/math/complex/algebraic/inverseComplex.js +95 -0
- package/lib/exercises/math/complex/algebraic/linearCombinaisonComplex.d.ts +10 -0
- package/lib/exercises/math/complex/algebraic/linearCombinaisonComplex.d.ts.map +1 -0
- package/lib/exercises/math/complex/algebraic/linearCombinaisonComplex.js +105 -0
- package/lib/exercises/math/complex/algebraic/moduloFromAlgebraicComplex.d.ts +8 -0
- package/lib/exercises/math/complex/algebraic/moduloFromAlgebraicComplex.d.ts.map +1 -0
- package/lib/exercises/math/complex/algebraic/moduloFromAlgebraicComplex.js +93 -0
- package/lib/exercises/math/complex/algebraic/mutiplyComplex.d.ts +8 -0
- package/lib/exercises/math/complex/algebraic/mutiplyComplex.d.ts.map +1 -0
- package/lib/exercises/math/complex/algebraic/mutiplyComplex.js +106 -0
- package/lib/exercises/math/complex/algebraic/reAndIm.d.ts +9 -0
- package/lib/exercises/math/complex/algebraic/reAndIm.d.ts.map +1 -0
- package/lib/exercises/math/complex/algebraic/reAndIm.js +92 -0
- package/lib/exercises/math/complex/geometric/complexAlgebraicFromModuloAndArg.d.ts +9 -0
- package/lib/exercises/math/complex/geometric/complexAlgebraicFromModuloAndArg.d.ts.map +1 -0
- package/lib/exercises/math/complex/geometric/complexAlgebraicFromModuloAndArg.js +151 -0
- package/lib/exercises/math/complex/geometric/complexDistance.d.ts +11 -0
- package/lib/exercises/math/complex/geometric/complexDistance.d.ts.map +1 -0
- package/lib/exercises/math/complex/geometric/complexDistance.js +125 -0
- package/lib/exercises/math/complex/geometric/complexGeomAffixAlgFromPoint.d.ts +9 -0
- package/lib/exercises/math/complex/geometric/complexGeomAffixAlgFromPoint.d.ts.map +1 -0
- package/lib/exercises/math/complex/geometric/complexGeomAffixAlgFromPoint.js +326 -0
- package/lib/exercises/math/complex/geometric/complexGeomAffixExpFromCenteredRegularPolygon.d.ts +10 -0
- package/lib/exercises/math/complex/geometric/complexGeomAffixExpFromCenteredRegularPolygon.d.ts.map +1 -0
- package/lib/exercises/math/complex/geometric/complexGeomAffixExpFromCenteredRegularPolygon.js +459 -0
- package/lib/exercises/math/complex/geometric/complexGeomAffixExpFromPoint.d.ts +14 -0
- package/lib/exercises/math/complex/geometric/complexGeomAffixExpFromPoint.d.ts.map +1 -0
- package/lib/exercises/math/complex/geometric/complexGeomAffixExpFromPoint.js +539 -0
- package/lib/exercises/math/complex/geometric/complexGeomAffixTrigFromPoint.d.ts +13 -0
- package/lib/exercises/math/complex/geometric/complexGeomAffixTrigFromPoint.d.ts.map +1 -0
- package/lib/exercises/math/complex/geometric/complexGeomAffixTrigFromPoint.js +485 -0
- package/lib/exercises/math/complex/geometric/complexGeomApproxOfCosArgOrSinArgFromPointAndAffixTrig.d.ts +12 -0
- package/lib/exercises/math/complex/geometric/complexGeomApproxOfCosArgOrSinArgFromPointAndAffixTrig.d.ts.map +1 -0
- package/lib/exercises/math/complex/geometric/complexGeomApproxOfCosArgOrSinArgFromPointAndAffixTrig.js +224 -0
- package/lib/exercises/math/complex/geometric/complexGeomArgumentOfFracCBABFromFigure.d.ts +11 -0
- package/lib/exercises/math/complex/geometric/complexGeomArgumentOfFracCBABFromFigure.d.ts.map +1 -0
- package/lib/exercises/math/complex/geometric/complexGeomArgumentOfFracCBABFromFigure.js +448 -0
- package/lib/exercises/math/complex/geometric/complexGeomFindPointFromAffixExp.d.ts +11 -0
- package/lib/exercises/math/complex/geometric/complexGeomFindPointFromAffixExp.d.ts.map +1 -0
- package/lib/exercises/math/complex/geometric/complexGeomFindPointFromAffixExp.js +223 -0
- package/lib/exercises/math/complex/geometric/complexGeomFindPointFromPowerOfUnitRootFromFigure.d.ts +11 -0
- package/lib/exercises/math/complex/geometric/complexGeomFindPointFromPowerOfUnitRootFromFigure.d.ts.map +1 -0
- package/lib/exercises/math/complex/geometric/complexGeomFindPointFromPowerOfUnitRootFromFigure.js +348 -0
- package/lib/exercises/math/complex/geometric/complexGeomPlaceAffixPoint.d.ts +8 -0
- package/lib/exercises/math/complex/geometric/complexGeomPlaceAffixPoint.d.ts.map +1 -0
- package/lib/exercises/math/complex/geometric/complexGeomPlaceAffixPoint.js +86 -0
- package/lib/exercises/math/complex/geometric/complexGeomPlacePointFromZAPlusZ.d.ts +11 -0
- package/lib/exercises/math/complex/geometric/complexGeomPlacePointFromZAPlusZ.d.ts.map +1 -0
- package/lib/exercises/math/complex/geometric/complexGeomPlacePointFromZAPlusZ.js +311 -0
- package/lib/exercises/math/complex/geometric/complexGeomPlacePointFromZATimesZ.d.ts +11 -0
- package/lib/exercises/math/complex/geometric/complexGeomPlacePointFromZATimesZ.d.ts.map +1 -0
- package/lib/exercises/math/complex/geometric/complexGeomPlacePointFromZATimesZ.js +345 -0
- package/lib/exercises/math/complex/geometric/complexGeomPlacePointFromZATransformed.d.ts +16 -0
- package/lib/exercises/math/complex/geometric/complexGeomPlacePointFromZATransformed.d.ts.map +1 -0
- package/lib/exercises/math/complex/geometric/complexGeomPlacePointFromZATransformed.js +729 -0
- package/lib/exercises/math/complex/geometric/complexGeomPlacePointWithAffixInU.d.ts +11 -0
- package/lib/exercises/math/complex/geometric/complexGeomPlacePointWithAffixInU.d.ts.map +1 -0
- package/lib/exercises/math/complex/geometric/complexGeomPlacePointWithAffixInU.js +253 -0
- package/lib/exercises/math/complex/geometric/index.d.ts +12 -0
- package/lib/exercises/math/complex/geometric/index.d.ts.map +1 -0
- package/lib/exercises/math/complex/geometric/index.js +19 -0
- package/lib/exercises/math/complex/index.d.ts +4 -10
- package/lib/exercises/math/complex/index.d.ts.map +1 -1
- package/lib/exercises/math/complex/index.js +4 -11
- package/lib/exercises/math/complex/polynomials/factorizePolynomialInC.d.ts +10 -0
- package/lib/exercises/math/complex/polynomials/factorizePolynomialInC.d.ts.map +1 -0
- package/lib/exercises/math/complex/polynomials/factorizePolynomialInC.js +176 -0
- package/lib/exercises/math/complex/polynomials/index.d.ts +4 -0
- package/lib/exercises/math/complex/polynomials/index.d.ts.map +1 -0
- package/lib/exercises/math/complex/polynomials/index.js +3 -0
- package/lib/exercises/math/complex/polynomials/solveSecondDegreeInComplex.d.ts +10 -0
- package/lib/exercises/math/complex/polynomials/solveSecondDegreeInComplex.d.ts.map +1 -0
- package/lib/exercises/math/complex/polynomials/solveSecondDegreeInComplex.js +190 -0
- package/lib/exercises/math/complex/polynomials/solveZSquareEqualsA.d.ts +11 -0
- package/lib/exercises/math/complex/polynomials/solveZSquareEqualsA.d.ts.map +1 -0
- package/lib/exercises/math/complex/polynomials/solveZSquareEqualsA.js +158 -0
- package/lib/exercises/math/complex/unitRoots/giveNUnitRoot.d.ts +7 -0
- package/lib/exercises/math/complex/unitRoots/giveNUnitRoot.d.ts.map +1 -0
- package/lib/exercises/math/complex/unitRoots/giveNUnitRoot.js +122 -0
- package/lib/exercises/math/complex/unitRoots/giveOneSolutionToComplexPowNEqualsOne.d.ts +8 -0
- package/lib/exercises/math/complex/unitRoots/giveOneSolutionToComplexPowNEqualsOne.d.ts.map +1 -0
- package/lib/exercises/math/complex/unitRoots/giveOneSolutionToComplexPowNEqualsOne.js +138 -0
- package/lib/exercises/math/complex/unitRoots/index.d.ts +3 -0
- package/lib/exercises/math/complex/unitRoots/index.d.ts.map +1 -0
- package/lib/exercises/math/complex/unitRoots/index.js +2 -0
- package/lib/exercises/math/conversion/clock/clockReading.d.ts +12 -0
- package/lib/exercises/math/conversion/clock/clockReading.d.ts.map +1 -0
- package/lib/exercises/math/conversion/clock/clockReading.js +385 -0
- package/lib/exercises/math/conversion/clock/clockReadingPlusTimeOperation.d.ts +2 -0
- package/lib/exercises/math/conversion/clock/clockReadingPlusTimeOperation.d.ts.map +1 -0
- package/lib/exercises/math/conversion/clock/clockReadingPlusTimeOperation.js +521 -0
- package/lib/exercises/math/conversion/clock/clockWritingByManipulatingNeedles.d.ts +2 -0
- package/lib/exercises/math/conversion/clock/clockWritingByManipulatingNeedles.d.ts.map +1 -0
- package/lib/exercises/math/conversion/clock/clockWritingByManipulatingNeedles.js +359 -0
- package/lib/exercises/math/conversion/clock/dateTimeOperationAdd.d.ts +16 -0
- package/lib/exercises/math/conversion/clock/dateTimeOperationAdd.d.ts.map +1 -0
- package/lib/exercises/math/conversion/clock/dateTimeOperationAdd.js +319 -0
- package/lib/exercises/math/conversion/clock/index.d.ts +2 -0
- package/lib/exercises/math/conversion/clock/index.d.ts.map +1 -0
- package/lib/exercises/math/conversion/clock/index.js +4 -0
- package/lib/exercises/math/conversion/index.d.ts +1 -0
- package/lib/exercises/math/conversion/index.d.ts.map +1 -1
- package/lib/exercises/math/conversion/index.js +1 -0
- package/lib/exercises/math/geometry/angles/angleNatureFromFigure.d.ts +11 -0
- package/lib/exercises/math/geometry/angles/angleNatureFromFigure.d.ts.map +1 -0
- package/lib/exercises/math/geometry/angles/angleNatureFromFigure.js +233 -0
- package/lib/exercises/math/geometry/angles/angleNatureFromMeasure.d.ts +10 -0
- package/lib/exercises/math/geometry/angles/angleNatureFromMeasure.d.ts.map +1 -0
- package/lib/exercises/math/geometry/angles/angleNatureFromMeasure.js +137 -0
- package/lib/exercises/math/geometry/angles/index.d.ts +2 -0
- package/lib/exercises/math/geometry/angles/index.d.ts.map +1 -1
- package/lib/exercises/math/geometry/angles/index.js +2 -0
- package/lib/exercises/math/geometry/circles/buildCircleFromRadius.d.ts +9 -0
- package/lib/exercises/math/geometry/circles/buildCircleFromRadius.d.ts.map +1 -0
- package/lib/exercises/math/geometry/circles/buildCircleFromRadius.js +187 -0
- package/lib/exercises/math/geometry/circles/index.d.ts +1 -0
- package/lib/exercises/math/geometry/circles/index.d.ts.map +1 -1
- package/lib/exercises/math/geometry/circles/index.js +1 -0
- package/lib/exercises/math/geometry/lines/buildParallelFromLineAndPoint.d.ts +11 -0
- package/lib/exercises/math/geometry/lines/buildParallelFromLineAndPoint.d.ts.map +1 -0
- package/lib/exercises/math/geometry/lines/buildParallelFromLineAndPoint.js +154 -0
- package/lib/exercises/math/geometry/lines/buildPerpendicularFromLineAndPoint.d.ts +11 -0
- package/lib/exercises/math/geometry/lines/buildPerpendicularFromLineAndPoint.d.ts.map +1 -0
- package/lib/exercises/math/geometry/lines/buildPerpendicularFromLineAndPoint.js +157 -0
- package/lib/exercises/math/geometry/lines/index.d.ts +2 -0
- package/lib/exercises/math/geometry/lines/index.d.ts.map +1 -1
- package/lib/exercises/math/geometry/lines/index.js +2 -0
- package/lib/exercises/math/geometry/triangles/index.d.ts +2 -0
- package/lib/exercises/math/geometry/triangles/index.d.ts.map +1 -1
- package/lib/exercises/math/geometry/triangles/index.js +2 -1
- package/lib/exercises/math/geometry/triangles/traceHeightInTriangle.d.ts +13 -0
- package/lib/exercises/math/geometry/triangles/traceHeightInTriangle.d.ts.map +1 -0
- package/lib/exercises/math/geometry/triangles/traceHeightInTriangle.js +271 -0
- package/lib/exercises/math/geometry/triangles/traceMedianInTriangle.d.ts +8 -0
- package/lib/exercises/math/geometry/triangles/traceMedianInTriangle.d.ts.map +1 -1
- package/lib/exercises/math/geometry/triangles/traceMedianInTriangle.js +284 -53
- package/lib/exercises/math/geometry/vectors/constructions/index.d.ts +1 -0
- package/lib/exercises/math/geometry/vectors/constructions/index.d.ts.map +1 -1
- package/lib/exercises/math/geometry/vectors/constructions/index.js +1 -0
- package/lib/exercises/math/geometry/vectors/constructions/traceVectorSumFromVecs.d.ts +8 -0
- package/lib/exercises/math/geometry/vectors/constructions/traceVectorSumFromVecs.d.ts.map +1 -0
- package/lib/exercises/math/geometry/vectors/constructions/traceVectorSumFromVecs.js +165 -0
- package/lib/exercises/math/geometry/volumes/index.d.ts +1 -0
- package/lib/exercises/math/geometry/volumes/index.d.ts.map +1 -1
- package/lib/exercises/math/geometry/volumes/index.js +1 -0
- package/lib/exercises/math/geometry/volumes/volumeOfCylinder.d.ts +8 -0
- package/lib/exercises/math/geometry/volumes/volumeOfCylinder.d.ts.map +1 -0
- package/lib/exercises/math/geometry/volumes/volumeOfCylinder.js +157 -0
- package/lib/exercises/math/graphs/adjacentMatrixPath.d.ts +10 -0
- package/lib/exercises/math/graphs/adjacentMatrixPath.d.ts.map +1 -0
- package/lib/exercises/math/graphs/adjacentMatrixPath.js +89 -0
- package/lib/exercises/math/graphs/edgesNumberFromSummitsDegrees.d.ts +7 -0
- package/lib/exercises/math/graphs/edgesNumberFromSummitsDegrees.d.ts.map +1 -0
- package/lib/exercises/math/graphs/edgesNumberFromSummitsDegrees.js +98 -0
- package/lib/exercises/math/graphs/eulerianChainFromAdjacentMatrix.d.ts +8 -0
- package/lib/exercises/math/graphs/eulerianChainFromAdjacentMatrix.d.ts.map +1 -0
- package/lib/exercises/math/graphs/eulerianChainFromAdjacentMatrix.js +96 -0
- package/lib/exercises/math/graphs/graphsChainOrPathOfLengthN.d.ts +15 -0
- package/lib/exercises/math/graphs/graphsChainOrPathOfLengthN.d.ts.map +1 -0
- package/lib/exercises/math/graphs/graphsChainOrPathOfLengthN.js +262 -0
- package/lib/exercises/math/graphs/graphsCheckIsConnectedUndirectedGraph.d.ts +11 -0
- package/lib/exercises/math/graphs/graphsCheckIsConnectedUndirectedGraph.d.ts.map +1 -0
- package/lib/exercises/math/graphs/graphsCheckIsConnectedUndirectedGraph.js +178 -0
- package/lib/exercises/math/graphs/graphsCheckIsSameGraph.d.ts +19 -0
- package/lib/exercises/math/graphs/graphsCheckIsSameGraph.d.ts.map +1 -0
- package/lib/exercises/math/graphs/graphsCheckIsSameGraph.js +301 -0
- package/lib/exercises/math/graphs/graphsCheckIsVerticesAdjacent.d.ts +16 -0
- package/lib/exercises/math/graphs/graphsCheckIsVerticesAdjacent.d.ts.map +1 -0
- package/lib/exercises/math/graphs/graphsCheckIsVerticesAdjacent.js +207 -0
- package/lib/exercises/math/graphs/graphsDegreeOfVertex.d.ts +15 -0
- package/lib/exercises/math/graphs/graphsDegreeOfVertex.d.ts.map +1 -0
- package/lib/exercises/math/graphs/graphsDegreeOfVertex.js +232 -0
- package/lib/exercises/math/graphs/graphsOrderOfGraph.d.ts +14 -0
- package/lib/exercises/math/graphs/graphsOrderOfGraph.d.ts.map +1 -0
- package/lib/exercises/math/graphs/graphsOrderOfGraph.js +222 -0
- package/lib/exercises/math/graphs/index.d.ts +10 -0
- package/lib/exercises/math/graphs/index.d.ts.map +1 -0
- package/lib/exercises/math/graphs/index.js +9 -0
- package/lib/exercises/math/index.d.ts +1 -0
- package/lib/exercises/math/index.d.ts.map +1 -1
- package/lib/exercises/math/index.js +1 -0
- package/lib/exercises/math/matrices/areMatricesInverse.d.ts +9 -0
- package/lib/exercises/math/matrices/areMatricesInverse.d.ts.map +1 -0
- package/lib/exercises/math/matrices/areMatricesInverse.js +106 -0
- package/lib/exercises/math/matrices/computeFixedMatrixInRecurrenceSequence.d.ts +9 -0
- package/lib/exercises/math/matrices/computeFixedMatrixInRecurrenceSequence.d.ts.map +1 -0
- package/lib/exercises/math/matrices/computeFixedMatrixInRecurrenceSequence.js +144 -0
- package/lib/exercises/math/matrices/findInversedMatrixFromSystem.d.ts +8 -0
- package/lib/exercises/math/matrices/findInversedMatrixFromSystem.d.ts.map +1 -0
- package/lib/exercises/math/matrices/findInversedMatrixFromSystem.js +148 -0
- package/lib/exercises/math/matrices/index.d.ts +12 -0
- package/lib/exercises/math/matrices/index.d.ts.map +1 -1
- package/lib/exercises/math/matrices/index.js +12 -0
- package/lib/exercises/math/matrices/isMatrixTransitionMatrix.d.ts +8 -0
- package/lib/exercises/math/matrices/isMatrixTransitionMatrix.d.ts.map +1 -0
- package/lib/exercises/math/matrices/isMatrixTransitionMatrix.js +132 -0
- package/lib/exercises/math/matrices/matrixBuildMatrixFromCoefficients.d.ts +8 -0
- package/lib/exercises/math/matrices/matrixBuildMatrixFromCoefficients.d.ts.map +1 -0
- package/lib/exercises/math/matrices/matrixBuildMatrixFromCoefficients.js +152 -0
- package/lib/exercises/math/matrices/matrixCheckIsSymmetrical.d.ts +8 -0
- package/lib/exercises/math/matrices/matrixCheckIsSymmetrical.d.ts.map +1 -0
- package/lib/exercises/math/matrices/matrixCheckIsSymmetrical.js +155 -0
- package/lib/exercises/math/matrices/matrixComputeDetOfMat2.d.ts +8 -0
- package/lib/exercises/math/matrices/matrixComputeDetOfMat2.d.ts.map +1 -0
- package/lib/exercises/math/matrices/matrixComputeDetOfMat2.js +142 -0
- package/lib/exercises/math/matrices/matrixComputeInverseOfMat2.d.ts +8 -0
- package/lib/exercises/math/matrices/matrixComputeInverseOfMat2.d.ts.map +1 -0
- package/lib/exercises/math/matrices/matrixComputeInverseOfMat2.js +237 -0
- package/lib/exercises/math/matrices/matrixComputeLinearCombination.d.ts +15 -0
- package/lib/exercises/math/matrices/matrixComputeLinearCombination.d.ts.map +1 -0
- package/lib/exercises/math/matrices/matrixComputeLinearCombination.js +232 -0
- package/lib/exercises/math/matrices/matrixComputePower.d.ts +12 -0
- package/lib/exercises/math/matrices/matrixComputePower.d.ts.map +1 -0
- package/lib/exercises/math/matrices/matrixComputePower.js +230 -0
- package/lib/exercises/math/matrices/matrixComputeProduct.d.ts +9 -0
- package/lib/exercises/math/matrices/matrixComputeProduct.d.ts.map +1 -0
- package/lib/exercises/math/matrices/matrixComputeProduct.js +178 -0
- package/lib/exercises/math/matrices/writeMatrixAssociatedToSystem.d.ts +8 -0
- package/lib/exercises/math/matrices/writeMatrixAssociatedToSystem.d.ts.map +1 -0
- package/lib/exercises/math/matrices/writeMatrixAssociatedToSystem.js +105 -0
- package/lib/exercises/math/spaceGeometry/basis/index.d.ts +1 -0
- package/lib/exercises/math/spaceGeometry/basis/index.d.ts.map +1 -1
- package/lib/exercises/math/spaceGeometry/basis/index.js +1 -0
- package/lib/exercises/math/spaceGeometry/basis/spaceSegmentLengthInRectangularPrism.d.ts +18 -0
- package/lib/exercises/math/spaceGeometry/basis/spaceSegmentLengthInRectangularPrism.d.ts.map +1 -0
- package/lib/exercises/math/spaceGeometry/basis/spaceSegmentLengthInRectangularPrism.js +538 -0
- package/lib/exercises/math/trigonometry/formulas/trigoAdditionFormulaUsage.d.ts.map +1 -1
- package/lib/exercises/math/trigonometry/formulas/trigoAdditionFormulaUsage.js +6 -5
- package/lib/exercises/math/trigonometry/triangle/trigonometrySohcahtoaCalcul.js +1 -1
- package/lib/exercises/utils/geogebra/toolBarConstructor.d.ts +1 -0
- package/lib/exercises/utils/geogebra/toolBarConstructor.d.ts.map +1 -1
- package/lib/exercises/utils/geogebra/toolBarConstructor.js +2 -0
- package/lib/exercises/vea/matrixVEA.d.ts +2 -0
- package/lib/exercises/vea/matrixVEA.d.ts.map +1 -0
- package/lib/exercises/vea/matrixVEA.js +1 -0
- package/lib/geogebra/parsers/geogebraParser.d.ts +3 -0
- package/lib/geogebra/parsers/geogebraParser.d.ts.map +1 -1
- package/lib/geogebra/parsers/geogebraParser.js +27 -0
- package/lib/index.d.ts +286 -23
- package/lib/index.d.ts.map +1 -1
- package/lib/latexTester.js +2 -0
- package/lib/math/geometry/angle.d.ts.map +1 -1
- package/lib/math/geometry/angle.js +3 -0
- package/lib/math/geometry/point.d.ts.map +1 -1
- package/lib/math/geometry/point.js +3 -1
- package/lib/math/geometry/segment.d.ts +1 -1
- package/lib/math/geometry/segment.d.ts.map +1 -1
- package/lib/math/geometry/segment.js +5 -2
- package/lib/math/graphs/graph.d.ts +43 -0
- package/lib/math/graphs/graph.d.ts.map +1 -0
- package/lib/math/graphs/graph.js +391 -0
- package/lib/math/matrices/matrix.d.ts +42 -3
- package/lib/math/matrices/matrix.d.ts.map +1 -1
- package/lib/math/matrices/matrix.js +173 -7
- package/lib/math/matrices/parseMatrix.d.ts +3 -0
- package/lib/math/matrices/parseMatrix.d.ts.map +1 -0
- package/lib/math/matrices/parseMatrix.js +22 -0
- package/lib/math/systems/generalSystem.d.ts +2 -0
- package/lib/math/systems/generalSystem.d.ts.map +1 -1
- package/lib/math/systems/generalSystem.js +5 -0
- package/lib/math/utils/geometry/angleBetweenPoints.d.ts +4 -0
- package/lib/math/utils/geometry/angleBetweenPoints.d.ts.map +1 -0
- package/lib/math/utils/geometry/angleBetweenPoints.js +58 -0
- package/lib/math/utils/geometry/angleNWSE.d.ts +3 -0
- package/lib/math/utils/geometry/angleNWSE.d.ts.map +1 -0
- package/lib/math/utils/geometry/angleNWSE.js +56 -0
- package/lib/math/utils/graphs/graphRenderer.d.ts +25 -0
- package/lib/math/utils/graphs/graphRenderer.d.ts.map +1 -0
- package/lib/math/utils/graphs/graphRenderer.js +123 -0
- package/lib/playground.d.ts +6 -1
- package/lib/playground.d.ts.map +1 -1
- package/lib/playground.js +6 -5
- package/lib/tests/singleExo.test.d.ts.map +1 -1
- package/lib/tests/singleExo.test.js +2 -2
- package/lib/tree/parsers/latexParser.d.ts +1 -1
- package/lib/tree/utilities/nodeSimplifier.d.ts +1 -1
- package/lib/types/keyIds.d.ts +2 -0
- package/lib/types/keyIds.d.ts.map +1 -1
- package/lib/utils/arrays/arrayChunks.d.ts +9 -0
- package/lib/utils/arrays/arrayChunks.d.ts.map +1 -0
- package/lib/utils/arrays/arrayChunks.js +34 -0
- package/lib/utils/strings/frenchDays.d.ts +2 -0
- package/lib/utils/strings/frenchDays.d.ts.map +1 -0
- package/lib/utils/strings/frenchDays.js +9 -0
- package/lib/utils/strings/ordinalSuffixed.d.ts +2 -0
- package/lib/utils/strings/ordinalSuffixed.d.ts.map +1 -0
- package/lib/utils/strings/ordinalSuffixed.js +5 -0
- package/package.json +7 -1
|
@@ -1,10 +1,51 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { opposite } from "../../tree/nodes/functions/oppositeNode.js";
|
|
2
|
+
import { reifyAlgebraic, } from "../../tree/nodes/nodeConstructor.js";
|
|
3
|
+
import { add } from "../../tree/nodes/operators/addNode.js";
|
|
4
|
+
import { frac } from "../../tree/nodes/operators/fractionNode.js";
|
|
5
|
+
import { multiply, MultiplyNode, } from "../../tree/nodes/operators/multiplyNode.js";
|
|
2
6
|
import { SubstractNode } from "../../tree/nodes/operators/substractNode.js";
|
|
7
|
+
import { NodeComparator } from "../../tree/utilities/nodeComparator.js";
|
|
8
|
+
import { zip } from "../../utils/arrays/arrayZip.js";
|
|
9
|
+
import { transpose } from "../../utils/arrays/transpose.js";
|
|
10
|
+
import { doWhile } from "../../utils/doWhile.js";
|
|
3
11
|
import { randint } from "../utils/random/randint.js";
|
|
4
12
|
export class MatrixConstructor {
|
|
5
|
-
static random(rows, cols) {
|
|
6
|
-
const
|
|
7
|
-
|
|
13
|
+
static random(rows, cols, opts) {
|
|
14
|
+
const allowIdentity = opts?.allowIdentity ?? false;
|
|
15
|
+
const elementsOpts = opts?.elementsOpts ?? [-10, 11];
|
|
16
|
+
const mat = doWhile(() => new Matrix(Array.from(Array(rows), (_) => Array.from(Array(cols), (_) => randint(...elementsOpts).toTree()))), (m) => !allowIdentity && m.isIdentity());
|
|
17
|
+
return mat;
|
|
18
|
+
}
|
|
19
|
+
static identity(order) {
|
|
20
|
+
return new Matrix(Array.from(Array(order), (_, i) => Array.from(Array(order), (_, i2) => i === i2 ? (1).toTree() : (0).toTree())));
|
|
21
|
+
}
|
|
22
|
+
static randomInversible(rows, cols, opts) {
|
|
23
|
+
const mat = doWhile(() => MatrixConstructor.random(rows, cols, opts), (m) => {
|
|
24
|
+
const det = m.determinant().evaluate();
|
|
25
|
+
return det === 0 || (!!opts?.niceInversible && Math.abs(det) > 10);
|
|
26
|
+
});
|
|
27
|
+
return mat;
|
|
28
|
+
}
|
|
29
|
+
static fromIdentifiers(identifiers) {
|
|
30
|
+
return new Matrix(identifiers.elementsIds.map((row) => row.map((cell) => reifyAlgebraic(cell))));
|
|
31
|
+
}
|
|
32
|
+
static emptyVarMatrix(nbRows, nbCols) {
|
|
33
|
+
const nodeVarEmpty = "".toTree();
|
|
34
|
+
const elements = [...Array(nbRows).keys()].map(() => [...Array(nbCols).keys()].map(() => nodeVarEmpty));
|
|
35
|
+
return new Matrix(elements);
|
|
36
|
+
}
|
|
37
|
+
static randomAdjacent(length, opts) {
|
|
38
|
+
const nbs = Array.from({ length }, () => Array(length).fill(0));
|
|
39
|
+
for (let i = 0; i < length; i++) {
|
|
40
|
+
for (let j = 0; j <= i; j++) {
|
|
41
|
+
if (!opts?.adjacentAllowLoop && j === i)
|
|
42
|
+
nbs[i][j] = 0;
|
|
43
|
+
else
|
|
44
|
+
nbs[i][j] = randint(0, 2);
|
|
45
|
+
nbs[j][i] = nbs[i][j];
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
return new Matrix(nbs.map((row) => row.map((nb) => nb.toTree())));
|
|
8
49
|
}
|
|
9
50
|
}
|
|
10
51
|
export class Matrix {
|
|
@@ -16,15 +57,140 @@ export class Matrix {
|
|
|
16
57
|
this.columns = elements[0].length;
|
|
17
58
|
this.rows = elements.length;
|
|
18
59
|
}
|
|
60
|
+
transposed() {
|
|
61
|
+
return new Matrix(transpose(this.elements));
|
|
62
|
+
}
|
|
63
|
+
isSymmetrical() {
|
|
64
|
+
return [...new Array(this.rows).keys()]
|
|
65
|
+
.flatMap((i) => [...new Array(this.columns).keys()].map((j) => [i, j]))
|
|
66
|
+
.every(([i, j]) => NodeComparator.isEqualViaSub(this.elements[i][j], this.elements[j][i]));
|
|
67
|
+
}
|
|
68
|
+
symmetrized() {
|
|
69
|
+
return this.add(this.transposed()).times(frac(1, 2));
|
|
70
|
+
}
|
|
71
|
+
toIdentifiers() {
|
|
72
|
+
return {
|
|
73
|
+
id: "matrix",
|
|
74
|
+
elementsIds: this.elements.map((row) => row.map((cell) => cell.toIdentifiers())),
|
|
75
|
+
};
|
|
76
|
+
}
|
|
19
77
|
determinant() {
|
|
20
78
|
if (this.rows === 2 && this.columns === 2) {
|
|
21
|
-
return new SubstractNode(new MultiplyNode(this.elements[0][0], this.elements[1][1]), new MultiplyNode(this.elements[0][1], this.elements[1][0]))
|
|
79
|
+
return new SubstractNode(new MultiplyNode(this.elements[0][0], this.elements[1][1]), new MultiplyNode(this.elements[0][1], this.elements[1][0]));
|
|
22
80
|
}
|
|
23
81
|
throw Error("general determinant not implemented yet");
|
|
24
82
|
}
|
|
83
|
+
toInversed() {
|
|
84
|
+
if (this.rows !== 2 || this.columns !== 2)
|
|
85
|
+
throw Error("general inverse not implemented yet");
|
|
86
|
+
const det = this.determinant();
|
|
87
|
+
if (det.simplify().toTex() === "0")
|
|
88
|
+
throw Error("matrix is not inversible");
|
|
89
|
+
return new Matrix([
|
|
90
|
+
[this.elements[1][1], opposite(this.elements[0][1])],
|
|
91
|
+
[opposite(this.elements[1][0]), this.elements[0][0]],
|
|
92
|
+
]).times(frac(1, det));
|
|
93
|
+
}
|
|
94
|
+
isIdentity() {
|
|
95
|
+
if (this.rows !== this.columns) {
|
|
96
|
+
return false;
|
|
97
|
+
}
|
|
98
|
+
return (this.elements.every((row, index) => row[index].equals((1).toTree())) &&
|
|
99
|
+
this.elements.every((row, index) => row.every((cell, index2) => cell.equals((0).toTree()) || index === index2)));
|
|
100
|
+
}
|
|
101
|
+
isTransition() {
|
|
102
|
+
return (this.elements
|
|
103
|
+
.flat()
|
|
104
|
+
.every((x) => x.evaluate() >= 0 && x.evaluate() <= 1) &&
|
|
105
|
+
this.elements.every((row) => row
|
|
106
|
+
.reduce((acc, curr) => add(acc, curr).simplify(), (0).toTree())
|
|
107
|
+
.evaluate() === 1));
|
|
108
|
+
}
|
|
109
|
+
inverse() {
|
|
110
|
+
if (this.rows === 2 && this.columns === 2) {
|
|
111
|
+
const nodeDet = this.determinant().simplify({ towardsDistribute: true });
|
|
112
|
+
if (NodeComparator.isEqualViaSub(nodeDet, (0).toTree())) {
|
|
113
|
+
return undefined;
|
|
114
|
+
}
|
|
115
|
+
else {
|
|
116
|
+
const [[a, b], [c, d]] = this.elements;
|
|
117
|
+
return new Matrix([
|
|
118
|
+
[d, opposite(b)],
|
|
119
|
+
[opposite(c), a],
|
|
120
|
+
]).times(frac(1, nodeDet));
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
throw Error("general inverse not implemented yet");
|
|
124
|
+
}
|
|
125
|
+
density() {
|
|
126
|
+
const nbElementsNonZero = this.elements
|
|
127
|
+
.flat()
|
|
128
|
+
.filter((elt) => !NodeComparator.isEqualViaSub(elt, (0).toTree())).length;
|
|
129
|
+
return nbElementsNonZero / (this.rows * this.columns);
|
|
130
|
+
}
|
|
131
|
+
matForMapFunc(func) {
|
|
132
|
+
const arrElementMapped = this.elements.map((row, i) => row.map((elt, j) => func(elt, i, j)));
|
|
133
|
+
return new Matrix(arrElementMapped);
|
|
134
|
+
}
|
|
135
|
+
times(k) {
|
|
136
|
+
const arrElementScaled = this.elements.map((row) => row.map((elt) => multiply(k, elt)));
|
|
137
|
+
return new Matrix(arrElementScaled);
|
|
138
|
+
}
|
|
139
|
+
opposite() {
|
|
140
|
+
return this.times((-1).toTree());
|
|
141
|
+
}
|
|
142
|
+
isMatAdditionPossible(matPrime) {
|
|
143
|
+
return this.rows === matPrime.rows && this.columns === matPrime.columns;
|
|
144
|
+
}
|
|
145
|
+
add(matPrime) {
|
|
146
|
+
const arrElementSum = zip(this.elements, matPrime.elements).map(([row, rowPrime]) => row.map((elt, i) => add(elt, rowPrime[i])));
|
|
147
|
+
return new Matrix(arrElementSum);
|
|
148
|
+
}
|
|
149
|
+
substract(matPrime) {
|
|
150
|
+
return this.add(matPrime.opposite());
|
|
151
|
+
}
|
|
152
|
+
isMatProductPossible(matPrime) {
|
|
153
|
+
return this.rows === matPrime.columns;
|
|
154
|
+
}
|
|
155
|
+
matrixProduct(matPrime) {
|
|
156
|
+
const matPrimeTransposed = matPrime.transposed();
|
|
157
|
+
const arrElementProduct = this.elements.map((row) => matPrimeTransposed.elements.map((column) => zip(row, column).reduce((acc, [nodeAik, nodeBkj], i) => {
|
|
158
|
+
const nodeAikBkj = multiply(nodeAik, nodeBkj, {
|
|
159
|
+
forceTimesSign: true,
|
|
160
|
+
});
|
|
161
|
+
if (i === 0) {
|
|
162
|
+
return nodeAikBkj;
|
|
163
|
+
}
|
|
164
|
+
else {
|
|
165
|
+
return add(acc, nodeAikBkj);
|
|
166
|
+
}
|
|
167
|
+
}, (0).toTree())));
|
|
168
|
+
return new Matrix(arrElementProduct);
|
|
169
|
+
}
|
|
170
|
+
power(exponent) {
|
|
171
|
+
return [...Array(exponent).keys()].reduce((acc, i) => {
|
|
172
|
+
if (i === 0) {
|
|
173
|
+
return this;
|
|
174
|
+
}
|
|
175
|
+
else {
|
|
176
|
+
return acc.matrixProduct(this);
|
|
177
|
+
}
|
|
178
|
+
}, this);
|
|
179
|
+
}
|
|
180
|
+
equals(matPrime) {
|
|
181
|
+
return this.elements.every((row, i) => row.every((elt, j) => {
|
|
182
|
+
const eltPrime = matPrime.elements[i][j];
|
|
183
|
+
return (NodeComparator.isEqualViaSub(eltPrime, elt) ||
|
|
184
|
+
NodeComparator.isEqualViaFrac(eltPrime, elt));
|
|
185
|
+
}));
|
|
186
|
+
}
|
|
25
187
|
toTex() {
|
|
26
188
|
return `\\begin{pmatrix}${this.elements
|
|
27
|
-
.map((row
|
|
28
|
-
.join("")}\\end{pmatrix}`;
|
|
189
|
+
.map((row) => `${row.map((cell) => cell.toTex()).join("&")}`)
|
|
190
|
+
.join("\\\\")}\\end{pmatrix}`;
|
|
191
|
+
}
|
|
192
|
+
simplify(simplifyOpts) {
|
|
193
|
+
const arrElementSimplified = this.elements.map((row) => row.map((elt) => elt.simplify(simplifyOpts)));
|
|
194
|
+
return new Matrix(arrElementSimplified);
|
|
29
195
|
}
|
|
30
196
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"parseMatrix.d.ts","sourceRoot":"","sources":["../../../src/math/matrices/parseMatrix.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAErC,eAAO,MAAM,WAAW,GAAI,KAAK,MAAM,KAAG,MAyBzC,CAAC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { parseAlgebraic } from "../../tree/parsers/latexParser.js";
|
|
2
|
+
import { Matrix } from "./matrix.js";
|
|
3
|
+
export const parseMatrix = (tex) => {
|
|
4
|
+
const parseMatrixToArrArrStr = (input) => {
|
|
5
|
+
// Extrait le contenu entre \begin{...} et \end{...}
|
|
6
|
+
const match = input.match(/\\begin\{[a-zA-Z*]+\}([\s\S]*)\\end\{[a-zA-Z*]+\}/);
|
|
7
|
+
const content = match ? match[1] : undefined;
|
|
8
|
+
if (content) {
|
|
9
|
+
return content
|
|
10
|
+
.split("\\\\") // sépare les lignes
|
|
11
|
+
.map((row) => row.trim())
|
|
12
|
+
.filter((row) => row.length > 0) // ignore une éventuelle ligne vide en fin
|
|
13
|
+
.map((row) => row.split("&").map((cell) => cell.trim()));
|
|
14
|
+
}
|
|
15
|
+
else {
|
|
16
|
+
throw new Error("Unsupported tex: " + tex);
|
|
17
|
+
}
|
|
18
|
+
};
|
|
19
|
+
const elts = parseMatrixToArrArrStr(tex).map((row) => row.map((str) => parseAlgebraic(str)));
|
|
20
|
+
const mat = new Matrix(elts);
|
|
21
|
+
return mat;
|
|
22
|
+
};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { AlgebraicNode, SimplifyOptions } from "../../tree/nodes/algebraicNode.js";
|
|
2
2
|
import { EqualNode } from "../../tree/nodes/equations/equalNode.js";
|
|
3
3
|
import { NodeIdentifiers } from "../../tree/nodes/nodeConstructor.js";
|
|
4
|
+
import { Matrix } from "../matrices/matrix.js";
|
|
4
5
|
export declare abstract class GeneralSystemConstructor {
|
|
5
6
|
static random(): GeneralSystem;
|
|
6
7
|
static niceValues(): GeneralSystem;
|
|
@@ -17,6 +18,7 @@ export declare class GeneralSystem {
|
|
|
17
18
|
getEqualNodes(varNames?: string[]): EqualNode[];
|
|
18
19
|
checkCouple(x: AlgebraicNode, y: AlgebraicNode): boolean;
|
|
19
20
|
multiplyEquation(nodes: AlgebraicNode[]): GeneralSystem;
|
|
21
|
+
getMatrix(): Matrix;
|
|
20
22
|
solve(): {
|
|
21
23
|
x: AlgebraicNode;
|
|
22
24
|
y: AlgebraicNode;
|
|
@@ -1 +1 @@
|
|
|
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;
|
|
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;AAO7C,OAAO,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAI/C,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,CAAC,QAAQ,GAAE,MAAM,EAAe;IAU7C,WAAW,CAAC,CAAC,EAAE,aAAa,EAAE,CAAC,EAAE,aAAa;IAQ9C,gBAAgB,CAAC,KAAK,EAAE,aAAa,EAAE;IAUvC,SAAS;IAIT,KAAK;;;;IAoDL,KAAK,CAAC,QAAQ,GAAE,MAAM,EAAe;IAerC,eAAe,CACb,QAAQ,GAAE,MAAM,EAAe,EAC/B,eAAe,GAAE,OAAc;CAqIlC"}
|
|
@@ -6,6 +6,7 @@ import { multiply } from "../../tree/nodes/operators/multiplyNode.js";
|
|
|
6
6
|
import { substract } from "../../tree/nodes/operators/substractNode.js";
|
|
7
7
|
import { doWhile } from "../../utils/doWhile.js";
|
|
8
8
|
import { alignTex } from "../../utils/latex/alignTex.js";
|
|
9
|
+
import { Matrix } from "../matrices/matrix.js";
|
|
9
10
|
import { lcm } from "../utils/arithmetic/lcm.js";
|
|
10
11
|
import { randint } from "../utils/random/randint.js";
|
|
11
12
|
export class GeneralSystemConstructor {
|
|
@@ -80,6 +81,10 @@ export class GeneralSystem {
|
|
|
80
81
|
: this.coeffs[1],
|
|
81
82
|
]);
|
|
82
83
|
}
|
|
84
|
+
getMatrix() {
|
|
85
|
+
const coeffs = this.coeffs.map((row) => row.slice(0, row.length - 1));
|
|
86
|
+
return new Matrix(coeffs);
|
|
87
|
+
}
|
|
83
88
|
solve() {
|
|
84
89
|
if (this.coeffs.length !== 2)
|
|
85
90
|
throw Error("General system resolution not implemented yet");
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { Point } from "../../../math/geometry/point.js";
|
|
2
|
+
export declare const valueAngleBetweenPoints: (point1: Point, pointCenter: Point, point2: Point) => number;
|
|
3
|
+
export declare const exactAngleCandidate: (valueAngle: number) => import("../../../tree/nodes/numbers/constantNode.js").ConstantNode | import("../../../tree/nodes/numbers/numberNode.js").NumberNode | import("../../../tree/nodes/operators/multiplyNode.js").MultiplyNode;
|
|
4
|
+
//# sourceMappingURL=angleBetweenPoints.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"angleBetweenPoints.d.ts","sourceRoot":"","sources":["../../../../src/math/utils/geometry/angleBetweenPoints.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,8BAA8B,CAAC;AASrD,eAAO,MAAM,uBAAuB,GAClC,QAAQ,KAAK,EACb,aAAa,KAAK,EAClB,QAAQ,KAAK,WAoCd,CAAC;AAEF,eAAO,MAAM,mBAAmB,GAAI,YAAY,MAAM,4MAoCrD,CAAC"}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { SpaceVector } from "../../../math/geometry/spaceVector.js";
|
|
2
|
+
import { VectorConstructor } from "../../../math/geometry/vector.js";
|
|
3
|
+
import { opposite } from "../../../tree/nodes/functions/oppositeNode.js";
|
|
4
|
+
import { PiNode } from "../../../tree/nodes/numbers/piNode.js";
|
|
5
|
+
import { frac } from "../../../tree/nodes/operators/fractionNode.js";
|
|
6
|
+
import { multiply } from "../../../tree/nodes/operators/multiplyNode.js";
|
|
7
|
+
import { NodeComparator } from "../../../tree/utilities/nodeComparator.js";
|
|
8
|
+
export const valueAngleBetweenPoints = (point1, pointCenter, point2) => {
|
|
9
|
+
const vec1 = VectorConstructor.fromPoints(pointCenter, point1);
|
|
10
|
+
const vec2 = VectorConstructor.fromPoints(pointCenter, point2);
|
|
11
|
+
const [nodeNorm1, nodeNorm2] = [vec1, vec2].map((vec) => vec.getNorm());
|
|
12
|
+
const nodeScalarProduct = vec1.scalarProduct(vec2);
|
|
13
|
+
const nodeCosAngle = frac(nodeScalarProduct, multiply(nodeNorm1, nodeNorm2));
|
|
14
|
+
const valueCosAngle = Math.min(1, Math.max(-1, nodeCosAngle.evaluate()));
|
|
15
|
+
const valueAngle = (() => {
|
|
16
|
+
const valueAngleRaw = Math.acos(valueCosAngle);
|
|
17
|
+
const nodeVectorialProduct = (() => {
|
|
18
|
+
const spaceVec1 = new SpaceVector(vec1.name, vec1.x, vec1.y, (0).toTree());
|
|
19
|
+
const spaceVec2 = new SpaceVector(vec2.name, vec2.x, vec2.y, (0).toTree());
|
|
20
|
+
return spaceVec1.vetorialProduct(spaceVec2);
|
|
21
|
+
})();
|
|
22
|
+
if (nodeVectorialProduct.z.evaluate() > 0) {
|
|
23
|
+
return valueAngleRaw;
|
|
24
|
+
}
|
|
25
|
+
else {
|
|
26
|
+
return -valueAngleRaw;
|
|
27
|
+
}
|
|
28
|
+
})();
|
|
29
|
+
return valueAngle;
|
|
30
|
+
};
|
|
31
|
+
export const exactAngleCandidate = (valueAngle) => {
|
|
32
|
+
const nodeAngleExactCandidate = (() => {
|
|
33
|
+
if (Math.abs(valueAngle - 0) < 0.05) {
|
|
34
|
+
return (0).toTree();
|
|
35
|
+
}
|
|
36
|
+
else {
|
|
37
|
+
const sign = valueAngle >= 0 ? +1 : -1;
|
|
38
|
+
const nMax = 8; //Pi/8 is the limit
|
|
39
|
+
const [nodeAngleCandidate] = [...Array(nMax).keys()]
|
|
40
|
+
.map((i) => i + 1)
|
|
41
|
+
.flatMap((n) => {
|
|
42
|
+
const nodeAngleBase = frac(PiNode, n);
|
|
43
|
+
const arrNodeAngle = [...Array(n + 1).keys()].map((i) => {
|
|
44
|
+
const nodeAngleCandidate = multiply(multiply(sign, i), nodeAngleBase);
|
|
45
|
+
return nodeAngleCandidate;
|
|
46
|
+
});
|
|
47
|
+
return arrNodeAngle;
|
|
48
|
+
})
|
|
49
|
+
.filter((nodeAngleCandidate) => Math.abs(nodeAngleCandidate.evaluate() - valueAngle) < 0.05);
|
|
50
|
+
return nodeAngleCandidate;
|
|
51
|
+
}
|
|
52
|
+
})();
|
|
53
|
+
if (nodeAngleExactCandidate &&
|
|
54
|
+
NodeComparator.isEqualViaSub(nodeAngleExactCandidate, opposite(PiNode))) {
|
|
55
|
+
return PiNode;
|
|
56
|
+
}
|
|
57
|
+
return nodeAngleExactCandidate;
|
|
58
|
+
};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
export declare function createTypeAngleSectorNWSE(valueAngle: number): "E" | "N" | "S" | "W";
|
|
2
|
+
export declare function createTypeAngleSectorNWSESecondary(valueAngle: number): "WSW" | "SSW" | "SSE" | "ESE" | "ENE" | "NNE" | "NNW" | "WNW";
|
|
3
|
+
//# sourceMappingURL=angleNWSE.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"angleNWSE.d.ts","sourceRoot":"","sources":["../../../../src/math/utils/geometry/angleNWSE.ts"],"names":[],"mappings":"AAEA,wBAAgB,yBAAyB,CAAC,UAAU,EAAE,MAAM,yBAyB3D;AAED,wBAAgB,kCAAkC,CAAC,UAAU,EAAE,MAAM,iEA2CpE"}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { PiNode } from "../../../tree/nodes/numbers/piNode.js";
|
|
2
|
+
export function createTypeAngleSectorNWSE(valueAngle) {
|
|
3
|
+
const valuePi = PiNode.evaluate();
|
|
4
|
+
const valueAngleOffsetForTuningSectors = valuePi * 0.25; //ici on veut des secteurs de type N W S E
|
|
5
|
+
const valueAngleInMinusPiPlusPi = (valueAngle - valueAngleOffsetForTuningSectors) % valuePi;
|
|
6
|
+
if (-valuePi <= valueAngleInMinusPiPlusPi &&
|
|
7
|
+
valueAngleInMinusPiPlusPi < -valuePi * 0.5) {
|
|
8
|
+
return "S";
|
|
9
|
+
}
|
|
10
|
+
else if (-valuePi * 0.5 <= valueAngleInMinusPiPlusPi &&
|
|
11
|
+
valueAngleInMinusPiPlusPi < 0) {
|
|
12
|
+
return "W";
|
|
13
|
+
}
|
|
14
|
+
else if (0 <= valueAngleInMinusPiPlusPi &&
|
|
15
|
+
valueAngleInMinusPiPlusPi < valuePi * 0.5) {
|
|
16
|
+
return "N";
|
|
17
|
+
}
|
|
18
|
+
else {
|
|
19
|
+
return "E";
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
export function createTypeAngleSectorNWSESecondary(valueAngle) {
|
|
23
|
+
const valuePi = PiNode.evaluate();
|
|
24
|
+
const valueAngleInMinusPiPlusPi = valueAngle % valuePi;
|
|
25
|
+
if (-valuePi <= valueAngleInMinusPiPlusPi &&
|
|
26
|
+
valueAngleInMinusPiPlusPi < -valuePi * 0.75) {
|
|
27
|
+
return "WSW";
|
|
28
|
+
}
|
|
29
|
+
else if (-valuePi * 0.75 <= valueAngleInMinusPiPlusPi &&
|
|
30
|
+
valueAngleInMinusPiPlusPi < -valuePi * 0.5) {
|
|
31
|
+
return "SSW";
|
|
32
|
+
}
|
|
33
|
+
else if (-valuePi * 0.5 <= valueAngleInMinusPiPlusPi &&
|
|
34
|
+
valueAngleInMinusPiPlusPi < -valuePi * 0.25) {
|
|
35
|
+
return "SSE";
|
|
36
|
+
}
|
|
37
|
+
else if (-valuePi * 0.25 <= valueAngleInMinusPiPlusPi &&
|
|
38
|
+
valueAngleInMinusPiPlusPi < 0) {
|
|
39
|
+
return "ESE";
|
|
40
|
+
}
|
|
41
|
+
else if (0 <= valueAngleInMinusPiPlusPi &&
|
|
42
|
+
valueAngleInMinusPiPlusPi < valuePi * 0.25) {
|
|
43
|
+
return "ENE";
|
|
44
|
+
}
|
|
45
|
+
else if (valuePi * 0.25 <= valueAngleInMinusPiPlusPi &&
|
|
46
|
+
valueAngleInMinusPiPlusPi < valuePi * 0.5) {
|
|
47
|
+
return "NNE";
|
|
48
|
+
}
|
|
49
|
+
else if (valuePi * 0.5 <= valueAngleInMinusPiPlusPi &&
|
|
50
|
+
valueAngleInMinusPiPlusPi < valuePi * 0.75) {
|
|
51
|
+
return "NNW";
|
|
52
|
+
}
|
|
53
|
+
else {
|
|
54
|
+
return "WNW";
|
|
55
|
+
}
|
|
56
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { Graph } from "../../graphs/graph.js";
|
|
2
|
+
import * as TSGraphViz from "ts-graphviz";
|
|
3
|
+
import { Engine } from "@hpcc-js/wasm-graphviz";
|
|
4
|
+
export interface GraphNode {
|
|
5
|
+
label: string;
|
|
6
|
+
x: number;
|
|
7
|
+
y: number;
|
|
8
|
+
}
|
|
9
|
+
export interface GraphEdge {
|
|
10
|
+
from: string;
|
|
11
|
+
to: string;
|
|
12
|
+
}
|
|
13
|
+
export declare class GraphRenderer {
|
|
14
|
+
static convertToGraphVizGraph(graph: Graph): TSGraphViz.Digraph;
|
|
15
|
+
static renderToSVG(graph: Graph, layoutEngineIn?: Engine): string;
|
|
16
|
+
static convertSVGToNodesAndEdges(strSVG: string): {
|
|
17
|
+
nodes: GraphNode[];
|
|
18
|
+
edges: GraphEdge[];
|
|
19
|
+
};
|
|
20
|
+
static renderToNodesAndEdges(graph: Graph, layoutEngineIn?: Engine): {
|
|
21
|
+
nodes: GraphNode[];
|
|
22
|
+
edges: GraphEdge[];
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
//# sourceMappingURL=graphRenderer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"graphRenderer.d.ts","sourceRoot":"","sources":["../../../../src/math/utils/graphs/graphRenderer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;AAE9C,OAAO,KAAK,UAAU,MAAM,aAAa,CAAC;AAC1C,OAAO,EAAE,MAAM,EAAY,MAAM,wBAAwB,CAAC;AAM1D,MAAM,WAAW,SAAS;IACxB,KAAK,EAAE,MAAM,CAAC;IACd,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;CACX;AAED,MAAM,WAAW,SAAS;IACxB,IAAI,EAAE,MAAM,CAAC;IACb,EAAE,EAAE,MAAM,CAAC;CACZ;AAED,qBAAa,aAAa;IACxB,MAAM,CAAC,sBAAsB,CAAC,KAAK,EAAE,KAAK,GAAG,UAAU,CAAC,OAAO;IAkE/D,MAAM,CAAC,WAAW,CAAC,KAAK,EAAE,KAAK,EAAE,cAAc,CAAC,EAAE,MAAM;IA0BxD,MAAM,CAAC,yBAAyB,CAAC,MAAM,EAAE,MAAM,GAAG;QAChD,KAAK,EAAE,SAAS,EAAE,CAAC;QACnB,KAAK,EAAE,SAAS,EAAE,CAAC;KACpB;IAwDD,MAAM,CAAC,qBAAqB,CAAC,KAAK,EAAE,KAAK,EAAE,cAAc,CAAC,EAAE,MAAM;eA1DzD,SAAS,EAAE;eACX,SAAS,EAAE;;CA6DrB"}
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
import * as TSGraphViz from "ts-graphviz";
|
|
2
|
+
import { Graphviz } from "@hpcc-js/wasm-graphviz";
|
|
3
|
+
const graphviz = await Graphviz.load();
|
|
4
|
+
import { JSDOM } from "jsdom";
|
|
5
|
+
import { random } from "../../../utils/alea/random.js";
|
|
6
|
+
export class GraphRenderer {
|
|
7
|
+
static convertToGraphVizGraph(graph) {
|
|
8
|
+
const digraph = new TSGraphViz.Digraph();
|
|
9
|
+
// Create nodes
|
|
10
|
+
const dictGraphvizNode = Object.fromEntries(graph.vertexNames.map((nameVertex) => {
|
|
11
|
+
const graphvizNode = new TSGraphViz.Node(nameVertex, {});
|
|
12
|
+
return [nameVertex, graphvizNode];
|
|
13
|
+
}));
|
|
14
|
+
// Create edges between the nodes
|
|
15
|
+
const arrConnectionNoDuplicate = (() => {
|
|
16
|
+
const arrConnection = Object.entries(graph.dictConnections()).flatMap(([nameVertexStart, dictConnections]) => {
|
|
17
|
+
return Object.entries(dictConnections)
|
|
18
|
+
.filter(([_, isConnection]) => isConnection)
|
|
19
|
+
.map(([nameVertexEnd, _]) => [nameVertexStart, nameVertexEnd]);
|
|
20
|
+
});
|
|
21
|
+
if (graph.isDirected) {
|
|
22
|
+
return arrConnection;
|
|
23
|
+
}
|
|
24
|
+
else {
|
|
25
|
+
return arrConnection
|
|
26
|
+
.map(([nameVertexStart, nameVertexEnd]) => [nameVertexStart, nameVertexEnd].join("-"))
|
|
27
|
+
.reduce((acc, strEdge) => {
|
|
28
|
+
const strEdgeReversed = strEdge.split("").toReversed().join("");
|
|
29
|
+
if (acc.includes(strEdgeReversed)) {
|
|
30
|
+
//ignore
|
|
31
|
+
}
|
|
32
|
+
else {
|
|
33
|
+
acc = [...acc, strEdge];
|
|
34
|
+
}
|
|
35
|
+
return acc;
|
|
36
|
+
}, [])
|
|
37
|
+
.map((strEdge) => {
|
|
38
|
+
const [nameVertexStart, nameVertexEnd] = strEdge.split("-");
|
|
39
|
+
return [nameVertexStart, nameVertexEnd];
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
})();
|
|
43
|
+
const arrEdge = arrConnectionNoDuplicate.map(([nameVertexStart, nameVertexEnd]) => {
|
|
44
|
+
const [graphvizNodeStart, graphvizNodeEnd] = [
|
|
45
|
+
nameVertexStart,
|
|
46
|
+
nameVertexEnd,
|
|
47
|
+
].map((nameVertex) => dictGraphvizNode[nameVertex]);
|
|
48
|
+
const graphvizEdge = new TSGraphViz.Edge([graphvizNodeStart, graphvizNodeEnd], {});
|
|
49
|
+
return graphvizEdge;
|
|
50
|
+
});
|
|
51
|
+
// Add elements to the graph
|
|
52
|
+
Object.entries(dictGraphvizNode).forEach(([_, graphvizNode]) => digraph.addNode(graphvizNode));
|
|
53
|
+
arrEdge.forEach((graphvizEdge) => digraph.addEdge(graphvizEdge));
|
|
54
|
+
return digraph;
|
|
55
|
+
}
|
|
56
|
+
static renderToSVG(graph, layoutEngineIn) {
|
|
57
|
+
const digraph = GraphRenderer.convertToGraphVizGraph(graph);
|
|
58
|
+
const dot = TSGraphViz.toDot(digraph);
|
|
59
|
+
// Render DOT to SVG
|
|
60
|
+
/*
|
|
61
|
+
const arrLayoutEngine = [
|
|
62
|
+
"circo",
|
|
63
|
+
"dot",
|
|
64
|
+
"fdp",
|
|
65
|
+
"neato",
|
|
66
|
+
"nop",
|
|
67
|
+
"nop2",
|
|
68
|
+
// "osage",
|
|
69
|
+
// "patchwork",
|
|
70
|
+
"sfdp",
|
|
71
|
+
"twopi",
|
|
72
|
+
];
|
|
73
|
+
*/
|
|
74
|
+
const layoutEngine = layoutEngineIn ?? random(["fdp", "circo"]);
|
|
75
|
+
const svg = graphviz.layout(dot, "svg", layoutEngine);
|
|
76
|
+
return svg;
|
|
77
|
+
}
|
|
78
|
+
static convertSVGToNodesAndEdges(strSVG) {
|
|
79
|
+
function parseSvgGraph(svgString) {
|
|
80
|
+
const domParser = new new JSDOM().window.DOMParser();
|
|
81
|
+
const doc = domParser.parseFromString(svgString, "image/svg+xml");
|
|
82
|
+
const svgEl = doc.querySelector("svg");
|
|
83
|
+
const height = parseFloat(svgEl?.getAttribute("height") ?? "0");
|
|
84
|
+
// Translation du groupe racine (pattern classique Graphviz)
|
|
85
|
+
const graphGroup = doc.querySelector("g.graph") ?? doc.querySelector("svg > g");
|
|
86
|
+
const transform = graphGroup?.getAttribute("transform") ?? "";
|
|
87
|
+
const match = transform.match(/translate\(([-\d.]+)[ ,]([-\d.]+)\)/);
|
|
88
|
+
const [tx, ty] = match
|
|
89
|
+
? [parseFloat(match[1]), parseFloat(match[2])]
|
|
90
|
+
: [0, 0];
|
|
91
|
+
// Sommets
|
|
92
|
+
const nodes = Array.from(doc.querySelectorAll("g.node")).map((g) => {
|
|
93
|
+
const ellipse = g.querySelector("ellipse");
|
|
94
|
+
const text = g.querySelector("text");
|
|
95
|
+
const label = text?.textContent?.trim() ??
|
|
96
|
+
g.querySelector("title")?.textContent?.trim() ??
|
|
97
|
+
"";
|
|
98
|
+
const cx = parseFloat(ellipse?.getAttribute("cx") ?? "0");
|
|
99
|
+
const cy = parseFloat(ellipse?.getAttribute("cy") ?? "0");
|
|
100
|
+
return {
|
|
101
|
+
label,
|
|
102
|
+
x: cx + tx,
|
|
103
|
+
y: height - (cy + ty), // flip vertical SVG -> GeoGebra
|
|
104
|
+
};
|
|
105
|
+
});
|
|
106
|
+
// Arêtes : lues directement depuis le <title> de chaque g.edge (ex: "A->B")
|
|
107
|
+
const edges = Array.from(doc.querySelectorAll("g.edge"))
|
|
108
|
+
.map((g) => g.querySelector("title")?.textContent?.trim() ?? "")
|
|
109
|
+
.map((title) => {
|
|
110
|
+
const [from, to] = title.split(/->|->/).map((s) => s.trim());
|
|
111
|
+
return { from, to };
|
|
112
|
+
})
|
|
113
|
+
.filter((e) => Boolean(e.from && e.to));
|
|
114
|
+
return { nodes, edges };
|
|
115
|
+
}
|
|
116
|
+
const { nodes, edges } = parseSvgGraph(strSVG);
|
|
117
|
+
return { nodes, edges };
|
|
118
|
+
}
|
|
119
|
+
static renderToNodesAndEdges(graph, layoutEngineIn) {
|
|
120
|
+
const strSVG = this.renderToSVG(graph, layoutEngineIn);
|
|
121
|
+
return this.convertSVGToNodesAndEdges(strSVG);
|
|
122
|
+
}
|
|
123
|
+
}
|
package/lib/playground.d.ts
CHANGED
|
@@ -1,2 +1,7 @@
|
|
|
1
|
-
export declare const playground: () => void
|
|
1
|
+
export declare const playground: () => Promise<void>;
|
|
2
|
+
/***
|
|
3
|
+
*
|
|
4
|
+
* !!TODO
|
|
5
|
+
* - j'ai l'impression que opposite(3).simplify() et numberNode(-3) ne passent pas tjrs "equals", j'ai du mal à comprendre pourquoi alors que opposite(3) se simplifie bien en numberNode
|
|
6
|
+
*/
|
|
2
7
|
//# sourceMappingURL=playground.d.ts.map
|
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":"AAAA,eAAO,MAAM,UAAU,qBAAiB,CAAC;AAEzC;;;;GAIG"}
|
package/lib/playground.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
export const playground = async () => { };
|
|
2
|
+
/***
|
|
3
|
+
*
|
|
4
|
+
* !!TODO
|
|
5
|
+
* - j'ai l'impression que opposite(3).simplify() et numberNode(-3) ne passent pas tjrs "equals", j'ai du mal à comprendre pourquoi alors que opposite(3) se simplifie bien en numberNode
|
|
6
|
+
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"singleExo.test.d.ts","sourceRoot":"","sources":["../../src/tests/singleExo.test.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"singleExo.test.d.ts","sourceRoot":"","sources":["../../src/tests/singleExo.test.ts"],"names":[],"mappings":"AAGA,OAAO,6BAA6B,CAAC"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
+
import { factoIdRmq1 } from "../exercises/math/index.js";
|
|
1
2
|
import "../prototypesEnhancement.js";
|
|
2
3
|
import { exoTest } from "./exoTest.js";
|
|
3
|
-
import { pyLimitProgramExecution, } from "../exercises/math/index.js";
|
|
4
4
|
try {
|
|
5
5
|
for (let i = 0; i < 1000; i++)
|
|
6
|
-
exoTest(
|
|
6
|
+
exoTest(factoIdRmq1);
|
|
7
7
|
}
|
|
8
8
|
catch (err) {
|
|
9
9
|
throw err;
|
|
@@ -7,6 +7,6 @@ type ParserOptions = {
|
|
|
7
7
|
allowStartingPower?: boolean;
|
|
8
8
|
};
|
|
9
9
|
export declare const parseAlgebraic: (latex: string, opts?: ParserOptions) => AlgebraicNode | IDontKnowNode;
|
|
10
|
-
export declare const parseLatex: (latex: string) => AlgebraicNode | EqualNode |
|
|
10
|
+
export declare const parseLatex: (latex: string) => AlgebraicNode | EqualNode | IDontKnowNode | InequationNode;
|
|
11
11
|
export {};
|
|
12
12
|
//# sourceMappingURL=latexParser.d.ts.map
|
|
@@ -2,7 +2,7 @@ import { AlgebraicNode, SimplifyOptions } from "../nodes/algebraicNode.js";
|
|
|
2
2
|
import { ToTexOptions } from "../nodes/node.js";
|
|
3
3
|
export declare abstract class NodeSimplifier {
|
|
4
4
|
static getDepth: <T extends AlgebraicNode>(algebraicNode: T, simplifyOpts: SimplifyOptions, toTexOptions?: ToTexOptions) => number;
|
|
5
|
-
static getPEMDASPriority: (algebraicNode: AlgebraicNode) => 1 | 0 | 2 | 100 | -1 |
|
|
5
|
+
static getPEMDASPriority: (algebraicNode: AlgebraicNode) => 1 | 0 | 2 | 100 | -1 | 5 | 3 | 4;
|
|
6
6
|
static nodesSortedByPEMDASPriorityAsc: (nodes: AlgebraicNode[]) => AlgebraicNode[];
|
|
7
7
|
static nodesStepByStep: <T extends AlgebraicNode>(algebraicNode: T, simplifyOpts: SimplifyOptions, simplifierOpts?: {
|
|
8
8
|
isMultiTopLevel: boolean;
|
package/lib/types/keyIds.d.ts
CHANGED
|
@@ -27,6 +27,8 @@ export type KeyId =
|
|
|
27
27
|
| "guillemet" | "quote" | "hyphen" | "euro" | "space" | "underscore" | "A" | "B" | "C" | "D" | "E" | "F" | "G" | "H" | "I" | "J" | "K" | "L" | "M" | "N" | "O" | "P" | "Q" | "R" | "S" | "T" | "U" | "V" | "W" | "X" | "Y" | "Z" | "É" | "È" | "Ç" | "À" | "a" | "b" | "c" | "d" | "e" | "f" | "g" | "h" | "i" | "j" | "k" | "l" | "m" | "n" | "o" | "p" | "q" | "r" | "s" | "t" | "u" | "v" | "w" | "x" | "y" | "z" | "é" | "è" | "à" | "ç" | "ù" | "ô"
|
|
28
28
|
/**numbers */
|
|
29
29
|
| "0" | "1" | "2" | "3" | "4" | "5" | "6" | "7" | "8" | "9"
|
|
30
|
+
/**matrix*/
|
|
31
|
+
| "mat-2-2" | "det-2-2"
|
|
30
32
|
/**atoms */
|
|
31
33
|
| "Hydrogène" | "Hélium" | "Lithium" | "Béryllium" | "Bore" | "Carbone" | "Azote" | "Oxygène" | "Fluor" | "Néon" | "Sodium" | "Magnésium" | "Aluminium" | "Silicium" | "Phosphore" | "Soufre" | "Chlore" | "Argon" | "Potassium" | "Calcium" | "Scandium" | "Titane" | "Vanadium" | "Chrome" | "Manganèse" | "Fer" | "Cobalt" | "Nickel" | "Cuivre" | "Zinc" | "Gallium" | "Germanium" | "Arsenic" | "Sélénium" | "Brome" | "Krypton" | "Rubidium" | "Strontium" | "Yttrium" | "Zirconium" | "Niobium" | "Molybdène" | "Technétium" | "Ruthénium" | "Rhodium" | "Palladium" | "Argent" | "Cadmium" | "Indium" | "Étain" | "Antimoine" | "Tellure" | "Iode" | "Xénon" | "Césium" | "Baryum" | "Lanthane" | "Cérium" | "Praséodyme" | "Néodyme" | "Prométhium" | "Samarium" | "Europium" | "Gadolinium" | "Térbium" | "Dysprosium" | "Holmium" | "Erbium" | "Thulium" | "Ytterbium" | "Lutétium" | "Hafnium" | "Tantale" | "Tungstène" | "Rhénium" | "Osmium" | "Iridium" | "Platine" | "Or" | "Mercure" | "Thallium" | "Plomb" | "Bismuth" | "Polonium" | "Astate" | "Radon" | "Francium" | "Radium" | "Actinium" | "Thorium" | "Protactinium" | "Uranium" | "Neptunium" | "Plutonium" | "Américium" | "Curium" | "Berkélium" | "Californium" | "Einsteinium" | "Fermium" | "Mendélévium" | "Nobelium" | "Lawrencium" | "Rutherfordium" | "Dubnium" | "Seaborgium" | "Bohrium" | "Hassium" | "Meitnérium" | "Darmstadtium" | "Roentgenium" | "Copernicium" | "Nihonium" | "Flerovium" | "Moscovium" | "Livermorium" | "Tennessine" | "Oganesson"
|
|
32
34
|
/**Molecules */
|