math-exercises 3.0.138 → 3.0.139

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.
@@ -0,0 +1,7 @@
1
+ import { Exercise } from "../../../../exercises/exercise.js";
2
+ type Identifiers = {
3
+ nb: number;
4
+ };
5
+ export declare const countDivisors: Exercise<Identifiers>;
6
+ export {};
7
+ //# sourceMappingURL=countDivisors.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"countDivisors.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calcul/arithmetics/countDivisors.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAeT,MAAM,6BAA6B,CAAC;AASrC,KAAK,WAAW,GAAG;IACjB,EAAE,EAAE,MAAM,CAAC;CACZ,CAAC;AAoGF,eAAO,MAAM,aAAa,EAAE,QAAQ,CAAC,WAAW,CAkB/C,CAAC"}
@@ -0,0 +1,103 @@
1
+ import { addValidProp, shuffleProps, propWhile, tryToAddWrongProp, } from "../../../../exercises/exercise.js";
2
+ import { getDistinctQuestions } from "../../../../exercises/utils/getDistinctQuestions.js";
3
+ import { numberVEA } from "../../../../exercises/vea/numberVEA.js";
4
+ import { dividersOf } from "../../../../math/utils/arithmetic/dividersOf.js";
5
+ import { randint } from "../../../../math/utils/random/randint.js";
6
+ import { frac } from "../../../../tree/nodes/operators/fractionNode.js";
7
+ import { handleVEAError } from "../../../../utils/errors/handleVEAError.js";
8
+ import { joinanded } from "../../../../utils/strings/joinanded.js";
9
+ const getPropositions = (n, { answer }) => {
10
+ const propositions = [];
11
+ addValidProp(propositions, answer);
12
+ const answerNb = answer.unfrenchify();
13
+ propWhile(propositions, n, () => {
14
+ tryToAddWrongProp(propositions, Math.max(1, answerNb + randint(-3, 3, [0])).frenchify());
15
+ });
16
+ return shuffleProps(propositions, n);
17
+ };
18
+ const getAnswer = (identifiers) => {
19
+ const dividers = dividersOf(identifiers.nb);
20
+ return dividers.length.frenchify();
21
+ };
22
+ const getInstruction = (identifiers) => {
23
+ return `Combien le nombre $${identifiers.nb}$ a-t-il de diviseurs ?`;
24
+ };
25
+ const getHint = (identifiers) => {
26
+ return `Les diviseurs de $${identifiers.nb}$ sont les nombres $a$ et $b$ tels que
27
+
28
+ $$
29
+ ${identifiers.nb} = a \\times b
30
+ $$
31
+
32
+ N'oublie pas que tout nombre naturel $n$ peut s'écrire :
33
+
34
+ $$
35
+ n = 1 \\times n
36
+ $$`;
37
+ };
38
+ const getCorrection = (identifiers) => {
39
+ const divisors = dividersOf(identifiers.nb);
40
+ const pureDivisors = divisors.slice(1, divisors.length % 2 === 0 ? divisors.length / 2 : divisors.length - 1);
41
+ if (divisors.length === 2) {
42
+ return `$${identifiers.nb}$ est un nombre premier, car il n'est divisible que par lui-même et $1$.
43
+
44
+ Il n'a donc que deux diviseurs.`;
45
+ }
46
+ return `Comme tous les nombres naturels, $${identifiers.nb}$ est divisible par $1$ et par lui-même.
47
+
48
+ De plus, il est divisible par ${joinanded(divisors.slice(1, divisors.length - 1).map((e) => `$${e.frenchify()}$`))}, car :
49
+
50
+ ${pureDivisors
51
+ .map((d) => `\n$$\n${identifiers.nb} = ${d} \\times ${frac(identifiers.nb, d)
52
+ .simplify()
53
+ .toTex()}\n$$`)
54
+ .join("\n \n")}
55
+
56
+ Le nombre de diviseurs de $${identifiers.nb}$ est donc $${divisors.length}$.
57
+ `;
58
+ };
59
+ const getKeys = () => {
60
+ return [];
61
+ };
62
+ const isAnswerValid = (ans, { answer }) => {
63
+ try {
64
+ return numberVEA(ans, answer);
65
+ }
66
+ catch (err) {
67
+ return handleVEAError(err);
68
+ }
69
+ };
70
+ const getCountDivisorsQuestion = () => {
71
+ const nb = randint(2, 101);
72
+ const identifiers = { nb };
73
+ return getQuestionFromIdentifiers(identifiers);
74
+ };
75
+ const getQuestionFromIdentifiers = (identifiers) => {
76
+ return {
77
+ answer: getAnswer(identifiers),
78
+ instruction: getInstruction(identifiers),
79
+ keys: getKeys(identifiers),
80
+ answerFormat: "tex",
81
+ identifiers,
82
+ hint: getHint(identifiers),
83
+ correction: getCorrection(identifiers),
84
+ };
85
+ };
86
+ export const countDivisors = {
87
+ id: "countDivisors",
88
+ connector: "=",
89
+ label: "Compter les diviseurs d'un nombre",
90
+ isSingleStep: true,
91
+ generator: (nb, opts) => getDistinctQuestions(() => getCountDivisorsQuestion(opts), nb),
92
+ qcmTimer: 60,
93
+ freeTimer: 60,
94
+ getPropositions,
95
+ isAnswerValid,
96
+ subject: "Mathématiques",
97
+ getInstruction,
98
+ getHint,
99
+ getCorrection,
100
+ getAnswer,
101
+ getQuestionFromIdentifiers,
102
+ hasHintAndCorrection: true,
103
+ };
@@ -0,0 +1,7 @@
1
+ import { Exercise } from "../../../../exercises/exercise.js";
2
+ type Identifiers = {
3
+ nbs: number[];
4
+ };
5
+ export declare const findPrimeInList: Exercise<Identifiers>;
6
+ export {};
7
+ //# sourceMappingURL=findPrimeInList.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"findPrimeInList.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calcul/arithmetics/findPrimeInList.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAYT,MAAM,6BAA6B,CAAC;AAYrC,KAAK,WAAW,GAAG;IACjB,GAAG,EAAE,MAAM,EAAE,CAAC;CACf,CAAC;AAkFF,eAAO,MAAM,eAAe,EAAE,QAAQ,CAAC,WAAW,CAmBjD,CAAC"}
@@ -0,0 +1,89 @@
1
+ import { addValidProp, shuffleProps, tryToAddWrongProp, } from "../../../../exercises/exercise.js";
2
+ import { getDistinctQuestions } from "../../../../exercises/utils/getDistinctQuestions.js";
3
+ import { primes } from "../../../../math/numbers/integer/primes.js";
4
+ import { dividersOf } from "../../../../math/utils/arithmetic/dividersOf.js";
5
+ import { isPrime } from "../../../../math/utils/arithmetic/isPrime.js";
6
+ import { randint } from "../../../../math/utils/random/randint.js";
7
+ import { random } from "../../../../utils/alea/random.js";
8
+ import { shuffle } from "../../../../utils/alea/shuffle.js";
9
+ import { doWhile } from "../../../../utils/doWhile.js";
10
+ import { joinanded } from "../../../../utils/strings/joinanded.js";
11
+ import { pluralize } from "../../../../utils/strings/pluralize.js";
12
+ const getPropositions = (n, { nbs }) => {
13
+ const propositions = [];
14
+ for (const nb of nbs) {
15
+ if (isPrime(nb))
16
+ addValidProp(propositions, nb.frenchify());
17
+ else
18
+ tryToAddWrongProp(propositions, nb.frenchify());
19
+ }
20
+ return shuffleProps(propositions, n);
21
+ };
22
+ const getAnswer = () => {
23
+ return "";
24
+ };
25
+ const getInstruction = () => {
26
+ return `Parmi les nombres suivants, lequel ou lesquels sont des nombres premiers ?`;
27
+ };
28
+ const getHint = () => {
29
+ return `Un nombre est premier s'il n'a que deux diviseurs : $1$ et lui-même.`;
30
+ };
31
+ const getCorrection = (identifiers) => {
32
+ return `Un nombre est premier s'il n'a que deux diviseurs : $1$ et lui-même.
33
+
34
+ Pour chaque nombre, on compte son nombre de diviseurs :
35
+
36
+ ${identifiers.nbs
37
+ .map((nb) => {
38
+ const divisors = dividersOf(nb);
39
+ return `\n
40
+ - $${nb}$ a $${divisors.length}$ ${pluralize("diviseur", divisors.length)} : ${joinanded(divisors.map((e) => `$${e.frenchify()}$`))}. ${divisors.length === 2
41
+ ? "Il est donc premier."
42
+ : "Il n'est donc pas premier."}`;
43
+ })
44
+ .join("")}`;
45
+ };
46
+ const getFindPrimeInListQuestion = () => {
47
+ const nbRightAnswer = randint(1, 4);
48
+ const nbs = [];
49
+ for (let i = 0; i < nbRightAnswer; i++) {
50
+ nbs.push(doWhile(() => random(primes), (nb) => nbs.includes(nb)));
51
+ }
52
+ for (let i = 0; i < 4 - nbRightAnswer; i++) {
53
+ nbs.push(doWhile(() => randint(1, 101), (x) => isPrime(x) || nbs.includes(x)));
54
+ }
55
+ const identifiers = {
56
+ nbs: shuffle(nbs),
57
+ };
58
+ return getQuestionFromIdentifiers(identifiers);
59
+ };
60
+ const getQuestionFromIdentifiers = (identifiers) => {
61
+ return {
62
+ answer: getAnswer(identifiers),
63
+ instruction: getInstruction(identifiers),
64
+ keys: [],
65
+ answerFormat: "tex",
66
+ identifiers,
67
+ hint: getHint(identifiers),
68
+ correction: getCorrection(identifiers),
69
+ };
70
+ };
71
+ export const findPrimeInList = {
72
+ id: "findPrimeInList",
73
+ connector: "=",
74
+ label: "Trouver les nombres premiers dans une liste",
75
+ isSingleStep: true,
76
+ generator: (nb, opts) => getDistinctQuestions(() => getFindPrimeInListQuestion(opts), nb),
77
+ qcmTimer: 60,
78
+ freeTimer: 60,
79
+ getPropositions,
80
+ subject: "Mathématiques",
81
+ getInstruction,
82
+ getHint,
83
+ getCorrection,
84
+ getAnswer,
85
+ getQuestionFromIdentifiers,
86
+ hasHintAndCorrection: true,
87
+ answerType: "QCM",
88
+ isQCM: true,
89
+ };
@@ -0,0 +1,12 @@
1
+ import { Exercise } from "../../../../exercises/exercise.js";
2
+ import { NodeIdentifiers } from "../../../../tree/nodes/nodeConstructor.js";
3
+ type Identifiers = {
4
+ nb: number;
5
+ fakeDecomps: NodeIdentifiers[];
6
+ };
7
+ type Options = {
8
+ doNotUsePowers?: boolean;
9
+ };
10
+ export declare const findRightPrimeDecomposition: Exercise<Identifiers, Options>;
11
+ export {};
12
+ //# sourceMappingURL=findRightPrimeDecomposition.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"findRightPrimeDecomposition.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calcul/arithmetics/findRightPrimeDecomposition.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAgBT,MAAM,6BAA6B,CAAC;AAQrC,OAAO,EACL,eAAe,EAEhB,MAAM,qCAAqC,CAAC;AAU7C,KAAK,WAAW,GAAG;IACjB,EAAE,EAAE,MAAM,CAAC;IACX,WAAW,EAAE,eAAe,EAAE,CAAC;CAChC,CAAC;AAEF,KAAK,OAAO,GAAG;IACb,cAAc,CAAC,EAAE,OAAO,CAAC;CAC1B,CAAC;AAkIF,eAAO,MAAM,2BAA2B,EAAE,QAAQ,CAAC,WAAW,EAAE,OAAO,CAsBtE,CAAC"}
@@ -0,0 +1,129 @@
1
+ import { addValidProp, shuffleProps, GeneratorOptionTarget, GeneratorOptionType,
2
+ // tryToAddWrongProp,
3
+ addWrongProp, } from "../../../../exercises/exercise.js";
4
+ import { getDistinctQuestions } from "../../../../exercises/utils/getDistinctQuestions.js";
5
+ import { dividersOf } from "../../../../math/utils/arithmetic/dividersOf.js";
6
+ import { isPrime } from "../../../../math/utils/arithmetic/isPrime.js";
7
+ // import { isPrime } from "../../../../math/utils/arithmetic/isPrime.js";
8
+ import { primeDecompNode } from "../../../../math/utils/arithmetic/primeDecompNode.js";
9
+ import { primeDecomposition } from "../../../../math/utils/arithmetic/primeDecomposition.js";
10
+ import { randint } from "../../../../math/utils/random/randint.js";
11
+ import { reifyAlgebraic, } from "../../../../tree/nodes/nodeConstructor.js";
12
+ import { multiply, MultiplyNode, } from "../../../../tree/nodes/operators/multiplyNode.js";
13
+ import { power } from "../../../../tree/nodes/operators/powerNode.js";
14
+ import { operatorComposition } from "../../../../tree/utilities/operatorComposition.js";
15
+ import { random } from "../../../../utils/alea/random.js";
16
+ import { doWhile } from "../../../../utils/doWhile.js";
17
+ const options = [
18
+ {
19
+ id: "doNotUsePowers",
20
+ label: "Ne pas utiliser de puissances",
21
+ target: GeneratorOptionTarget.generation,
22
+ type: GeneratorOptionType.checkbox,
23
+ defaultValue: false,
24
+ },
25
+ ];
26
+ const getPropositions = (n, { answer, fakeDecomps }) => {
27
+ const propositions = [];
28
+ addValidProp(propositions, answer);
29
+ for (const decomp of fakeDecomps) {
30
+ addWrongProp(propositions, reifyAlgebraic(decomp).toTex({ forceNoSimplification: true }));
31
+ }
32
+ return shuffleProps(propositions, n);
33
+ };
34
+ const getAnswer = (identifiers, opts) => {
35
+ const decomp = primeDecompNode(identifiers.nb, !opts?.doNotUsePowers);
36
+ return decomp.toTex();
37
+ };
38
+ const getInstruction = (identifiers) => {
39
+ return `Parmi les propositions suivantes, laquelle est la décomposition en produit de facteurs premiers de $${identifiers.nb}$ ?`;
40
+ };
41
+ const getHint = (_identifiers, opts) => {
42
+ return `La décomposition en produit de facteurs premiers d'un nombre $n$ est une écriture de la forme :
43
+
44
+ ${opts?.doNotUsePowers
45
+ ? `$$
46
+ n = p_1 \\times p_2 \\times ...
47
+ $$`
48
+ : `$$
49
+ n = p_1^{k_1} \\times p_2^{k_2} \\times ...
50
+ $$`}
51
+
52
+ où $p_1$, $p_2$, ... sont des nombres premiers${opts?.doNotUsePowers
53
+ ? " ."
54
+ : " et $k_1$, $k_2$, ... sont des entiers naturels."}
55
+
56
+ Parmi les écritures proposées, il faut donc repérer celle dans laquelle chaque facteur est un nombre premier.`;
57
+ };
58
+ const getCorrection = (identifiers, opts) => {
59
+ return `La décomposition en produit de facteurs premiers de $${identifiers.nb}$ est :
60
+
61
+ $$
62
+ ${getAnswer(identifiers, opts)}
63
+ $$`;
64
+ };
65
+ const getFindRightPrimeDecompositionQuestion = (opts) => {
66
+ let nb = 0;
67
+ let divisors = [];
68
+ do {
69
+ nb = randint(10, 101);
70
+ divisors = dividersOf(nb);
71
+ } while (divisors.length < 5);
72
+ // const pureDivisors = divisors.slice(
73
+ // 0,
74
+ // divisors.length % 2 === 0 ? divisors.length / 2 : (divisors.length + 1) / 2,
75
+ // );
76
+ const fakeDecomps = [];
77
+ const nonPrimes = [];
78
+ console.log(nb);
79
+ for (let i = 0; i < 3; i++) {
80
+ const nonPrime = doWhile(() => random(divisors.slice(1).filter((n) => !isPrime(n))), (n) => nonPrimes.includes(n));
81
+ nonPrimes.push(nonPrime);
82
+ if (nonPrime === nb) {
83
+ fakeDecomps.push(multiply(1, nb).toIdentifiers());
84
+ }
85
+ else {
86
+ const rest = nb / nonPrime;
87
+ const fakeDecomp = primeDecomposition(rest);
88
+ fakeDecomp.push({ value: nonPrime, power: 1 });
89
+ fakeDecomp.sort((a, b) => a.value - b.value);
90
+ fakeDecomps.push(operatorComposition(MultiplyNode, fakeDecomp.map((d) => d.power > 1
91
+ ? opts?.doNotUsePowers
92
+ ? power(d.value, d.power).toMultiplyNode()
93
+ : power(d.value, d.power)
94
+ : d.value.toTree())).toIdentifiers());
95
+ }
96
+ }
97
+ const identifiers = { nb, fakeDecomps };
98
+ return getQuestionFromIdentifiers(identifiers, opts);
99
+ };
100
+ const getQuestionFromIdentifiers = (identifiers, opts) => {
101
+ return {
102
+ answer: getAnswer(identifiers, opts),
103
+ instruction: getInstruction(identifiers, opts),
104
+ keys: [],
105
+ answerFormat: "tex",
106
+ identifiers,
107
+ hint: getHint(identifiers, opts),
108
+ correction: getCorrection(identifiers, opts),
109
+ };
110
+ };
111
+ export const findRightPrimeDecomposition = {
112
+ id: "findRightPrimeDecomposition",
113
+ connector: "=",
114
+ label: "Trouver la bonne décomposition en produit de facteurs premiers",
115
+ isSingleStep: true,
116
+ generator: (nb, opts) => getDistinctQuestions(() => getFindRightPrimeDecompositionQuestion(opts), nb),
117
+ qcmTimer: 60,
118
+ freeTimer: 60,
119
+ getPropositions,
120
+ subject: "Mathématiques",
121
+ getInstruction,
122
+ getHint,
123
+ getCorrection,
124
+ getAnswer,
125
+ getQuestionFromIdentifiers,
126
+ hasHintAndCorrection: true,
127
+ answerType: "QCU",
128
+ options,
129
+ };
@@ -11,4 +11,6 @@ export * from "./primeNumberIdentification.js";
11
11
  export * from "./whichMultipleAmI.js";
12
12
  export * from "./isMultipleOrDivisor.js";
13
13
  export * from "./coprime.js";
14
+ export * from "./countDivisors.js";
15
+ export * from "./findPrimeInList.js";
14
16
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calcul/arithmetics/index.ts"],"names":[],"mappings":"AAAA,cAAc,wBAAwB,CAAC;AACvC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,mBAAmB,CAAC;AAClC,cAAc,iBAAiB,CAAC;AAChC,cAAc,mBAAmB,CAAC;AAClC,cAAc,yBAAyB,CAAC;AACxC,cAAc,0BAA0B,CAAC;AACzC,cAAc,iBAAiB,CAAC;AAChC,cAAc,iCAAiC,CAAC;AAChD,cAAc,gCAAgC,CAAC;AAC/C,cAAc,uBAAuB,CAAC;AACtC,cAAc,0BAA0B,CAAC;AACzC,cAAc,cAAc,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calcul/arithmetics/index.ts"],"names":[],"mappings":"AAAA,cAAc,wBAAwB,CAAC;AACvC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,mBAAmB,CAAC;AAClC,cAAc,iBAAiB,CAAC;AAChC,cAAc,mBAAmB,CAAC;AAClC,cAAc,yBAAyB,CAAC;AACxC,cAAc,0BAA0B,CAAC;AACzC,cAAc,iBAAiB,CAAC;AAChC,cAAc,iCAAiC,CAAC;AAChD,cAAc,gCAAgC,CAAC;AAC/C,cAAc,uBAAuB,CAAC;AACtC,cAAc,0BAA0B,CAAC;AACzC,cAAc,cAAc,CAAC;AAC7B,cAAc,oBAAoB,CAAC;AACnC,cAAc,sBAAsB,CAAC"}
@@ -11,3 +11,6 @@ export * from "./primeNumberIdentification.js";
11
11
  export * from "./whichMultipleAmI.js";
12
12
  export * from "./isMultipleOrDivisor.js";
13
13
  export * from "./coprime.js";
14
+ export * from "./countDivisors.js";
15
+ export * from "./findPrimeInList.js";
16
+ // export * from "./findRightPrimeDecomposition.js";
package/lib/index.d.ts CHANGED
@@ -49,6 +49,10 @@ declare const mathExercises: (Exercise<{
49
49
  }, Record<string, string | boolean | string[]>> | Exercise<{
50
50
  a: number;
51
51
  b: number;
52
+ }, Record<string, string | boolean | string[]>> | Exercise<{
53
+ nb: number;
54
+ }, Record<string, string | boolean | string[]>> | Exercise<{
55
+ nbs: number[];
52
56
  }, Record<string, string | boolean | string[]>> | Exercise<{
53
57
  integerFirst: boolean;
54
58
  integer: number;
@@ -1 +1 @@
1
- {"version":3,"file":"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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;kDAA6B,CAAC;AAE/C,OAAO,EAAE,aAAa,EAAE,WAAW,EAAE,QAAQ,EAAE,QAAQ,EAAE,cAAc,EAAE,CAAC"}
@@ -1,5 +1,7 @@
1
1
  import { Node, NodeIds, NodeOptions, NodeType, ToTexOptions } from "../node.js";
2
2
  import { OperatorIds, OperatorNode } from "./operatorNode.js";
3
+ import { NumberNode } from "../numbers/numberNode.js";
4
+ import { MultiplyNode } from "./multiplyNode.js";
3
5
  import { AlgebraicNode, SimplifyOptions } from "../algebraicNode.js";
4
6
  export declare function isPowerNode(a: Node): a is PowerNode;
5
7
  export declare function isSquareNode(a: Node): a is SquareNode;
@@ -31,6 +33,7 @@ export declare class PowerNode implements OperatorNode {
31
33
  simplify(opts?: SimplifyOptions, _log?: boolean): AlgebraicNode;
32
34
  equals(node: AlgebraicNode): boolean;
33
35
  derivative(varName?: string | undefined): AlgebraicNode;
36
+ toMultiplyNode(): AlgebraicNode | import("../numbers/constantNode.js").ConstantNode | NumberNode | MultiplyNode;
34
37
  }
35
38
  export declare class SquareNode extends PowerNode {
36
39
  constructor(child: AlgebraicNode, opts?: NodeOptions);
@@ -1 +1 @@
1
- {"version":3,"file":"powerNode.d.ts","sourceRoot":"","sources":["../../../../src/tree/nodes/operators/powerNode.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAChF,OAAO,EAAE,WAAW,EAAE,YAAY,EAAkB,MAAM,mBAAmB,CAAC;AAG9E,OAAO,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;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AAI,CAAC,EAAE,YAAY,GAAG,MAAM;IA0BlC,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC;IAMtC,oBAAoB,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,aAAa,CAAC;IAOxD,QAAQ,CAAC,IAAI,CAAC,EAAE,eAAe,EAAE,IAAI,UAAQ,GAAG,aAAa;IA6D7D,MAAM,CAAC,IAAI,EAAE,aAAa,GAAG,OAAO;IAOpC,UAAU,CAAC,OAAO,CAAC,EAAE,MAAM,GAAG,SAAS,GAAG,aAAa;IAcvD,cAAc;CASf;AAED,qBAAa,UAAW,SAAQ,SAAS;gBAC3B,KAAK,EAAE,aAAa,EAAE,IAAI,CAAC,EAAE,WAAW;CAIrD"}
@@ -7,6 +7,7 @@ import { isSqrtNode } from "../functions/sqrtNode.js";
7
7
  import { round } from "../../../math/utils/round.js";
8
8
  import { FractionNode, isFractionNode } from "./fractionNode.js";
9
9
  import { FunctionsIds, isFunctionNode } from "../functions/functionNode.js";
10
+ import { operatorComposition } from "../../../tree/utilities/operatorComposition.js";
10
11
  export function isPowerNode(a) {
11
12
  return isOperatorNode(a) && a.id === OperatorIds.power;
12
13
  }
@@ -156,6 +157,17 @@ export class PowerNode {
156
157
  throw Error("unimplemented");
157
158
  return multiply(multiply(this.rightChild, power(this.leftChild, this.rightChild.value - 1)), this.leftChild.derivative(varName));
158
159
  }
160
+ toMultiplyNode() {
161
+ if (this.rightChild.evaluate() === 1)
162
+ return this.leftChild;
163
+ if (this.rightChild.evaluate() === 0)
164
+ return (1).toTree();
165
+ const lefts = [];
166
+ for (let i = 0; i < this.rightChild.evaluate(); i++) {
167
+ lefts.push(this.leftChild);
168
+ }
169
+ return operatorComposition(MultiplyNode, lefts);
170
+ }
159
171
  }
160
172
  export class SquareNode extends PowerNode {
161
173
  constructor(child, opts) {
@@ -1,2 +1,2 @@
1
- export declare const joinanded: (arrStr: string[], separator: string, lastSeparator: string) => string;
1
+ export declare const joinanded: (arrStr: string[], separator?: string, lastSeparator?: string) => string;
2
2
  //# sourceMappingURL=joinanded.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"joinanded.d.ts","sourceRoot":"","sources":["../../../src/utils/strings/joinanded.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,SAAS,GACpB,QAAQ,MAAM,EAAE,EAChB,WAAW,MAAM,EACjB,eAAe,MAAM,WAWtB,CAAC"}
1
+ {"version":3,"file":"joinanded.d.ts","sourceRoot":"","sources":["../../../src/utils/strings/joinanded.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,SAAS,GACpB,QAAQ,MAAM,EAAE,EAChB,YAAW,MAAa,EACxB,gBAAe,MAAe,WAW/B,CAAC"}
@@ -1,4 +1,4 @@
1
- export const joinanded = (arrStr, separator, lastSeparator) => {
1
+ export const joinanded = (arrStr, separator = ", ", lastSeparator = " et ") => {
2
2
  if (arrStr.length === 0) {
3
3
  return "";
4
4
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "math-exercises",
3
3
  "type": "module",
4
- "version": "3.0.138",
4
+ "version": "3.0.139",
5
5
  "description": "Math exercises generator for middle school and high school",
6
6
  "main": "lib/index.js",
7
7
  "files": [