math-exercises 3.0.184 → 3.0.185

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 (26) hide show
  1. package/lib/exercises/math/functions/exponential/algebraic/approxExpAPlusB.d.ts.map +1 -1
  2. package/lib/exercises/math/functions/exponential/algebraic/approxExpAPlusB.js +91 -38
  3. package/lib/exercises/math/probaStat/trees/index.d.ts +1 -1
  4. package/lib/exercises/math/probaStat/trees/index.d.ts.map +1 -1
  5. package/lib/exercises/math/probaStat/trees/index.js +1 -3
  6. package/lib/exercises/math/probaStat/trees/probabilityTree.d.ts +9 -3
  7. package/lib/exercises/math/probaStat/trees/probabilityTree.d.ts.map +1 -1
  8. package/lib/exercises/math/probaStat/trees/probabilityTree.js +419 -45
  9. package/lib/exercises/math/sequences/arithmetic/situations/arithmeticFindRankFromSituation.d.ts.map +1 -1
  10. package/lib/exercises/math/sequences/arithmetic/situations/arithmeticFindRankFromSituation.js +3 -3
  11. package/lib/exercises/math/sequences/arithmetic/situations/arithmeticFindThresholdFromSituation.d.ts.map +1 -1
  12. package/lib/exercises/math/sequences/arithmetic/situations/arithmeticFindThresholdFromSituation.js +2 -2
  13. package/lib/exercises/math/sequences/arithmetic/situations/index.d.ts +2 -0
  14. package/lib/exercises/math/sequences/arithmetic/situations/index.d.ts.map +1 -1
  15. package/lib/exercises/math/sequences/arithmetic/situations/index.js +2 -2
  16. package/lib/index.d.ts +13 -0
  17. package/lib/index.d.ts.map +1 -1
  18. package/lib/math/utils/sequences/situations/seqArithmeticSituations.d.ts +2 -0
  19. package/lib/math/utils/sequences/situations/seqArithmeticSituations.d.ts.map +1 -1
  20. package/lib/math/utils/sequences/situations/seqArithmeticSituations.js +150 -128
  21. package/lib/math/utils/sequences/situations/seqArithmeticUtils.d.ts +1 -1
  22. package/lib/math/utils/sequences/situations/seqArithmeticUtils.d.ts.map +1 -1
  23. package/lib/math/utils/sequences/situations/seqArithmeticUtils.js +4 -1
  24. package/lib/tests/questionTest.d.ts.map +1 -1
  25. package/lib/tests/questionTest.js +1 -0
  26. package/package.json +1 -1
@@ -6,7 +6,7 @@ export declare const seqArithmeticUtils: {
6
6
  getAnswerNodeExplicitFormula: (initial: number, reason: number, firstRank: number) => EqualNode;
7
7
  getAnswerNodeRecurrenceFormula: (_initial: number, reason: number, _firstRank: number) => EqualNode;
8
8
  getAnswerNodeRandomTerm: (initial: number, reason: number, firstRank: number, rankAsked: number) => import("../../../../tree/nodes/operators/addNode.js").AddNode;
9
- getAnswerNodeRandomRank: (initial: number, reason: number, _firstRank: number, valueAsked: number) => import("../../../../tree/nodes/operators/fractionNode.js").FractionNode;
9
+ getAnswerNodeRandomRank: (initial: number, reason: number, _firstRank: number, valueAsked: number) => import("../../../../tree/nodes/numbers/constantNode.js").ConstantNode | import("../../../../tree/nodes/numbers/numberNode.js").NumberNode;
10
10
  getAnswerNodeThresholdRank: (initial: number, reason: number, firstRank: number, valueThreshold: number, inequationSymbol: InequationSymbol) => import("../../../../tree/nodes/numbers/constantNode.js").ConstantNode | import("../../../../tree/nodes/numbers/numberNode.js").NumberNode;
11
11
  getAnswerNodeSumThresholdRank: (initial: number, reason: number, firstRank: number, valueThreshold: number, inequationSymbol: InequationSymbol) => import("../../../../tree/nodes/numbers/constantNode.js").ConstantNode | import("../../../../tree/nodes/numbers/numberNode.js").NumberNode;
12
12
  randThreshold: (initial: number, reason: number, firstRank: number, roundTo: number) => number;
@@ -1 +1 @@
1
- {"version":3,"file":"seqArithmeticUtils.d.ts","sourceRoot":"","sources":["../../../../../src/math/utils/sequences/situations/seqArithmeticUtils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,sCAAsC,CAAC;AAExE,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AA8MpE,eAAO,MAAM,kBAAkB;4BArMA,MAAM,UAAU,MAAM,QAAQ,MAAM;+BAIjC,MAAM,UAAU,MAAM,QAAQ,MAAM;4CAK3D,MAAM,UACP,MAAM,aACH,MAAM;+CAaP,MAAM,UACR,MAAM,cACF,MAAM;uCAWT,MAAM,UACP,MAAM,aACH,MAAM,aACN,MAAM;uCAUR,MAAM,UACP,MAAM,cACF,MAAM,cACN,MAAM;0CAQT,MAAM,UACP,MAAM,aACH,MAAM,kBACD,MAAM,oBACJ,gBAAgB;6CAwBzB,MAAM,UACP,MAAM,aACH,MAAM,kBACD,MAAM,oBACJ,gBAAgB;6BAmEzB,MAAM,UACP,MAAM,aACH,MAAM,WACR,MAAM;gCAgBN,MAAM,UACP,MAAM,aACH,MAAM,WACR,MAAM;CA0BhB,CAAC"}
1
+ {"version":3,"file":"seqArithmeticUtils.d.ts","sourceRoot":"","sources":["../../../../../src/math/utils/sequences/situations/seqArithmeticUtils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,sCAAsC,CAAC;AAExE,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAiNpE,eAAO,MAAM,kBAAkB;4BAvMA,MAAM,UAAU,MAAM,QAAQ,MAAM;+BAIjC,MAAM,UAAU,MAAM,QAAQ,MAAM;4CAK3D,MAAM,UACP,MAAM,aACH,MAAM;+CAaP,MAAM,UACR,MAAM,cACF,MAAM;uCAWT,MAAM,UACP,MAAM,aACH,MAAM,aACN,MAAM;uCAUR,MAAM,UACP,MAAM,cACF,MAAM,cACN,MAAM;0CAUT,MAAM,UACP,MAAM,aACH,MAAM,kBACD,MAAM,oBACJ,gBAAgB;6CAwBzB,MAAM,UACP,MAAM,aACH,MAAM,kBACD,MAAM,oBACJ,gBAAgB;6BAmEzB,MAAM,UACP,MAAM,aACH,MAAM,WACR,MAAM;gCAgBN,MAAM,UACP,MAAM,aACH,MAAM,WACR,MAAM;CA0BhB,CAAC"}
@@ -7,6 +7,7 @@ import { substract } from "../../../../tree/nodes/operators/substractNode.js";
7
7
  import { probaFlip } from "../../../../utils/alea/probaFlip.js";
8
8
  import { random, randomMany } from "../../../../utils/alea/random.js";
9
9
  import { randfloat } from "../../random/randfloat.js";
10
+ import { round } from "../../round.js";
10
11
  const valueForRank = (initial, reason, rank) => {
11
12
  return initial + reason * rank;
12
13
  };
@@ -33,7 +34,9 @@ const getAnswerNodeRandomTerm = (initial, reason, firstRank, rankAsked) => {
33
34
  const getAnswerNodeRandomRank = (initial, reason, _firstRank, valueAsked) => {
34
35
  //u_n = u_0 + r * n
35
36
  //n = (u_n - u_0) / r
36
- return frac(substract(valueAsked, initial), reason);
37
+ const nodeRaw = frac(substract(valueAsked, initial), reason);
38
+ const valueRounded = round(nodeRaw.evaluate(), 0);
39
+ return valueRounded.toTree();
37
40
  };
38
41
  const getAnswerNodeThresholdRank = (initial, reason, firstRank, valueThreshold, inequationSymbol) => {
39
42
  //u_n = u_0 + r * n >= t
@@ -1 +1 @@
1
- {"version":3,"file":"questionTest.d.ts","sourceRoot":"","sources":["../../src/tests/questionTest.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,6BAA6B,CAAC;AAKjE,eAAO,MAAM,YAAY,GACvB,KAAK,QAAQ,CAAC,MAAM,CAAC,EACrB,UAAU,QAAQ,CAAC,MAAM,CAAC;;;CAuS3B,CAAC"}
1
+ {"version":3,"file":"questionTest.d.ts","sourceRoot":"","sources":["../../src/tests/questionTest.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,6BAA6B,CAAC;AAKjE,eAAO,MAAM,YAAY,GACvB,KAAK,QAAQ,CAAC,MAAM,CAAC,EACrB,UAAU,QAAQ,CAAC,MAAM,CAAC;;;CAwS3B,CAAC"}
@@ -36,6 +36,7 @@ export const questionTest = (exo, question) => {
36
36
  assertJsonStringifiable(question.identifiers);
37
37
  }
38
38
  catch (err) {
39
+ console.log("question.identifiers", question.identifiers);
39
40
  throw new Error(`exo ${exo.id} : ${err}`);
40
41
  }
41
42
  const dotDecimalPattern = /\d+\.\d+/;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "math-exercises",
3
3
  "type": "module",
4
- "version": "3.0.184",
4
+ "version": "3.0.185",
5
5
  "description": "Math exercises generator for middle school and high school",
6
6
  "main": "lib/index.js",
7
7
  "files": [