math-exercises 2.2.4 → 2.2.6
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/exercise.d.ts +1 -1
- package/lib/exercises/exercise.d.ts.map +1 -1
- package/lib/exercises/math/calcul/digitDecimalRank.js +4 -4
- package/lib/exercises/math/calcul/digitDecimalRankNumber.d.ts +8 -0
- package/lib/exercises/math/calcul/digitDecimalRankNumber.d.ts.map +1 -0
- package/lib/exercises/math/calcul/digitDecimalRankNumber.js +60 -0
- package/lib/exercises/math/calcul/digitRank.js +4 -4
- package/lib/exercises/math/calcul/digitRankNumber.d.ts +8 -0
- package/lib/exercises/math/calcul/digitRankNumber.d.ts.map +1 -0
- package/lib/exercises/math/calcul/digitRankNumber.js +56 -0
- package/lib/exercises/math/calcul/fractions/fractionAndIntegerDivision.d.ts.map +1 -1
- package/lib/exercises/math/calcul/fractions/fractionAndIntegerDivision.js +34 -0
- package/lib/exercises/math/calcul/fractions/fractionAndIntegerProduct.d.ts.map +1 -1
- package/lib/exercises/math/calcul/fractions/fractionAndIntegerProduct.js +17 -0
- package/lib/exercises/math/calcul/fractions/fractionsDivision.d.ts.map +1 -1
- package/lib/exercises/math/calcul/fractions/fractionsDivision.js +23 -0
- package/lib/exercises/math/calcul/fractions/fractionsProduct.d.ts.map +1 -1
- package/lib/exercises/math/calcul/fractions/fractionsProduct.js +15 -0
- package/lib/exercises/math/calcul/index.d.ts +2 -0
- package/lib/exercises/math/calcul/index.d.ts.map +1 -1
- package/lib/exercises/math/calcul/index.js +2 -0
- package/lib/exercises/math/calcul/proportionality/scaleUsage.js +1 -1
- package/lib/exercises/math/calcul/rounding/rounding.d.ts.map +1 -1
- package/lib/exercises/math/calcul/rounding/rounding.js +18 -0
- package/lib/exercises/math/calculLitteral/distributivity/allIdentities.d.ts.map +1 -1
- package/lib/exercises/math/calculLitteral/distributivity/allIdentities.js +1 -0
- package/lib/exercises/math/calculLitteral/distributivity/canonicalFormDevelopment.d.ts.map +1 -1
- package/lib/exercises/math/calculLitteral/distributivity/canonicalFormDevelopment.js +1 -0
- package/lib/exercises/math/calculLitteral/distributivity/doubleDistributivity.d.ts.map +1 -1
- package/lib/exercises/math/calculLitteral/distributivity/doubleDistributivity.js +31 -1
- package/lib/exercises/math/calculLitteral/distributivity/doubleDistributivityWithCoeff.d.ts.map +1 -1
- package/lib/exercises/math/calculLitteral/distributivity/doubleDistributivityWithCoeff.js +11 -2
- package/lib/exercises/math/calculLitteral/distributivity/firstIdentity.d.ts.map +1 -1
- package/lib/exercises/math/calculLitteral/distributivity/firstIdentity.js +21 -2
- package/lib/exercises/math/calculLitteral/distributivity/secondIdentity.d.ts.map +1 -1
- package/lib/exercises/math/calculLitteral/distributivity/secondIdentity.js +23 -2
- package/lib/exercises/math/calculLitteral/distributivity/simpleDistributivity.d.ts.map +1 -1
- package/lib/exercises/math/calculLitteral/distributivity/simpleDistributivity.js +17 -2
- package/lib/exercises/math/calculLitteral/distributivity/thirdIdentity.d.ts.map +1 -1
- package/lib/exercises/math/calculLitteral/distributivity/thirdIdentity.js +21 -2
- package/lib/exercises/math/calculLitteral/equation/equationSimpleSquare.d.ts.map +1 -1
- package/lib/exercises/math/calculLitteral/equation/equationSimpleSquare.js +26 -1
- package/lib/exercises/math/calculLitteral/equation/equationType1Exercise.d.ts.map +1 -1
- package/lib/exercises/math/calculLitteral/equation/equationType1Exercise.js +18 -2
- package/lib/exercises/math/calculLitteral/equation/equationType2Exercise.d.ts.map +1 -1
- package/lib/exercises/math/calculLitteral/equation/equationType2Exercise.js +19 -2
- package/lib/exercises/math/calculLitteral/equation/equationType3Exercise.d.ts.map +1 -1
- package/lib/exercises/math/calculLitteral/equation/equationType3Exercise.js +15 -2
- package/lib/exercises/math/calculLitteral/equation/equationType4Exercise.d.ts.map +1 -1
- package/lib/exercises/math/calculLitteral/equation/equationType4Exercise.js +20 -5
- package/lib/exercises/math/calculLitteral/equation/firstDegreeEquation.d.ts.map +1 -1
- package/lib/exercises/math/calculLitteral/equation/firstDegreeEquation.js +24 -1
- package/lib/exercises/math/calculLitteral/equation/firstDegreeEquationIntType1.d.ts.map +1 -1
- package/lib/exercises/math/calculLitteral/equation/firstDegreeEquationIntType1.js +20 -1
- package/lib/exercises/math/calculLitteral/equation/firstDegreeEquationIntType2.d.ts.map +1 -1
- package/lib/exercises/math/calculLitteral/equation/firstDegreeEquationIntType2.js +19 -3
- package/lib/exercises/math/calculLitteral/equation/fractionEquation.d.ts.map +1 -1
- package/lib/exercises/math/calculLitteral/equation/fractionEquation.js +24 -8
- package/lib/exercises/math/calculLitteral/equation/multiplicationEquation.d.ts.map +1 -1
- package/lib/exercises/math/calculLitteral/equation/multiplicationEquation.js +21 -2
- package/lib/exercises/math/calculLitteral/factorisation/factoIdRmq1.d.ts.map +1 -1
- package/lib/exercises/math/calculLitteral/factorisation/factoIdRmq1.js +24 -4
- package/lib/exercises/math/calculLitteral/factorisation/factoIdRmq2.d.ts.map +1 -1
- package/lib/exercises/math/calculLitteral/factorisation/factoIdRmq2.js +25 -5
- package/lib/exercises/math/calculLitteral/factorisation/factoIdRmq3.d.ts.map +1 -1
- package/lib/exercises/math/calculLitteral/factorisation/factoIdRmq3.js +19 -0
- package/lib/exercises/math/calculLitteral/factorisation/factoType1Exercise.d.ts.map +1 -1
- package/lib/exercises/math/calculLitteral/factorisation/factoType1Exercise.js +1 -0
- package/lib/exercises/math/calculLitteral/factorisation/factorizeCanonicalForm.d.ts +8 -0
- package/lib/exercises/math/calculLitteral/factorisation/factorizeCanonicalForm.d.ts.map +1 -0
- package/lib/exercises/math/calculLitteral/factorisation/factorizeCanonicalForm.js +77 -0
- package/lib/exercises/math/calculLitteral/factorisation/factorizeCanonicalFormWithSqrt.d.ts +8 -0
- package/lib/exercises/math/calculLitteral/factorisation/factorizeCanonicalFormWithSqrt.d.ts.map +1 -0
- package/lib/exercises/math/calculLitteral/factorisation/factorizeCanonicalFormWithSqrt.js +80 -0
- package/lib/exercises/math/calculLitteral/factorisation/index.d.ts +2 -0
- package/lib/exercises/math/calculLitteral/factorisation/index.d.ts.map +1 -1
- package/lib/exercises/math/calculLitteral/factorisation/index.js +2 -0
- package/lib/exercises/math/equaDiff/equaDiffGeneralForme.d.ts.map +1 -1
- package/lib/exercises/math/equaDiff/equaDiffGeneralForme.js +1 -0
- package/lib/exercises/math/functions/basics/inverseImageFunctionTable.d.ts +2 -0
- package/lib/exercises/math/functions/basics/inverseImageFunctionTable.d.ts.map +1 -1
- package/lib/exercises/math/functions/basics/inverseImageFunctionTable.js +46 -66
- package/lib/exercises/math/functions/logarithm/log10PowerSimplifying.d.ts.map +1 -1
- package/lib/exercises/math/functions/logarithm/log10PowerSimplifying.js +12 -2
- package/lib/exercises/math/functions/trinoms/index.d.ts +2 -0
- package/lib/exercises/math/functions/trinoms/index.d.ts.map +1 -1
- package/lib/exercises/math/functions/trinoms/index.js +2 -0
- package/lib/exercises/math/functions/trinoms/solveEquationByFactorisation.d.ts +5 -0
- package/lib/exercises/math/functions/trinoms/solveEquationByFactorisation.d.ts.map +1 -0
- package/lib/exercises/math/functions/trinoms/solveEquationByFactorisation.js +44 -0
- package/lib/exercises/math/functions/trinoms/solveSecondDegreeEquationByFactorisation.d.ts +9 -0
- package/lib/exercises/math/functions/trinoms/solveSecondDegreeEquationByFactorisation.d.ts.map +1 -0
- package/lib/exercises/math/functions/trinoms/solveSecondDegreeEquationByFactorisation.js +134 -0
- package/lib/exercises/math/functions/trinoms/solveSecondDegreeEquationFromCano.d.ts +7 -0
- package/lib/exercises/math/functions/trinoms/solveSecondDegreeEquationFromCano.d.ts.map +1 -0
- package/lib/exercises/math/functions/trinoms/solveSecondDegreeEquationFromCano.js +59 -0
- package/lib/exercises/math/geometry/vectors/scalarProductViaCoords.d.ts.map +1 -1
- package/lib/exercises/math/geometry/vectors/scalarProductViaCoords.js +1 -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/percent/applyPercent.d.ts.map +1 -1
- package/lib/exercises/math/percent/applyPercent.js +20 -2
- package/lib/exercises/math/probaStat/probaFromTableNoContext.d.ts.map +1 -1
- package/lib/exercises/math/probaStat/probaFromTableNoContext.js +5 -4
- package/lib/exercises/math/sequences/arithmetic/arithmeticFindRandomTermFromTwoTerms.d.ts +11 -0
- package/lib/exercises/math/sequences/arithmetic/arithmeticFindRandomTermFromTwoTerms.d.ts.map +1 -0
- package/lib/exercises/math/sequences/arithmetic/arithmeticFindRandomTermFromTwoTerms.js +49 -0
- package/lib/exercises/math/sequences/arithmetic/index.d.ts +1 -0
- package/lib/exercises/math/sequences/arithmetic/index.d.ts.map +1 -1
- package/lib/exercises/math/sequences/arithmetic/index.js +1 -0
- package/lib/exercises/math/spaceGeometry/index.d.ts +2 -0
- package/lib/exercises/math/spaceGeometry/index.d.ts.map +1 -0
- package/lib/exercises/math/spaceGeometry/index.js +17 -0
- package/lib/exercises/math/spaceGeometry/vectors/index.d.ts +4 -0
- package/lib/exercises/math/spaceGeometry/vectors/index.d.ts.map +1 -0
- package/lib/exercises/math/spaceGeometry/vectors/index.js +19 -0
- package/lib/exercises/math/spaceGeometry/vectors/spaceVectorCoordinatesFromPoints.d.ts +5 -0
- package/lib/exercises/math/spaceGeometry/vectors/spaceVectorCoordinatesFromPoints.d.ts.map +1 -0
- package/lib/exercises/math/spaceGeometry/vectors/spaceVectorCoordinatesFromPoints.js +52 -0
- package/lib/exercises/math/spaceGeometry/vectors/spaceVectorLinearCombinationCoords.d.ts +5 -0
- package/lib/exercises/math/spaceGeometry/vectors/spaceVectorLinearCombinationCoords.d.ts.map +1 -0
- package/lib/exercises/math/spaceGeometry/vectors/spaceVectorLinearCombinationCoords.js +62 -0
- package/lib/exercises/math/spaceGeometry/vectors/spaceVectorNormCalculation.d.ts +9 -0
- package/lib/exercises/math/spaceGeometry/vectors/spaceVectorNormCalculation.d.ts.map +1 -0
- package/lib/exercises/math/spaceGeometry/vectors/spaceVectorNormCalculation.js +54 -0
- package/lib/exercises/math/squareRoots/squareRootIdentities.js +3 -3
- package/lib/exercises/math/suites/sequencePlot.d.ts.map +1 -1
- package/lib/exercises/math/suites/sequencePlot.js +1 -2
- package/lib/exercises/math/trigonometry/trigonometrySideCalcul.d.ts.map +1 -1
- package/lib/exercises/math/trigonometry/trigonometrySideCalcul.js +1 -0
- package/lib/exercises/pc/calibrationCurveOfSolution.d.ts.map +1 -1
- package/lib/exercises/pc/calibrationCurveOfSolution.js +1 -0
- package/lib/exercises/pc/chemicalElements/findAtomicStructureElement.d.ts.map +1 -1
- package/lib/exercises/pc/chemicalElements/findAtomicStructureElement.js +1 -0
- package/lib/exercises/pc/chemicalElements/massOrVolumeProportion.d.ts.map +1 -1
- package/lib/exercises/pc/chemicalElements/massOrVolumeProportion.js +1 -0
- package/lib/exercises/pc/chemicalReactions/calculateSynthesisEfficiency.d.ts.map +1 -1
- package/lib/exercises/pc/chemicalReactions/calculateSynthesisEfficiency.js +1 -0
- package/lib/exercises/pc/chemicalReactions/titrationEquivalenceRelation.d.ts.map +1 -1
- package/lib/exercises/pc/chemicalReactions/titrationEquivalenceRelation.js +1 -0
- package/lib/exercises/pc/dosage/beerLambertRandomValue.d.ts.map +1 -1
- package/lib/exercises/pc/dosage/beerLambertRandomValue.js +1 -0
- package/lib/exercises/pc/dosage/concentrationCalculation.d.ts.map +1 -1
- package/lib/exercises/pc/dosage/concentrationCalculation.js +1 -0
- package/lib/exercises/pc/dosage/concentrationFromMassCalculation.d.ts.map +1 -1
- package/lib/exercises/pc/dosage/concentrationFromMassCalculation.js +1 -0
- package/lib/exercises/pc/electricity/calculateIntensity.js +1 -1
- package/lib/exercises/pc/electricity/calculateVoltage.d.ts.map +1 -1
- package/lib/exercises/pc/electricity/calculateVoltage.js +1 -0
- package/lib/exercises/pc/electricity/electricPowerOrEnergyCalculation.d.ts.map +1 -1
- package/lib/exercises/pc/electricity/electricPowerOrEnergyCalculation.js +1 -0
- package/lib/exercises/pc/electricity/ohmLaw.d.ts.map +1 -1
- package/lib/exercises/pc/electricity/ohmLaw.js +1 -0
- package/lib/exercises/pc/electricity/ohmicConductorOrGenerator.d.ts.map +1 -1
- package/lib/exercises/pc/electricity/ohmicConductorOrGenerator.js +1 -0
- package/lib/exercises/pc/energy/calorificValue.d.ts.map +1 -1
- package/lib/exercises/pc/energy/calorificValue.js +1 -0
- package/lib/exercises/pc/energy/combustionTransferEnergy.d.ts.map +1 -1
- package/lib/exercises/pc/energy/combustionTransferEnergy.js +1 -0
- package/lib/exercises/pc/energy/combustionTransferEnergy2.d.ts.map +1 -1
- package/lib/exercises/pc/energy/combustionTransferEnergy2.js +1 -0
- package/lib/exercises/pc/energy/efficencyOfConverter.d.ts.map +1 -1
- package/lib/exercises/pc/energy/efficencyOfConverter.js +1 -0
- package/lib/exercises/pc/energy/efficiencyCalculation.d.ts.map +1 -1
- package/lib/exercises/pc/energy/efficiencyCalculation.js +1 -0
- package/lib/exercises/pc/energy/kineticEnergyOrMassOrSpeed.d.ts.map +1 -1
- package/lib/exercises/pc/energy/kineticEnergyOrMassOrSpeed.js +1 -0
- package/lib/exercises/pc/energy/thermalEnergyTransferCalculation.d.ts.map +1 -1
- package/lib/exercises/pc/energy/thermalEnergyTransferCalculation.js +1 -0
- package/lib/exercises/pc/forces/calculateNormalOrFrictionForce.d.ts.map +1 -1
- package/lib/exercises/pc/forces/calculateNormalOrFrictionForce.js +1 -0
- package/lib/exercises/pc/forces/electroStaticForce.d.ts.map +1 -1
- package/lib/exercises/pc/forces/electroStaticForce.js +1 -0
- package/lib/exercises/pc/forces/gravitationalAttractionObjectHeight.d.ts.map +1 -1
- package/lib/exercises/pc/forces/gravitationalAttractionObjectHeight.js +1 -0
- package/lib/exercises/pc/forces/gravitationalForcePlanets.d.ts.map +1 -1
- package/lib/exercises/pc/forces/gravitationalForcePlanets.js +1 -0
- package/lib/exercises/pc/forces/massWeight.d.ts.map +1 -1
- package/lib/exercises/pc/forces/massWeight.js +1 -0
- package/lib/exercises/pc/motion/averageSpeed.d.ts.map +1 -1
- package/lib/exercises/pc/motion/averageSpeed.js +1 -0
- package/lib/exercises/pc/motion/averageSpeedCalculation.d.ts.map +1 -1
- package/lib/exercises/pc/motion/averageSpeedCalculation.js +1 -0
- package/lib/exercises/pc/motion/motionReference.d.ts.map +1 -1
- package/lib/exercises/pc/motion/motionReference.js +1 -0
- package/lib/exercises/pc/pH.d.ts.map +1 -1
- package/lib/exercises/pc/pH.js +1 -0
- package/lib/exercises/pc/power/calculatePowerOfLight.d.ts.map +1 -1
- package/lib/exercises/pc/power/calculatePowerOfLight.js +1 -0
- package/lib/exercises/pc/spectral/spectralEnergy.d.ts.map +1 -1
- package/lib/exercises/pc/spectral/spectralEnergy.js +1 -0
- package/lib/exercises/pc/waves/lightDistanceConversion.d.ts.map +1 -1
- package/lib/exercises/pc/waves/lightDistanceConversion.js +1 -0
- package/lib/exercises/pc/waves/periodicWaveCelerity.d.ts.map +1 -1
- package/lib/exercises/pc/waves/periodicWaveCelerity.js +1 -0
- package/lib/exercises/pc/weight/calculateWeight.d.ts.map +1 -1
- package/lib/exercises/pc/weight/calculateWeight.js +1 -0
- package/lib/exercises/pc/weight/weightOnTheMoon.d.ts.map +1 -1
- package/lib/exercises/pc/weight/weightOnTheMoon.js +1 -0
- package/lib/index.d.ts +33 -64
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +4 -0
- package/lib/math/geometry/spacePoint.d.ts +27 -0
- package/lib/math/geometry/spacePoint.d.ts.map +1 -0
- package/lib/math/geometry/spacePoint.js +80 -0
- package/lib/math/geometry/spaceVector.d.ts +28 -0
- package/lib/math/geometry/spaceVector.d.ts.map +1 -0
- package/lib/math/geometry/spaceVector.js +83 -0
- package/lib/math/numbers/decimals/decimal.d.ts +1 -0
- package/lib/math/numbers/decimals/decimal.d.ts.map +1 -1
- package/lib/math/numbers/decimals/decimal.js +8 -0
- package/lib/math/numbers/rationals/rational.d.ts +1 -0
- package/lib/math/numbers/rationals/rational.d.ts.map +1 -1
- package/lib/math/numbers/rationals/rational.js +4 -0
- package/lib/math/utils/random/randTupleInt.d.ts +1 -0
- package/lib/math/utils/random/randTupleInt.d.ts.map +1 -1
- package/lib/math/utils/random/randTupleInt.js +5 -1
- package/lib/playground.d.ts +2 -0
- package/lib/playground.d.ts.map +1 -0
- package/lib/playground.js +20 -0
- package/lib/server.d.ts +3 -0
- package/lib/server.d.ts.map +1 -1
- package/lib/server.js +7 -0
- package/lib/tree/nodes/equations/equationSolutionNode.d.ts.map +1 -1
- package/lib/tree/nodes/equations/equationSolutionNode.js +8 -0
- package/lib/tree/nodes/node.d.ts +1 -0
- package/lib/tree/nodes/node.d.ts.map +1 -1
- package/lib/tree/nodes/operators/multiplyNode.d.ts.map +1 -1
- package/lib/tree/nodes/operators/multiplyNode.js +8 -2
- package/lib/tree/nodes/operators/powerNode.js +1 -1
- package/lib/utils/alignTex.d.ts +2 -0
- package/lib/utils/alignTex.d.ts.map +1 -0
- package/lib/utils/alignTex.js +18 -0
- package/package.json +1 -1
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SpaceVector = exports.SpaceVectorConstructor = void 0;
|
|
4
|
+
const sqrtNode_1 = require("../../tree/nodes/functions/sqrtNode");
|
|
5
|
+
const addNode_1 = require("../../tree/nodes/operators/addNode");
|
|
6
|
+
const multiplyNode_1 = require("../../tree/nodes/operators/multiplyNode");
|
|
7
|
+
const powerNode_1 = require("../../tree/nodes/operators/powerNode");
|
|
8
|
+
const substractNode_1 = require("../../tree/nodes/operators/substractNode");
|
|
9
|
+
const randint_1 = require("../utils/random/randint");
|
|
10
|
+
const spacePoint_1 = require("./spacePoint");
|
|
11
|
+
class SpaceVectorConstructor {
|
|
12
|
+
static fromPoints(origin, end) {
|
|
13
|
+
return new SpaceVector(`${origin.name}${end.name}`, new substractNode_1.SubstractNode(end.x, origin.x).simplify(), new substractNode_1.SubstractNode(end.y, origin.y).simplify(), new substractNode_1.SubstractNode(end.z, origin.z).simplify());
|
|
14
|
+
}
|
|
15
|
+
static random(name, allowNull = true) {
|
|
16
|
+
let x;
|
|
17
|
+
let y;
|
|
18
|
+
let z;
|
|
19
|
+
do {
|
|
20
|
+
x = (0, randint_1.randint)(-10, 11);
|
|
21
|
+
y = (0, randint_1.randint)(-10, 11);
|
|
22
|
+
z = (0, randint_1.randint)(-10, 11);
|
|
23
|
+
} while (!allowNull && x === 0 && y === 0 && z === 0);
|
|
24
|
+
return new SpaceVector(name, x.toTree(), y.toTree(), z.toTree());
|
|
25
|
+
}
|
|
26
|
+
static randomDifferents(names, allowNull = true) {
|
|
27
|
+
const res = [];
|
|
28
|
+
for (let i = 0; i < names.length; i++) {
|
|
29
|
+
let vec;
|
|
30
|
+
do {
|
|
31
|
+
vec = SpaceVectorConstructor.random(names[i], allowNull);
|
|
32
|
+
} while (res.some((v) => v.equals(vec)));
|
|
33
|
+
res.push(vec);
|
|
34
|
+
}
|
|
35
|
+
return res;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
exports.SpaceVectorConstructor = SpaceVectorConstructor;
|
|
39
|
+
class SpaceVector {
|
|
40
|
+
constructor(name, x, y, z) {
|
|
41
|
+
this.name = name;
|
|
42
|
+
this.tex = `\\overrightarrow{${name}}`;
|
|
43
|
+
this.x = x;
|
|
44
|
+
this.y = y;
|
|
45
|
+
this.z = z;
|
|
46
|
+
}
|
|
47
|
+
toTex() {
|
|
48
|
+
return `\\overrightarrow{${this.name}}`;
|
|
49
|
+
}
|
|
50
|
+
toInlineCoordsTex() {
|
|
51
|
+
return `\\left(${this.x.simplify().toTex()};${this.y
|
|
52
|
+
.simplify()
|
|
53
|
+
.toTex()};${this.z.simplify().toTex()}\\right)`;
|
|
54
|
+
}
|
|
55
|
+
toTexWithCoords() {
|
|
56
|
+
return `\\overrightarrow{${this.name}}\\begin{pmatrix}${this.x.toTex()} \\\\ ${this.y.toTex()} \\\\ ${this.z.toTex()} \\end{pmatrix}`;
|
|
57
|
+
}
|
|
58
|
+
isColinear(v) {
|
|
59
|
+
throw Error("unimplemented");
|
|
60
|
+
}
|
|
61
|
+
determinant(v) {
|
|
62
|
+
throw Error("unimplemented");
|
|
63
|
+
}
|
|
64
|
+
times(k, name) {
|
|
65
|
+
return new SpaceVector(name ?? "v", new multiplyNode_1.MultiplyNode(this.x, k).simplify(), new multiplyNode_1.MultiplyNode(this.y, k).simplify(), new multiplyNode_1.MultiplyNode(this.z, k).simplify());
|
|
66
|
+
}
|
|
67
|
+
scalarProduct(v) {
|
|
68
|
+
throw Error("unimplemented");
|
|
69
|
+
}
|
|
70
|
+
add(v) {
|
|
71
|
+
return new SpaceVector(`${this.name}+${v.name}`, new addNode_1.AddNode(this.x, v.x).simplify(), new addNode_1.AddNode(this.y, v.y).simplify(), new addNode_1.AddNode(this.z, v.z).simplify());
|
|
72
|
+
}
|
|
73
|
+
getNorm() {
|
|
74
|
+
return new sqrtNode_1.SqrtNode(new addNode_1.AddNode(new powerNode_1.SquareNode(this.x), new addNode_1.AddNode(new powerNode_1.SquareNode(this.y), new powerNode_1.SquareNode(this.z)))).simplify();
|
|
75
|
+
}
|
|
76
|
+
getEndPoint(startPoint, name) {
|
|
77
|
+
return new spacePoint_1.SpacePoint(name ?? "B", new addNode_1.AddNode(startPoint.x, this.x).simplify(), new addNode_1.AddNode(startPoint.y, this.y).simplify(), new addNode_1.AddNode(startPoint.z, this.z).simplify());
|
|
78
|
+
}
|
|
79
|
+
equals(v) {
|
|
80
|
+
return this.x.equals(v.x) && this.y.equals(v.y) && this.z.equals(v.z);
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
exports.SpaceVector = SpaceVector;
|
|
@@ -28,6 +28,7 @@ export declare class Decimal implements Nombre {
|
|
|
28
28
|
multiplyByPowerOfTen(power: number): Decimal;
|
|
29
29
|
toScientificPart(): number;
|
|
30
30
|
toScientificNotation(decimals?: number): NumberNode | MultiplyNode;
|
|
31
|
+
getDigitAtRank(rank: number): number;
|
|
31
32
|
toRational(): Rational | import("../integer/integer").Integer;
|
|
32
33
|
toTree(): NumberNode;
|
|
33
34
|
toPercentNode(): PercentNode;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"decimal.d.ts","sourceRoot":"","sources":["../../../../src/math/numbers/decimals/decimal.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,UAAU,EAAE,MAAM,qCAAqC,CAAC;AACjE,OAAO,EAAE,WAAW,EAAE,MAAM,sCAAsC,CAAC;AACnE,OAAO,EAAE,YAAY,EAAE,MAAM,yCAAyC,CAAC;AAEvE,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAC/C,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAEjD,eAAO,MAAM,iBAAiB,UAAyC,CAAC;AACxE,8BAAsB,kBAAkB;IACtC,MAAM,CAAC,cAAc,CAAC,SAAS,EAAE,MAAM,EAAE,YAAY,GAAE,MAAU,GAAG,MAAM;IAY1E,MAAM,CAAC,MAAM,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,SAAS,CAAC,EAAE,MAAM,GAAG,OAAO;IAMpE,MAAM,CAAC,SAAS,CAAC,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,GAAG,OAAO;IAK/D,MAAM,CAAC,gBAAgB,CAAC,SAAS,CAAC,EAAE,MAAM,GAAG,OAAO;CAMrD;AAED,qBAAa,OAAQ,YAAW,MAAM;IACpC,KAAK,EAAE,MAAM,CAAC;IACd,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,aAAsB;IAC1B,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,EAAE,MAAM,CAAC;gBACR,KAAK,EAAE,MAAM,GAAG,MAAM;IASlC,MAAM,CAAC,CAAC,EAAE,MAAM;IAIhB;;;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MAAM,CAAC,CAAC,EAAE,MAAM;IAIhB;;;;OAIG;IACH,KAAK,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM;IAIhC,oBAAoB,CAAC,KAAK,EAAE,MAAM;IAkClC,gBAAgB;IA6BhB,oBAAoB,CAAC,QAAQ,CAAC,EAAE,MAAM;IAwCtC,cAAc,CAAC,IAAI,EAAE,MAAM;IAS3B,UAAU;IAMV,MAAM;IAIN,aAAa;CAGd"}
|
|
@@ -154,6 +154,14 @@ class Decimal {
|
|
|
154
154
|
return new multiplyNode_1.MultiplyNode(decNode, new numberNode_1.NumberNode(10));
|
|
155
155
|
return new multiplyNode_1.MultiplyNode(decNode, new powerNode_1.PowerNode(new numberNode_1.NumberNode(10), new numberNode_1.NumberNode(power)));
|
|
156
156
|
}
|
|
157
|
+
getDigitAtRank(rank) {
|
|
158
|
+
if (rank >= 0) {
|
|
159
|
+
return Number(this.intPart.toString()[this.intPart.toString().length - 1 - rank]);
|
|
160
|
+
}
|
|
161
|
+
else {
|
|
162
|
+
return Number(this.decimalPart[-rank - 1]);
|
|
163
|
+
}
|
|
164
|
+
}
|
|
157
165
|
toRational() {
|
|
158
166
|
return new rational_1.Rational(this.multiplyByPowerOfTen(this.precision).value, 10 ** this.precision).simplify();
|
|
159
167
|
}
|
|
@@ -23,6 +23,7 @@ export declare class Rational implements Nombre {
|
|
|
23
23
|
toTex(): string;
|
|
24
24
|
add(nb: Nombre): Nombre;
|
|
25
25
|
multiply(nb: Nombre): Rational | Integer;
|
|
26
|
+
reverse(shouldSimplify: boolean): Nombre;
|
|
26
27
|
divide(nb: Nombre): Nombre;
|
|
27
28
|
opposite(): Rational;
|
|
28
29
|
toTree(opts?: NodeOptions): FractionNode | OppositeNode;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rational.d.ts","sourceRoot":"","sources":["../../../../src/math/numbers/rationals/rational.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,YAAY,EAAE,MAAM,yCAAyC,CAA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YAAY,EAAE,MAAM,yCAAyC,CAAC;AAIvE,OAAO,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAE7C,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAE/C,8BAAsB,mBAAmB;IACvC;;OAEG;IACH,MAAM,CAAC,kBAAkB,CAAC,MAAM,GAAE,MAAW;IAW7C,MAAM,CAAC,kBAAkB,CAAC,GAAG,GAAE,MAAW;IAO1C,MAAM,CAAC,0BAA0B,CAAC,GAAG,GAAE,MAAW;CAQnD;AAED,qBAAa,QAAS,YAAW,MAAM;IACrC,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,CAAC;IACd,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,CAAC;IACd,YAAY,EAAE,OAAO,CAAC;IACtB,IAAI,EAAE,UAAU,CAAC;gBAEL,SAAS,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM;IAYlD,MAAM,CAAC,CAAC,EAAE,MAAM;IAGhB,KAAK;IAML,GAAG,CAAC,EAAE,EAAE,MAAM,GAAG,MAAM;IAkBvB,QAAQ,CAAC,EAAE,EAAE,MAAM,GAAG,QAAQ,GAAG,OAAO;IAgBxC,OAAO,CAAC,cAAc,EAAE,OAAO,GAAG,MAAM;IAIxC,MAAM,CAAC,EAAE,EAAE,MAAM,GAAG,MAAM;IAgB1B,QAAQ,IAAI,QAAQ;IAIpB,MAAM,CAAC,IAAI,CAAC,EAAE,WAAW;IAgBzB,cAAc;IAId,QAAQ,IAAI,OAAO,GAAG,QAAQ;CAS/B"}
|
|
@@ -96,6 +96,10 @@ class Rational {
|
|
|
96
96
|
}
|
|
97
97
|
throw Error("not implemented yet");
|
|
98
98
|
}
|
|
99
|
+
reverse(shouldSimplify) {
|
|
100
|
+
const frac = new Rational(this.denum, this.num);
|
|
101
|
+
return shouldSimplify ? frac.simplify() : frac;
|
|
102
|
+
}
|
|
99
103
|
divide(nb) {
|
|
100
104
|
switch (nb.type) {
|
|
101
105
|
case nombre_1.NumberType.Integer: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"randTupleInt.d.ts","sourceRoot":"","sources":["../../../../src/math/utils/random/randTupleInt.ts"],"names":[],"mappings":"AAGA,UAAU,mBAAmB;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;
|
|
1
|
+
{"version":3,"file":"randTupleInt.d.ts","sourceRoot":"","sources":["../../../../src/math/utils/random/randTupleInt.ts"],"names":[],"mappings":"AAGA,UAAU,mBAAmB;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;IACpB,YAAY,CAAC,EAAE,OAAO,CAAC;CACxB;AAED;;;;GAIG;AACH,eAAO,MAAM,YAAY,SACjB,MAAM,WACH,mBAAmB,KAC3B,MAAM,EAUR,CAAC;AAEF,eAAO,MAAM,oBAAoB,OAC3B,MAAM,QACJ,MAAM,WACH,mBAAmB,KAC3B,MAAM,EAAE,EAUV,CAAC"}
|
|
@@ -11,7 +11,11 @@ const randint_1 = require("./randint");
|
|
|
11
11
|
const randTupleInt = (size, options) => {
|
|
12
12
|
const res = [];
|
|
13
13
|
for (let i = 0; i < size; i++) {
|
|
14
|
-
|
|
14
|
+
let x;
|
|
15
|
+
do {
|
|
16
|
+
x = (0, randint_1.randint)(options.from, options.to, options.excludes);
|
|
17
|
+
} while (options.allDifferent && res.includes(x));
|
|
18
|
+
res.push(x);
|
|
15
19
|
}
|
|
16
20
|
return res;
|
|
17
21
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"playground.d.ts","sourceRoot":"","sources":["../src/playground.ts"],"names":[],"mappings":"AAOA,eAAO,MAAM,UAAU,YAgBtB,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.playground = void 0;
|
|
4
|
+
const affine_1 = require("./math/polynomials/affine");
|
|
5
|
+
const randTupleInt_1 = require("./math/utils/random/randTupleInt");
|
|
6
|
+
const addNode_1 = require("./tree/nodes/operators/addNode");
|
|
7
|
+
const multiplyNode_1 = require("./tree/nodes/operators/multiplyNode");
|
|
8
|
+
const random_1 = require("./utils/random");
|
|
9
|
+
const shuffle_1 = require("./utils/shuffle");
|
|
10
|
+
const playground = () => {
|
|
11
|
+
const affines = affine_1.AffineConstructor.differentRandoms(3);
|
|
12
|
+
const permut = [
|
|
13
|
+
(0, shuffle_1.shuffle)([affines[0], affines[1]]),
|
|
14
|
+
(0, shuffle_1.shuffle)([affines[0], affines[2]]),
|
|
15
|
+
];
|
|
16
|
+
const operation = (0, random_1.random)(["add", "substract"]);
|
|
17
|
+
const statementTree = new addNode_1.AddNode(new multiplyNode_1.MultiplyNode(permut[0][0].toTree(), permut[0][1].toTree()), new multiplyNode_1.MultiplyNode(permut[1][0].toTree(), permut[1][1].toTree()));
|
|
18
|
+
console.log((0, randTupleInt_1.distinctRandTupleInt)(3, 2, { from: 1, to: 10 }));
|
|
19
|
+
};
|
|
20
|
+
exports.playground = playground;
|
package/lib/server.d.ts
CHANGED
package/lib/server.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":"AAUA,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;
|
|
1
|
+
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":"AAUA,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAuC3D,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,MAAM;QACd,MAAM,EAAE,MAAM,aAAa,CAAC;QAC5B,SAAS,EAAE,MAAM,MAAM,CAAC;QACxB,YAAY,EAAE,CAAC,QAAQ,CAAC,EAAE,MAAM,KAAK,aAAa,CAAC;KACpD;IACD,UAAU,MAAM;QACd,MAAM,EAAE,MAAM,aAAa,CAAC;KAC7B;CACF"}
|
package/lib/server.js
CHANGED
|
@@ -36,10 +36,15 @@ const cors_1 = __importDefault(require("cors"));
|
|
|
36
36
|
const numberNode_1 = require("./tree/nodes/numbers/numberNode");
|
|
37
37
|
const infiniteNode_1 = require("./tree/nodes/numbers/infiniteNode");
|
|
38
38
|
const toScientific_1 = require("./utils/numberPrototype/toScientific");
|
|
39
|
+
const variableNode_1 = require("./tree/nodes/variables/variableNode");
|
|
40
|
+
const playground_1 = require("./playground");
|
|
39
41
|
const jsonParser = body_parser_1.default.json();
|
|
40
42
|
const mathExercises = Object.values(MathExercises);
|
|
41
43
|
const pcExercises = Object.values(PCExercises);
|
|
42
44
|
const allExercises = [...mathExercises, ...pcExercises];
|
|
45
|
+
String.prototype.toTree = function () {
|
|
46
|
+
return new variableNode_1.VariableNode(this.valueOf());
|
|
47
|
+
};
|
|
43
48
|
Number.prototype.toTree = function () {
|
|
44
49
|
const value = this.valueOf();
|
|
45
50
|
if (value === Infinity)
|
|
@@ -59,7 +64,9 @@ const runServer = () => {
|
|
|
59
64
|
const app = (0, express_1.default)();
|
|
60
65
|
app.use((0, cors_1.default)());
|
|
61
66
|
console.log("math exos", mathExercises.length);
|
|
67
|
+
console.log("math hints", mathExercises.filter((exo) => exo.hasHintAndCorrection).length);
|
|
62
68
|
console.log("pc exos", pcExercises.length);
|
|
69
|
+
(0, playground_1.playground)();
|
|
63
70
|
app.get("/", (req, res) => {
|
|
64
71
|
res.json(allExercises);
|
|
65
72
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"equationSolutionNode.d.ts","sourceRoot":"","sources":["../../../../src/tree/nodes/equations/equationSolutionNode.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AACtD,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAE1D,KAAK,2BAA2B,GAAG;IAAE,QAAQ,CAAC,EAAE,MAAM,CAAC;IAAC,IAAI,CAAC,EAAE,WAAW,CAAA;CAAE,CAAC;AAC7E,qBAAa,oBAAqB,YAAW,IAAI;IAC/C,IAAI,EAAE,QAAQ,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;IACjB,YAAY,EAAE,eAAe,CAAC;IAC9B,IAAI,CAAC,EAAE,WAAW,CAAC;gBAEjB,YAAY,EAAE,eAAe,EAC7B,MAAM,CAAC,EAAE,2BAA2B;IActC,cAAc;IAId,SAAS;
|
|
1
|
+
{"version":3,"file":"equationSolutionNode.d.ts","sourceRoot":"","sources":["../../../../src/tree/nodes/equations/equationSolutionNode.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AACtD,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAE1D,KAAK,2BAA2B,GAAG;IAAE,QAAQ,CAAC,EAAE,MAAM,CAAC;IAAC,IAAI,CAAC,EAAE,WAAW,CAAA;CAAE,CAAC;AAC7E,qBAAa,oBAAqB,YAAW,IAAI;IAC/C,IAAI,EAAE,QAAQ,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;IACjB,YAAY,EAAE,eAAe,CAAC;IAC9B,IAAI,CAAC,EAAE,WAAW,CAAC;gBAEjB,YAAY,EAAE,eAAe,EAC7B,MAAM,CAAC,EAAE,2BAA2B;IActC,cAAc;IAId,SAAS;IAiBT,iBAAiB,CAAC,IAAI,CAAC,EAAE,WAAW;IAQpC,YAAY;IAGZ,QAAQ;IAGR,KAAK;CAGN"}
|
|
@@ -25,6 +25,14 @@ class EquationSolutionNode {
|
|
|
25
25
|
if (this.opts?.allowRawRightChildAsSolution)
|
|
26
26
|
res.push(solTex);
|
|
27
27
|
}
|
|
28
|
+
else {
|
|
29
|
+
const solTex = this.solutionsSet.elements.map((e) => e.toTex());
|
|
30
|
+
res.push(solTex.map((e) => `${this.variable}=${e}`).join("\\text{ ou }"));
|
|
31
|
+
if (this.opts?.allowRawRightChildAsSolution) {
|
|
32
|
+
res.push(solTex.join(";"));
|
|
33
|
+
res.push(solTex.join("\\text{ ou }"));
|
|
34
|
+
}
|
|
35
|
+
}
|
|
28
36
|
return res;
|
|
29
37
|
}
|
|
30
38
|
toEquivalentNodes(opts) {
|
package/lib/tree/nodes/node.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"node.d.ts","sourceRoot":"","sources":["../../../src/tree/nodes/node.ts"],"names":[],"mappings":"AAIA,oBAAY,QAAQ;IAClB,MAAM,IAAA;IACN,QAAQ,IAAA;IACR,QAAQ,IAAA;IACR,QAAQ,IAAA;IACR,QAAQ,IAAA;IACR,GAAG,IAAA;IACH,UAAU,IAAA;IACV,KAAK,IAAA;IACL,MAAM,IAAA;IACN,QAAQ,IAAA;IACR,OAAO,KAAA;IACP,MAAM,KAAA;CACP;AACD,MAAM,MAAM,WAAW,GAAG;IACxB,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAC/B,4BAA4B,CAAC,EAAE,OAAO,CAAC;IACvC,sBAAsB,CAAC,EAAE,OAAO,CAAC;IACjC,4BAA4B,CAAC,EAAE,OAAO,CAAC;IACvC,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,iBAAiB,CAAC,EAAE,OAAO,CAAC;CAC7B,CAAC;AAEF,MAAM,MAAM,YAAY,GAAG;IACzB,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,YAAY,CAAC,EAAE,OAAO,CAAC;IAEvB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,QAA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,cAAc,EAAE,CAAC,IAAI,CAAC,EAAE,WAAW,KAAK,MAAM,EAAE,CAAC;IACjD,KAAK,EAAE,CAAC,IAAI,CAAC,EAAE,YAAY,KAAK,MAAM,CAAC;CAGxC;AAED,eAAO,MAAM,eAAe,MAAO,IAAI,KAAG,OAMzC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"multiplyNode.d.ts","sourceRoot":"","sources":["../../../../src/tree/nodes/operators/multiplyNode.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,WAAW,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACpE,OAAO,EACL,uBAAuB,EACvB,WAAW,EAEZ,MAAM,gBAAgB,CAAC;AAYxB,OAAO,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAOlE,wBAAgB,cAAc,CAAC,CAAC,EAAE,IAAI,GAAG,CAAC,IAAI,YAAY,CAEzD;AAED,eAAO,MAAM,iBAAiB,QAAS,aAAa,EAAE,SAWrD,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,OAAO,aAGL;IAEF,YAAY,IAAI,MAAM;IAItB,KAAK,CAAC,IAAI,CAAC,EAAE,YAAY,GAAG,MAAM;
|
|
1
|
+
{"version":3,"file":"multiplyNode.d.ts","sourceRoot":"","sources":["../../../../src/tree/nodes/operators/multiplyNode.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,WAAW,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACpE,OAAO,EACL,uBAAuB,EACvB,WAAW,EAEZ,MAAM,gBAAgB,CAAC;AAYxB,OAAO,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAOlE,wBAAgB,cAAc,CAAC,CAAC,EAAE,IAAI,GAAG,CAAC,IAAI,YAAY,CAEzD;AAED,eAAO,MAAM,iBAAiB,QAAS,aAAa,EAAE,SAWrD,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,OAAO,aAGL;IAEF,YAAY,IAAI,MAAM;IAItB,KAAK,CAAC,IAAI,CAAC,EAAE,YAAY,GAAG,MAAM;IA4DlC,SAAS;IAkDT,iBAAiB,CAAC,IAAI,CAAC,EAAE,WAAW,GAAG,YAAY,EAAE;IAwFrD,cAAc,CAAC,IAAI,CAAC,EAAE,WAAW,GAAG,MAAM,EAAE;IAQ5C,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC;IAIrC,IAAI;IAGJ,QAAQ,CAAC,IAAI,CAAC,EAAE,eAAe,GAAG,aAAa;IA0H/C,MAAM,CAAC,IAAI,EAAE,aAAa;CAU3B"}
|
|
@@ -52,7 +52,8 @@ class MultiplyNode {
|
|
|
52
52
|
toTex(opts) {
|
|
53
53
|
let leftTex = this.leftChild.toTex(opts);
|
|
54
54
|
let rightTex = this.rightChild.toTex(opts);
|
|
55
|
-
if (
|
|
55
|
+
if (!opts?.forceNoSimplification &&
|
|
56
|
+
(0, numberNode_1.isNumberNode)(this.leftChild) &&
|
|
56
57
|
this.leftChild.value === 1 &&
|
|
57
58
|
opts?.scientific === undefined) {
|
|
58
59
|
return rightTex;
|
|
@@ -68,7 +69,7 @@ class MultiplyNode {
|
|
|
68
69
|
}
|
|
69
70
|
if (needBrackets)
|
|
70
71
|
rightTex = `\\left(${rightTex}\\right)`;
|
|
71
|
-
if (leftTex === "-1") {
|
|
72
|
+
if (leftTex === "-1" && !opts?.forceNoSimplification) {
|
|
72
73
|
// if (!isNumberNode(this.rightChild)) {
|
|
73
74
|
return "-" + rightTex;
|
|
74
75
|
// }
|
|
@@ -271,6 +272,11 @@ class MultiplyNode {
|
|
|
271
272
|
return new fractionNode_1.FractionNode(numNode, denumNode).simplify(opts);
|
|
272
273
|
}
|
|
273
274
|
const simplifyExternalNodes = (a, b) => {
|
|
275
|
+
if ((0, variableNode_1.isVariableNode)(a) && (0, variableNode_1.isVariableNode)(b)) {
|
|
276
|
+
if (a.name === b.name) {
|
|
277
|
+
return new powerNode_1.SquareNode(a);
|
|
278
|
+
}
|
|
279
|
+
}
|
|
274
280
|
if ((0, numberNode_1.isNumberNode)(a) && (0, numberNode_1.isNumberNode)(b)) {
|
|
275
281
|
return new numberNode_1.NumberNode((0, round_1.round)(a.value * b.value, 12));
|
|
276
282
|
}
|
|
@@ -171,7 +171,7 @@ class PowerNode {
|
|
|
171
171
|
return new PowerNode(leftSimplified.leftChild, new multiplyNode_1.MultiplyNode(rightSimplified, leftSimplified.rightChild).simplify(opts)).simplify(opts);
|
|
172
172
|
}
|
|
173
173
|
if ((0, multiplyNode_1.isMultiplyNode)(leftSimplified)) {
|
|
174
|
-
return new multiplyNode_1.MultiplyNode(new PowerNode(leftSimplified.leftChild, rightSimplified), new PowerNode(leftSimplified.rightChild, rightSimplified));
|
|
174
|
+
return new multiplyNode_1.MultiplyNode(new PowerNode(leftSimplified.leftChild, rightSimplified), new PowerNode(leftSimplified.rightChild, rightSimplified)).simplify(opts);
|
|
175
175
|
}
|
|
176
176
|
if (!opts?.keepPowers &&
|
|
177
177
|
(0, numberNode_1.isNumberNode)(copy.rightChild) &&
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"alignTex.d.ts","sourceRoot":"","sources":["../../src/utils/alignTex.ts"],"names":[],"mappings":"AAAA,wBAAgB,QAAQ,CAAC,GAAG,EAAE,MAAM,EAAE,EAAE,GAAG,MAAM,UAehD"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.alignTex = void 0;
|
|
4
|
+
function alignTex(arr) {
|
|
5
|
+
//! le "&" avant les join sert à aligner à gauche
|
|
6
|
+
//! mais ca crée un manque d'espace moche
|
|
7
|
+
//! je pense qu'il faut changer d'environnement (align)
|
|
8
|
+
//! utiliser un autre genre array ou equation je sais pas
|
|
9
|
+
const aligned = `$$
|
|
10
|
+
\\begin{align*}
|
|
11
|
+
${typeof arr === "string"
|
|
12
|
+
? arr
|
|
13
|
+
: arr.map((el) => "&" + el.join("&")).join(` \\\\`)}
|
|
14
|
+
\\end{align*}
|
|
15
|
+
$$`;
|
|
16
|
+
return aligned;
|
|
17
|
+
}
|
|
18
|
+
exports.alignTex = alignTex;
|