math-exercises 3.0.14 → 3.0.16

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.
@@ -37,7 +37,7 @@ const getThirdDegreeFunctionVariation = () => {
37
37
  new IntervalNode(racine2Tree, PlusInfinityNode, ClosureType.FO),
38
38
  ]).toTex();
39
39
  const commands = [
40
- `f(x) = ${polynome.toString()}`,
40
+ `f(x) = ${polynome.toMathString()}`,
41
41
  `SetColor(f, "${randomColor()}")`,
42
42
  ];
43
43
  const y1 = polynome.calculate(racine1);
@@ -33,7 +33,7 @@ const getDerivativeNumberReading = () => {
33
33
  const polynome = new Polynomial([d, c, b / 2, a / 3]);
34
34
  const instruction = `Ci-dessous sont tracées la courbe $\\mathcal C_f$ de la fonction $f$ et la tangente à cette courbe au point d'abscisse $${xA}$.$\\\\$ Déterminer $f'(${xA})$.`;
35
35
  const commands = [
36
- `f(x) = ${polynome.toString()}`,
36
+ `f(x) = ${polynome.toMathString()}`,
37
37
  `SetColor(f, "${blueMain}")`,
38
38
  `SetCaption(f, "$\\mathcal C_f$")`,
39
39
  `ShowLabel(f, true)`,
@@ -8,7 +8,7 @@ const getRootsReadingQuestion = () => {
8
8
  const trinom = TrinomConstructor.randomNiceRoots(randint(1, 3));
9
9
  const roots = trinom.getRoots();
10
10
  const commands = [
11
- `f(x) = ${trinom.toString()}`,
11
+ `f(x) = ${trinom.toMathString()}`,
12
12
  `SetColor(f, "${randomColor()}")`,
13
13
  ];
14
14
  const ggb = new GeogebraConstructor({
@@ -8,7 +8,7 @@ import { randint } from "../../../../../math/utils/random/randint.js";
8
8
  const getSummitReadingQuestion = () => {
9
9
  const trinom = TrinomConstructor.randomCanonical();
10
10
  const commands = [
11
- `f(x) = ${trinom.toString()}`,
11
+ `f(x) = ${trinom.toMathString()}`,
12
12
  `SetColor(f, "${randomColor()}")`,
13
13
  ];
14
14
  const ggb = new GeogebraConstructor({
@@ -60,7 +60,7 @@ const getConvexityQuadrinomialsGeoQuestion = () => {
60
60
  const questionType = askConvex ? "convexe" : "concave";
61
61
  const instruction = `Ci-dessous est tracée la courbe représentative $\\mathcal C_f$ d'une fonction $f$. Sur quel intervalle $f$ est-elle ${questionType} ?`;
62
62
  const commands = [
63
- `f(x) = ${quadrinomial.toString()}`,
63
+ `f(x) = ${quadrinomial.toMathString()}`,
64
64
  `SetColor(f, "${blueMain}")`,
65
65
  `SetCaption(f, "$\\mathcal C_f$")`,
66
66
  `ShowLabel(f, true)`,
@@ -8,7 +8,7 @@ const getConvexityTrinomialsGeoQuestion = () => {
8
8
  const trinom = TrinomConstructor.random();
9
9
  const instruction = `Ci-dessous est tracée la courbe représentative $\\mathcal C_f$ d'une fonction $f$. Sur $\\mathbb{R}$, la fonction $f$ est :`;
10
10
  const commands = [
11
- `f(x) = ${trinom.toString()}`,
11
+ `f(x) = ${trinom.toMathString()}`,
12
12
  `SetColor(f, "${blueMain}")`,
13
13
  `SetCaption(f, "$\\mathcal C_f$")`,
14
14
  `ShowLabel(f, true)`,
@@ -249,7 +249,7 @@ export class Trinom extends Polynomial {
249
249
  return `${aString}${bString}${cString}`;
250
250
  }
251
251
  toGGBCommands({ name, color, label } = { name: "f", color: blueMain, label: "" }) {
252
- const cmds = [`${name} = ${this.toString()}`];
252
+ const cmds = [`${name} = ${this.toMathString()}`];
253
253
  if (color) {
254
254
  cmds.push(`SetColor(${name}, "${color}")`);
255
255
  }
@@ -1 +1 @@
1
- {"version":3,"file":"playground.d.ts","sourceRoot":"","sources":["../src/playground.ts"],"names":[],"mappings":"AAcA,eAAO,MAAM,UAAU,YAiBtB,CAAC"}
1
+ {"version":3,"file":"playground.d.ts","sourceRoot":"","sources":["../src/playground.ts"],"names":[],"mappings":"AAeA,eAAO,MAAM,UAAU,YAGtB,CAAC"}
package/lib/playground.js CHANGED
@@ -1,21 +1,5 @@
1
- import { probaLawFlip } from "./utils/alea/probaLawFlip.js";
1
+ import { parseAlgebraic } from "./tree/parsers/latexParser.js";
2
2
  export const playground = () => {
3
- const res = [0, 0, 0];
4
- for (let i = 0; i < 1000; i++) {
5
- const x = probaLawFlip([
6
- [-1, 0.45],
7
- [0, 0.1],
8
- [1, 0.45],
9
- ]);
10
- if (x === -1) {
11
- res[0]++;
12
- }
13
- else if (x === 0) {
14
- res[1]++;
15
- }
16
- else {
17
- res[2]++;
18
- }
19
- }
20
- console.log(res);
3
+ const tex = "\\cos\\left(\\frac{\\pi}{2}\\right)";
4
+ console.log(parseAlgebraic(tex).simplify().toTex());
21
5
  };
@@ -58,7 +58,7 @@ export class CosNode {
58
58
  if (!trigoPoint)
59
59
  return new CosNode(simplifiedChild);
60
60
  else
61
- return trigoPoint.sin;
61
+ return trigoPoint.cos;
62
62
  }
63
63
  else {
64
64
  // Écrire les règles algébriques spécifiques à sin ici
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "math-exercises",
3
3
  "type": "module",
4
- "version": "3.0.14",
4
+ "version": "3.0.16",
5
5
  "description": "Math exercises generator for middle school and high school",
6
6
  "main": "lib/index.js",
7
7
  "files": [