math-exercises 3.0.136 → 3.0.137

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.
Files changed (47) hide show
  1. package/lib/exercises/math/calcul/decimals/decimalFractionToDecimal.d.ts.map +1 -1
  2. package/lib/exercises/math/calcul/decimals/decimalFractionToDecimal.js +0 -2
  3. package/lib/exercises/math/calculLitteral/equation/equationFromProblem.d.ts.map +1 -1
  4. package/lib/exercises/math/calculLitteral/equation/equationFromProblem.js +0 -14
  5. package/lib/exercises/math/calculLitteral/factorisation/factoType3.d.ts +12 -0
  6. package/lib/exercises/math/calculLitteral/factorisation/factoType3.d.ts.map +1 -0
  7. package/lib/exercises/math/calculLitteral/factorisation/factoType3.js +115 -0
  8. package/lib/exercises/math/calculLitteral/factorisation/factoType4.d.ts +12 -0
  9. package/lib/exercises/math/calculLitteral/factorisation/factoType4.d.ts.map +1 -0
  10. package/lib/exercises/math/calculLitteral/factorisation/factoType4.js +112 -0
  11. package/lib/exercises/math/calculLitteral/factorisation/index.d.ts +2 -0
  12. package/lib/exercises/math/calculLitteral/factorisation/index.d.ts.map +1 -1
  13. package/lib/exercises/math/calculLitteral/factorisation/index.js +2 -0
  14. package/lib/exercises/math/derivation/derivative/sqrt/index.d.ts +1 -0
  15. package/lib/exercises/math/derivation/derivative/sqrt/index.d.ts.map +1 -1
  16. package/lib/exercises/math/derivation/derivative/sqrt/index.js +1 -1
  17. package/lib/exercises/math/derivation/derivative/sqrt/sqrtProductDerivative.d.ts.map +1 -1
  18. package/lib/exercises/math/derivation/derivative/sqrt/sqrtProductDerivative.js +83 -26
  19. package/lib/exercises/math/geometry/cartesian/index.d.ts +0 -1
  20. package/lib/exercises/math/geometry/cartesian/index.d.ts.map +1 -1
  21. package/lib/exercises/math/geometry/cartesian/index.js +1 -1
  22. package/lib/exercises/math/geometry/cartesian/placeAbscissOnSemiLineV2.d.ts.map +1 -1
  23. package/lib/exercises/math/geometry/cartesian/placeAbscissOnSemiLineV2.js +0 -1
  24. package/lib/exercises/math/geometry/euclidianConstructions/index.js +2 -0
  25. package/lib/exercises/math/geometry/euclidianConstructions/pointImageFromHomothety.d.ts +16 -0
  26. package/lib/exercises/math/geometry/euclidianConstructions/pointImageFromHomothety.d.ts.map +1 -0
  27. package/lib/exercises/math/geometry/euclidianConstructions/pointImageFromHomothety.js +241 -0
  28. package/lib/exercises/math/geometry/euclidianConstructions/segmentImageFromHomothety.d.ts +16 -0
  29. package/lib/exercises/math/geometry/euclidianConstructions/segmentImageFromHomothety.d.ts.map +1 -0
  30. package/lib/exercises/math/geometry/euclidianConstructions/segmentImageFromHomothety.js +258 -0
  31. package/lib/geogebra/parsers/geogebraParser.d.ts +1 -0
  32. package/lib/geogebra/parsers/geogebraParser.d.ts.map +1 -1
  33. package/lib/geogebra/parsers/geogebraParser.js +38 -0
  34. package/lib/index.d.ts +17 -8
  35. package/lib/index.d.ts.map +1 -1
  36. package/lib/latexTester.d.ts.map +1 -1
  37. package/lib/latexTester.js +1 -0
  38. package/lib/math/utils/functions/functionComparison.d.ts.map +1 -1
  39. package/lib/math/utils/functions/functionComparison.js +0 -4
  40. package/lib/math/utils/functions/functionComposition.d.ts.map +1 -1
  41. package/lib/math/utils/functions/functionComposition.js +0 -10
  42. package/lib/math/utils/functions/functionDecomposition.d.ts.map +1 -1
  43. package/lib/math/utils/functions/functionDecomposition.js +0 -42
  44. package/lib/utils/arrays/arrayIntersection.d.ts +2 -0
  45. package/lib/utils/arrays/arrayIntersection.d.ts.map +1 -0
  46. package/lib/utils/arrays/arrayIntersection.js +8 -0
  47. package/package.json +1 -1
@@ -35,10 +35,6 @@ const getSafeEvaluationDictForEqualityCheck = (node1, node2, nbSafeX = 4) => {
35
35
  };
36
36
  const isEqualFromRandomEvaluations = (node1, node2) => {
37
37
  return Object.values(getSafeEvaluationDictForEqualityCheck(node1, node2)).every((arrSafeEval) => {
38
- // console.log(
39
- // "arrSafeEval",
40
- // arrSafeEval.map((safeEval) => safeEval.value),
41
- // );
42
38
  return arrSafeEval
43
39
  .slice(1)
44
40
  .every((safeEval) => substract(arrSafeEval[0].value, safeEval.value).evaluate() === 0);
@@ -1 +1 @@
1
- {"version":3,"file":"functionComposition.d.ts","sourceRoot":"","sources":["../../../../src/math/utils/functions/functionComposition.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,aAAa,EACb,eAAe,EAChB,MAAM,mCAAmC,CAAC;AAU3C,OAAO,EAEL,YAAY,EACb,MAAM,4CAA4C,CAAC;AAEpD,eAAO,MAAM,qBAAqB,GAChC,aAAa,aAAa,EAC1B,cAAc,aAAa,EAC3B,eAAc,YAA2C,kBAiB1D,CAAC;AAMF,MAAM,MAAM,iBAAiB,GAAG;IAC9B,OAAO,EAAE,aAAa,EAAE,CAAC;IACzB,QAAQ,EAAE,QAAQ,CAAC;CACpB,CAAC;AAEF,eAAO,MAAM,eAAe,GAAI,MAAM,aAAa,wBA4ClD,CAAC;AAMF,MAAM,MAAM,QAAQ,GAAG;IACrB,IAAI,EAAE,CAAC,WAAW,GAAG,YAAY,GAAG,OAAO,CAAC,EAAE,CAAC;CAChD,CAAC;AA6BF,wBAAgB,yBAAyB,CACvC,WAAW,EAAE,aAAa,EAC1B,IAAI,EAAE,QAAQ,EACd,YAAY,EAAE,aAAa,EAC3B,iBAAiB,GAAE,MAAW,EAC9B,eAAe,GAAE,eAAoB,iBAiEtC"}
1
+ {"version":3,"file":"functionComposition.d.ts","sourceRoot":"","sources":["../../../../src/math/utils/functions/functionComposition.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,aAAa,EACb,eAAe,EAChB,MAAM,mCAAmC,CAAC;AAU3C,OAAO,EAEL,YAAY,EACb,MAAM,4CAA4C,CAAC;AAEpD,eAAO,MAAM,qBAAqB,GAChC,aAAa,aAAa,EAC1B,cAAc,aAAa,EAC3B,eAAc,YAA2C,kBAiB1D,CAAC;AAMF,MAAM,MAAM,iBAAiB,GAAG;IAC9B,OAAO,EAAE,aAAa,EAAE,CAAC;IACzB,QAAQ,EAAE,QAAQ,CAAC;CACpB,CAAC;AAEF,eAAO,MAAM,eAAe,GAAI,MAAM,aAAa,wBA4ClD,CAAC;AAMF,MAAM,MAAM,QAAQ,GAAG;IACrB,IAAI,EAAE,CAAC,WAAW,GAAG,YAAY,GAAG,OAAO,CAAC,EAAE,CAAC;CAChD,CAAC;AA6BF,wBAAgB,yBAAyB,CACvC,WAAW,EAAE,aAAa,EAC1B,IAAI,EAAE,QAAQ,EACd,YAAY,EAAE,aAAa,EAC3B,iBAAiB,GAAE,MAAW,EAC9B,eAAe,GAAE,eAAoB,iBAsDtC"}
@@ -65,11 +65,6 @@ function operatorNodeByReplacingRightChild(opNode, nodeRightChildNew) {
65
65
  return NodeConstructor.fromIdentifiers(nodeIds);
66
66
  }
67
67
  export function nodeByReplacingNodeAtPath(nodeCarrier, path, nodeInjected, simplifyUpToLevel = -1, simplifyOptions = {}) {
68
- // console.log("nodeByReplacingNodeAtPath", {
69
- // node: nodeCarrier.toTex(),
70
- // key: path.keys.join("."),
71
- // nodeInjected: nodeInjected.toTex(),
72
- // });
73
68
  function getNodeForKey(node, key) {
74
69
  if (key === "leftChild" || key === "rightChild") {
75
70
  return node[key];
@@ -82,11 +77,6 @@ export function nodeByReplacingNodeAtPath(nodeCarrier, path, nodeInjected, simpl
82
77
  }
83
78
  }
84
79
  function nodeByReplacingChildAtKey(node, key, nodeInjected) {
85
- // console.log("nodeByReplacingChildAtKey", {
86
- // node: node.toTex(),
87
- // key: key,
88
- // nodeInjected: nodeInjected.toTex(),
89
- // });
90
80
  if (key === "leftChild" && isOperatorNode(node)) {
91
81
  return operatorNodeByReplacingLeftChild(node, nodeInjected);
92
82
  }
@@ -1 +1 @@
1
- {"version":3,"file":"functionDecomposition.d.ts","sourceRoot":"","sources":["../../../../src/math/utils/functions/functionDecomposition.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,mCAAmC,CAAC;AAYlE,OAAO,EAEL,YAAY,EACb,MAAM,4CAA4C,CAAC;AAcpD,eAAO,MAAM,sBAAsB,GACjC,MAAM,aAAa,EACnB,eAAc,YAA2C;WAElC,aAAa;WAAS,aAAa;GA8Q3D,CAAC;AAwEF,eAAO,MAAM,mBAAmB,GAAI,MAAM,aAAa,EAAE,QAAQ,MAAM,kBAItE,CAAC;AAEF,wBAAgB,YAAY,CAAC,KAAK,EAAE,aAAa,EAAE,KAAK,EAAE,aAAa,iBAMtE;AAMD,wBAAgB,yBAAyB,CAAC,IAAI,EAAE,aAAa,GAAG,OAAO,CAmBtE"}
1
+ {"version":3,"file":"functionDecomposition.d.ts","sourceRoot":"","sources":["../../../../src/math/utils/functions/functionDecomposition.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,mCAAmC,CAAC;AAYlE,OAAO,EAEL,YAAY,EACb,MAAM,4CAA4C,CAAC;AAcpD,eAAO,MAAM,sBAAsB,GACjC,MAAM,aAAa,EACnB,eAAc,YAA2C;WAElC,aAAa;WAAS,aAAa;GAyO3D,CAAC;AAqEF,eAAO,MAAM,mBAAmB,GAAI,MAAM,aAAa,EAAE,QAAQ,MAAM,kBAItE,CAAC;AAEF,wBAAgB,YAAY,CAAC,KAAK,EAAE,aAAa,EAAE,KAAK,EAAE,aAAa,iBAMtE;AAMD,wBAAgB,yBAAyB,CAAC,IAAI,EAAE,aAAa,GAAG,OAAO,CAmBtE"}
@@ -43,7 +43,6 @@ export const functionDecompositions = (node, variableNode = "x".toTree()) => {
43
43
  const levelPicks = getCartesiansProducts(nodePathsWithVariableAtEnd.map((nodePathWithNodes) => [
44
44
  ...Array(nodePathWithNodes.nodePath.keys.length).keys(),
45
45
  ]));
46
- // console.log("levelPicks", levelPicks.length);
47
46
  levelPicks.forEach((levelPick) => {
48
47
  if (counter > 1000) {
49
48
  return outArr;
@@ -53,18 +52,6 @@ export const functionDecompositions = (node, variableNode = "x".toTree()) => {
53
52
  const level = levelPick[i];
54
53
  return nodePathUpward(nodePathWithNodes, level);
55
54
  });
56
- // console.log(
57
- // "nodePathsUpByLevel",
58
- // nodePathsUpByLevel.map((nodePathWithNodes) => {
59
- // return {
60
- // endNode:
61
- // nodePathWithNodes.arrNode[
62
- // nodePathWithNodes.arrNode.length - 1
63
- // ].toTex(),
64
- // keypath: nodePathWithNodes.nodePath.keys.join("."),
65
- // };
66
- // }),
67
- // );
68
55
  //merge wrt collision (collision means that some of the wrappedVariables trees are superimposing, and we don't want that)
69
56
  const mergedNodePathsUpByLevel = nodePathsUpByLevel.reduce((acc, incomingNodePathWithNodes) => {
70
57
  const incomingNodePathsString = incomingNodePathWithNodes.nodePath.keys.join(".");
@@ -89,18 +76,6 @@ export const functionDecompositions = (node, variableNode = "x".toTree()) => {
89
76
  return [...acc, incomingNodePathWithNodes];
90
77
  }
91
78
  }, []);
92
- // console.log(
93
- // "mergedNodePathsUpByLevel",
94
- // mergedNodePathsUpByLevel.map((nodePathWithNodes) => {
95
- // return {
96
- // endNode:
97
- // nodePathWithNodes.arrNode[
98
- // nodePathWithNodes.arrNode.length - 1
99
- // ].toTex(),
100
- // keypath: nodePathWithNodes.nodePath.keys.join("."),
101
- // };
102
- // }),
103
- // );
104
79
  const wrappedVariables = mergedNodePathsUpByLevel.map((nodePathWithNodes) => nodePathWithNodes &&
105
80
  nodePathWithNodes.arrNode[nodePathWithNodes.arrNode.length - 1]);
106
81
  for (let index = 0; index < wrappedVariables.length; index++) {
@@ -119,15 +94,6 @@ export const functionDecompositions = (node, variableNode = "x".toTree()) => {
119
94
  else {
120
95
  //attempt salvation
121
96
  const comparisonDicts = otherWrappedVariables.map((node) => getComparisonDict(node, sameNodeCandidate));
122
- // console.log(
123
- // "comparisonDicts",
124
- // comparisonDicts.map((comparisonDict) => {
125
- // return {
126
- // sub: comparisonDict?.sub?.toTex(),
127
- // frac: comparisonDict?.frac?.toTex(),
128
- // };
129
- // }),
130
- // );
131
97
  const isSalvationPossible = comparisonDicts.every((comparisonDict) => comparisonDict?.sub !== undefined ||
132
98
  comparisonDict?.frac !== undefined);
133
99
  if (isSalvationPossible) {
@@ -139,10 +105,6 @@ export const functionDecompositions = (node, variableNode = "x".toTree()) => {
139
105
  return multiply(comparisonDict.frac, variableNode);
140
106
  }
141
107
  });
142
- // console.log(
143
- // "nodeGaskets",
144
- // nodeGaskets.map((node) => node.toTex()),
145
- // );
146
108
  const nodeUEnds = [...Array(wrappedVariables.length).keys()].map((i) => {
147
109
  if (i === index) {
148
110
  return variableNode;
@@ -207,10 +169,6 @@ function getComparisonDict(node1, node2) {
207
169
  : undefined,
208
170
  frac: (() => {
209
171
  const successfulEvalsWithoutZeroV2 = successfulEvals.filter(({ v2 }) => v2 !== 0);
210
- // console.log(
211
- // "successfulEvalsWithoutZeroV2",
212
- // successfulEvalsWithoutZeroV2,
213
- // );
214
172
  return successfulEvalsWithoutZeroV2
215
173
  .slice(1)
216
174
  .every(({ v1, v2 }) => substract(frac(v1, v2), frac(successfulEvalsWithoutZeroV2[0].v1, successfulEvalsWithoutZeroV2[0].v2)).evaluate() === 0)
@@ -0,0 +1,2 @@
1
+ export declare function intersect<T>(arrArr: Array<Array<T>>): T[];
2
+ //# sourceMappingURL=arrayIntersection.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"arrayIntersection.d.ts","sourceRoot":"","sources":["../../../src/utils/arrays/arrayIntersection.ts"],"names":[],"mappings":"AAAA,wBAAgB,SAAS,CAAC,CAAC,EAAE,MAAM,EAAE,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,OAOnD"}
@@ -0,0 +1,8 @@
1
+ export function intersect(arrArr) {
2
+ if (arrArr.length === 0) {
3
+ return [];
4
+ }
5
+ return arrArr
6
+ .slice(1)
7
+ .reduce((acc, x) => acc.filter(Set.prototype.has, new Set(x)), arrArr[0]);
8
+ }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "math-exercises",
3
3
  "type": "module",
4
- "version": "3.0.136",
4
+ "version": "3.0.137",
5
5
  "description": "Math exercises generator for middle school and high school",
6
6
  "main": "lib/index.js",
7
7
  "files": [