math-exercises 3.0.131 → 3.0.133

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 (109) hide show
  1. package/lib/exercises/exercise.d.ts +37 -30
  2. package/lib/exercises/exercise.d.ts.map +1 -1
  3. package/lib/exercises/math/calcul/mentalCaluls/mentalProgramSolve.d.ts +2 -2
  4. package/lib/exercises/math/calcul/mentalCaluls/mentalProgramSolve.d.ts.map +1 -1
  5. package/lib/exercises/math/calcul/mentalCaluls/mentalProgramSolve.js +44 -40
  6. package/lib/exercises/math/calcul/ordering/compareA10N.d.ts +1 -1
  7. package/lib/exercises/math/calcul/ordering/compareA10N.d.ts.map +1 -1
  8. package/lib/exercises/math/calcul/ordering/compareA10N.js +15 -10
  9. package/lib/exercises/math/calcul/ordering/compareFracABWithFracAPlusCBPlusC.d.ts.map +1 -1
  10. package/lib/exercises/math/calcul/ordering/compareFracABWithFracAPlusCBPlusC.js +0 -1
  11. package/lib/exercises/math/calcul/ordering/compareFracAndDec.d.ts +1 -1
  12. package/lib/exercises/math/calcul/ordering/compareFracAndDec.js +1 -1
  13. package/lib/exercises/math/calcul/proportionality/findCoeffInProportionalTableNonIntegers.js +1 -1
  14. package/lib/exercises/math/calcul/proportionality/isTableProportionalNonInteger.d.ts.map +1 -1
  15. package/lib/exercises/math/calcul/proportionality/isTableProportionalNonInteger.js +2 -0
  16. package/lib/exercises/math/calcul/rounding/estimatePow10NPlusPow10MinusN.d.ts.map +1 -1
  17. package/lib/exercises/math/calcul/rounding/estimatePow10NPlusPow10MinusN.js +8 -6
  18. package/lib/exercises/math/calcul/rounding/rounding.d.ts +1 -1
  19. package/lib/exercises/math/calcul/rounding/rounding.d.ts.map +1 -1
  20. package/lib/exercises/math/calcul/rounding/rounding.js +7 -6
  21. package/lib/exercises/math/calculLitteral/equation/equationFromProblem.d.ts.map +1 -1
  22. package/lib/exercises/math/calculLitteral/equation/equationFromProblem.js +8 -9
  23. package/lib/exercises/math/calculLitteral/simplifying/compareATimes0.d.ts.map +1 -1
  24. package/lib/exercises/math/calculLitteral/simplifying/compareATimes0.js +4 -4
  25. package/lib/exercises/math/calculLitteral/writing/writeLitExpFromFrenchExp.d.ts.map +1 -1
  26. package/lib/exercises/math/calculLitteral/writing/writeLitExpFromFrenchExp.js +15 -60
  27. package/lib/exercises/math/conversion/kmPerMinToKmPerHourConversion.js +14 -10
  28. package/lib/exercises/math/conversion/lengthConversion.d.ts.map +1 -1
  29. package/lib/exercises/math/conversion/lengthConversion.js +1 -0
  30. package/lib/exercises/math/conversion/prefixToNumber.d.ts +0 -2
  31. package/lib/exercises/math/conversion/prefixToNumber.d.ts.map +1 -1
  32. package/lib/exercises/math/conversion/prefixToNumber.js +31 -24
  33. package/lib/exercises/math/conversion/secondsToHours.js +1 -1
  34. package/lib/exercises/math/functions/affines/drawAffineFromPointAndLeadingCoeff.js +2 -2
  35. package/lib/exercises/math/functions/affines/drawAffineFromProgCalc.d.ts +1 -1
  36. package/lib/exercises/math/functions/affines/drawAffineFromProgCalc.d.ts.map +1 -1
  37. package/lib/exercises/math/functions/affines/drawAffineFromProgCalc.js +4 -5
  38. package/lib/exercises/math/functions/affines/leadingCoefficient.js +1 -1
  39. package/lib/exercises/math/geometry/angles/anglesUsingIsParallel.d.ts +1 -1
  40. package/lib/exercises/math/geometry/angles/anglesUsingIsParallel.d.ts.map +1 -1
  41. package/lib/exercises/math/geometry/angles/anglesUsingIsParallel.js +10 -11
  42. package/lib/exercises/math/geometry/angles/isParallelUsingAngles.d.ts +1 -1
  43. package/lib/exercises/math/geometry/angles/isParallelUsingAngles.d.ts.map +1 -1
  44. package/lib/exercises/math/geometry/angles/isParallelUsingAngles.js +8 -8
  45. package/lib/exercises/math/geometry/cartesian/index.d.ts +1 -0
  46. package/lib/exercises/math/geometry/cartesian/index.d.ts.map +1 -1
  47. package/lib/exercises/math/geometry/cartesian/index.js +1 -0
  48. package/lib/exercises/math/geometry/cartesian/placeAbscissOnSemiLine.d.ts +6 -9
  49. package/lib/exercises/math/geometry/cartesian/placeAbscissOnSemiLine.d.ts.map +1 -1
  50. package/lib/exercises/math/geometry/cartesian/placeAbscissOnSemiLine.js +60 -137
  51. package/lib/exercises/math/geometry/cartesian/placeAbscissOnSemiLineV2.d.ts +16 -0
  52. package/lib/exercises/math/geometry/cartesian/placeAbscissOnSemiLineV2.d.ts.map +1 -0
  53. package/lib/exercises/math/geometry/cartesian/placeAbscissOnSemiLineV2.js +213 -0
  54. package/lib/exercises/math/percent/evolutions/globalPercent.d.ts +4 -1
  55. package/lib/exercises/math/percent/evolutions/globalPercent.d.ts.map +1 -1
  56. package/lib/exercises/math/percent/evolutions/globalPercent.js +37 -21
  57. package/lib/exercises/math/percent/findProportion.d.ts.map +1 -1
  58. package/lib/exercises/math/percent/findProportion.js +24 -26
  59. package/lib/exercises/math/percent/percentToDecimal.d.ts +4 -1
  60. package/lib/exercises/math/percent/percentToDecimal.d.ts.map +1 -1
  61. package/lib/exercises/math/percent/percentToDecimal.js +55 -35
  62. package/lib/exercises/math/powers/calculateNegativePower.d.ts +1 -1
  63. package/lib/exercises/math/powers/calculateNegativePower.d.ts.map +1 -1
  64. package/lib/exercises/math/powers/calculateNegativePower.js +17 -10
  65. package/lib/exercises/math/probaStat/basicProbas/possibleValuesForProba.js +2 -2
  66. package/lib/exercises/math/probaStat/basicStats/calculateFrequencyInList.d.ts +5 -1
  67. package/lib/exercises/math/probaStat/basicStats/calculateFrequencyInList.d.ts.map +1 -1
  68. package/lib/exercises/math/probaStat/basicStats/calculateFrequencyInList.js +76 -12
  69. package/lib/exercises/math/probaStat/conditionalProbaWriteFromFrench.js +7 -7
  70. package/lib/exercises/math/probaStat/probaAsSumOfProbas.d.ts +2 -3
  71. package/lib/exercises/math/probaStat/probaAsSumOfProbas.d.ts.map +1 -1
  72. package/lib/exercises/math/probaStat/probaAsSumOfProbas.js +60 -95
  73. package/lib/exercises/math/probaStat/probaFromTableWithContext.d.ts +12 -5
  74. package/lib/exercises/math/probaStat/probaFromTableWithContext.d.ts.map +1 -1
  75. package/lib/exercises/math/probaStat/probaFromTableWithContext.js +354 -94
  76. package/lib/exercises/math/probaStat/stats1var/medianWithList.d.ts +4 -1
  77. package/lib/exercises/math/probaStat/stats1var/medianWithList.d.ts.map +1 -1
  78. package/lib/exercises/math/probaStat/stats1var/medianWithList.js +43 -23
  79. package/lib/exercises/math/probaStat/stats1var/plausibilityOfAverage.d.ts.map +1 -1
  80. package/lib/exercises/math/probaStat/stats1var/plausibilityOfAverage.js +70 -23
  81. package/lib/exercises/math/probaStat/stats1var/quartilesList.d.ts +1 -1
  82. package/lib/exercises/math/probaStat/stats1var/quartilesList.d.ts.map +1 -1
  83. package/lib/exercises/math/probaStat/stats1var/quartilesList.js +4 -4
  84. package/lib/exercises/pc/index.d.ts +0 -1
  85. package/lib/exercises/pc/index.d.ts.map +1 -1
  86. package/lib/exercises/pc/index.js +0 -1
  87. package/lib/exercises/pc/motion/averageSpeed.d.ts +0 -2
  88. package/lib/exercises/pc/motion/averageSpeed.d.ts.map +1 -1
  89. package/lib/exercises/pc/motion/averageSpeed.js +40 -45
  90. package/lib/exercises/pc/optics/lensFormula.d.ts +1 -2
  91. package/lib/exercises/pc/optics/lensFormula.d.ts.map +1 -1
  92. package/lib/exercises/pc/optics/lensFormula.js +7 -10
  93. package/lib/exercises/pc/weight/calculateWeight.d.ts +1 -3
  94. package/lib/exercises/pc/weight/calculateWeight.d.ts.map +1 -1
  95. package/lib/exercises/pc/weight/calculateWeight.js +38 -30
  96. package/lib/index.d.ts +932 -948
  97. package/lib/index.d.ts.map +1 -1
  98. package/lib/math/progCalc/progCalc.d.ts +2 -2
  99. package/lib/math/progCalc/progCalc.d.ts.map +1 -1
  100. package/lib/math/progCalc/progCalc.js +4 -11
  101. package/lib/playgroundUtils.d.ts +3 -0
  102. package/lib/playgroundUtils.d.ts.map +1 -0
  103. package/lib/playgroundUtils.js +13 -0
  104. package/lib/server.js +121 -0
  105. package/lib/tests/exoTest.d.ts.map +1 -1
  106. package/lib/tests/exoTest.js +13 -0
  107. package/lib/types/keyIds.d.ts +1 -1
  108. package/lib/types/keyIds.d.ts.map +1 -1
  109. package/package.json +1 -1
@@ -178,7 +178,7 @@ const getCorrection = (identifiers) => {
178
178
  };
179
179
  const getGGBOptions = (identifiers, opts) => {
180
180
  const { arrIntersectionIds, arrAngleIndex, arrAngleForLabel } = identifiers;
181
- const nbDigits = opts?.nbDigits ?? 1;
181
+ const nbDigits = opts?.nbDigits ?? "1";
182
182
  const arrIntersection = arrIntersectionIds.map(IntersectionConstructor.fromIdentifiers);
183
183
  const arrAngle = arrAngleIndex.map((angleIndex, i) => arrIntersection[i].getAngle(angleIndex));
184
184
  const arrCommandPoints = arrAngle
@@ -217,7 +217,7 @@ const getGGBOptions = (identifiers, opts) => {
217
217
  //fake or real label
218
218
  `ShowLabel(${a.name}, false)`,
219
219
  ...a.getFitCaptionCommands({
220
- text: round(arrAngleForLabel ? arrAngleForLabel[i] : a.evaluate(), nbDigits).frenchify(),
220
+ text: round(arrAngleForLabel ? arrAngleForLabel[i] : a.evaluate(), Number(nbDigits)).frenchify(),
221
221
  size: "small",
222
222
  color: ["red", "blue"][i],
223
223
  }),
@@ -241,7 +241,7 @@ const isAnswerValid = (ans, { answer }) => {
241
241
  const optsDefault = {
242
242
  angleTypes: ["alternes-internes"],
243
243
  isFakeDisplay: true,
244
- nbDigits: 0,
244
+ nbDigits: "0",
245
245
  };
246
246
  const options = [
247
247
  {
@@ -269,7 +269,7 @@ const options = [
269
269
  label: "Nombre de décimales",
270
270
  target: GeneratorOptionTarget.generation,
271
271
  type: GeneratorOptionType.select,
272
- values: [0, 1, 2],
272
+ values: ["0", "1", "2"],
273
273
  defaultValue: optsDefault.nbDigits,
274
274
  },
275
275
  ];
@@ -281,11 +281,11 @@ const getIsParallelUsingAnglesQuestion = (optsIn) => {
281
281
  function createConfigGeom(isParralelInGeom, isLookingParallel) {
282
282
  const deviation = isLookingParallel ? 1 : 5;
283
283
  const cAngleInDegreesMin = 30;
284
- const cAngleInDegreesTop = randfloat(cAngleInDegreesMin, 180 - cAngleInDegreesMin, opts.nbDigits);
284
+ const cAngleInDegreesTop = randfloat(cAngleInDegreesMin, 180 - cAngleInDegreesMin, Number(opts.nbDigits));
285
285
  const cAngleInDegreesBottom = isParralelInGeom
286
286
  ? cAngleInDegreesTop
287
287
  : cAngleInDegreesTop +
288
- randfloat(-deviation, deviation, opts.nbDigits, [0]);
288
+ randfloat(-deviation, deviation, Number(opts.nbDigits), [0]);
289
289
  return {
290
290
  cAngleInDegreesTop,
291
291
  cAngleInDegreesBottom,
@@ -351,10 +351,10 @@ const getIsParallelUsingAnglesQuestion = (optsIn) => {
351
351
  let arrAngleForLabel;
352
352
  if (opts.isFakeDisplay) {
353
353
  const angleInDegreesMin = 25;
354
- const cAngleInDegreesTop = randfloat(angleInDegreesMin, 180 - angleInDegreesMin, opts.nbDigits);
354
+ const cAngleInDegreesTop = randfloat(angleInDegreesMin, 180 - angleInDegreesMin, Number(opts.nbDigits));
355
355
  const cAngleInDegreesBottom = isParralel
356
356
  ? cAngleInDegreesTop
357
- : cAngleInDegreesTop + randfloat(-25, 50, opts.nbDigits, [0]);
357
+ : cAngleInDegreesTop + randfloat(-25, 50, Number(opts.nbDigits), [0]);
358
358
  //angles at angleIndexes 0 and 2 have same value. Same for angleIndexes 1 and 3.
359
359
  arrAngleForLabel = [cAngleInDegreesTop, cAngleInDegreesBottom].map((angle, i) => {
360
360
  return arrAngleIndex[i] % 2 == 0 ? angle : 180 - angle;
@@ -11,6 +11,7 @@ export * from "./readAbscissOnLine.js";
11
11
  export * from "./readAbscissOnSemiLine.js";
12
12
  export * from "./placeAbscissOnLine.js";
13
13
  export * from "./placeAbscissOnSemiLine.js";
14
+ export * from "./placeAbscissOnSemiLineV2.js";
14
15
  export * from "./cartesianFromVectorAndPoint.js";
15
16
  export * from "./cartesianFromTwoPoints.js";
16
17
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/geometry/cartesian/index.ts"],"names":[],"mappings":"AAAA,cAAc,+BAA+B,CAAC;AAC9C,cAAc,eAAe,CAAC;AAC9B,cAAc,8BAA8B,CAAC;AAC7C,cAAc,uBAAuB,CAAC;AACtC,cAAc,sBAAsB,CAAC;AACrC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,qBAAqB,CAAC;AACpC,cAAc,kBAAkB,CAAC;AACjC,cAAc,oCAAoC,CAAC;AAEnD,cAAc,wBAAwB,CAAC;AACvC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,yBAAyB,CAAC;AACxC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,kCAAkC,CAAC;AACjD,cAAc,6BAA6B,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/geometry/cartesian/index.ts"],"names":[],"mappings":"AAAA,cAAc,+BAA+B,CAAC;AAC9C,cAAc,eAAe,CAAC;AAC9B,cAAc,8BAA8B,CAAC;AAC7C,cAAc,uBAAuB,CAAC;AACtC,cAAc,sBAAsB,CAAC;AACrC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,qBAAqB,CAAC;AACpC,cAAc,kBAAkB,CAAC;AACjC,cAAc,oCAAoC,CAAC;AAEnD,cAAc,wBAAwB,CAAC;AACvC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,yBAAyB,CAAC;AACxC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,+BAA+B,CAAC;AAC9C,cAAc,kCAAkC,CAAC;AACjD,cAAc,6BAA6B,CAAC"}
@@ -12,5 +12,6 @@ export * from "./readAbscissOnLine.js";
12
12
  export * from "./readAbscissOnSemiLine.js";
13
13
  export * from "./placeAbscissOnLine.js";
14
14
  export * from "./placeAbscissOnSemiLine.js";
15
+ export * from "./placeAbscissOnSemiLineV2.js";
15
16
  export * from "./cartesianFromVectorAndPoint.js";
16
17
  export * from "./cartesianFromTwoPoints.js";
@@ -1,16 +1,13 @@
1
1
  import { Exercise } from "../../../../exercises/exercise.js";
2
2
  import { NumberType } from "../../../../math/numbers/nombre.js";
3
- import { NodeIdentifiers } from "../../../../tree/nodes/nodeConstructor.js";
4
3
  type Identifiers = {
5
4
  abscissType: NumberType;
6
- axisUnit: NodeIdentifiers;
7
- absciss1: NodeIdentifiers;
8
- absciss2: NodeIdentifiers;
5
+ axisUnit: number;
6
+ oneUnitTex: string;
7
+ absciss: number;
8
+ abscissTex: string;
9
+ coeff: number;
9
10
  };
10
- type Options = {
11
- questionType: "standard" | "éviter le comptage";
12
- numberType: "Entiers" | "Rationnels" | "Décimaux";
13
- };
14
- export declare const placeAbscissOnSemiLine: Exercise<Identifiers, Options>;
11
+ export declare const placeAbscissOnSemiLine: Exercise<Identifiers>;
15
12
  export {};
16
13
  //# sourceMappingURL=placeAbscissOnSemiLine.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"placeAbscissOnSemiLine.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/geometry/cartesian/placeAbscissOnSemiLine.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAWT,MAAM,6BAA6B,CAAC;AAQrC,OAAO,EAAE,UAAU,EAAE,MAAM,8BAA8B,CAAC;AAK1D,OAAO,EAEL,eAAe,EAChB,MAAM,qCAAqC,CAAC;AAK7C,KAAK,WAAW,GAAG;IACjB,WAAW,EAAE,UAAU,CAAC;IACxB,QAAQ,EAAE,eAAe,CAAC;IAC1B,QAAQ,EAAE,eAAe,CAAC;IAC1B,QAAQ,EAAE,eAAe,CAAC;CAC3B,CAAC;AAkOF,KAAK,OAAO,GAAG;IACb,YAAY,EAAE,UAAU,GAAG,oBAAoB,CAAC;IAChD,UAAU,EAAE,SAAS,GAAG,YAAY,GAAG,UAAU,CAAC;CACnD,CAAC;AA6BF,eAAO,MAAM,sBAAsB,EAAE,QAAQ,CAAC,WAAW,EAAE,OAAO,CAYjE,CAAC"}
1
+ {"version":3,"file":"placeAbscissOnSemiLine.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/geometry/cartesian/placeAbscissOnSemiLine.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAQT,MAAM,6BAA6B,CAAC;AAOrC,OAAO,EAAE,UAAU,EAAE,MAAM,8BAA8B,CAAC;AAQ1D,KAAK,WAAW,GAAG;IACjB,WAAW,EAAE,UAAU,CAAC;IACxB,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,EAAE,MAAM,CAAC;IACnB,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,EAAE,MAAM,CAAC;IACnB,KAAK,EAAE,MAAM,CAAC;CACf,CAAC;AA6IF,eAAO,MAAM,sBAAsB,EAAE,QAAQ,CAAC,WAAW,CAWxD,CAAC"}
@@ -1,56 +1,32 @@
1
- import { GeneratorOptionTarget, GeneratorOptionType, } from "../../../../exercises/exercise.js";
2
1
  import { toolBarConstructor } from "../../../../exercises/utils/geogebra/toolBarConstructor.js";
3
2
  import { getDistinctQuestions } from "../../../../exercises/utils/getDistinctQuestions.js";
4
3
  import { GeogebraConstructor } from "../../../../geogebra/geogebraConstructor.js";
5
- import { GeogebraParser } from "../../../../geogebra/parsers/geogebraParser.js";
6
4
  import { ggbPointToCoords } from "../../../../geogebra/parsers/ggbPointToCoords.js";
7
5
  import { parseGGBPoints } from "../../../../geogebra/parsers/parseGGBPoints.js";
8
6
  import { Point } from "../../../../math/geometry/point.js";
9
7
  import { NumberType } from "../../../../math/numbers/nombre.js";
10
- import { dividersOf } from "../../../../math/utils/arithmetic/dividersOf.js";
8
+ import { randfloat } from "../../../../math/utils/random/randfloat.js";
11
9
  import { randint } from "../../../../math/utils/random/randint.js";
12
10
  import { round } from "../../../../math/utils/round.js";
13
- import { NodeConstructor, } from "../../../../tree/nodes/nodeConstructor.js";
14
- import { frac } from "../../../../tree/nodes/operators/fractionNode.js";
15
- import { multiply } from "../../../../tree/nodes/operators/multiplyNode.js";
11
+ import { FractionNode } from "../../../../tree/nodes/operators/fractionNode.js";
12
+ import { MultiplyNode } from "../../../../tree/nodes/operators/multiplyNode.js";
16
13
  import { random } from "../../../../utils/alea/random.js";
17
- const getInstruction = ({ abscissType, absciss2, }) => {
18
- const absciss2Node = NodeConstructor.fromIdentifiers(absciss2);
19
- return `Placer le point d'abscisse $${abscissType === NumberType.Decimal
20
- ? round(absciss2Node.evaluate(), 1).frenchify()
21
- : absciss2Node.toTex()}$ sur la demi-droite graduée ci-dessous :`;
14
+ const getInstruction = ({ abscissTex }) => {
15
+ return `Placer le point d'abscisse $${abscissTex}$ sur la demi-droite graduée ci-dessous :`;
22
16
  };
23
17
  // const getHint: GetHint<Identifiers> = (identifiers) => {};
24
18
  // const getCorrection: GetCorrection<Identifiers> = (identifiers) => {};
25
- const getGGBAnswer = ({ absciss2 }) => {
26
- const nodeAbciss2 = NodeConstructor.fromIdentifiers(absciss2);
27
- return [`(${nodeAbciss2.evaluate()},0)`];
19
+ const getGGBAnswer = ({ coeff }) => {
20
+ return [`(${coeff},0)`];
28
21
  };
29
- const getStudentGGBOptions = ({ abscissType, absciss1, axisUnit, absciss2, }) => {
30
- const [axisUnitNode, absciss1Node, absciss2Node] = [
31
- axisUnit,
32
- absciss1,
33
- absciss2,
34
- ].map((nodeIds) => NodeConstructor.fromIdentifiers(nodeIds));
35
- const [valueAxisUnit, valueAbsciss1, valueAbsciss2] = [
36
- axisUnitNode,
37
- absciss1Node,
38
- absciss2Node,
39
- ].map((node) => node.evaluate());
40
- const xMin = Math.min(Math.min(0, valueAbsciss1), valueAbsciss2);
41
- const xMax = Math.max(Math.max(0, valueAbsciss1), valueAbsciss2);
42
- const yxRatio = 0.5;
43
- const yMax = yxRatio * (xMax - xMin);
44
- const yMin = -yMax;
22
+ const getStudentGGBOptions = ({ oneUnitTex, abscissType, }) => {
45
23
  const O = new Point("O", (0).toTree(), (0).toTree());
46
- const I = new Point("I", absciss1Node, (0).toTree());
24
+ const I = new Point("I", (1).toTree(), (0).toTree());
47
25
  const commands = [
48
26
  ...O.toGGBCommand(),
49
- `Text("\\footnotesize 0", (0, ${yMin / 4}), false, true, 0, 0)`,
27
+ `Text("\\footnotesize 0", (0, -0.5), false, true, 0, 0)`,
50
28
  ...I.toGGBCommand(),
51
- `Text("\\footnotesize ${abscissType === NumberType.Decimal
52
- ? round(absciss1Node.evaluate(), 1).frenchify()
53
- : absciss1Node.toTex()}", (${valueAbsciss1}, ${abscissType === NumberType.Rational ? yMin / 2 : yMin / 4}), false, true, 0, 0)`,
29
+ `Text("\\footnotesize ${oneUnitTex}", (1, ${abscissType === NumberType.Rational ? -1 : -0.5}), false, true, 0, 0)`,
54
30
  ];
55
31
  const ggb = new GeogebraConstructor({
56
32
  commands,
@@ -60,7 +36,7 @@ const getStudentGGBOptions = ({ abscissType, absciss1, axisUnit, absciss2, }) =>
60
36
  hideGrid: true,
61
37
  xAxis: {
62
38
  hideNumbers: true,
63
- steps: valueAxisUnit,
39
+ steps: 1,
64
40
  showPositive: true,
65
41
  },
66
42
  yAxis: {
@@ -70,102 +46,73 @@ const getStudentGGBOptions = ({ abscissType, absciss1, axisUnit, absciss2, }) =>
70
46
  forbidShiftDragZoom: true,
71
47
  });
72
48
  return ggb.getOptions({
73
- coords: ggb.getAdaptedCoords({
74
- xMin,
75
- xMax,
76
- yMin,
77
- yMax,
78
- }),
79
- // coords: [xMin, xMax, yMin, yMax],
49
+ coords: [-1, 10, -2, 2],
80
50
  });
81
51
  };
82
- const isGGBAnswerValid = (ans, { absciss2, axisUnit }) => {
83
- const [absciss2Node, axisUnitNode] = [absciss2, axisUnit].map((nodeIds) => NodeConstructor.fromIdentifiers(nodeIds));
84
- const commands = ans;
85
- const dictObj = new GeogebraParser(commands).objectDict();
86
- console.log("dictObj:", dictObj);
87
- const strPointA = dictObj["A"];
88
- if (!strPointA) {
89
- return false;
90
- }
91
- const coordsA = ggbPointToCoords(strPointA);
52
+ const isGGBAnswerValid = (ans, { coeff }) => {
92
53
  const points = parseGGBPoints(ans).map((p) => ggbPointToCoords(p));
93
- return (points.length === 3 && //O,I,A
94
- Math.abs(coordsA.y) < 0.5 * axisUnitNode.evaluate() &&
95
- Math.abs(coordsA.x - absciss2Node.evaluate()) <
96
- 0.1 * axisUnitNode.evaluate());
54
+ return (points.length === 1 &&
55
+ Math.abs(points[0].y) < 0.5 &&
56
+ Math.abs(points[0].x - coeff) < 0.1);
97
57
  };
98
- const getPlaceAbscissOnSemiLineQuestion = (optsIn) => {
99
- const arrayedOptions = optsIn ?? optsDefault;
100
- const opts = {
101
- questionType: random(arrayedOptions.questionType),
102
- numberType: random(arrayedOptions.numberType),
103
- };
104
- const abscissType = (() => {
105
- switch (opts.numberType) {
106
- case "Entiers":
107
- return NumberType.Integer;
108
- case "Rationnels":
109
- return NumberType.Rational;
110
- case "Décimaux":
111
- return NumberType.Decimal;
112
- }
113
- })();
114
- //[ [1/2, 2/2, 3/2], [1/3,2/3,3/3,4/3,5/3], ...]
115
- function fracFamilyList() {
116
- const maxDen = 5;
117
- return [...Array(maxDen - 2).keys()]
118
- .map((index) => index + 2)
119
- .map((den) => [...Array(den === 2 ? 3 * den - 1 : 2 * den - 1).keys()]
120
- .map((index) => index + 1)
121
- .filter((num) => opts.questionType === "éviter le comptage"
122
- ? num !== 1 && num !== den
123
- : true)
124
- .map((num) => frac(num, den)));
125
- }
126
- const fracList = random(fracFamilyList());
127
- const den = fracList[0].rightChild;
128
- const factor1 = random(fracList);
129
- const factor2 = random(fracList, [factor1]);
130
- let referenceNum;
131
- let absciss1Node;
132
- let absciss2Node;
58
+ const getPlaceAbscissOnSemiLineQuestion = () => {
59
+ const abscissType = random([
60
+ NumberType.Integer,
61
+ NumberType.Rational,
62
+ NumberType.Decimal,
63
+ ]);
64
+ let absciss, axisUnit, oneUnitTex, abscissTex, coeff;
133
65
  switch (abscissType) {
134
66
  case NumberType.Integer:
135
- {
136
- referenceNum = multiply(randint(1, 13), den);
137
- absciss1Node = multiply(referenceNum, factor1).simplify();
138
- absciss2Node = multiply(referenceNum, factor2).simplify();
139
- }
67
+ axisUnit = randint(1, 10);
68
+ coeff = randint(2, 10);
69
+ absciss = axisUnit * coeff;
70
+ oneUnitTex = axisUnit.frenchify();
71
+ abscissTex = absciss.frenchify();
140
72
  break;
141
73
  case NumberType.Rational:
142
74
  {
143
- referenceNum = random([...Array(19).keys()]
144
- .map((index) => index + 1)
145
- .filter((num) => !dividersOf(num).includes(den.evaluate()))).toTree();
146
- absciss1Node = frac(multiply(referenceNum, factor1.leftChild).simplify(), factor1.rightChild);
147
- absciss2Node = frac(multiply(referenceNum, factor2.leftChild).simplify(), factor2.rightChild);
75
+ const randomFrac = random([
76
+ [1, 2],
77
+ [1, 3],
78
+ [2, 3],
79
+ [1, 4],
80
+ [3, 4],
81
+ [1, 5],
82
+ [2, 5],
83
+ [3, 5],
84
+ [4, 5],
85
+ ]);
86
+ axisUnit = randomFrac[0] / randomFrac[1];
87
+ const oneUnit = new FractionNode(randomFrac[0].toTree(), randomFrac[1].toTree());
88
+ oneUnitTex = oneUnit.toTex();
89
+ coeff = randint(2, 10);
90
+ absciss = axisUnit * coeff;
91
+ abscissTex = new MultiplyNode(oneUnit, coeff.toTree())
92
+ .simplify()
93
+ .toTex();
148
94
  }
149
95
  break;
150
96
  case NumberType.Decimal:
151
97
  default:
152
- {
153
- referenceNum = frac(multiply(randint(1, 13 * 10), den), 10);
154
- absciss1Node = multiply(referenceNum, factor1).simplify();
155
- absciss2Node = multiply(referenceNum, factor2).simplify();
156
- }
98
+ axisUnit = randfloat(0, 5, 1);
99
+ coeff = randint(2, 10);
100
+ absciss = round(axisUnit * coeff, 2);
101
+ oneUnitTex = axisUnit.frenchify();
102
+ abscissTex = absciss.frenchify();
157
103
  break;
158
104
  }
159
- const axisUnitNode = frac(referenceNum, den).simplify();
160
105
  const identifiers = {
106
+ absciss,
107
+ abscissTex,
161
108
  abscissType,
162
- axisUnit: axisUnitNode.toIdentifiers(),
163
- absciss1: absciss1Node.toIdentifiers(),
164
- absciss2: absciss2Node.toIdentifiers(),
109
+ axisUnit,
110
+ coeff,
111
+ oneUnitTex,
165
112
  };
166
113
  return getQuestionFromIdentifiers(identifiers);
167
114
  };
168
- const getQuestionFromIdentifiers = (identifiers, opts) => {
115
+ const getQuestionFromIdentifiers = (identifiers) => {
169
116
  const question = {
170
117
  ggbAnswer: getGGBAnswer(identifiers),
171
118
  instruction: getInstruction(identifiers),
@@ -173,38 +120,14 @@ const getQuestionFromIdentifiers = (identifiers, opts) => {
173
120
  identifiers,
174
121
  // hint: getHint(identifiers),
175
122
  // correction: getCorrection(identifiers),
176
- options: opts,
177
123
  };
178
124
  return question;
179
125
  };
180
- const optsDefault = {
181
- questionType: ["standard", "éviter le comptage"],
182
- numberType: ["Entiers", "Rationnels", "Décimaux"],
183
- };
184
- const options = [
185
- {
186
- id: "questionType",
187
- label: "Type de question",
188
- target: GeneratorOptionTarget.generation,
189
- type: GeneratorOptionType.multiselect,
190
- values: ["standard", "éviter le comptage"],
191
- defaultValue: optsDefault.questionType,
192
- },
193
- {
194
- id: "numberType",
195
- label: "Type de nombres",
196
- target: GeneratorOptionTarget.generation,
197
- type: GeneratorOptionType.multiselect,
198
- values: ["Entiers", "Rationnels", "Décimaux"],
199
- defaultValue: optsDefault.numberType,
200
- },
201
- ];
202
126
  export const placeAbscissOnSemiLine = {
203
127
  id: "placeAbscissOnSemiLine",
204
128
  label: "Placer un point d'abscisse donnée sur une demi-droite graduée",
205
129
  isSingleStep: true,
206
- generator: (nb, opts) => getDistinctQuestions(() => getPlaceAbscissOnSemiLineQuestion(opts), nb),
207
- options,
130
+ generator: (nb) => getDistinctQuestions(getPlaceAbscissOnSemiLineQuestion, nb),
208
131
  ggbTimer: 60,
209
132
  isGGBAnswerValid,
210
133
  subject: "Mathématiques",
@@ -0,0 +1,16 @@
1
+ import { Exercise } from "../../../../exercises/exercise.js";
2
+ import { NumberType } from "../../../../math/numbers/nombre.js";
3
+ import { NodeIdentifiers } from "../../../../tree/nodes/nodeConstructor.js";
4
+ type Identifiers = {
5
+ abscissType: NumberType;
6
+ axisUnit: NodeIdentifiers;
7
+ absciss1: NodeIdentifiers;
8
+ absciss2: NodeIdentifiers;
9
+ };
10
+ type Options = {
11
+ questionType: "standard" | "éviter le comptage";
12
+ numberType: "Entiers" | "Rationnels" | "Décimaux";
13
+ };
14
+ export declare const placeAbscissOnSemiLineV2: Exercise<Identifiers, Options>;
15
+ export {};
16
+ //# sourceMappingURL=placeAbscissOnSemiLineV2.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"placeAbscissOnSemiLineV2.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/geometry/cartesian/placeAbscissOnSemiLineV2.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAWT,MAAM,6BAA6B,CAAC;AAQrC,OAAO,EAAE,UAAU,EAAE,MAAM,8BAA8B,CAAC;AAK1D,OAAO,EAEL,eAAe,EAChB,MAAM,qCAAqC,CAAC;AAK7C,KAAK,WAAW,GAAG;IACjB,WAAW,EAAE,UAAU,CAAC;IACxB,QAAQ,EAAE,eAAe,CAAC;IAC1B,QAAQ,EAAE,eAAe,CAAC;IAC1B,QAAQ,EAAE,eAAe,CAAC;CAC3B,CAAC;AAkOF,KAAK,OAAO,GAAG;IACb,YAAY,EAAE,UAAU,GAAG,oBAAoB,CAAC;IAChD,UAAU,EAAE,SAAS,GAAG,YAAY,GAAG,UAAU,CAAC;CACnD,CAAC;AA6BF,eAAO,MAAM,wBAAwB,EAAE,QAAQ,CAAC,WAAW,EAAE,OAAO,CAYnE,CAAC"}
@@ -0,0 +1,213 @@
1
+ import { GeneratorOptionTarget, GeneratorOptionType, } from "../../../../exercises/exercise.js";
2
+ import { toolBarConstructor } from "../../../../exercises/utils/geogebra/toolBarConstructor.js";
3
+ import { getDistinctQuestions } from "../../../../exercises/utils/getDistinctQuestions.js";
4
+ import { GeogebraConstructor } from "../../../../geogebra/geogebraConstructor.js";
5
+ import { GeogebraParser } from "../../../../geogebra/parsers/geogebraParser.js";
6
+ import { ggbPointToCoords } from "../../../../geogebra/parsers/ggbPointToCoords.js";
7
+ import { parseGGBPoints } from "../../../../geogebra/parsers/parseGGBPoints.js";
8
+ import { Point } from "../../../../math/geometry/point.js";
9
+ import { NumberType } from "../../../../math/numbers/nombre.js";
10
+ import { dividersOf } from "../../../../math/utils/arithmetic/dividersOf.js";
11
+ import { randint } from "../../../../math/utils/random/randint.js";
12
+ import { round } from "../../../../math/utils/round.js";
13
+ import { NodeConstructor, } from "../../../../tree/nodes/nodeConstructor.js";
14
+ import { frac } from "../../../../tree/nodes/operators/fractionNode.js";
15
+ import { multiply } from "../../../../tree/nodes/operators/multiplyNode.js";
16
+ import { random } from "../../../../utils/alea/random.js";
17
+ const getInstruction = ({ abscissType, absciss2, }) => {
18
+ const absciss2Node = NodeConstructor.fromIdentifiers(absciss2);
19
+ return `Placer le point d'abscisse $${abscissType === NumberType.Decimal
20
+ ? round(absciss2Node.evaluate(), 1).frenchify()
21
+ : absciss2Node.toTex()}$ sur la demi-droite graduée ci-dessous :`;
22
+ };
23
+ // const getHint: GetHint<Identifiers> = (identifiers) => {};
24
+ // const getCorrection: GetCorrection<Identifiers> = (identifiers) => {};
25
+ const getGGBAnswer = ({ absciss2 }) => {
26
+ const nodeAbciss2 = NodeConstructor.fromIdentifiers(absciss2);
27
+ return [`(${nodeAbciss2.evaluate()},0)`];
28
+ };
29
+ const getStudentGGBOptions = ({ abscissType, absciss1, axisUnit, absciss2, }) => {
30
+ const [axisUnitNode, absciss1Node, absciss2Node] = [
31
+ axisUnit,
32
+ absciss1,
33
+ absciss2,
34
+ ].map((nodeIds) => NodeConstructor.fromIdentifiers(nodeIds));
35
+ const [valueAxisUnit, valueAbsciss1, valueAbsciss2] = [
36
+ axisUnitNode,
37
+ absciss1Node,
38
+ absciss2Node,
39
+ ].map((node) => node.evaluate());
40
+ const xMin = Math.min(Math.min(0, valueAbsciss1), valueAbsciss2);
41
+ const xMax = Math.max(Math.max(0, valueAbsciss1), valueAbsciss2);
42
+ const yxRatio = 0.5;
43
+ const yMax = yxRatio * (xMax - xMin);
44
+ const yMin = -yMax;
45
+ const O = new Point("O", (0).toTree(), (0).toTree());
46
+ const I = new Point("I", absciss1Node, (0).toTree());
47
+ const commands = [
48
+ ...O.toGGBCommand(),
49
+ `Text("\\footnotesize 0", (0, ${yMin / 4}), false, true, 0, 0)`,
50
+ ...I.toGGBCommand(),
51
+ `Text("\\footnotesize ${abscissType === NumberType.Decimal
52
+ ? round(absciss1Node.evaluate(), 1).frenchify()
53
+ : absciss1Node.toTex()}", (${valueAbsciss1}, ${abscissType === NumberType.Rational ? yMin / 2 : yMin / 4}), false, true, 0, 0)`,
54
+ ];
55
+ const ggb = new GeogebraConstructor({
56
+ commands,
57
+ customToolBar: toolBarConstructor({
58
+ point: true,
59
+ }),
60
+ hideGrid: true,
61
+ xAxis: {
62
+ hideNumbers: true,
63
+ steps: valueAxisUnit,
64
+ showPositive: true,
65
+ },
66
+ yAxis: {
67
+ hidden: true,
68
+ },
69
+ maxHeight: 220,
70
+ forbidShiftDragZoom: true,
71
+ });
72
+ return ggb.getOptions({
73
+ coords: ggb.getAdaptedCoords({
74
+ xMin,
75
+ xMax,
76
+ yMin,
77
+ yMax,
78
+ }),
79
+ // coords: [xMin, xMax, yMin, yMax],
80
+ });
81
+ };
82
+ const isGGBAnswerValid = (ans, { absciss2, axisUnit }) => {
83
+ const [absciss2Node, axisUnitNode] = [absciss2, axisUnit].map((nodeIds) => NodeConstructor.fromIdentifiers(nodeIds));
84
+ const commands = ans;
85
+ const dictObj = new GeogebraParser(commands).objectDict();
86
+ console.log("dictObj:", dictObj);
87
+ const strPointA = dictObj["A"];
88
+ if (!strPointA) {
89
+ return false;
90
+ }
91
+ const coordsA = ggbPointToCoords(strPointA);
92
+ const points = parseGGBPoints(ans).map((p) => ggbPointToCoords(p));
93
+ return (points.length === 3 && //O,I,A
94
+ Math.abs(coordsA.y) < 0.5 * axisUnitNode.evaluate() &&
95
+ Math.abs(coordsA.x - absciss2Node.evaluate()) <
96
+ 0.1 * axisUnitNode.evaluate());
97
+ };
98
+ const getPlaceAbscissOnSemiLineV2Question = (optsIn) => {
99
+ const arrayedOptions = optsIn ?? optsDefault;
100
+ const opts = {
101
+ questionType: random(arrayedOptions.questionType),
102
+ numberType: random(arrayedOptions.numberType),
103
+ };
104
+ const abscissType = (() => {
105
+ switch (opts.numberType) {
106
+ case "Entiers":
107
+ return NumberType.Integer;
108
+ case "Rationnels":
109
+ return NumberType.Rational;
110
+ case "Décimaux":
111
+ return NumberType.Decimal;
112
+ }
113
+ })();
114
+ //[ [1/2, 2/2, 3/2], [1/3,2/3,3/3,4/3,5/3], ...]
115
+ function fracFamilyList() {
116
+ const maxDen = 5;
117
+ return [...Array(maxDen - 2).keys()]
118
+ .map((index) => index + 2)
119
+ .map((den) => [...Array(den === 2 ? 3 * den - 1 : 2 * den - 1).keys()]
120
+ .map((index) => index + 1)
121
+ .filter((num) => opts.questionType === "éviter le comptage"
122
+ ? num !== 1 && num !== den
123
+ : true)
124
+ .map((num) => frac(num, den)));
125
+ }
126
+ const fracList = random(fracFamilyList());
127
+ const den = fracList[0].rightChild;
128
+ const factor1 = random(fracList);
129
+ const factor2 = random(fracList, [factor1]);
130
+ let referenceNum;
131
+ let absciss1Node;
132
+ let absciss2Node;
133
+ switch (abscissType) {
134
+ case NumberType.Integer:
135
+ {
136
+ referenceNum = multiply(randint(1, 13), den);
137
+ absciss1Node = multiply(referenceNum, factor1).simplify();
138
+ absciss2Node = multiply(referenceNum, factor2).simplify();
139
+ }
140
+ break;
141
+ case NumberType.Rational:
142
+ {
143
+ referenceNum = random([...Array(19).keys()]
144
+ .map((index) => index + 1)
145
+ .filter((num) => !dividersOf(num).includes(den.evaluate()))).toTree();
146
+ absciss1Node = frac(multiply(referenceNum, factor1.leftChild).simplify(), factor1.rightChild);
147
+ absciss2Node = frac(multiply(referenceNum, factor2.leftChild).simplify(), factor2.rightChild);
148
+ }
149
+ break;
150
+ case NumberType.Decimal:
151
+ default:
152
+ {
153
+ referenceNum = frac(multiply(randint(1, 13 * 10), den), 10);
154
+ absciss1Node = multiply(referenceNum, factor1).simplify();
155
+ absciss2Node = multiply(referenceNum, factor2).simplify();
156
+ }
157
+ break;
158
+ }
159
+ const axisUnitNode = frac(referenceNum, den).simplify();
160
+ const identifiers = {
161
+ abscissType,
162
+ axisUnit: axisUnitNode.toIdentifiers(),
163
+ absciss1: absciss1Node.toIdentifiers(),
164
+ absciss2: absciss2Node.toIdentifiers(),
165
+ };
166
+ return getQuestionFromIdentifiers(identifiers);
167
+ };
168
+ const getQuestionFromIdentifiers = (identifiers, opts) => {
169
+ const question = {
170
+ ggbAnswer: getGGBAnswer(identifiers),
171
+ instruction: getInstruction(identifiers),
172
+ studentGgbOptions: getStudentGGBOptions(identifiers),
173
+ identifiers,
174
+ // hint: getHint(identifiers),
175
+ // correction: getCorrection(identifiers),
176
+ options: opts,
177
+ };
178
+ return question;
179
+ };
180
+ const optsDefault = {
181
+ questionType: ["standard", "éviter le comptage"],
182
+ numberType: ["Entiers", "Rationnels", "Décimaux"],
183
+ };
184
+ const options = [
185
+ {
186
+ id: "questionType",
187
+ label: "Type de question",
188
+ target: GeneratorOptionTarget.generation,
189
+ type: GeneratorOptionType.multiselect,
190
+ values: ["standard", "éviter le comptage"],
191
+ defaultValue: optsDefault.questionType,
192
+ },
193
+ {
194
+ id: "numberType",
195
+ label: "Type de nombres",
196
+ target: GeneratorOptionTarget.generation,
197
+ type: GeneratorOptionType.multiselect,
198
+ values: ["Entiers", "Rationnels", "Décimaux"],
199
+ defaultValue: optsDefault.numberType,
200
+ },
201
+ ];
202
+ export const placeAbscissOnSemiLineV2 = {
203
+ id: "placeAbscissOnSemiLineV2",
204
+ label: "Placer un point d'abscisse donnée sur une demi-droite graduée",
205
+ isSingleStep: true,
206
+ generator: (nb, opts) => getDistinctQuestions(() => getPlaceAbscissOnSemiLineV2Question(opts), nb),
207
+ options,
208
+ ggbTimer: 60,
209
+ isGGBAnswerValid,
210
+ subject: "Mathématiques",
211
+ getQuestionFromIdentifiers,
212
+ answerType: "GGB",
213
+ };
@@ -2,6 +2,9 @@ import { Exercise } from "../../../exercise.js";
2
2
  type Identifiers = {
3
3
  evolutions: string[];
4
4
  };
5
- export declare const globalPercent: Exercise<Identifiers>;
5
+ type Options = {
6
+ nbEvos: string;
7
+ };
8
+ export declare const globalPercent: Exercise<Identifiers, Options>;
6
9
  export {};
7
10
  //# sourceMappingURL=globalPercent.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"globalPercent.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/percent/evolutions/globalPercent.ts"],"names":[],"mappings":"AACA,OAAO,EACL,QAAQ,EAcT,MAAM,sBAAsB,CAAC;AAM9B,KAAK,WAAW,GAAG;IACjB,UAAU,EAAE,MAAM,EAAE,CAAC;CACtB,CAAC;AA4GF,eAAO,MAAM,aAAa,EAAE,QAAQ,CAAC,WAAW,CAe/C,CAAC"}
1
+ {"version":3,"file":"globalPercent.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/percent/evolutions/globalPercent.ts"],"names":[],"mappings":"AACA,OAAO,EACL,QAAQ,EAiBT,MAAM,sBAAsB,CAAC;AAM9B,KAAK,WAAW,GAAG;IACjB,UAAU,EAAE,MAAM,EAAE,CAAC;CACtB,CAAC;AAmHF,KAAK,OAAO,GAAG;IACb,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC;AAgBF,eAAO,MAAM,aAAa,EAAE,QAAQ,CAAC,WAAW,EAAE,OAAO,CAiBxD,CAAC"}