math-exercises 3.0.211 → 3.0.213
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/congruenceBasicEquation.d.ts +9 -0
- package/lib/exercises/math/arithmetic/congruenceBasicEquation.d.ts.map +1 -0
- package/lib/exercises/math/arithmetic/congruenceBasicEquation.js +116 -0
- package/lib/exercises/math/arithmetic/diophantianEquationSimpleSolution.d.ts +9 -0
- package/lib/exercises/math/arithmetic/diophantianEquationSimpleSolution.d.ts.map +1 -0
- package/lib/exercises/math/arithmetic/diophantianEquationSimpleSolution.js +129 -0
- package/lib/exercises/math/arithmetic/fermatUsageOnBigPowers.d.ts +9 -0
- package/lib/exercises/math/arithmetic/fermatUsageOnBigPowers.d.ts.map +1 -0
- package/lib/exercises/math/arithmetic/fermatUsageOnBigPowers.js +140 -0
- package/lib/exercises/math/arithmetic/fillCongruenceTableFirstDegree.d.ts +9 -0
- package/lib/exercises/math/arithmetic/fillCongruenceTableFirstDegree.d.ts.map +1 -0
- package/lib/exercises/math/arithmetic/fillCongruenceTableFirstDegree.js +106 -0
- package/lib/exercises/math/arithmetic/findBezoutCoefficients.d.ts +8 -0
- package/lib/exercises/math/arithmetic/findBezoutCoefficients.d.ts.map +1 -0
- package/lib/exercises/math/arithmetic/findBezoutCoefficients.js +175 -0
- package/lib/exercises/math/arithmetic/hasDiophantianEquationSolution.d.ts +9 -0
- package/lib/exercises/math/arithmetic/hasDiophantianEquationSolution.d.ts.map +1 -0
- package/lib/exercises/math/arithmetic/hasDiophantianEquationSolution.js +105 -0
- package/lib/exercises/math/arithmetic/index.d.ts +8 -0
- package/lib/exercises/math/arithmetic/index.d.ts.map +1 -1
- package/lib/exercises/math/arithmetic/index.js +8 -0
- package/lib/exercises/math/arithmetic/pgcdFromPrimeDecomposition.d.ts +10 -0
- package/lib/exercises/math/arithmetic/pgcdFromPrimeDecomposition.d.ts.map +1 -0
- package/lib/exercises/math/arithmetic/pgcdFromPrimeDecomposition.js +136 -0
- package/lib/exercises/math/arithmetic/pgcdHomogenuity.d.ts +8 -0
- package/lib/exercises/math/arithmetic/pgcdHomogenuity.d.ts.map +1 -0
- package/lib/exercises/math/arithmetic/pgcdHomogenuity.js +124 -0
- package/lib/exercises/math/calcul/ordering/compareFracAndDec.js +2 -2
- package/lib/exercises/math/complex/argumentFromAlgebraicComplex.d.ts +3 -0
- package/lib/exercises/math/complex/argumentFromAlgebraicComplex.d.ts.map +1 -1
- package/lib/exercises/math/complex/argumentFromAlgebraicComplex.js +92 -3
- package/lib/exercises/math/complex/conjugateDivideComplex.d.ts.map +1 -1
- package/lib/exercises/math/complex/conjugateDivideComplex.js +67 -6
- package/lib/exercises/math/complex/conjugateMultiplyComplex.d.ts.map +1 -1
- package/lib/exercises/math/complex/conjugateMultiplyComplex.js +54 -15
- package/lib/exercises/math/complex/divideComplex.d.ts.map +1 -1
- package/lib/exercises/math/complex/divideComplex.js +60 -6
- package/lib/exercises/math/complex/exp/complexAlgebraicFromExpForm.d.ts +9 -0
- package/lib/exercises/math/complex/exp/complexAlgebraicFromExpForm.d.ts.map +1 -0
- package/lib/exercises/math/complex/exp/complexAlgebraicFromExpForm.js +178 -0
- package/lib/exercises/math/complex/exp/complexExpFormPowerSimplify.d.ts +10 -0
- package/lib/exercises/math/complex/exp/complexExpFormPowerSimplify.d.ts.map +1 -0
- package/lib/exercises/math/complex/exp/complexExpFormPowerSimplify.js +152 -0
- package/lib/exercises/math/complex/exp/complexExpFormProductSimplify.d.ts +11 -0
- package/lib/exercises/math/complex/exp/complexExpFormProductSimplify.d.ts.map +1 -0
- package/lib/exercises/math/complex/exp/complexExpFormProductSimplify.js +165 -0
- package/lib/exercises/math/complex/exp/complexExpFormQuotientSimplify.d.ts +11 -0
- package/lib/exercises/math/complex/exp/complexExpFormQuotientSimplify.d.ts.map +1 -0
- package/lib/exercises/math/complex/exp/complexExpFormQuotientSimplify.js +164 -0
- package/lib/exercises/math/complex/exp/complexExpFromAlgebraicForm.d.ts +9 -0
- package/lib/exercises/math/complex/exp/complexExpFromAlgebraicForm.d.ts.map +1 -0
- package/lib/exercises/math/complex/exp/complexExpFromAlgebraicForm.js +175 -0
- package/lib/exercises/math/complex/exp/index.d.ts +5 -0
- package/lib/exercises/math/complex/exp/index.d.ts.map +1 -0
- package/lib/exercises/math/complex/exp/index.js +5 -0
- package/lib/exercises/math/complex/index.d.ts +1 -0
- package/lib/exercises/math/complex/index.d.ts.map +1 -1
- package/lib/exercises/math/complex/index.js +1 -0
- package/lib/exercises/math/complex/inverseComplex.d.ts.map +1 -1
- package/lib/exercises/math/complex/inverseComplex.js +35 -2
- package/lib/exercises/math/complex/linearCombinaisonComplex.d.ts.map +1 -1
- package/lib/exercises/math/complex/linearCombinaisonComplex.js +36 -5
- package/lib/exercises/math/complex/moduloFromAlgebraicComplex.d.ts.map +1 -1
- package/lib/exercises/math/complex/moduloFromAlgebraicComplex.js +38 -9
- package/lib/exercises/math/derivation/problems/index.d.ts +0 -1
- package/lib/exercises/math/derivation/problems/index.d.ts.map +1 -1
- package/lib/exercises/math/derivation/problems/index.js +1 -1
- package/lib/exercises/math/trigonometry/formulas/index.d.ts +2 -0
- package/lib/exercises/math/trigonometry/formulas/index.d.ts.map +1 -0
- package/lib/exercises/math/trigonometry/formulas/index.js +1 -0
- package/lib/exercises/math/trigonometry/formulas/trigoAdditionFormulaUsage.d.ts +8 -0
- package/lib/exercises/math/trigonometry/formulas/trigoAdditionFormulaUsage.d.ts.map +1 -0
- package/lib/exercises/math/trigonometry/formulas/trigoAdditionFormulaUsage.js +217 -0
- package/lib/exercises/math/trigonometry/index.d.ts +1 -0
- package/lib/exercises/math/trigonometry/index.d.ts.map +1 -1
- package/lib/exercises/math/trigonometry/index.js +1 -0
- package/lib/index.d.ts +52 -7
- package/lib/index.d.ts.map +1 -1
- package/lib/math/utils/arithmetic/bezout.d.ts +2 -0
- package/lib/math/utils/arithmetic/bezout.d.ts.map +1 -0
- package/lib/math/utils/arithmetic/bezout.js +10 -0
- package/lib/playground.d.ts +0 -5
- package/lib/playground.d.ts.map +1 -1
- package/lib/playground.js +3 -9
- package/lib/tree/nodes/algebraicNode.d.ts +2 -0
- package/lib/tree/nodes/algebraicNode.d.ts.map +1 -1
- package/lib/tree/nodes/complex/complexNode.d.ts +3 -0
- package/lib/tree/nodes/complex/complexNode.d.ts.map +1 -1
- package/lib/tree/nodes/complex/complexNode.js +8 -0
- package/lib/tree/nodes/functions/absNode.d.ts.map +1 -1
- package/lib/tree/nodes/functions/absNode.js +6 -1
- package/lib/tree/nodes/functions/expNode.d.ts +2 -2
- package/lib/tree/nodes/functions/expNode.d.ts.map +1 -1
- package/lib/tree/nodes/functions/expNode.js +2 -2
- package/lib/tree/nodes/node.d.ts +2 -0
- package/lib/tree/nodes/node.d.ts.map +1 -1
- package/lib/tree/nodes/operators/addNode.js +6 -0
- package/lib/tree/nodes/operators/multiplyNode.d.ts +1 -1
- package/lib/tree/nodes/operators/multiplyNode.d.ts.map +1 -1
- package/lib/tree/nodes/operators/multiplyNode.js +11 -6
- package/lib/tree/nodes/operators/powerNode.d.ts.map +1 -1
- package/lib/tree/nodes/operators/powerNode.js +2 -0
- package/package.json +1 -1
|
@@ -27,7 +27,9 @@ export const multiply = (a, b, opts) => {
|
|
|
27
27
|
const nodeB = typeof b === "number" ? b.toTree() : typeof b === "string" ? b.toTree() : b;
|
|
28
28
|
return new MultiplyNode(nodeA, nodeB, opts);
|
|
29
29
|
};
|
|
30
|
-
export const sortMultiplyNodes = (arr) => {
|
|
30
|
+
export const sortMultiplyNodes = (arr, opts) => {
|
|
31
|
+
if (opts?.noMultiplyOrder)
|
|
32
|
+
return 0;
|
|
31
33
|
arr.sort((a, b) => {
|
|
32
34
|
return (Number(b.isNumeric) - Number(a.isNumeric) ||
|
|
33
35
|
Number(isNumberNode(b) && b.value === -1) -
|
|
@@ -102,7 +104,8 @@ export class MultiplyNode {
|
|
|
102
104
|
// }
|
|
103
105
|
}
|
|
104
106
|
//!this is atrocious
|
|
105
|
-
let showTimesSign = !opts?.
|
|
107
|
+
let showTimesSign = !opts?.forceNoTimesSign &&
|
|
108
|
+
!opts?.forceDotSign &&
|
|
106
109
|
(opts?.forceTimesSign ||
|
|
107
110
|
!isNaN(+rightTex[0]) ||
|
|
108
111
|
(this.rightChild.isNumeric &&
|
|
@@ -114,7 +117,7 @@ export class MultiplyNode {
|
|
|
114
117
|
isVariableNode(this.rightChild) &&
|
|
115
118
|
this.leftChild.name === this.rightChild.name) ||
|
|
116
119
|
(isSqrtNode(this.leftChild) && isSqrtNode(this.rightChild)));
|
|
117
|
-
if (isOperatorNode(this.rightChild)) {
|
|
120
|
+
if (!opts?.forceNoTimesSign && isOperatorNode(this.rightChild)) {
|
|
118
121
|
showTimesSign ||= [OperatorIds.fraction].includes(this.rightChild.id);
|
|
119
122
|
if (isFractionNode(this.rightChild.leftChild)) {
|
|
120
123
|
showTimesSign = true;
|
|
@@ -261,6 +264,8 @@ export class MultiplyNode {
|
|
|
261
264
|
const leftSimplified = this.leftChild.simplify(opts, log);
|
|
262
265
|
const rightSimplified = this.rightChild.simplify(opts, log);
|
|
263
266
|
const copy = new MultiplyNode(leftSimplified, rightSimplified, this.opts);
|
|
267
|
+
if (opts?.forbidMultiplications)
|
|
268
|
+
return copy;
|
|
264
269
|
/**get externals nodes (= extremités du sous arbre non multiplicatif)
|
|
265
270
|
* les opposites sont supprimés et on ajoute *-1 à la fin si leur nb est impair
|
|
266
271
|
*/
|
|
@@ -319,8 +324,8 @@ export class MultiplyNode {
|
|
|
319
324
|
if (nums.some((node) => isNumberNode(node) && node.value === 0)) {
|
|
320
325
|
return new NumberNode(0);
|
|
321
326
|
}
|
|
322
|
-
sortMultiplyNodes(nums);
|
|
323
|
-
sortMultiplyNodes(denums);
|
|
327
|
+
sortMultiplyNodes(nums, opts);
|
|
328
|
+
sortMultiplyNodes(denums, opts);
|
|
324
329
|
const numNode = operatorComposition(MultiplyNode, nums);
|
|
325
330
|
const denumNode = denums.length === 1
|
|
326
331
|
? denums[0]
|
|
@@ -403,7 +408,7 @@ export class MultiplyNode {
|
|
|
403
408
|
return new NumberNode(1);
|
|
404
409
|
if (externals.length === 1)
|
|
405
410
|
return externals[0];
|
|
406
|
-
sortMultiplyNodes(externals);
|
|
411
|
+
sortMultiplyNodes(externals, opts);
|
|
407
412
|
return operatorComposition(MultiplyNode, externals);
|
|
408
413
|
}
|
|
409
414
|
toSimplificationTex(opts) {
|
|
@@ -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;AAC9E,OAAO,EAAE,UAAU,EAAgB,MAAM,0BAA0B,CAAC;AACpE,OAAO,EAAE,YAAY,EAA4B,MAAM,mBAAmB,CAAC;AAC3E,OAAO,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAOrE,wBAAgB,WAAW,CAAC,CAAC,EAAE,IAAI,GAAG,CAAC,IAAI,SAAS,CAEnD;AAED,wBAAgB,YAAY,CAAC,CAAC,EAAE,IAAI,GAAG,CAAC,IAAI,UAAU,CAErD;AACD,eAAO,MAAM,MAAM,GAAI,GAAG,aAAa,GAAG,MAAM,GAAG,MAAM,eAKxD,CAAC;AAEF,eAAO,MAAM,KAAK,GAChB,GAAG,aAAa,GAAG,MAAM,GAAG,MAAM,EAClC,GAAG,aAAa,GAAG,MAAM,GAAG,MAAM,EAClC,OAAO,WAAW,cAOnB,CAAC;AAEF,qBAAa,SAAU,YAAW,YAAY;IAC5C,IAAI,CAAC,EAAE,WAAW,CAAC;IACnB,EAAE,EAAE,WAAW,CAAC;IAChB,SAAS,EAAE,aAAa,CA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