math-exercises 3.0.197 → 3.0.199

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 (78) hide show
  1. package/lib/exercises/math/calculLitteral/equation/exp/expOfTrinomEquals1Equation.d.ts.map +1 -1
  2. package/lib/exercises/math/calculLitteral/equation/exp/expOfTrinomEquals1Equation.js +3 -0
  3. package/lib/exercises/math/calculLitteral/inequations/firstDegreeInequationsType3.d.ts.map +1 -1
  4. package/lib/exercises/math/calculLitteral/inequations/firstDegreeInequationsType3.js +58 -30
  5. package/lib/exercises/math/complex/addComplex.d.ts.map +1 -1
  6. package/lib/exercises/math/complex/addComplex.js +53 -7
  7. package/lib/exercises/math/complex/conjugateComplex.d.ts.map +1 -1
  8. package/lib/exercises/math/complex/conjugateComplex.js +48 -7
  9. package/lib/exercises/math/complex/mutiplyComplex.d.ts.map +1 -1
  10. package/lib/exercises/math/complex/mutiplyComplex.js +51 -18
  11. package/lib/exercises/math/complex/reAndIm.d.ts.map +1 -1
  12. package/lib/exercises/math/complex/reAndIm.js +35 -4
  13. package/lib/exercises/math/derivation/convexity/convexityQuadrinomials.d.ts.map +1 -1
  14. package/lib/exercises/math/derivation/convexity/convexityQuadrinomials.js +46 -4
  15. package/lib/exercises/math/derivation/convexity/convexityQuadrinomialsGeo.d.ts +9 -0
  16. package/lib/exercises/math/derivation/convexity/convexityQuadrinomialsGeo.d.ts.map +1 -0
  17. package/lib/exercises/math/derivation/convexity/convexityQuadrinomialsGeo.js +160 -0
  18. package/lib/exercises/math/derivation/convexity/convexityTrinomials.d.ts.map +1 -1
  19. package/lib/exercises/math/derivation/convexity/convexityTrinomials.js +33 -2
  20. package/lib/exercises/math/derivation/convexity/convexityTrinomialsGeo.d.ts +7 -0
  21. package/lib/exercises/math/derivation/convexity/convexityTrinomialsGeo.d.ts.map +1 -0
  22. package/lib/exercises/math/derivation/convexity/convexityTrinomialsGeo.js +80 -0
  23. package/lib/exercises/math/derivation/convexity/index.d.ts +2 -0
  24. package/lib/exercises/math/derivation/convexity/index.d.ts.map +1 -1
  25. package/lib/exercises/math/derivation/convexity/index.js +2 -0
  26. package/lib/exercises/math/derivation/convexity/inflexionPointQuadrinomials.js +2 -2
  27. package/lib/exercises/math/derivation/derivative/exp/expDerivativeFour.d.ts.map +1 -1
  28. package/lib/exercises/math/derivation/derivative/exp/expDerivativeFour.js +39 -33
  29. package/lib/exercises/math/derivation/derivative/exp/secondDerivativeOfExpoFunction.d.ts.map +1 -1
  30. package/lib/exercises/math/derivation/derivative/exp/secondDerivativeOfExpoFunction.js +45 -3
  31. package/lib/exercises/math/derivation/derivative/ln/lnDerivativeOne.d.ts.map +1 -1
  32. package/lib/exercises/math/derivation/derivative/ln/lnDerivativeOne.js +53 -11
  33. package/lib/exercises/math/derivation/derivative/ln/lnDerivativeThree.d.ts.map +1 -1
  34. package/lib/exercises/math/derivation/derivative/ln/lnDerivativeThree.js +54 -3
  35. package/lib/exercises/math/derivation/derivative/ln/lnDerivativeTwo.d.ts.map +1 -1
  36. package/lib/exercises/math/derivation/derivative/ln/lnDerivativeTwo.js +23 -0
  37. package/lib/exercises/math/derivation/derivative/polynomial/secondDerivativeOfThirdDegreeFunction.d.ts.map +1 -1
  38. package/lib/exercises/math/derivation/derivative/polynomial/secondDerivativeOfThirdDegreeFunction.js +30 -0
  39. package/lib/exercises/math/derivation/derivative/polynomial/secondDerivativeOfTrinom.d.ts.map +1 -1
  40. package/lib/exercises/math/derivation/derivative/polynomial/secondDerivativeOfTrinom.js +25 -1
  41. package/lib/exercises/math/derivation/derivative/trigo/cosCompositionDerivation.d.ts.map +1 -1
  42. package/lib/exercises/math/derivation/derivative/trigo/cosCompositionDerivation.js +27 -0
  43. package/lib/exercises/math/derivation/derivative/trigo/cosSecondDegreeDerivative.d.ts.map +1 -1
  44. package/lib/exercises/math/derivation/derivative/trigo/cosSecondDegreeDerivative.js +47 -3
  45. package/lib/exercises/math/derivation/derivative/trigo/sinCompositionDerivation.d.ts.map +1 -1
  46. package/lib/exercises/math/derivation/derivative/trigo/sinCompositionDerivation.js +44 -5
  47. package/lib/exercises/math/derivation/derivative/trigo/sinSecondDegreeDerivative.d.ts.map +1 -1
  48. package/lib/exercises/math/derivation/derivative/trigo/sinSecondDegreeDerivative.js +65 -9
  49. package/lib/exercises/math/functions/exponential/sign/expFunctionBasicSign.d.ts.map +1 -1
  50. package/lib/exercises/math/functions/exponential/sign/expFunctionBasicSign.js +3 -0
  51. package/lib/exercises/math/functions/exponential/variations/varSignTableOfAffineTimesExp.js +1 -1
  52. package/lib/exercises/math/functions/exponential/variations/varSignTableOfExpMinusX.js +1 -1
  53. package/lib/exercises/math/functions/sign/affineProductSign.d.ts.map +1 -1
  54. package/lib/exercises/math/functions/sign/affineProductSign.js +0 -4
  55. package/lib/exercises/math/functions/trinoms/summitAndCanonical/summitReading.d.ts.map +1 -1
  56. package/lib/exercises/math/functions/trinoms/summitAndCanonical/summitReading.js +1 -0
  57. package/lib/exercises/math/geometry/index.d.ts +0 -1
  58. package/lib/exercises/math/geometry/index.d.ts.map +1 -1
  59. package/lib/exercises/math/geometry/index.js +0 -1
  60. package/lib/exercises/math/spaceGeometry/vectors/spaceVectorLinearCombinationCoords.d.ts.map +1 -1
  61. package/lib/index.d.ts +6 -6
  62. package/lib/math/utils/arithmetic/gcd.d.ts +5 -0
  63. package/lib/math/utils/arithmetic/gcd.d.ts.map +1 -1
  64. package/lib/math/utils/arithmetic/gcd.js +5 -0
  65. package/lib/playground.d.ts.map +1 -1
  66. package/lib/playground.js +6 -1
  67. package/lib/server.js +3 -2
  68. package/lib/tests/pdfExo.test.js +2 -2
  69. package/lib/tests/pdfs/buildPDFForExercise.d.ts.map +1 -1
  70. package/lib/tests/pdfs/buildPDFForExercise.js +6 -0
  71. package/lib/tests/pdfs/quizPdfPreambule.d.ts.map +1 -1
  72. package/lib/tests/pdfs/quizPdfPreambule.js +1 -0
  73. package/lib/tests/pdfs/treeDiagramToLatex.d.ts +15 -0
  74. package/lib/tests/pdfs/treeDiagramToLatex.d.ts.map +1 -0
  75. package/lib/tests/pdfs/treeDiagramToLatex.js +49 -0
  76. package/lib/tests/questionTest.d.ts.map +1 -1
  77. package/lib/tests/questionTest.js +19 -0
  78. package/package.json +1 -1
@@ -1,18 +1,20 @@
1
1
  import { addValidProp, propWhile, shuffleProps, tryToAddWrongProp, } from "../../../../../exercises/exercise.js";
2
2
  import { getDistinctQuestions } from "../../../../../exercises/utils/getDistinctQuestions.js";
3
3
  import { AffineConstructor } from "../../../../../math/polynomials/affine.js";
4
- import { CosNode } from "../../../../../tree/nodes/functions/cosNode.js";
5
- import { SinNode } from "../../../../../tree/nodes/functions/sinNode.js";
4
+ import { cos, CosNode } from "../../../../../tree/nodes/functions/cosNode.js";
5
+ import { sin, SinNode } from "../../../../../tree/nodes/functions/sinNode.js";
6
6
  import { NumberNode } from "../../../../../tree/nodes/numbers/numberNode.js";
7
7
  import { AddNode } from "../../../../../tree/nodes/operators/addNode.js";
8
- import { MultiplyNode } from "../../../../../tree/nodes/operators/multiplyNode.js";
8
+ import { multiply, MultiplyNode, } from "../../../../../tree/nodes/operators/multiplyNode.js";
9
9
  import { PowerNode } from "../../../../../tree/nodes/operators/powerNode.js";
10
10
  import { VariableNode } from "../../../../../tree/nodes/variables/variableNode.js";
11
+ import { parseAlgebraic } from "../../../../../tree/parsers/latexParser.js";
12
+ import { handleVEAError } from "../../../../../utils/errors/handleVEAError.js";
11
13
  const getAnswer = (identifiers) => {
12
14
  const { affinecoeffs } = identifiers;
13
15
  const affine = AffineConstructor.fromCoeffs(affinecoeffs);
14
16
  const ans = new MultiplyNode(new MultiplyNode(new PowerNode(affinecoeffs[1].toTree(), new NumberNode(2)), new NumberNode(-1)), new SinNode(affine.toTree().simplify({ forbidFactorize: true })))
15
- .simplify()
17
+ .simplify({ forbidFactorize: true })
16
18
  .toTex();
17
19
  return ans;
18
20
  };
@@ -32,6 +34,47 @@ const getSinSecondDegreeDerivativeQuestion = () => {
32
34
  const identifiers = { affinecoeffs };
33
35
  return getQuestionFromIdentifiers(identifiers);
34
36
  };
37
+ const getHint = () => {
38
+ return `Pour toute fonction dérivable $u$, on a :
39
+
40
+ $$
41
+ \\left(\\sin(u)\\right)' = u'\\times \\cos(u)
42
+ $$
43
+
44
+ et
45
+
46
+ $$
47
+ \\left(\\cos(u)\\right)' = -u'\\times \\sin(u)
48
+ $$`;
49
+ };
50
+ const getCorrection = (identifiers) => {
51
+ const { affinecoeffs } = identifiers;
52
+ const affTree = AffineConstructor.fromCoeffs(affinecoeffs).toTree();
53
+ const a = affinecoeffs[1];
54
+ return `On utilise la propriété suivante : pour toute fonction dérivable $u$,
55
+
56
+ $$
57
+ \\left(\\sin(u)\\right)' = u'\\times \\cos(u)
58
+ $$
59
+
60
+ et
61
+
62
+ $$
63
+ \\left(\\cos(u)\\right)' = -u'\\times \\sin(u)
64
+ $$
65
+
66
+ Ici, on dérive la fonction $f$ deux fois. On a, pour tout $x\\in \\mathbb{R}$ :
67
+
68
+ $$
69
+ f'(x) = ${multiply(a, cos(affTree)).toTex()}
70
+ $$
71
+
72
+ Donc
73
+
74
+ $$
75
+ f''(x)= ${multiply(multiply(-a, a).simplify(), sin(affTree)).toTex()}
76
+ $$`;
77
+ };
35
78
  const getQuestionFromIdentifiers = (identifiers) => {
36
79
  const question = {
37
80
  answer: getAnswer(identifiers),
@@ -39,6 +82,8 @@ const getQuestionFromIdentifiers = (identifiers) => {
39
82
  keys: ["x", "sin", "cos", "tan"],
40
83
  answerFormat: "tex",
41
84
  identifiers,
85
+ hint: getHint(identifiers),
86
+ correction: getCorrection(identifiers),
42
87
  };
43
88
  return question;
44
89
  };
@@ -73,11 +118,21 @@ const getPropositions = (n, { answer, affinecoeffs }) => {
73
118
  });
74
119
  return shuffleProps(propositions, n);
75
120
  };
76
- const isAnswerValid = (ans, { affinecoeffs }) => {
77
- const affine = new AddNode(new MultiplyNode(new NumberNode(affinecoeffs[1]), new VariableNode("x")), new NumberNode(affinecoeffs[0])).simplify({ forbidFactorize: true });
78
- const validanswer = new MultiplyNode(new MultiplyNode(new PowerNode(new NumberNode(affinecoeffs[1]), new NumberNode(2)), new NumberNode(-1)), new SinNode(affine)).simplify();
79
- const latexs = validanswer.toAllValidTexs();
80
- return latexs.includes(ans);
121
+ const isAnswerValid = (ans, { answer }) => {
122
+ try {
123
+ const parsed = parseAlgebraic(ans);
124
+ if (!parsed)
125
+ return false;
126
+ return (parsed
127
+ .simplify({
128
+ forbidFactorize: true,
129
+ towardsDistribute: true,
130
+ })
131
+ .toTex() === answer);
132
+ }
133
+ catch (err) {
134
+ return handleVEAError(err);
135
+ }
81
136
  };
82
137
  export const sinSecondDegreeDerivative = {
83
138
  id: "sinSecondDegreeDerivative",
@@ -92,4 +147,5 @@ export const sinSecondDegreeDerivative = {
92
147
  getAnswer,
93
148
  getInstruction,
94
149
  getQuestionFromIdentifiers,
150
+ hasHintAndCorrection: true,
95
151
  };
@@ -1 +1 @@
1
- {"version":3,"file":"expFunctionBasicSign.d.ts","sourceRoot":"","sources":["../../../../../../src/exercises/math/functions/exponential/sign/expFunctionBasicSign.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAYT,MAAM,6BAA6B,CAAC;AAOrC,KAAK,WAAW,GAAG;IAGjB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,IAAI,EAAE,MAAM,CAAC;CACd,CAAC;AAwFF,eAAO,MAAM,oBAAoB,EAAE,QAAQ,CAAC,WAAW,CAkBtD,CAAC"}
1
+ {"version":3,"file":"expFunctionBasicSign.d.ts","sourceRoot":"","sources":["../../../../../../src/exercises/math/functions/exponential/sign/expFunctionBasicSign.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAYT,MAAM,6BAA6B,CAAC;AAOrC,KAAK,WAAW,GAAG;IAGjB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,IAAI,EAAE,MAAM,CAAC;CACd,CAAC;AAwFF,eAAO,MAAM,oBAAoB,EAAE,QAAQ,CAAC,WAAW,CAqBtD,CAAC"}
@@ -98,4 +98,7 @@ export const expFunctionBasicSign = {
98
98
  getAnswer,
99
99
  getQuestionFromIdentifiers,
100
100
  hasHintAndCorrection: true,
101
+ pdfOptions: {
102
+ shouldSpreadPropositions: true,
103
+ },
101
104
  };
@@ -90,7 +90,7 @@ On en conclut que $f$ est ${vars[0]} puis ${vars[1]}.
90
90
  `;
91
91
  };
92
92
  const getKeys = () => {
93
- return ["epower"];
93
+ return ["epower", "infty"];
94
94
  };
95
95
  const isAnswerTableValid = (ans, { answerTable }) => {
96
96
  try {
@@ -85,7 +85,7 @@ car $e^0 = 1$.
85
85
  `;
86
86
  };
87
87
  const getKeys = () => {
88
- return ["epower"];
88
+ return ["epower", "infty"];
89
89
  };
90
90
  const isAnswerTableValid = (ans, { answerTable }) => {
91
91
  try {
@@ -1 +1 @@
1
- {"version":3,"file":"affineProductSign.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/functions/sign/affineProductSign.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAgBT,MAAM,6BAA6B,CAAC;AAErC,OAAO,EAGL,wBAAwB,EACzB,MAAM,yCAAyC,CAAC;AAejD,KAAK,WAAW,GAAG;IACjB,UAAU,EAAE,wBAAwB,CAAC;IACrC,UAAU,EAAE,wBAAwB,CAAC;IACrC,gBAAgB,EAAE,OAAO,CAAC;CAC3B,CAAC;AAkJF,KAAK,OAAO,GAAG;IACb,eAAe,EAAE,MAAM,CAAC;CACzB,CAAC;AAaF,eAAO,MAAM,iBAAiB,EAAE,QAAQ,CAAC,WAAW,EAAE,OAAO,CAiB5D,CAAC"}
1
+ {"version":3,"file":"affineProductSign.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/functions/sign/affineProductSign.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAgBT,MAAM,6BAA6B,CAAC;AAErC,OAAO,EAGL,wBAAwB,EACzB,MAAM,yCAAyC,CAAC;AAejD,KAAK,WAAW,GAAG;IACjB,UAAU,EAAE,wBAAwB,CAAC;IACrC,UAAU,EAAE,wBAAwB,CAAC;IACrC,gBAAgB,EAAE,OAAO,CAAC;CAC3B,CAAC;AA6IF,KAAK,OAAO,GAAG;IACb,eAAe,EAAE,MAAM,CAAC;CACzB,CAAC;AAaF,eAAO,MAAM,iBAAiB,EAAE,QAAQ,CAAC,WAAW,EAAE,OAAO,CAiB5D,CAAC"}
@@ -75,8 +75,6 @@ $$
75
75
 
76
76
  Sur quel(s) intervalle(s) $f$ est-elle ${isAskingPositive ? "positive" : "négative"} ?`;
77
77
  };
78
- // const getHint: GetHint<Identifiers, Options> = (identifiers, opts) => {};
79
- // const getCorrection: GetCorrection<Identifiers, Options> = (identifiers) => {};
80
78
  const getKeys = () => {
81
79
  return ["lbracket", "semicolon", "rbracket", "cup", "infty"];
82
80
  };
@@ -114,8 +112,6 @@ const getQuestionFromIdentifiers = (identifiers, opts) => {
114
112
  keys: getKeys(identifiers, opts),
115
113
  answerFormat: "tex",
116
114
  identifiers,
117
- // hint: getHint(identifiers, opts),
118
- // correction: getCorrection(identifiers, opts),
119
115
  };
120
116
  return question;
121
117
  };
@@ -1 +1 @@
1
- {"version":3,"file":"summitReading.d.ts","sourceRoot":"","sources":["../../../../../../src/exercises/math/functions/trinoms/summitAndCanonical/summitReading.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAgBT,MAAM,6BAA6B,CAAC;AASrC,KAAK,WAAW,GAAG;IACjB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;CACX,CAAC;AAiGF,eAAO,MAAM,aAAa,EAAE,QAAQ,CAAC,WAAW,CAgB/C,CAAC"}
1
+ {"version":3,"file":"summitReading.d.ts","sourceRoot":"","sources":["../../../../../../src/exercises/math/functions/trinoms/summitAndCanonical/summitReading.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAgBT,MAAM,6BAA6B,CAAC;AASrC,KAAK,WAAW,GAAG;IACjB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;CACX,CAAC;AAkGF,eAAO,MAAM,aAAa,EAAE,QAAQ,CAAC,WAAW,CAgB/C,CAAC"}
@@ -21,6 +21,7 @@ const getGGBOptions = (identifiers) => {
21
21
  const commands = [
22
22
  `f(x) = ${trinom.toMathString()}`,
23
23
  `SetColor(f, "${randomColor()}")`,
24
+ `SetFixed(f, true, false)`,
24
25
  ];
25
26
  const ggb = new GeogebraConstructor({
26
27
  commands,
@@ -4,7 +4,6 @@ export * from "./perimeters/index.js";
4
4
  export * from "./pythagore/index.js";
5
5
  export * from "./thales/index.js";
6
6
  export * from "./vectors/index.js";
7
- export * from "./convexity/index.js";
8
7
  export * from "./volumes/index.js";
9
8
  export * from "./euclidianConstructions/index.js";
10
9
  export * from "./shapes/index.js";
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/geometry/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAC;AACjC,cAAc,sBAAsB,CAAC;AACrC,cAAc,uBAAuB,CAAC;AACtC,cAAc,sBAAsB,CAAC;AACrC,cAAc,mBAAmB,CAAC;AAClC,cAAc,oBAAoB,CAAC;AACnC,cAAc,sBAAsB,CAAC;AACrC,cAAc,oBAAoB,CAAC;AACnC,cAAc,mCAAmC,CAAC;AAClD,cAAc,mBAAmB,CAAC;AAClC,cAAc,sBAAsB,CAAC;AACrC,cAAc,uBAAuB,CAAC;AACtC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,mBAAmB,CAAC;AAClC,cAAc,kBAAkB,CAAC;AACjC,cAAc,sBAAsB,CAAC;AACrC,cAAc,yBAAyB,CAAC;AACxC,cAAc,oBAAoB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/geometry/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAC;AACjC,cAAc,sBAAsB,CAAC;AACrC,cAAc,uBAAuB,CAAC;AACtC,cAAc,sBAAsB,CAAC;AACrC,cAAc,mBAAmB,CAAC;AAClC,cAAc,oBAAoB,CAAC;AACnC,cAAc,oBAAoB,CAAC;AACnC,cAAc,mCAAmC,CAAC;AAClD,cAAc,mBAAmB,CAAC;AAClC,cAAc,sBAAsB,CAAC;AACrC,cAAc,uBAAuB,CAAC;AACtC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,mBAAmB,CAAC;AAClC,cAAc,kBAAkB,CAAC;AACjC,cAAc,sBAAsB,CAAC;AACrC,cAAc,yBAAyB,CAAC;AACxC,cAAc,oBAAoB,CAAC"}
@@ -4,7 +4,6 @@ export * from "./perimeters/index.js";
4
4
  export * from "./pythagore/index.js";
5
5
  export * from "./thales/index.js";
6
6
  export * from "./vectors/index.js";
7
- export * from "./convexity/index.js";
8
7
  export * from "./volumes/index.js";
9
8
  export * from "./euclidianConstructions/index.js";
10
9
  export * from "./shapes/index.js";
@@ -1 +1 @@
1
- {"version":3,"file":"spaceVectorLinearCombinationCoords.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/spaceGeometry/vectors/spaceVectorLinearCombinationCoords.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAaT,MAAM,6BAA6B,CAAC;AAQrC,KAAK,WAAW,GAAG;IACjB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,EAAE,EAAE,MAAM,CAAC;IACX,EAAE,EAAE,MAAM,CAAC;IACX,EAAE,EAAE,MAAM,CAAC;IACX,EAAE,EAAE,MAAM,CAAC;IACX,EAAE,EAAE,MAAM,CAAC;IACX,EAAE,EAAE,MAAM,CAAC;CACZ,CAAC;AAiFF,eAAO,MAAM,kCAAkC,EAAE,QAAQ,CAAC,WAAW,CAcpE,CAAC"}
1
+ {"version":3,"file":"spaceVectorLinearCombinationCoords.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/spaceGeometry/vectors/spaceVectorLinearCombinationCoords.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAaT,MAAM,6BAA6B,CAAC;AAQrC,KAAK,WAAW,GAAG;IACjB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,EAAE,EAAE,MAAM,CAAC;IACX,EAAE,EAAE,MAAM,CAAC;IACX,EAAE,EAAE,MAAM,CAAC;IACX,EAAE,EAAE,MAAM,CAAC;IACX,EAAE,EAAE,MAAM,CAAC;IACX,EAAE,EAAE,MAAM,CAAC;CACZ,CAAC;AAkFF,eAAO,MAAM,kCAAkC,EAAE,QAAQ,CAAC,WAAW,CAcpE,CAAC"}
package/lib/index.d.ts CHANGED
@@ -1228,6 +1228,12 @@ declare const mathExercises: (Exercise<{
1228
1228
  quadcoeffs: number[];
1229
1229
  }, Record<string, string | boolean | string[]>> | Exercise<{
1230
1230
  quadcoeffs: number[];
1231
+ }, Record<string, string | boolean | string[]>> | Exercise<{
1232
+ trinom: number[];
1233
+ }, Record<string, string | boolean | string[]>> | Exercise<{
1234
+ askConvex: boolean;
1235
+ quadcoeffs: number[];
1236
+ inflexionPoint: number;
1231
1237
  }, Record<string, string | boolean | string[]>> | Exercise<{
1232
1238
  a: number;
1233
1239
  b: number;
@@ -2553,12 +2559,6 @@ declare const mathExercises: (Exercise<{
2553
2559
  }, Record<string, string | boolean | string[]>> | Exercise<{
2554
2560
  vec: string;
2555
2561
  vecsProposed: string[];
2556
- }, Record<string, string | boolean | string[]>> | Exercise<{
2557
- trinom: number[];
2558
- }, Record<string, string | boolean | string[]>> | Exercise<{
2559
- askConvex: boolean;
2560
- quadcoeffs: number[];
2561
- inflexionPoint: number;
2562
2562
  }, Record<string, string | boolean | string[]>> | Exercise<{
2563
2563
  cubeSide: number;
2564
2564
  }, Record<string, string | boolean | string[]>> | Exercise<{
@@ -1,2 +1,7 @@
1
+ /**
2
+ *
3
+ * @param args
4
+ * @returns positive pgcd
5
+ */
1
6
  export declare function gcd(...args: number[]): number;
2
7
  //# sourceMappingURL=gcd.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"gcd.d.ts","sourceRoot":"","sources":["../../../../src/math/utils/arithmetic/gcd.ts"],"names":[],"mappings":"AAIA,wBAAgB,GAAG,CAAC,GAAG,IAAI,EAAE,MAAM,EAAE,GAAG,MAAM,CAG7C"}
1
+ {"version":3,"file":"gcd.d.ts","sourceRoot":"","sources":["../../../../src/math/utils/arithmetic/gcd.ts"],"names":[],"mappings":"AAIA;;;;GAIG;AACH,wBAAgB,GAAG,CAAC,GAAG,IAAI,EAAE,MAAM,EAAE,GAAG,MAAM,CAG7C"}
@@ -1,6 +1,11 @@
1
1
  function pgcd(a, b) {
2
2
  return b ? pgcd(b, a % b) : Math.abs(a);
3
3
  }
4
+ /**
5
+ *
6
+ * @param args
7
+ * @returns positive pgcd
8
+ */
4
9
  export function gcd(...args) {
5
10
  if (args.length === 2)
6
11
  return pgcd(args[0], args[1]);
@@ -1 +1 @@
1
- {"version":3,"file":"playground.d.ts","sourceRoot":"","sources":["../src/playground.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,UAAU,YAAW,CAAC;AAEnC;;;;GAIG"}
1
+ {"version":3,"file":"playground.d.ts","sourceRoot":"","sources":["../src/playground.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,UAAU,YAItB,CAAC;AAEF;;;;GAIG"}
package/lib/playground.js CHANGED
@@ -1,4 +1,9 @@
1
- export const playground = () => { };
1
+ import { gcd } from "./math/utils/arithmetic/gcd.js";
2
+ export const playground = () => {
3
+ const a = -4;
4
+ const b = -8;
5
+ console.log(gcd(a, b));
6
+ };
2
7
  /***
3
8
  *
4
9
  * !!TODO
package/lib/server.js CHANGED
@@ -27,8 +27,9 @@ const runServer = () => {
27
27
  dotenv.config();
28
28
  const app = express();
29
29
  app.use(cors());
30
- console.log("math exos", mathExercises.length);
31
- console.log("math hints", mathExercises.filter((exo) => exo.hasHintAndCorrection).length);
30
+ console.log("math exos", mathExercises.filter((exo) => !exo.subject || exo.subject === "Mathématiques").length);
31
+ console.log("math hints", mathExercises.filter((exo) => exo.hasHintAndCorrection &&
32
+ (!exo.subject || exo.subject === "Mathématiques")).length);
32
33
  console.log("pc exos", `${pcExercises.length}`);
33
34
  console.log("pc hints", pcExercises.filter((exo) => exo.hasHintAndCorrection).length);
34
35
  playground();
@@ -1,8 +1,8 @@
1
1
  import { buildPdfForExercise } from "./pdfs/buildPDFForExercise.js";
2
2
  import "../prototypesEnhancement.js";
3
- import { equationFromSignTable } from "../exercises/math/index.js";
3
+ import { independancyFromProbaTree, } from "../exercises/math/index.js";
4
4
  try {
5
- buildPdfForExercise(equationFromSignTable);
5
+ buildPdfForExercise(independancyFromProbaTree);
6
6
  }
7
7
  catch (err) {
8
8
  console.log(err);
@@ -1 +1 @@
1
- {"version":3,"file":"buildPDFForExercise.d.ts","sourceRoot":"","sources":["../../../src/tests/pdfs/buildPDFForExercise.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,QAAQ,EAAe,MAAM,6BAA6B,CAAC;AAQpE,eAAO,MAAM,mBAAmB,GAAI,KAAK,QAAQ,CAAC,MAAM,CAAC,SA8LxD,CAAC"}
1
+ {"version":3,"file":"buildPDFForExercise.d.ts","sourceRoot":"","sources":["../../../src/tests/pdfs/buildPDFForExercise.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,QAAQ,EAAe,MAAM,6BAA6B,CAAC;AASpE,eAAO,MAAM,mBAAmB,GAAI,KAAK,QAAQ,CAAC,MAAM,CAAC,SAwMxD,CAAC"}
@@ -11,6 +11,7 @@ import { signTableToLatex } from "./signTableToLatex.js";
11
11
  import { varTableToLatex } from "./varTableToLatex.js";
12
12
  import { valueTableToLatex } from "./valueTableToLatex.js";
13
13
  import { signVarTableToLatex } from "./signVarTableToLatex.js";
14
+ import { treeDiagramToLatex } from "./treeDiagramToLatex.js";
14
15
  export const buildPdfForExercise = (exo) => {
15
16
  const __filename = fileURLToPath(import.meta.url);
16
17
  const __dirname = path.dirname(__filename);
@@ -45,6 +46,11 @@ export const buildPdfForExercise = (exo) => {
45
46
  for (const match of signVarTableMatches) {
46
47
  question.instruction = question.instruction.replace(match[0], signVarTableToLatex(JSON.parse(match[1])));
47
48
  }
49
+ const treeDiagramRegex = /<svg id=["']treeDiagram["']>([\s\S]*?)<\/svg>/g;
50
+ const treeDiagramMatches = question.instruction.matchAll(treeDiagramRegex);
51
+ for (const match of treeDiagramMatches) {
52
+ question.instruction = question.instruction.replace(match[0], treeDiagramToLatex(match[1]));
53
+ }
48
54
  const formatted = formatMarkdownToLatex(question.instruction);
49
55
  content += `
50
56
  ${formatted} \n
@@ -1 +1 @@
1
- {"version":3,"file":"quizPdfPreambule.d.ts","sourceRoot":"","sources":["../../../src/tests/pdfs/quizPdfPreambule.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,gBAAgB,cA6E5B,CAAC"}
1
+ {"version":3,"file":"quizPdfPreambule.d.ts","sourceRoot":"","sources":["../../../src/tests/pdfs/quizPdfPreambule.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,gBAAgB,cA8E5B,CAAC"}
@@ -2,6 +2,7 @@ export const quizPdfPreambule = () => {
2
2
  return `\\documentclass[a4paper, 8pt]{article}
3
3
  \\usepackage[dvipsnames,table]{xcolor}
4
4
  \\usepackage{tikz}
5
+ \\usetikzlibrary{trees}
5
6
  \\usepackage{tkz-tab}
6
7
  \\usepackage[utf8]{inputenc}
7
8
  \\usepackage[T1]{fontenc}
@@ -0,0 +1,15 @@
1
+ /**
2
+ *
3
+ * @param tree string[][][][] stringified, avec des £ au lieu des dollars
4
+ * @returns
5
+ *
6
+ * [//arbre
7
+ * [//etage
8
+ * [//block
9
+ * [proba, event]
10
+ * ]
11
+ * ]
12
+ * ]
13
+ */
14
+ export declare const treeDiagramToLatex: (tree: string) => string;
15
+ //# sourceMappingURL=treeDiagramToLatex.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"treeDiagramToLatex.d.ts","sourceRoot":"","sources":["../../../src/tests/pdfs/treeDiagramToLatex.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,kBAAkB,GAAI,MAAM,MAAM,WAmC9C,CAAC"}
@@ -0,0 +1,49 @@
1
+ import { dollarizeString } from "./dollarizeString.js";
2
+ /**
3
+ *
4
+ * @param tree string[][][][] stringified, avec des £ au lieu des dollars
5
+ * @returns
6
+ *
7
+ * [//arbre
8
+ * [//etage
9
+ * [//block
10
+ * [proba, event]
11
+ * ]
12
+ * ]
13
+ * ]
14
+ */
15
+ export const treeDiagramToLatex = (tree) => {
16
+ const parsedTree = JSON.parse(tree.replaceAll("£", "$"));
17
+ const mainEvent = dollarizeString(parsedTree[0][0][0][1]);
18
+ const mainProba = dollarizeString(parsedTree[0][0][0][0]);
19
+ const oppMainEvent = dollarizeString(parsedTree[0][0][1][1]);
20
+ const oppMainProba = dollarizeString(parsedTree[0][0][1][0]);
21
+ const firstSubEvent = dollarizeString(parsedTree[1][0][0][1]);
22
+ const firstSubProba = dollarizeString(parsedTree[1][0][0][0]);
23
+ const firstOppSubEvent = dollarizeString(parsedTree[1][0][1][1]);
24
+ const firstOppSubProba = dollarizeString(parsedTree[1][0][1][0]);
25
+ const secondSubEvent = dollarizeString(parsedTree[1][1][0][1]);
26
+ const secondSubProba = dollarizeString(parsedTree[1][1][0][0]);
27
+ const secondOppSubEvent = dollarizeString(parsedTree[1][1][1][1]);
28
+ const secondOppSubProba = dollarizeString(parsedTree[1][1][1][0]);
29
+ return `
30
+
31
+ \\begin{tikzpicture}[
32
+ level 1/.style={sibling distance=4cm},
33
+ level 2/.style={sibling distance=2cm},
34
+ edge from parent/.style={draw, -latex}
35
+ ]
36
+ \\node {}
37
+ child { node {${mainEvent}} }
38
+ child { node {${firstSubEvent}} edge from parent node[left] {${firstSubProba}} }
39
+ child { node {${firstOppSubEvent}} edge from parent node[right] {${firstOppSubProba}} }
40
+ edge from parent node[left] {${mainProba}}
41
+ }
42
+ child { node {${oppMainEvent}}
43
+ child { node {${secondSubEvent}} edge from parent node[left] {${secondSubProba}} }
44
+ child { node {${secondOppSubEvent}} edge from parent node[right] {${secondOppSubProba}} }
45
+ edge from parent node[right] {${oppMainProba}}
46
+ };
47
+ \\end{tikzpicture}
48
+ `;
49
+ };
@@ -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;;;CAqU3B,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;AA0BjE,eAAO,MAAM,YAAY,GACvB,KAAK,QAAQ,CAAC,MAAM,CAAC,EACrB,UAAU,QAAQ,CAAC,MAAM,CAAC;;;CAsU3B,CAAC"}
@@ -1,6 +1,25 @@
1
1
  import { latexTester } from "../latexTester.js";
2
2
  import { assertJsonStringifiable } from "./assertJsonStringifiable.js";
3
3
  import { formatMarkdownToLatex } from "./pdfs/formatMdToLatex.js";
4
+ /* //TODO
5
+ - tester les touches du clavier (si touche manquante erreur)
6
+ - tests sur les tableaux (ya-t-il bien au moins un input, la structure est-elle bonne, ...)
7
+ - tests sur les arbres (ya-t-il bien au moins un input, la structure est-elle bonne, ...)
8
+ -
9
+
10
+ */
11
+ /*
12
+ touches du clavier basiques :
13
+ 0-9
14
+ ,
15
+ +-* et /
16
+ sqrt et square
17
+ power
18
+ ( et )
19
+
20
+ un test basique serait si l'exo n'a pas de touche mais la réponse contient n'importe quel symbole hors des précédents
21
+ c'est basique car il faudrait aussi pouvoir tester les cas où y'a des touches mais certaines manquent
22
+ */
4
23
  export const questionTest = (exo, question) => {
5
24
  let qcmTime = -1;
6
25
  let veaTime = -1;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "math-exercises",
3
3
  "type": "module",
4
- "version": "3.0.197",
4
+ "version": "3.0.199",
5
5
  "description": "Math exercises generator for middle school and high school",
6
6
  "main": "lib/index.js",
7
7
  "files": [