math-exercises 3.0.184 → 3.0.186

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 (89) hide show
  1. package/lib/exercises/exercise.d.ts +1 -0
  2. package/lib/exercises/exercise.d.ts.map +1 -1
  3. package/lib/exercises/math/derivation/derivative/exp/index.d.ts +2 -0
  4. package/lib/exercises/math/derivation/derivative/exp/index.d.ts.map +1 -1
  5. package/lib/exercises/math/derivation/derivative/exp/index.js +2 -0
  6. package/lib/exercises/math/derivation/derivative/index.d.ts +3 -0
  7. package/lib/exercises/math/derivation/derivative/index.d.ts.map +1 -1
  8. package/lib/exercises/math/derivation/derivative/index.js +3 -0
  9. package/lib/exercises/math/derivation/derivativeNumber/index.d.ts +2 -0
  10. package/lib/exercises/math/derivation/derivativeNumber/index.d.ts.map +1 -1
  11. package/lib/exercises/math/derivation/derivativeNumber/index.js +2 -0
  12. package/lib/exercises/math/derivation/index.d.ts +1 -0
  13. package/lib/exercises/math/derivation/index.d.ts.map +1 -1
  14. package/lib/exercises/math/derivation/index.js +1 -0
  15. package/lib/exercises/math/derivation/tangent/index.d.ts +9 -0
  16. package/lib/exercises/math/derivation/tangent/index.d.ts.map +1 -1
  17. package/lib/exercises/math/derivation/tangent/index.js +9 -0
  18. package/lib/exercises/math/derivation/variations/index.d.ts +8 -0
  19. package/lib/exercises/math/derivation/variations/index.d.ts.map +1 -1
  20. package/lib/exercises/math/derivation/variations/index.js +8 -0
  21. package/lib/exercises/math/derivation/variations/signVarTable3dDegree.d.ts +10 -0
  22. package/lib/exercises/math/derivation/variations/signVarTable3dDegree.d.ts.map +1 -1
  23. package/lib/exercises/math/derivation/variations/signVarTable3dDegree.js +235 -231
  24. package/lib/exercises/math/functions/exponential/algebraic/approxExpAPlusB.d.ts.map +1 -1
  25. package/lib/exercises/math/functions/exponential/algebraic/approxExpAPlusB.js +91 -38
  26. package/lib/exercises/math/probaStat/trees/index.d.ts +1 -1
  27. package/lib/exercises/math/probaStat/trees/index.d.ts.map +1 -1
  28. package/lib/exercises/math/probaStat/trees/index.js +1 -3
  29. package/lib/exercises/math/probaStat/trees/probabilityTree.d.ts +9 -3
  30. package/lib/exercises/math/probaStat/trees/probabilityTree.d.ts.map +1 -1
  31. package/lib/exercises/math/probaStat/trees/probabilityTree.js +419 -45
  32. package/lib/exercises/math/python/index.d.ts +1 -0
  33. package/lib/exercises/math/python/index.d.ts.map +1 -1
  34. package/lib/exercises/math/python/index.js +1 -0
  35. package/lib/exercises/math/python/list/index.d.ts +11 -0
  36. package/lib/exercises/math/python/list/index.d.ts.map +1 -0
  37. package/lib/exercises/math/python/list/index.js +10 -0
  38. package/lib/exercises/math/python/list/pyListAppend.d.ts +29 -0
  39. package/lib/exercises/math/python/list/pyListAppend.d.ts.map +1 -0
  40. package/lib/exercises/math/python/list/pyListAppend.js +280 -0
  41. package/lib/exercises/math/python/list/pyListCreateListByComprehension.d.ts +11 -0
  42. package/lib/exercises/math/python/list/pyListCreateListByComprehension.d.ts.map +1 -0
  43. package/lib/exercises/math/python/list/pyListCreateListByComprehension.js +231 -0
  44. package/lib/exercises/math/python/list/pyListCreateListInstructionCompletion.d.ts +9 -0
  45. package/lib/exercises/math/python/list/pyListCreateListInstructionCompletion.d.ts.map +1 -0
  46. package/lib/exercises/math/python/list/pyListCreateListInstructionCompletion.js +232 -0
  47. package/lib/exercises/math/python/list/pyListElemAtIndex.d.ts +9 -0
  48. package/lib/exercises/math/python/list/pyListElemAtIndex.d.ts.map +1 -0
  49. package/lib/exercises/math/python/list/pyListElemAtIndex.js +292 -0
  50. package/lib/exercises/math/python/list/pyListMutationMix.d.ts +29 -0
  51. package/lib/exercises/math/python/list/pyListMutationMix.d.ts.map +1 -0
  52. package/lib/exercises/math/python/list/pyListMutationMix.js +455 -0
  53. package/lib/exercises/math/python/list/pyListRemove.d.ts +29 -0
  54. package/lib/exercises/math/python/list/pyListRemove.d.ts.map +1 -0
  55. package/lib/exercises/math/python/list/pyListRemove.js +375 -0
  56. package/lib/exercises/math/python/list/pyListSetElemAtIndex.d.ts +29 -0
  57. package/lib/exercises/math/python/list/pyListSetElemAtIndex.d.ts.map +1 -0
  58. package/lib/exercises/math/python/list/pyListSetElemAtIndex.js +331 -0
  59. package/lib/exercises/math/python/list/pyListSetElemAtIndexInstructionCompletion.d.ts +9 -0
  60. package/lib/exercises/math/python/list/pyListSetElemAtIndexInstructionCompletion.d.ts.map +1 -0
  61. package/lib/exercises/math/python/list/pyListSetElemAtIndexInstructionCompletion.js +346 -0
  62. package/lib/exercises/math/python/list/pyListSetElemAtIndexWaterfall.d.ts +29 -0
  63. package/lib/exercises/math/python/list/pyListSetElemAtIndexWaterfall.d.ts.map +1 -0
  64. package/lib/exercises/math/python/list/pyListSetElemAtIndexWaterfall.js +394 -0
  65. package/lib/exercises/math/sequences/arithmetic/situations/arithmeticFindRankFromSituation.d.ts.map +1 -1
  66. package/lib/exercises/math/sequences/arithmetic/situations/arithmeticFindRankFromSituation.js +3 -3
  67. package/lib/exercises/math/sequences/arithmetic/situations/arithmeticFindThresholdFromSituation.d.ts.map +1 -1
  68. package/lib/exercises/math/sequences/arithmetic/situations/arithmeticFindThresholdFromSituation.js +2 -2
  69. package/lib/exercises/math/sequences/arithmetic/situations/index.d.ts +2 -0
  70. package/lib/exercises/math/sequences/arithmetic/situations/index.d.ts.map +1 -1
  71. package/lib/exercises/math/sequences/arithmetic/situations/index.js +2 -2
  72. package/lib/geogebra/geogebraConstructor.d.ts +1 -0
  73. package/lib/geogebra/geogebraConstructor.d.ts.map +1 -1
  74. package/lib/geogebra/geogebraConstructor.js +3 -0
  75. package/lib/index.d.ts +293 -0
  76. package/lib/index.d.ts.map +1 -1
  77. package/lib/math/geometry/line.js +1 -1
  78. package/lib/math/utils/sequences/situations/seqArithmeticSituations.d.ts +2 -0
  79. package/lib/math/utils/sequences/situations/seqArithmeticSituations.d.ts.map +1 -1
  80. package/lib/math/utils/sequences/situations/seqArithmeticSituations.js +150 -128
  81. package/lib/math/utils/sequences/situations/seqArithmeticUtils.d.ts +1 -1
  82. package/lib/math/utils/sequences/situations/seqArithmeticUtils.d.ts.map +1 -1
  83. package/lib/math/utils/sequences/situations/seqArithmeticUtils.js +4 -1
  84. package/lib/tests/questionTest.d.ts.map +1 -1
  85. package/lib/tests/questionTest.js +1 -0
  86. package/lib/tree/nodes/functions/sqrtNode.d.ts +1 -1
  87. package/lib/tree/nodes/functions/sqrtNode.d.ts.map +1 -1
  88. package/lib/tree/nodes/functions/sqrtNode.js +5 -3
  89. 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+/;
@@ -25,7 +25,7 @@ export declare class SqrtNode implements FunctionNode {
25
25
  simplify(opts?: SimplifyOptions, _log?: boolean): AlgebraicNode;
26
26
  equals(node: AlgebraicNode): boolean;
27
27
  toDetailedEvaluation(vars: Record<string, AlgebraicNode>): AlgebraicNode;
28
- derivative(): AlgebraicNode;
28
+ derivative(varName?: string | undefined): AlgebraicNode;
29
29
  toSimplificationTex(): string;
30
30
  }
31
31
  //# sourceMappingURL=sqrtNode.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"sqrtNode.d.ts","sourceRoot":"","sources":["../../../../src/tree/nodes/functions/sqrtNode.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAClE,OAAO,EAAE,YAAY,EAAE,YAAY,EAAkB,MAAM,mBAAmB,CAAC;AAK/E,OAAO,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAKrE,wBAAgB,UAAU,CAAC,CAAC,EAAE,IAAI,GAAG,CAAC,IAAI,QAAQ,CAEjD;AAED,eAAO,MAAM,IAAI,GAAI,GAAG,aAAa,GAAG,MAAM,GAAG,MAAM,aAItD,CAAC;AAEF,qBAAa,QAAS,YAAW,YAAY;IAC3C,EAAE,EAAE,YAAY,CAAC;IACjB,KAAK,EAAE,aAAa,CAAC;IACrB,IAAI,EAAE,QAAQ,CAAC;IACf,IAAI,CAAC,EAAE,WAAW,CAAC;IACnB,SAAS,EAAE,OAAO,CAAC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C;gBACP,KAAK,EAAE,aAAa,EAAE,IAAI,CAAC,EAAE,WAAW;IAOpD,aAAa;;;;;;IAMb,YAAY,IAAI,MAAM;IAMtB,KAAK,IAAI,MAAM;IAGf,mBAAmB;IAOnB,iBAAiB,CAAC,IAAI,CAAC,EAAE,WAAW,GAAG,aAAa,EAAE;IAwBtD,cAAc,CAAC,IAAI,CAAC,EAAE,WAAW,GAAG,MAAM,EAAE;IAG5C,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC;IAGtC,QAAQ,CAAC,IAAI,CAAC,EAAE,eAAe,EAAE,IAAI,UAAQ,GAAG,aAAa;IAyD7D,MAAM,CAAC,IAAI,EAAE,aAAa,GAAG,OAAO;IAGpC,oBAAoB,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,aAAa,CAAC;IAOxD,UAAU,CAAC,OAAO,CAAC,EAAE,MAAM,GAAG,SAAS,GAAG,aAAa;IAIvD,mBAAmB;CAQpB"}
@@ -3,7 +3,7 @@ import { NodeIds, NodeType } from "../node.js";
3
3
  import { FunctionsIds, isFunctionNode } from "./functionNode.js";
4
4
  import { SquareRoot } from "../../../math/numbers/reals/real.js";
5
5
  import { NumberNode, isNumberNode } from "../numbers/numberNode.js";
6
- import { MultiplyNode, isMultiplyNode } from "../operators/multiplyNode.js";
6
+ import { MultiplyNode, isMultiplyNode, multiply, } from "../operators/multiplyNode.js";
7
7
  import { isInt } from "../../../utils/isInt.js";
8
8
  import { operatorComposition } from "../../../tree/utilities/operatorComposition.js";
9
9
  import { frac, isFractionNode } from "../operators/fractionNode.js";
@@ -135,8 +135,10 @@ export class SqrtNode {
135
135
  //? utile pour remplacer sqrt(2) par une approximation
136
136
  return (vars[this.toTex()] ?? new SqrtNode(this.child.toDetailedEvaluation(vars)));
137
137
  }
138
- derivative() {
139
- throw new Error("unimplemented derivative");
138
+ //(u^(1/2))' = (1/2)u'u^(-1/2)
139
+ derivative(varName) {
140
+ const nodeU = this.child;
141
+ return frac(nodeU.derivative(varName).simplify(), multiply(2, this));
140
142
  }
141
143
  toSimplificationTex() {
142
144
  const simplified = this.simplify();
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.186",
5
5
  "description": "Math exercises generator for middle school and high school",
6
6
  "main": "lib/index.js",
7
7
  "files": [