math-exercises 2.0.37 → 2.0.39
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/conversion/hoursToDecimal.d.ts +8 -0
- package/lib/exercises/conversion/hoursToDecimal.d.ts.map +1 -0
- package/lib/exercises/conversion/hoursToDecimal.js +72 -0
- package/lib/exercises/conversion/index.d.ts +1 -0
- package/lib/exercises/conversion/index.d.ts.map +1 -1
- package/lib/exercises/conversion/index.js +1 -0
- package/lib/exercises/derivation/derivative/thirdDegreeFunctionVariation.d.ts.map +1 -1
- package/lib/exercises/derivation/derivative/thirdDegreeFunctionVariation.js +1 -0
- package/lib/exercises/derivation/derivativeNumberReading.d.ts.map +1 -1
- package/lib/exercises/derivation/derivativeNumberReading.js +1 -0
- package/lib/exercises/exercise.d.ts +1 -0
- package/lib/exercises/exercise.d.ts.map +1 -1
- package/lib/exercises/functions/affines/affineExpressionReading.d.ts.map +1 -1
- package/lib/exercises/functions/affines/affineExpressionReading.js +1 -0
- package/lib/exercises/functions/affines/interceptReading.d.ts.map +1 -1
- package/lib/exercises/functions/affines/interceptReading.js +1 -0
- package/lib/exercises/functions/affines/leadingCoefficient.d.ts.map +1 -1
- package/lib/exercises/functions/affines/leadingCoefficient.js +1 -0
- package/lib/exercises/functions/basics/graphicEquation.d.ts.map +1 -1
- package/lib/exercises/functions/basics/graphicEquation.js +1 -0
- package/lib/exercises/functions/basics/graphicInequation.d.ts.map +1 -1
- package/lib/exercises/functions/basics/graphicInequation.js +1 -0
- package/lib/exercises/functions/basics/imageFunctionGeogebra.d.ts.map +1 -1
- package/lib/exercises/functions/basics/imageFunctionGeogebra.js +1 -0
- package/lib/exercises/functions/basics/inverseImageFunctionGeogebra.d.ts.map +1 -1
- package/lib/exercises/functions/basics/inverseImageFunctionGeogebra.js +1 -0
- package/lib/exercises/functions/index.d.ts +1 -0
- package/lib/exercises/functions/index.d.ts.map +1 -1
- package/lib/exercises/functions/index.js +1 -0
- package/lib/exercises/functions/parity/index.d.ts +3 -0
- package/lib/exercises/functions/parity/index.d.ts.map +1 -0
- package/lib/exercises/functions/parity/index.js +18 -0
- package/lib/exercises/functions/parity/parityFromAlgebra.d.ts +8 -0
- package/lib/exercises/functions/parity/parityFromAlgebra.d.ts.map +1 -0
- package/lib/exercises/functions/parity/parityFromAlgebra.js +117 -0
- package/lib/exercises/functions/parity/parityFromGraph.d.ts +8 -0
- package/lib/exercises/functions/parity/parityFromGraph.d.ts.map +1 -0
- package/lib/exercises/functions/parity/parityFromGraph.js +128 -0
- package/lib/exercises/functions/trinoms/rootsReading.d.ts.map +1 -1
- package/lib/exercises/functions/trinoms/rootsReading.js +1 -0
- package/lib/exercises/functions/trinoms/summitReading.d.ts.map +1 -1
- package/lib/exercises/functions/trinoms/summitReading.js +1 -0
- package/lib/exercises/geometry/areas/rightTriangleArea.d.ts.map +1 -1
- package/lib/exercises/geometry/areas/rightTriangleArea.js +1 -0
- package/lib/exercises/geometry/areas/triangleArea.d.ts.map +1 -1
- package/lib/exercises/geometry/areas/triangleArea.js +1 -0
- package/lib/exercises/geometry/pythagore/pythagore.d.ts.map +1 -1
- package/lib/exercises/geometry/pythagore/pythagore.js +1 -0
- package/lib/exercises/geometry/pythagore/pythagoreCalcul.d.ts.map +1 -1
- package/lib/exercises/geometry/pythagore/pythagoreCalcul.js +1 -0
- package/lib/exercises/geometry/thales/thales.d.ts.map +1 -1
- package/lib/exercises/geometry/thales/thales.js +1 -0
- package/lib/exercises/geometry/thales/thalesCalcul.d.ts.map +1 -1
- package/lib/exercises/geometry/thales/thalesCalcul.js +1 -0
- package/lib/exercises/geometry/vectors/coordinatesReading.d.ts.map +1 -1
- package/lib/exercises/geometry/vectors/coordinatesReading.js +1 -0
- package/lib/exercises/geometry/vectors/equalCaracteristicFromGraph.d.ts.map +1 -1
- package/lib/exercises/geometry/vectors/equalCaracteristicFromGraph.js +1 -0
- package/lib/exercises/limits/limitReading.d.ts.map +1 -1
- package/lib/exercises/limits/limitReading.js +1 -0
- package/lib/exercises/percent/index.d.ts +2 -0
- package/lib/exercises/percent/index.d.ts.map +1 -1
- package/lib/exercises/percent/index.js +2 -0
- package/lib/exercises/percent/percentToDecimal.d.ts +8 -0
- package/lib/exercises/percent/percentToDecimal.d.ts.map +1 -0
- package/lib/exercises/percent/percentToDecimal.js +69 -0
- package/lib/exercises/percent/valuePercent.d.ts +8 -0
- package/lib/exercises/percent/valuePercent.d.ts.map +1 -0
- package/lib/exercises/percent/valuePercent.js +45 -0
- package/lib/exercises/probaStat/probabilityTree.d.ts.map +1 -1
- package/lib/exercises/probaStat/probabilityTree.js +1 -0
- package/lib/exercises/sequences/arithmetic/arithmeticFirstTermsSum.d.ts +10 -0
- package/lib/exercises/sequences/arithmetic/arithmeticFirstTermsSum.d.ts.map +1 -0
- package/lib/exercises/sequences/arithmetic/arithmeticFirstTermsSum.js +50 -0
- package/lib/exercises/sequences/arithmetic/index.d.ts +1 -0
- package/lib/exercises/sequences/arithmetic/index.d.ts.map +1 -1
- package/lib/exercises/sequences/arithmetic/index.js +1 -0
- package/lib/exercises/sequences/arithmetic/recognizeArithmeticFromGraph.d.ts.map +1 -1
- package/lib/exercises/sequences/arithmetic/recognizeArithmeticFromGraph.js +1 -0
- package/lib/exercises/sequences/arithmetic/recognizeReasonFromGraph.d.ts.map +1 -1
- package/lib/exercises/sequences/arithmetic/recognizeReasonFromGraph.js +1 -0
- package/lib/exercises/trigonometry/trigonometry.d.ts.map +1 -1
- package/lib/exercises/trigonometry/trigonometry.js +1 -0
- package/lib/exercises/trigonometry/trigonometryAngleCalcul.d.ts.map +1 -1
- package/lib/exercises/trigonometry/trigonometryAngleCalcul.js +1 -0
- package/lib/exercises/trigonometry/trigonometrySideCalcul.d.ts.map +1 -1
- package/lib/exercises/trigonometry/trigonometrySideCalcul.js +1 -0
- package/lib/index.d.ts +103 -81
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +3 -0
- package/lib/math/numbers/decimals/decimal.d.ts +2 -0
- package/lib/math/numbers/decimals/decimal.d.ts.map +1 -1
- package/lib/math/numbers/decimals/decimal.js +4 -0
- package/lib/math/polynomials/polynomial.d.ts.map +1 -1
- package/lib/math/polynomials/polynomial.js +11 -0
- package/lib/math/polynomials/rationalFrac.d.ts.map +1 -1
- package/lib/math/polynomials/rationalFrac.js +13 -0
- package/lib/server.d.ts +1 -0
- package/lib/server.d.ts.map +1 -1
- package/lib/server.js +5 -0
- package/lib/types/keyIds.d.ts +1 -1
- package/lib/types/keyIds.d.ts.map +1 -1
- package/lib/utils/probaLawFlip.d.ts +5 -0
- package/lib/utils/probaLawFlip.d.ts.map +1 -1
- package/lib/utils/probaLawFlip.js +6 -1
- package/package.json +1 -1
package/lib/index.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
declare global {
|
|
2
2
|
interface Number {
|
|
3
3
|
toTree: () => AlgebraicNode;
|
|
4
|
+
frenchify: () => string;
|
|
4
5
|
}
|
|
5
6
|
}
|
|
6
7
|
import { AlgebraicNode } from "./tree/nodes/algebraicNode";
|
|
@@ -37,6 +38,23 @@ declare const mathExercises: (import("./exercises/exercise").MathExercise<{
|
|
|
37
38
|
}> | import("./exercises/exercise").MathExercise<{
|
|
38
39
|
rationalNum: [number, number];
|
|
39
40
|
rationalDenum: [number, number];
|
|
41
|
+
}> | import("./exercises/exercise").MathExercise<{
|
|
42
|
+
rational: [number, number];
|
|
43
|
+
rational2: [number, number];
|
|
44
|
+
}> | import("./exercises/exercise").MathExercise<{
|
|
45
|
+
num: number;
|
|
46
|
+
denum: number;
|
|
47
|
+
}> | import("./exercises/exercise").MathExercise<{
|
|
48
|
+
num: number;
|
|
49
|
+
denum: number;
|
|
50
|
+
leadingPart: number;
|
|
51
|
+
}> | import("./exercises/exercise").MathExercise<{
|
|
52
|
+
numbers: number[];
|
|
53
|
+
}> | import("./exercises/exercise").MathExercise<{
|
|
54
|
+
rand: number;
|
|
55
|
+
a: number;
|
|
56
|
+
b: number;
|
|
57
|
+
c: number;
|
|
40
58
|
}> | import("./exercises/exercise").MathExercise<{
|
|
41
59
|
/**
|
|
42
60
|
* TODO
|
|
@@ -70,23 +88,6 @@ declare const mathExercises: (import("./exercises/exercise").MathExercise<{
|
|
|
70
88
|
* ! espace tous les 3 chiffres dans un nb (le clavier doit le fournir aussi!)
|
|
71
89
|
|
|
72
90
|
*/
|
|
73
|
-
rational: [number, number];
|
|
74
|
-
rational2: [number, number];
|
|
75
|
-
}> | import("./exercises/exercise").MathExercise<{
|
|
76
|
-
num: number;
|
|
77
|
-
denum: number;
|
|
78
|
-
}> | import("./exercises/exercise").MathExercise<{
|
|
79
|
-
num: number;
|
|
80
|
-
denum: number;
|
|
81
|
-
leadingPart: number;
|
|
82
|
-
}> | import("./exercises/exercise").MathExercise<{
|
|
83
|
-
numbers: number[];
|
|
84
|
-
}> | import("./exercises/exercise").MathExercise<{
|
|
85
|
-
rand: number;
|
|
86
|
-
a: number;
|
|
87
|
-
b: number;
|
|
88
|
-
c: number;
|
|
89
|
-
}> | import("./exercises/exercise").MathExercise<{
|
|
90
91
|
numbers: number[];
|
|
91
92
|
}> | import("./exercises/exercise").MathExercise<{
|
|
92
93
|
rand: number;
|
|
@@ -255,6 +256,38 @@ declare const mathExercises: (import("./exercises/exercise").MathExercise<{
|
|
|
255
256
|
z1: number[];
|
|
256
257
|
z2: number[];
|
|
257
258
|
}> | import("./exercises/exercise").MathExercise<{
|
|
259
|
+
/**
|
|
260
|
+
* TODO
|
|
261
|
+
* Décimal : permettre facilement -0.xxx
|
|
262
|
+
* Tree shaking export
|
|
263
|
+
*
|
|
264
|
+
* VEA:
|
|
265
|
+
* -> -3x est bien transofmré en -3*x, x*(-3) mais pas en -x*3
|
|
266
|
+
* ->> faire le meme delire que pour les power mais pour les opposite ?
|
|
267
|
+
* c'est à dire créer toutes les permuts en déplacant le moins qquepart
|
|
268
|
+
* -> faire des nodes pour les Ensembles de nombre
|
|
269
|
+
*
|
|
270
|
+
* !-> choses pour lesquelles la v1 ne marchera pas :
|
|
271
|
+
* !-- fractions non réduites
|
|
272
|
+
* !-- nbs décimaux avec des 0
|
|
273
|
+
* !-- nb quelconque de moins, genre -3*-4 ou -x/-y
|
|
274
|
+
* !-> pour ces choses là il faut obligatoirement parser la rpéonse élève ?
|
|
275
|
+
*
|
|
276
|
+
* Passer les sqrtNode en tree-iable
|
|
277
|
+
*
|
|
278
|
+
*
|
|
279
|
+
*
|
|
280
|
+
* !!!à fix :
|
|
281
|
+
* ! fraction réductible
|
|
282
|
+
* ! 0,20 au lieu de 0,2
|
|
283
|
+
* ! moins partout dans fraction
|
|
284
|
+
* !puissances négatives vers inverse fraction
|
|
285
|
+
* ! simplification du ln
|
|
286
|
+
* ! meileure gestion des [] : le clavier devriat pouvoir produire des left/right ;
|
|
287
|
+
* !aussi en tapant [ puis diviser, le crochet passe en numérateur
|
|
288
|
+
* ! espace tous les 3 chiffres dans un nb (le clavier doit le fournir aussi!)
|
|
289
|
+
|
|
290
|
+
*/
|
|
258
291
|
re: number;
|
|
259
292
|
im: number;
|
|
260
293
|
}> | import("./exercises/exercise").MathExercise<{
|
|
@@ -292,6 +325,9 @@ declare const mathExercises: (import("./exercises/exercise").MathExercise<{
|
|
|
292
325
|
randomUnitIndex: number;
|
|
293
326
|
randomUnitInstructionIndex: number;
|
|
294
327
|
randomVolume: number;
|
|
328
|
+
}> | import("./exercises/exercise").MathExercise<{
|
|
329
|
+
dec: number;
|
|
330
|
+
isDecimalToHours: boolean;
|
|
295
331
|
}> | import("./exercises/exercise").MathExercise<{
|
|
296
332
|
tex: string;
|
|
297
333
|
}> | import("./exercises/exercise").MathExercise<{
|
|
@@ -524,38 +560,12 @@ declare const mathExercises: (import("./exercises/exercise").MathExercise<{
|
|
|
524
560
|
signs: number[];
|
|
525
561
|
isLog10: boolean;
|
|
526
562
|
}> | import("./exercises/exercise").MathExercise<{
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
* -> -3x est bien transofmré en -3*x, x*(-3) mais pas en -x*3
|
|
534
|
-
* ->> faire le meme delire que pour les power mais pour les opposite ?
|
|
535
|
-
* c'est à dire créer toutes les permuts en déplacant le moins qquepart
|
|
536
|
-
* -> faire des nodes pour les Ensembles de nombre
|
|
537
|
-
*
|
|
538
|
-
* !-> choses pour lesquelles la v1 ne marchera pas :
|
|
539
|
-
* !-- fractions non réduites
|
|
540
|
-
* !-- nbs décimaux avec des 0
|
|
541
|
-
* !-- nb quelconque de moins, genre -3*-4 ou -x/-y
|
|
542
|
-
* !-> pour ces choses là il faut obligatoirement parser la rpéonse élève ?
|
|
543
|
-
*
|
|
544
|
-
* Passer les sqrtNode en tree-iable
|
|
545
|
-
*
|
|
546
|
-
*
|
|
547
|
-
*
|
|
548
|
-
* !!!à fix :
|
|
549
|
-
* ! fraction réductible
|
|
550
|
-
* ! 0,20 au lieu de 0,2
|
|
551
|
-
* ! moins partout dans fraction
|
|
552
|
-
* !puissances négatives vers inverse fraction
|
|
553
|
-
* ! simplification du ln
|
|
554
|
-
* ! meileure gestion des [] : le clavier devriat pouvoir produire des left/right ;
|
|
555
|
-
* !aussi en tapant [ puis diviser, le crochet passe en numérateur
|
|
556
|
-
* ! espace tous les 3 chiffres dans un nb (le clavier doit le fournir aussi!)
|
|
557
|
-
|
|
558
|
-
*/
|
|
563
|
+
type: string;
|
|
564
|
+
fctTex: string;
|
|
565
|
+
}> | import("./exercises/exercise").MathExercise<{
|
|
566
|
+
type: string;
|
|
567
|
+
fctCmd: string;
|
|
568
|
+
}> | import("./exercises/exercise").MathExercise<{
|
|
559
569
|
coin: boolean;
|
|
560
570
|
radius: number;
|
|
561
571
|
diametre: number;
|
|
@@ -623,6 +633,38 @@ declare const mathExercises: (import("./exercises/exercise").MathExercise<{
|
|
|
623
633
|
}> | import("./exercises/exercise").MathExercise<{
|
|
624
634
|
xu: number;
|
|
625
635
|
yu: number;
|
|
636
|
+
/**
|
|
637
|
+
* TODO
|
|
638
|
+
* Décimal : permettre facilement -0.xxx
|
|
639
|
+
* Tree shaking export
|
|
640
|
+
*
|
|
641
|
+
* VEA:
|
|
642
|
+
* -> -3x est bien transofmré en -3*x, x*(-3) mais pas en -x*3
|
|
643
|
+
* ->> faire le meme delire que pour les power mais pour les opposite ?
|
|
644
|
+
* c'est à dire créer toutes les permuts en déplacant le moins qquepart
|
|
645
|
+
* -> faire des nodes pour les Ensembles de nombre
|
|
646
|
+
*
|
|
647
|
+
* !-> choses pour lesquelles la v1 ne marchera pas :
|
|
648
|
+
* !-- fractions non réduites
|
|
649
|
+
* !-- nbs décimaux avec des 0
|
|
650
|
+
* !-- nb quelconque de moins, genre -3*-4 ou -x/-y
|
|
651
|
+
* !-> pour ces choses là il faut obligatoirement parser la rpéonse élève ?
|
|
652
|
+
*
|
|
653
|
+
* Passer les sqrtNode en tree-iable
|
|
654
|
+
*
|
|
655
|
+
*
|
|
656
|
+
*
|
|
657
|
+
* !!!à fix :
|
|
658
|
+
* ! fraction réductible
|
|
659
|
+
* ! 0,20 au lieu de 0,2
|
|
660
|
+
* ! moins partout dans fraction
|
|
661
|
+
* !puissances négatives vers inverse fraction
|
|
662
|
+
* ! simplification du ln
|
|
663
|
+
* ! meileure gestion des [] : le clavier devriat pouvoir produire des left/right ;
|
|
664
|
+
* !aussi en tapant [ puis diviser, le crochet passe en numérateur
|
|
665
|
+
* ! espace tous les 3 chiffres dans un nb (le clavier doit le fournir aussi!)
|
|
666
|
+
|
|
667
|
+
*/
|
|
626
668
|
xv: number;
|
|
627
669
|
yv: number;
|
|
628
670
|
}> | import("./exercises/exercise").MathExercise<{
|
|
@@ -713,44 +755,19 @@ declare const mathExercises: (import("./exercises/exercise").MathExercise<{
|
|
|
713
755
|
rate: number;
|
|
714
756
|
nbMois: number;
|
|
715
757
|
}> | import("./exercises/exercise").MathExercise<{
|
|
716
|
-
isFromEvolutionToCM: boolean;
|
|
717
|
-
* TODO
|
|
718
|
-
* Décimal : permettre facilement -0.xxx
|
|
719
|
-
* Tree shaking export
|
|
720
|
-
*
|
|
721
|
-
* VEA:
|
|
722
|
-
* -> -3x est bien transofmré en -3*x, x*(-3) mais pas en -x*3
|
|
723
|
-
* ->> faire le meme delire que pour les power mais pour les opposite ?
|
|
724
|
-
* c'est à dire créer toutes les permuts en déplacant le moins qquepart
|
|
725
|
-
* -> faire des nodes pour les Ensembles de nombre
|
|
726
|
-
*
|
|
727
|
-
* !-> choses pour lesquelles la v1 ne marchera pas :
|
|
728
|
-
* !-- fractions non réduites
|
|
729
|
-
* !-- nbs décimaux avec des 0
|
|
730
|
-
* !-- nb quelconque de moins, genre -3*-4 ou -x/-y
|
|
731
|
-
* !-> pour ces choses là il faut obligatoirement parser la rpéonse élève ?
|
|
732
|
-
*
|
|
733
|
-
* Passer les sqrtNode en tree-iable
|
|
734
|
-
*
|
|
735
|
-
*
|
|
736
|
-
*
|
|
737
|
-
* !!!à fix :
|
|
738
|
-
* ! fraction réductible
|
|
739
|
-
* ! 0,20 au lieu de 0,2
|
|
740
|
-
* ! moins partout dans fraction
|
|
741
|
-
* !puissances négatives vers inverse fraction
|
|
742
|
-
* ! simplification du ln
|
|
743
|
-
* ! meileure gestion des [] : le clavier devriat pouvoir produire des left/right ;
|
|
744
|
-
* !aussi en tapant [ puis diviser, le crochet passe en numérateur
|
|
745
|
-
* ! espace tous les 3 chiffres dans un nb (le clavier doit le fournir aussi!)
|
|
746
|
-
|
|
747
|
-
*/
|
|
758
|
+
isFromEvolutionToCM: boolean;
|
|
748
759
|
evolution: number;
|
|
749
760
|
}> | import("./exercises/exercise").MathExercise<{
|
|
750
761
|
evolutions: string[];
|
|
751
762
|
}> | import("./exercises/exercise").MathExercise<{
|
|
752
763
|
randPercent: number;
|
|
753
764
|
isUp: boolean;
|
|
765
|
+
}> | import("./exercises/exercise").MathExercise<{
|
|
766
|
+
isPercentToDecimal: boolean;
|
|
767
|
+
nb: number;
|
|
768
|
+
}> | import("./exercises/exercise").MathExercise<{
|
|
769
|
+
percent: number;
|
|
770
|
+
nb: number;
|
|
754
771
|
}> | import("./exercises/exercise").MathExercise<{
|
|
755
772
|
int: number;
|
|
756
773
|
power: number;
|
|
@@ -905,6 +922,11 @@ declare const mathExercises: (import("./exercises/exercise").MathExercise<{
|
|
|
905
922
|
}> | import("./exercises/exercise").MathExercise<{
|
|
906
923
|
isAri: boolean;
|
|
907
924
|
sequence: number[];
|
|
925
|
+
}> | import("./exercises/exercise").MathExercise<{
|
|
926
|
+
firstRank: number;
|
|
927
|
+
firstValue: number;
|
|
928
|
+
reason: number;
|
|
929
|
+
nbTerms: number;
|
|
908
930
|
}> | import("./exercises/exercise").MathExercise<{
|
|
909
931
|
firstValue: number;
|
|
910
932
|
reason: number;
|
package/lib/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAGA,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,MAAM;QACd,MAAM,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAGA,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,MAAM;QACd,MAAM,EAAE,MAAM,aAAa,CAAC;QAC5B,SAAS,EAAE,MAAM,MAAM,CAAC;KACzB;CACF;AAgDD,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAC3D,QAAA,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAtCnB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;MA+BE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IA/BF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;MA+BE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IA/BF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;MA+BE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAO4C,CAAC;AAE/C,OAAO,EAAE,aAAa,EAAE,CAAC"}
|
package/lib/index.js
CHANGED
|
@@ -34,6 +34,9 @@ Number.prototype.toTree = function () {
|
|
|
34
34
|
return infiniteNode_1.MinusInfinityNode;
|
|
35
35
|
return new numberNode_1.NumberNode(value);
|
|
36
36
|
};
|
|
37
|
+
Number.prototype.frenchify = function () {
|
|
38
|
+
return (this.valueOf() + "").replace(".", ",");
|
|
39
|
+
};
|
|
37
40
|
/**
|
|
38
41
|
* TODO
|
|
39
42
|
* Décimal : permettre facilement -0.xxx
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { NumberNode } from "../../../tree/nodes/numbers/numberNode";
|
|
2
|
+
import { PercentNode } from "../../../tree/nodes/numbers/percentNode";
|
|
2
3
|
import { MultiplyNode } from "../../../tree/nodes/operators/multiplyNode";
|
|
3
4
|
import { Nombre, NumberType } from "../nombre";
|
|
4
5
|
import { Rational } from "../rationals/rational";
|
|
@@ -28,5 +29,6 @@ export declare class Decimal implements Nombre {
|
|
|
28
29
|
toScientificNotation(): NumberNode | MultiplyNode;
|
|
29
30
|
toRational(): Rational | import("../integer/integer").Integer;
|
|
30
31
|
toTree(): NumberNode;
|
|
32
|
+
toPercentNode(): PercentNode;
|
|
31
33
|
}
|
|
32
34
|
//# sourceMappingURL=decimal.d.ts.map
|
|
@@ -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,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,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,gB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AAa,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;IASzB,MAAM,CAAC,CAAC,EAAE,MAAM;IAIhB;;;;OAIG;IACH,KAAK,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM;IAIhC,oBAAoB,CAAC,KAAK,EAAE,MAAM;IAkClC,gBAAgB;IA2BhB,oBAAoB;IAsBpB,UAAU;IAMV,MAAM;IAIN,aAAa;CAGd"}
|
|
@@ -4,6 +4,7 @@ exports.Decimal = exports.DecimalConstructor = void 0;
|
|
|
4
4
|
const randint_1 = require("../../../math/utils/random/randint");
|
|
5
5
|
const round_1 = require("../../../math/utils/round");
|
|
6
6
|
const numberNode_1 = require("../../../tree/nodes/numbers/numberNode");
|
|
7
|
+
const percentNode_1 = require("../../../tree/nodes/numbers/percentNode");
|
|
7
8
|
const multiplyNode_1 = require("../../../tree/nodes/operators/multiplyNode");
|
|
8
9
|
const powerNode_1 = require("../../../tree/nodes/operators/powerNode");
|
|
9
10
|
const nombre_1 = require("../nombre");
|
|
@@ -138,5 +139,8 @@ class Decimal {
|
|
|
138
139
|
toTree() {
|
|
139
140
|
return new numberNode_1.NumberNode(this.value);
|
|
140
141
|
}
|
|
142
|
+
toPercentNode() {
|
|
143
|
+
return new percentNode_1.PercentNode(this.multiplyByPowerOfTen(2).value);
|
|
144
|
+
}
|
|
141
145
|
}
|
|
142
146
|
exports.Decimal = Decimal;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"polynomial.d.ts","sourceRoot":"","sources":["../../../src/math/polynomials/polynomial.ts"],"names":[],"mappings":"AAAA,OAAO,EAAQ,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAC1D,OAAO,EAAE,UAAU,EAAE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AAC,IAAI,CAAC,EAAE,WAAW;IA+BlC,SAAS,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM;IAO5B,QAAQ,CAAC,EAAE,EAAE,UAAU,GAAG,UAAU,GAAG,MAAM;IAiB7C,YAAY,CAAC,EAAE,EAAE,UAAU,GAAG,UAAU;IAiBxC,MAAM,CAAC,IAAI,CAAC,EAAE,WAAW;IAuCzB,KAAK,IAAI,MAAM;IAyBf,QAAQ,IAAI,MAAM;CAGnB"}
|
|
@@ -213,6 +213,17 @@ class Polynomial {
|
|
|
213
213
|
scalarDivide(n) {
|
|
214
214
|
return new Polynomial(this.coefficients.map((coeff) => coeff / n), this.variable);
|
|
215
215
|
}
|
|
216
|
+
// divide(Q: Polynomial): Polynomial {
|
|
217
|
+
// function n / d is
|
|
218
|
+
// require d ≠ 0
|
|
219
|
+
// q ← 0
|
|
220
|
+
// r ← n // At each step n = d × q + r
|
|
221
|
+
// while r ≠ 0 and degree(r) ≥ degree(d) do
|
|
222
|
+
// t ← lead(r) / lead(d) // Divide the leading terms
|
|
223
|
+
// q ← q + t
|
|
224
|
+
// r ← r − t × d
|
|
225
|
+
// return (q, r)
|
|
226
|
+
// }
|
|
216
227
|
opposite() {
|
|
217
228
|
return new Polynomial(this.coefficients.map((coeff) => -coeff), this.variable);
|
|
218
229
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rationalFrac.d.ts","sourceRoot":"","sources":["../../../src/math/polynomials/rationalFrac.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,yCAAyC,CAAC;AACvE,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,QAAQ,EAAE,MAAM,+BAA+B,CAAC;AAEzD,OAAO,EAAE,OAAO,EAAE,MAAM,4BAA4B,CAAC;AAGrD,qBAAa,YAAY;IACvB,GAAG,EAAE,UAAU,CAAC;IAChB,KAAK,EAAE,UAAU,CAAC;gBACN,GAAG,EAAE,UAAU,EAAE,KAAK,EAAE,UAAU;IAI9C,MAAM;
|
|
1
|
+
{"version":3,"file":"rationalFrac.d.ts","sourceRoot":"","sources":["../../../src/math/polynomials/rationalFrac.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,yCAAyC,CAAC;AACvE,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,QAAQ,EAAE,MAAM,+BAA+B,CAAC;AAEzD,OAAO,EAAE,OAAO,EAAE,MAAM,4BAA4B,CAAC;AAGrD,qBAAa,YAAY;IACvB,GAAG,EAAE,UAAU,CAAC;IAChB,KAAK,EAAE,UAAU,CAAC;gBACN,GAAG,EAAE,UAAU,EAAE,KAAK,EAAE,UAAU;IAI9C,MAAM;IAiBN,QAAQ;CAuCT"}
|
|
@@ -14,6 +14,19 @@ class RationalFrac {
|
|
|
14
14
|
toTree() {
|
|
15
15
|
return new fractionNode_1.FractionNode(this.num.toTree(), this.denum.toTree());
|
|
16
16
|
}
|
|
17
|
+
// isSimplified(){
|
|
18
|
+
// if (this.num.coefficients.length === 1 && this.num.coefficients[0] === 0)
|
|
19
|
+
// return true;
|
|
20
|
+
// const numCoeffs = this.num.coefficients.filter((c) => c !== 0);
|
|
21
|
+
// const numPGCD = numCoeffs.length > 1 ? gcd(...numCoeffs) : numCoeffs[0];
|
|
22
|
+
// const denumCoeffs = this.denum.coefficients.filter((c) => c !== 0);
|
|
23
|
+
// const denumPGCD =
|
|
24
|
+
// denumCoeffs.length > 1 ? gcd(...denumCoeffs) : denumCoeffs[0];
|
|
25
|
+
// const rational = new Rational(numPGCD, denumPGCD);
|
|
26
|
+
// if (rational.isIrreductible()) {
|
|
27
|
+
// return this;
|
|
28
|
+
// }
|
|
29
|
+
// }
|
|
17
30
|
simplify() {
|
|
18
31
|
if (this.num.coefficients.length === 1 && this.num.coefficients[0] === 0)
|
|
19
32
|
return new integer_1.Integer(0);
|
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":"AACA,OAAO,KAAK,SAAS,MAAM,aAAa,CAAC;AAGzC,OAAO,EAAE,SAAS,EAAE,CAAC;AAarB,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;
|
|
1
|
+
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,SAAS,MAAM,aAAa,CAAC;AAGzC,OAAO,EAAE,SAAS,EAAE,CAAC;AAarB,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAgB3D,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,MAAM;QACd,MAAM,EAAE,MAAM,aAAa,CAAC;QAC5B,SAAS,EAAE,MAAM,MAAM,CAAC;KACzB;CACF"}
|
package/lib/server.js
CHANGED
|
@@ -37,6 +37,7 @@ const dotenv_1 = __importDefault(require("dotenv"));
|
|
|
37
37
|
const cors_1 = __importDefault(require("cors"));
|
|
38
38
|
const numberNode_1 = require("./tree/nodes/numbers/numberNode");
|
|
39
39
|
const infiniteNode_1 = require("./tree/nodes/numbers/infiniteNode");
|
|
40
|
+
const round_1 = require("./math/utils/round");
|
|
40
41
|
const jsonParser = body_parser_1.default.json();
|
|
41
42
|
const allExercises = [...exercises];
|
|
42
43
|
Number.prototype.toTree = function () {
|
|
@@ -47,11 +48,15 @@ Number.prototype.toTree = function () {
|
|
|
47
48
|
return infiniteNode_1.MinusInfinityNode;
|
|
48
49
|
return new numberNode_1.NumberNode(value);
|
|
49
50
|
};
|
|
51
|
+
Number.prototype.frenchify = function () {
|
|
52
|
+
return (this.valueOf() + "").replace(".", ",");
|
|
53
|
+
};
|
|
50
54
|
const runServer = () => {
|
|
51
55
|
dotenv_1.default.config();
|
|
52
56
|
const app = (0, express_1.default)();
|
|
53
57
|
app.use((0, cors_1.default)());
|
|
54
58
|
console.log(exercises.length);
|
|
59
|
+
console.log((0, round_1.round)((35 * 10) / 6, 2) * 100);
|
|
55
60
|
app.get("/", (req, res) => {
|
|
56
61
|
res.json(allExercises);
|
|
57
62
|
});
|
package/lib/types/keyIds.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export type KeyId =
|
|
2
2
|
/**units */
|
|
3
|
-
"cm" | "cm2" | "celsius" | "Hz" | "mol" | "kJ" | "mL"
|
|
3
|
+
"cm" | "cm2" | "celsius" | "Hz" | "mol" | "kJ" | "mL" | "minutes" | "hours"
|
|
4
4
|
/**utility */
|
|
5
5
|
| "custom" | "right" | "left" | "rightarrow" | "del" | "close" | "switch" | "maj"
|
|
6
6
|
/**words */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"keyIds.d.ts","sourceRoot":"","sources":["../../src/types/keyIds.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,KAAK;AACf,WAAW;AACT,IAAI,GACJ,KAAK,GACL,SAAS,GACT,IAAI,GACJ,KAAK,GACL,IAAI,GACJ,IAAI;
|
|
1
|
+
{"version":3,"file":"keyIds.d.ts","sourceRoot":"","sources":["../../src/types/keyIds.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,KAAK;AACf,WAAW;AACT,IAAI,GACJ,KAAK,GACL,SAAS,GACT,IAAI,GACJ,KAAK,GACL,IAAI,GACJ,IAAI,GACJ,SAAS,GACT,OAAO;AAET,aAAa;GACX,QAAQ,GACR,OAAO,GACP,MAAM,GACN,YAAY,GACZ,KAAK,GACL,OAAO,GACP,QAAQ,GACR,KAAK;AAEP,WAAW;GACT,IAAI,GACJ,IAAI,GACJ,OAAO;AAET,cAAc;GACZ,gBAAgB,GAChB,QAAQ,GACR,SAAS;AAEX,gBAAgB;GACd,MAAM,GACN,OAAO,GACP,OAAO,GACP,MAAM,GACN,QAAQ,GACR,MAAM,GACN,SAAS,GACT,QAAQ,GACR,MAAM,GACN,OAAO,GACP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qB,GACrB,kBAAkB,GAClB,mBAAmB,GACnB,mBAAmB,GACnB,sBAAsB,GACtB,oBAAoB,GACpB,mBAAmB,GACnB,yBAAyB,GACzB,mBAAmB,GACnB,MAAM,GACN,kBAAkB,GAClB,wBAAwB,GACxB,sBAAsB,GACtB,sBAAsB,GACtB,uBAAuB,GACvB,qBAAqB,GACrB,qBAAqB,GACrB,uBAAuB,GACvB,mBAAmB,GACnB,QAAQ,GACR,mBAAmB,GACnB,mBAAmB,GACnB,QAAQ,GACR,uBAAuB,GACvB,QAAQ,GACR,sBAAsB,GACtB,QAAQ,GACR,sBAAsB,GACtB,OAAO,GACP,sBAAsB,GACtB,sBAAsB,GACtB,kBAAkB,GAClB,wBAAwB,GACxB,qBAAqB,GACrB,UAAU,GACV,mBAAmB,GACnB,yBAAyB,GACzB,iBAAiB,GACjB,uBAAuB,GACvB,iBAAiB,GACjB,oBAAoB,GACpB,iBAAiB,GACjB,kBAAkB,GAClB,qBAAqB,GACrB,mBAAmB,GACnB,sBAAsB,GACtB,oBAAoB,GACpB,eAAe,GACf,aAAa,GACb,aAAa,GACb,eAAe,GACf,eAAe,GACf,eAAe,GACf,uBAAuB,GACvB,gBAAgB,GAChB,mBAAmB,GACnB,sBAAsB,GACtB,qBAAqB,GACrB,kBAAkB,GAClB,wBAAwB,GACxB,uBAAuB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"probaLawFlip.d.ts","sourceRoot":"","sources":["../../src/utils/probaLawFlip.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,YAAY,
|
|
1
|
+
{"version":3,"file":"probaLawFlip.d.ts","sourceRoot":"","sources":["../../src/utils/probaLawFlip.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,eAAO,MAAM,YAAY,8BAaxB,CAAC"}
|
|
@@ -1,9 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
*
|
|
4
|
+
* @param arr [T, proba]
|
|
5
|
+
* @returns element T_i with proba p_i
|
|
6
|
+
*/
|
|
2
7
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
8
|
exports.probaLawFlip = void 0;
|
|
4
9
|
const probaLawFlip = (arr) => {
|
|
5
10
|
if (Math.abs(arr.reduce((acc, curr) => (acc += curr[1]), 0) - 1) > 0.1)
|
|
6
|
-
throw Error(
|
|
11
|
+
throw Error("proba law does not add up t 1");
|
|
7
12
|
const rand = Math.random();
|
|
8
13
|
const sorted = [...arr].sort((a, b) => b[1] - a[1]);
|
|
9
14
|
let probaAcc = 0;
|