math-exercises 3.0.187 → 3.0.188

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 (74) hide show
  1. package/lib/exercises/math/derivation/derivative/exp/expDerivativeProductFExp.d.ts.map +1 -1
  2. package/lib/exercises/math/derivation/derivative/exp/expDerivativeProductFExp.js +22 -6
  3. package/lib/exercises/math/derivation/derivative/exp/expDerivativeQuotientFExp.d.ts.map +1 -1
  4. package/lib/exercises/math/derivation/derivative/exp/expDerivativeQuotientFExp.js +16 -8
  5. package/lib/exercises/math/derivation/derivativeNumber/derivativeNumberAndImageReading.d.ts +9 -0
  6. package/lib/exercises/math/derivation/derivativeNumber/derivativeNumberAndImageReading.d.ts.map +1 -0
  7. package/lib/exercises/math/derivation/derivativeNumber/derivativeNumberAndImageReading.js +155 -0
  8. package/lib/exercises/math/derivation/derivativeNumber/index.d.ts +1 -0
  9. package/lib/exercises/math/derivation/derivativeNumber/index.d.ts.map +1 -1
  10. package/lib/exercises/math/derivation/derivativeNumber/index.js +1 -0
  11. package/lib/exercises/math/derivation/problems/problemMaximizeBoxVolumeFindX.d.ts.map +1 -1
  12. package/lib/exercises/math/derivation/problems/problemMaximizeBoxVolumeFindX.js +80 -29
  13. package/lib/exercises/math/derivation/problems/problemMaximizeProfitFindProduction.d.ts.map +1 -1
  14. package/lib/exercises/math/derivation/problems/problemMaximizeProfitFindProduction.js +30 -2
  15. package/lib/exercises/math/derivation/problems/problemMovementOnLineFindSpeedAtPoint.d.ts.map +1 -1
  16. package/lib/exercises/math/derivation/problems/problemMovementOnLineFindSpeedAtPoint.js +59 -16
  17. package/lib/exercises/math/derivation/tangent/tangentEquationFromFunctionExpression.d.ts.map +1 -1
  18. package/lib/exercises/math/derivation/tangent/tangentEquationFromFunctionExpression.js +23 -9
  19. package/lib/exercises/math/derivation/variations/findAbscissaOfExtremaFromFunctionExpression.d.ts.map +1 -1
  20. package/lib/exercises/math/derivation/variations/findAbscissaOfExtremaFromFunctionExpression.js +2 -7
  21. package/lib/exercises/math/derivation/variations/findExtremaFromFunctionExpression.d.ts.map +1 -1
  22. package/lib/exercises/math/derivation/variations/findExtremaFromFunctionExpression.js +2 -7
  23. package/lib/exercises/math/functions/sign/equationFromSignTable.d.ts +1 -0
  24. package/lib/exercises/math/functions/sign/equationFromSignTable.d.ts.map +1 -1
  25. package/lib/exercises/math/functions/sign/equationFromSignTable.js +60 -33
  26. package/lib/exercises/math/functions/sign/partialSignTableFromGraph.d.ts +6 -4
  27. package/lib/exercises/math/functions/sign/partialSignTableFromGraph.d.ts.map +1 -1
  28. package/lib/exercises/math/functions/sign/partialSignTableFromGraph.js +160 -63
  29. package/lib/exercises/math/functions/sign/readSignTable.d.ts +4 -1
  30. package/lib/exercises/math/functions/sign/readSignTable.d.ts.map +1 -1
  31. package/lib/exercises/math/functions/sign/readSignTable.js +32 -9
  32. package/lib/exercises/math/functions/sign/signTableFromGraph.d.ts +6 -4
  33. package/lib/exercises/math/functions/sign/signTableFromGraph.d.ts.map +1 -1
  34. package/lib/exercises/math/functions/sign/signTableFromGraph.js +160 -57
  35. package/lib/exercises/math/percent/evolutions/averageEvolutionRateFromStartAndEndValue.d.ts +9 -0
  36. package/lib/exercises/math/percent/evolutions/averageEvolutionRateFromStartAndEndValue.d.ts.map +1 -0
  37. package/lib/exercises/math/percent/evolutions/averageEvolutionRateFromStartAndEndValue.js +135 -0
  38. package/lib/exercises/math/percent/evolutions/index.d.ts +1 -0
  39. package/lib/exercises/math/percent/evolutions/index.d.ts.map +1 -1
  40. package/lib/exercises/math/percent/evolutions/index.js +1 -0
  41. package/lib/exercises/math/powers/equationOnePlusTPowerN.d.ts +9 -0
  42. package/lib/exercises/math/powers/equationOnePlusTPowerN.d.ts.map +1 -0
  43. package/lib/exercises/math/powers/equationOnePlusTPowerN.js +118 -0
  44. package/lib/exercises/math/powers/estimateNthRoot.d.ts +13 -0
  45. package/lib/exercises/math/powers/estimateNthRoot.d.ts.map +1 -0
  46. package/lib/exercises/math/powers/estimateNthRoot.js +126 -0
  47. package/lib/exercises/math/powers/index.d.ts +3 -0
  48. package/lib/exercises/math/powers/index.d.ts.map +1 -1
  49. package/lib/exercises/math/powers/index.js +3 -0
  50. package/lib/exercises/math/powers/solveNthRootEquation.d.ts +9 -0
  51. package/lib/exercises/math/powers/solveNthRootEquation.d.ts.map +1 -0
  52. package/lib/exercises/math/powers/solveNthRootEquation.js +111 -0
  53. package/lib/exercises/math/sequences/arithmetic/situations/arithmeticFindRecurrenceFormulaFromSituation.d.ts.map +1 -1
  54. package/lib/exercises/math/sequences/arithmetic/situations/arithmeticFindRecurrenceFormulaFromSituation.js +2 -2
  55. package/lib/exercises/math/sequences/geometric/geometricFindExplicitFormulaFromTwoConsecutiveTerms.js +1 -1
  56. package/lib/exercises/math/sequences/geometric/geometricFindRandomTermFromTwoConsecutiveTerms.js +1 -1
  57. package/lib/exercises/vea/percentVEA.d.ts +6 -1
  58. package/lib/exercises/vea/percentVEA.d.ts.map +1 -1
  59. package/lib/exercises/vea/percentVEA.js +15 -1
  60. package/lib/index.d.ts +34 -9
  61. package/lib/index.d.ts.map +1 -1
  62. package/lib/math/utils/sequences/situations/seqArithmeticSituations.d.ts.map +1 -1
  63. package/lib/math/utils/sequences/situations/seqArithmeticSituations.js +5 -8
  64. package/lib/math/utils/sequences/situations/seqArithmeticUtils.d.ts +1 -1
  65. package/lib/math/utils/sequences/situations/seqArithmeticUtils.d.ts.map +1 -1
  66. package/lib/math/utils/sequences/situations/seqArithmeticUtils.js +1 -3
  67. package/lib/math/utils/sequences/situations/seqGeometricSituations.d.ts.map +1 -1
  68. package/lib/math/utils/sequences/situations/seqGeometricSituations.js +8 -10
  69. package/lib/tests/questionTest.d.ts.map +1 -1
  70. package/lib/tests/questionTest.js +8 -0
  71. package/lib/tree/nodes/sets/closure.d.ts +1 -0
  72. package/lib/tree/nodes/sets/closure.d.ts.map +1 -1
  73. package/lib/tree/nodes/sets/closure.js +12 -0
  74. 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/numbers/constantNode.js").ConstantNode | import("../../../../tree/nodes/numbers/numberNode.js").NumberNode;
9
+ getAnswerNodeRandomRank: (initial: number, reason: number, _firstRank: number, valueAsked: number) => import("../../../../tree/nodes/operators/fractionNode.js").FractionNode;
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;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"}
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;AA+MpE,eAAO,MAAM,kBAAkB;4BAtMA,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;0CAST,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,7 +7,6 @@ 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";
11
10
  const valueForRank = (initial, reason, rank) => {
12
11
  return initial + reason * rank;
13
12
  };
@@ -35,8 +34,7 @@ const getAnswerNodeRandomRank = (initial, reason, _firstRank, valueAsked) => {
35
34
  //u_n = u_0 + r * n
36
35
  //n = (u_n - u_0) / r
37
36
  const nodeRaw = frac(substract(valueAsked, initial), reason);
38
- const valueRounded = round(nodeRaw.evaluate(), 0);
39
- return valueRounded.toTree();
37
+ return nodeRaw;
40
38
  };
41
39
  const getAnswerNodeThresholdRank = (initial, reason, firstRank, valueThreshold, inequationSymbol) => {
42
40
  //u_n = u_0 + r * n >= t
@@ -1 +1 @@
1
- {"version":3,"file":"seqGeometricSituations.d.ts","sourceRoot":"","sources":["../../../../../src/math/utils/sequences/situations/seqGeometricSituations.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,mCAAmC,CAAC;AAYlE,MAAM,MAAM,2BAA2B,GAAG;IACxC,cAAc,CAAC,EAAE,CACf,OAAO,EAAE,MAAM,EACf,MAAM,EAAE,MAAM,EACd,SAAS,EAAE,MAAM,EACjB,GAAG,SAAS,EAAE,OAAO,EAAE,KACpB,MAAM,CAAC;IAEZ,aAAa,EAAE,CACb,OAAO,EAAE,MAAM,EACf,MAAM,EAAE,MAAM,EACd,SAAS,EAAE,MAAM,EACjB,GAAG,SAAS,EAAE,OAAO,EAAE,KACpB,aAAa,CAAC;IACnB,OAAO,EAAE,CAAC,SAAS,EAAE,MAAM,EAAE,GAAG,SAAS,EAAE,OAAO,EAAE,KAAK,MAAM,CAAC;IAChE,kBAAkB,EAAE,CAClB,OAAO,EAAE,MAAM,EACf,MAAM,EAAE,MAAM,EACd,SAAS,EAAE,MAAM,EACjB,GAAG,SAAS,EAAE,OAAO,EAAE,KACpB,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAC9B,CAAC;AAEF,MAAM,MAAM,WAAW,GAAG;IACxB,cAAc,EAAE,CAAC,UAAU,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,KAAK,MAAM,CAAC;IACzE,cAAc,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,KAAK,aAAa,CAAC;CACpE,CAAC;AAEF,MAAM,MAAM,iCAAiC,GAAG;IAC9C,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,EAAE,CAAC;CAClB,CAAC;AAEF,MAAM,MAAM,kBAAkB,GAAG;IAC/B,IAAI,EAAE,QAAQ,GAAG,kBAAkB,GAAG,KAAK,GAAG,eAAe,CAAC;IAC9D,WAAW,EAAE,MAAM,MAAM,CAAC;IAC1B,UAAU,EAAE,MAAM,MAAM,CAAC;IACzB,mBAAmB,EAAE,MAAM,iCAAiC,CAAC;IAC7D,aAAa,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,KAAK,MAAM,CAAC;IAC9E,WAAW,EAAE,WAAW,CAAC;IAEzB,eAAe,EAAE,CACf,OAAO,EAAE,MAAM,EACf,MAAM,EAAE,MAAM,EACd,SAAS,EAAE,MAAM,EACjB,eAAe,CAAC,EAAE,iCAAiC,KAChD,MAAM,CAAC;IAEZ,4BAA4B,EAAE,2BAA2B,CAAC;IAC1D,8BAA8B,EAAE,2BAA2B,CAAC;IAE5D,uBAAuB,EAAE,2BAA2B,CAAC;CAItD,CAAC;AA+2CF,eAAO,MAAM,mBAAmB;;sCA51Cb,MAAM,UACP,MAAM,aACH,MAAM,gBACH,OAAO,EAAE;;;;;sCA2Bd,MAAM,UACP,MAAM,aACH,MAAM,gBACH,OAAO,EAAE;;;;;;;sCAiChB,MAAM,UACP,MAAM,aACH,MAAM,gBACH,OAAO,EAAE;;;;IAyxC9B,CAAC"}
1
+ {"version":3,"file":"seqGeometricSituations.d.ts","sourceRoot":"","sources":["../../../../../src/math/utils/sequences/situations/seqGeometricSituations.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,mCAAmC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EAAE,MAAM,KAAK,MAAM,CAAC;IAC9E,WAAW,EAAE,WAAW,CAAC;IAEzB,eAAe,EAAE,CACf,OAAO,EAAE,MAAM,EACf,MAAM,EAAE,MAAM,EACd,SAAS,EAAE,MAAM,EACjB,eAAe,CAAC,EAAE,iCAAiC,KAChD,MAAM,CAAC;IAEZ,4BAA4B,EAAE,2BAA2B,CAAC;IAC1D,8BAA8B,EAAE,2BAA2B,CAAC;IAE5D,uBAAuB,EAAE,2BAA2B,CAAC;CAItD,CAAC;AA42CF,eAAO,MAAM,mBAAmB;;sCAz1Cb,MAAM,UACP,MAAM,aACH,MAAM,gBACH,OAAO,EAAE;;;;;sCA2Bd,MAAM,UACP,MAAM,aACH,MAAM,gBACH,OAAO,EAAE;;;;;;;sCAiChB,MAAM,UACP,MAAM,aACH,MAAM,gBACH,OAAO,EAAE;;;;IAsxC9B,CAAC"}
@@ -3,6 +3,7 @@ import { substract } from "../../../../tree/nodes/operators/substractNode.js";
3
3
  import { alignTex } from "../../../../utils/latex/alignTex.js";
4
4
  import { randfloat } from "../../random/randfloat.js";
5
5
  import { randint } from "../../random/randint.js";
6
+ import { round } from "../../round.js";
6
7
  import { seqGeometricUtils } from "./seqGeometricUtils.js";
7
8
  const getStrFactor = (firstRank) => {
8
9
  return firstRank === 0 ? "n" : "(n-1)";
@@ -67,10 +68,7 @@ $$
67
68
 
68
69
  En particulier :
69
70
 
70
- ${alignTex([
71
- [`u_{${rankAsked}}`, "=", answerNode.toTex()],
72
- ["", "=", answerNode.simplify().toTex()],
73
- ])}
71
+ ${alignTex([[`u_{${rankAsked}}`, "=", answerNode.toTex()]])}
74
72
 
75
73
  `;
76
74
  return { str };
@@ -84,7 +82,7 @@ const templatesSituationsGeometric = [
84
82
  {
85
83
  type: "evoPercentage",
86
84
  randInitial: () => randint(20, 51) * 100,
87
- randReason: () => 1 + randfloat(0, 4, 2, [0]) / 100, //expl: 1,0331
85
+ randReason: () => round(1 + randfloat(0, 4, 2, [0]) / 100, 4), //expl: 1,0331
88
86
  randThreshold: (initial, reason, firstRank) => seqGeometricUtils.randThreshold(initial, reason, firstRank, 2),
89
87
  randSuperfluousData: () => {
90
88
  const rand = randint(0, 2);
@@ -211,7 +209,7 @@ Le capital en $\\textrm{€}$, au premier janvier de l'année $${add(2026, subst
211
209
  {
212
210
  type: "evoPercentage",
213
211
  randInitial: () => randint(13, 30) * 1000,
214
- randReason: () => 1 - (randint(10, 26, [0]) * 1.0) / 100, //expl: 0,80
212
+ randReason: () => round(1 - (randint(10, 26, [0]) * 1.0) / 100, 2), //expl: 0,80
215
213
  randThreshold: (initial, reason, firstRank) => seqGeometricUtils.randThreshold(initial, reason, firstRank, 2),
216
214
  randSuperfluousData: () => {
217
215
  const rand = randint(0, 2);
@@ -341,7 +339,7 @@ La valeur de la voiture de Killian en $\\textrm{€}$, au premier juillet de l'a
341
339
  {
342
340
  type: "factorPercentage",
343
341
  randInitial: () => randfloat(1, 2, 2),
344
- randReason: () => 1 - (randint(10, 26, [0]) * 1.0) / 100, //expl: 0,80
342
+ randReason: () => round(1 - (randint(10, 26, [0]) * 1.0) / 100, 2), //expl: 0,80
345
343
  randThreshold: (initial, reason, firstRank) => seqGeometricUtils.randThreshold(initial, reason, firstRank, 2),
346
344
  randSuperfluousData: () => {
347
345
  const rand = randint(0, 2);
@@ -468,7 +466,7 @@ La hauteur de la balle est donc une suite géométrique de premier terme $${init
468
466
  {
469
467
  type: "evoPercentage",
470
468
  randInitial: () => randint(50, 101) * 100,
471
- randReason: () => 1 + (randint(10, 40) * 1.0) / 100, //expl: 1,25
469
+ randReason: () => round(1 + (randint(10, 40) * 1.0) / 100, 2), //expl: 1,25
472
470
  randThreshold: (initial, reason, firstRank) => seqGeometricUtils.randThreshold(initial, reason, firstRank, 2),
473
471
  randSuperfluousData: () => {
474
472
  const rand = randint(0, 2);
@@ -710,7 +708,7 @@ Le nombre de personnes informées est donc une suite géométrique de premier te
710
708
  {
711
709
  type: "evoPercentage",
712
710
  randInitial: () => randint(28, 44) * 1000,
713
- randReason: () => 1 + randint(2, 7) / 100, //expl: 1,05
711
+ randReason: () => round(1 + randint(2, 7) / 100, 2), //expl: 1,05
714
712
  randThreshold: (initial, reason, firstRank) => seqGeometricUtils.randThreshold(initial, reason, firstRank, 2),
715
713
  randSuperfluousData: () => {
716
714
  const rand = randint(0, 2);
@@ -845,7 +843,7 @@ Le salaire en $\\textrm{€}$ pour l'année $${add(2025, substract("n".toTree(),
845
843
  {
846
844
  type: "evoPercentage",
847
845
  randInitial: () => randint(28, 44) * 1000,
848
- randReason: () => 1 + randint(2, 7) / 100, //expl: 1,05
846
+ randReason: () => round(1 + randint(2, 7) / 100, 2), //expl: 1,05
849
847
  randThreshold: (initial, reason, firstRank) => seqGeometricUtils.randThreshold(initial, reason, firstRank, 2),
850
848
  randSuperfluousData: () => {
851
849
  const rand = randint(0, 2);
@@ -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;;;CAwS3B,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;;;CAgU3B,CAAC"}
@@ -69,6 +69,14 @@ export const questionTest = (exo, question) => {
69
69
  throw new Error(`exo ${exo.id} has no initTable`);
70
70
  if (!question.initTable.some((row) => row.some((cell) => cell === "")))
71
71
  throw new Error(`exo ${exo.id} is answertype table but no input in table`);
72
+ const initTableRowsLengths = question.initTable.map((row) => row.length);
73
+ if (initTableRowsLengths.some((rowLength, i) => rowLength !== initTableRowsLengths[0]))
74
+ throw new Error(`exo ${exo.id} has different row lengths in initTable`);
75
+ const answerTableRowsLengths = question.answerTable.map((row) => row.length);
76
+ if (answerTableRowsLengths.some((rowLength, i) => rowLength !== answerTableRowsLengths[0]))
77
+ throw new Error(`exo ${exo.id} has different row lengths in answerTable`);
78
+ if (initTableRowsLengths.some((rowLength, i) => rowLength !== question.answerTable[i].length))
79
+ throw new Error(`exo ${exo.id} has different row lengths in answerTable and initTable`);
72
80
  }
73
81
  else if (exo.answerType === "treeDiagram") {
74
82
  if (!question.initTreeTable?.length)
@@ -10,6 +10,7 @@ export declare abstract class Closure {
10
10
  static leftReverse(closure: ClosureType): ClosureType;
11
11
  static rightReverse(closure: ClosureType): ClosureType;
12
12
  static switch(closure: ClosureType): ClosureType;
13
+ static fromBooleans(isLeftClosed: boolean, isRightClosed: boolean): ClosureType;
13
14
  static fromBrackets(left: "[" | "]", right: "]" | "["): ClosureType;
14
15
  static toBrackets(closure: ClosureType): string[];
15
16
  static isLeftOpen(closure: ClosureType): boolean;
@@ -1 +1 @@
1
- {"version":3,"file":"closure.d.ts","sourceRoot":"","sources":["../../../../src/tree/nodes/sets/closure.ts"],"names":[],"mappings":"AAEA,oBAAY,WAAW;IACrB,EAAE,IAAA;IACF,EAAE,IAAA;IACF,EAAE,IAAA;IACF,EAAE,IAAA;CACH;AAED,8BAAsB,OAAO;IAC3B,MAAM,CAAC,MAAM;IAcb,MAAM,CAAC,OAAO,CAAC,OAAO,EAAE,WAAW;IAYnC,MAAM,CAAC,WAAW,CAAC,OAAO,EAAE,WAAW;IAYvC,MAAM,CAAC,YAAY,CAAC,OAAO,EAAE,WAAW;IAYxC,MAAM,CAAC,MAAM,CAAC,OAAO,EAAE,WAAW;IAYlC,MAAM,CAAC,YAAY,CAAC,IAAI,EAAE,GAAG,GAAG,GAAG,EAAE,KAAK,EAAE,GAA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,MAAM,CAAC,WAAW,CAAC,OAAO,EAAE,WAAW;IAWvC,MAAM,CAAC,iBAAiB,GAAI,GAAG,GAAG,GAAG,GAAG,EAAE,GAAG,GAAG,GAAG,GAAG,eAGpD;IACF,MAAM,CAAC,kBAAkB,GAAI,GAAG,GAAG,GAAG,GAAG,EAAE,GAAG,GAAG,GAAG,GAAG,eAGrD;IACF,MAAM,CAAC,iBAAiB,GAAI,GAAG,GAAG,GAAG,GAAG,EAAE,GAAG,GAAG,GAAG,GAAG,eAGpD;IACF,MAAM,CAAC,kBAAkB,GAAI,GAAG,GAAG,GAAG,GAAG,EAAE,GAAG,GAAG,GAAG,GAAG,eAGrD;CACH"}
@@ -69,6 +69,18 @@ export class Closure {
69
69
  return ClosureType.FO;
70
70
  }
71
71
  }
72
+ static fromBooleans(isLeftClosed, isRightClosed) {
73
+ if (isLeftClosed) {
74
+ if (isRightClosed)
75
+ return ClosureType.FF;
76
+ else
77
+ return ClosureType.FO;
78
+ }
79
+ else if (isRightClosed)
80
+ return ClosureType.OF;
81
+ else
82
+ return ClosureType.OO;
83
+ }
72
84
  static fromBrackets(left, right) {
73
85
  if (left === "[")
74
86
  if (right === "]")
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "math-exercises",
3
3
  "type": "module",
4
- "version": "3.0.187",
4
+ "version": "3.0.188",
5
5
  "description": "Math exercises generator for middle school and high school",
6
6
  "main": "lib/index.js",
7
7
  "files": [