math-exercises 1.3.44 → 1.3.47

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.
@@ -9,24 +9,24 @@ export interface Question {
9
9
  instruction?: string;
10
10
  startStatement?: string;
11
11
  answer: string;
12
- answerFormat?: 'tex' | 'raw';
12
+ answerFormat: 'tex' | 'raw';
13
13
  keys?: string[];
14
14
  commands?: string[];
15
15
  coords?: number[];
16
16
  options?: any;
17
- getPropositions?: (n: number) => Proposition[];
17
+ getPropositions: (n: number) => Proposition[];
18
18
  }
19
19
  export interface Exercise {
20
20
  id: string;
21
21
  instruction: string;
22
22
  isSingleStep: boolean;
23
23
  label: string;
24
- sections: Section[];
25
- levels: Level[];
24
+ sections: MathSection[];
25
+ levels: MathLevel[];
26
26
  connector: '=' | '\\iff' | '\\approx';
27
27
  keys?: string[];
28
28
  generator(nb: number, options?: GeneratorOptions): Question[];
29
29
  }
30
- export type Level = '6ème' | '5ème' | '4ème' | '3ème' | '2nde' | '1reTech' | '1reESM' | '1reSpé' | 'TermSpé' | 'TermTech' | 'MathExp' | 'MathComp';
31
- export type Section = 'Calcul littéral' | 'Équations' | 'Racines carrées' | 'Fractions' | 'Calculs' | 'Géométrie cartésienne' | 'Vecteurs' | 'Puissances' | 'Suites' | 'Pourcentages' | 'Dérivation' | 'Probabilités' | 'Droites' | 'Géométrie euclidienne' | 'Conversions' | 'Arithmétique' | 'Fonctions affines' | 'Proportionnalité' | 'Logarithme népérien' | 'Exponentielle' | 'Fonctions' | 'Statistiques' | 'Limites' | 'Intégration' | 'Primitives' | 'Équations différentielles' | 'Trigonométrie';
30
+ export type MathLevel = '6ème' | '5ème' | '4ème' | '3ème' | '2nde' | '1reTech' | '1reESM' | '1reSpé' | 'TermSpé' | 'TermTech' | 'MathExp' | 'MathComp';
31
+ export type MathSection = 'Calcul littéral' | 'Équations' | 'Racines carrées' | 'Fractions' | 'Calculs' | 'Géométrie cartésienne' | 'Vecteurs' | 'Puissances' | 'Suites' | 'Pourcentages' | 'Dérivation' | 'Probabilités' | 'Droites' | 'Géométrie euclidienne' | 'Conversions' | 'Arithmétique' | 'Fonctions affines' | 'Proportionnalité' | 'Logarithme népérien' | 'Exponentielle' | 'Fonctions' | 'Statistiques' | 'Limites' | 'Intégration' | 'Primitives' | 'Équations différentielles' | 'Trigonométrie';
32
32
  //# sourceMappingURL=exercise.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"exercise.d.ts","sourceRoot":"","sources":["../../src/exercises/exercise.ts"],"names":[],"mappings":"AAMA,MAAM,MAAM,gBAAgB,GAAG,EAAE,CAAC;AAElC,MAAM,MAAM,WAAW,GAAG;IACxB,EAAE,EAAE,MAAM,CAAC;IACX,SAAS,EAAE,MAAM,CAAC;IAClB,aAAa,EAAE,OAAO,CAAC;IACvB,MAAM,EAAE,KAAK,GAAG,KAAK,CAAC;CACvB,CAAC;AACF,MAAM,WAAW,QAAQ;IACvB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,MAAM,EAAE,MAAM,CAAC;IACf,YAAY,CAAC,EAAE,KAAK,GAAG,KAAK,CAAC;IAC7B,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;IAChB,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;IACpB,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;IAClB,OAAO,CAAC,EAAE,GAAG,CAAC;IACd,eAAe,CAAC,EAAE,CAAC,CAAC,EAAE,MAAM,KAAK,WAAW,EAAE,CAAC;CAChD;AAED,MAAM,WAAW,QAAQ;IACvB,EAAE,EAAE,MAAM,CAAC;IACX,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,EAAE,OAAO,CAAC;IACtB,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,OAAO,EAAE,CAAC;IACpB,MAAM,EAAE,KAAK,EAAE,CAAC;IAChB,SAAS,EAAE,GAAG,GAAG,OAAO,GAAG,UAAU,CAAC;IACtC,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;IAChB,SAAS,CAAC,EAAE,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,gBAAgB,GAAG,QAAQ,EAAE,CAAC;CAC/D;AAED,MAAM,MAAM,KAAK,GACb,MAAM,GACN,MAAM,GACN,MAAM,GACN,MAAM,GACN,MAAM,GACN,SAAS,GACT,QAAQ,GACR,QAAQ,GACR,SAAS,GACT,UAAU,GACV,SAAS,GACT,UAAU,CAAC;AAEf,MAAM,MAAM,OAAO,GACf,iBAAiB,GACjB,WAAW,GACX,iBAAiB,GACjB,WAAW,GACX,SAAS,GACT,uBAAuB,GACvB,UAAU,GACV,YAAY,GACZ,QAAQ,GACR,cAAc,GACd,YAAY,GACZ,cAAc,GACd,SAAS,GACT,uBAAuB,GACvB,aAAa,GACb,cAAc,GACd,mBAAmB,GACnB,kBAAkB,GAClB,qBAAqB,GACrB,eAAe,GACf,WAAW,GACX,cAAc,GACd,SAAS,GACT,aAAa,GACb,YAAY,GACZ,2BAA2B,GAC3B,eAAe,CAAC"}
1
+ {"version":3,"file":"exercise.d.ts","sourceRoot":"","sources":["../../src/exercises/exercise.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,gBAAgB,GAAG,EAAE,CAAC;AAElC,MAAM,MAAM,WAAW,GAAG;IACxB,EAAE,EAAE,MAAM,CAAC;IACX,SAAS,EAAE,MAAM,CAAC;IAClB,aAAa,EAAE,OAAO,CAAC;IACvB,MAAM,EAAE,KAAK,GAAG,KAAK,CAAC;CACvB,CAAC;AACF,MAAM,WAAW,QAAQ;IACvB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,MAAM,EAAE,MAAM,CAAC;IACf,YAAY,EAAE,KAAK,GAAG,KAAK,CAAC;IAC5B,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;IAChB,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;IACpB,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;IAClB,OAAO,CAAC,EAAE,GAAG,CAAC;IACd,eAAe,EAAE,CAAC,CAAC,EAAE,MAAM,KAAK,WAAW,EAAE,CAAC;CAC/C;AAED,MAAM,WAAW,QAAQ;IACvB,EAAE,EAAE,MAAM,CAAC;IACX,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,EAAE,OAAO,CAAC;IACtB,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,WAAW,EAAE,CAAC;IACxB,MAAM,EAAE,SAAS,EAAE,CAAC;IACpB,SAAS,EAAE,GAAG,GAAG,OAAO,GAAG,UAAU,CAAC;IACtC,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;IAChB,SAAS,CAAC,EAAE,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,gBAAgB,GAAG,QAAQ,EAAE,CAAC;CAC/D;AAED,MAAM,MAAM,SAAS,GACjB,MAAM,GACN,MAAM,GACN,MAAM,GACN,MAAM,GACN,MAAM,GACN,SAAS,GACT,QAAQ,GACR,QAAQ,GACR,SAAS,GACT,UAAU,GACV,SAAS,GACT,UAAU,CAAC;AAEf,MAAM,MAAM,WAAW,GACnB,iBAAiB,GACjB,WAAW,GACX,iBAAiB,GACjB,WAAW,GACX,SAAS,GACT,uBAAuB,GACvB,UAAU,GACV,YAAY,GACZ,QAAQ,GACR,cAAc,GACd,YAAY,GACZ,cAAc,GACd,SAAS,GACT,uBAAuB,GACvB,aAAa,GACb,cAAc,GACd,mBAAmB,GACnB,kBAAkB,GAClB,qBAAqB,GACrB,eAAe,GACf,WAAW,GACX,cAAc,GACd,SAAS,GACT,aAAa,GACb,YAAY,GACZ,2BAA2B,GAC3B,eAAe,CAAC"}
@@ -1,7 +1,2 @@
1
1
  "use strict";
2
- // export enum Connector {
3
- // equal = "=",
4
- // equiv = "\\iff",
5
- // implies = "\\Rightarrow",
6
- // }
7
2
  Object.defineProperty(exports, "__esModule", { value: true });
@@ -39,7 +39,7 @@ function getSignFunction() {
39
39
  answer =
40
40
  a > 0
41
41
  ? `\\left]-\\infty;${(0, simplify_1.simplifyNode)(new numberNode_1.NumberNode(-b / a)).toTex()}\\right]`
42
- : `\\left[${(0, simplify_1.simplifyNode)(new numberNode_1.NumberNode(-b / a)).toTex()};+\\infty\\left[`;
42
+ : `\\left[${(0, simplify_1.simplifyNode)(new numberNode_1.NumberNode(-b / a)).toTex()};+\\infty\\right[`;
43
43
  break;
44
44
  }
45
45
  const getPropositions = (n) => {
@@ -1 +1 @@
1
- {"version":3,"file":"mainRemarkableValues.d.ts","sourceRoot":"","sources":["../../../src/exercises/trigonometry/mainRemarkableValues.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAGjD,eAAO,MAAM,4BAA4B,EAAE,QAU1C,CAAC;AAEF,wBAAgB,uBAAuB,IAAI,QAAQ,CAalD"}
1
+ {"version":3,"file":"mainRemarkableValues.d.ts","sourceRoot":"","sources":["../../../src/exercises/trigonometry/mainRemarkableValues.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,QAAQ,EAAe,QAAQ,EAAE,MAAM,aAAa,CAAC;AAI9D,eAAO,MAAM,4BAA4B,EAAE,QAU1C,CAAC;AAEF,wBAAgB,uBAAuB,IAAI,QAAQ,CAkDlD"}
@@ -3,7 +3,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getMainRemarkableValues = exports.mainRemarkableValuesExercise = void 0;
4
4
  const remarkableValue_1 = require("../../math/trigonometry/remarkableValue");
5
5
  const coinFlip_1 = require("../../utils/coinFlip");
6
+ const shuffle_1 = require("../../utils/shuffle");
6
7
  const getDistinctQuestions_1 = require("../utils/getDistinctQuestions");
8
+ const uuid_1 = require("uuid");
7
9
  exports.mainRemarkableValuesExercise = {
8
10
  id: 'mainRemarkableValues',
9
11
  connector: '=',
@@ -18,12 +20,47 @@ exports.mainRemarkableValuesExercise = {
18
20
  function getMainRemarkableValues() {
19
21
  const isCos = (0, coinFlip_1.coinFlip)();
20
22
  const remarkableValue = remarkableValue_1.RemarkableValueConstructor.mainInterval();
23
+ const answer = isCos ? remarkableValue.cos.toTex() : remarkableValue.sin.toTex();
24
+ const values = [
25
+ '-1',
26
+ '-\\frac{\\sqrt 3}{2}',
27
+ '-\\frac{\\sqrt 2}{2}',
28
+ '-\\frac{1}{2}',
29
+ '0',
30
+ '\\frac{\\sqrt 3}{2}',
31
+ '\\frac{\\sqrt 2}{2}',
32
+ '\\frac{1}{2}',
33
+ '1',
34
+ ];
35
+ (0, shuffle_1.shuffle)(values);
36
+ const getPropositions = (n) => {
37
+ const props = [
38
+ {
39
+ id: (0, uuid_1.v4)(),
40
+ statement: answer,
41
+ isRightAnswer: true,
42
+ format: 'tex',
43
+ },
44
+ ];
45
+ for (let i = 0; i < n - 1; i++) {
46
+ const statement = values.find((val) => !props.some((el) => el.statement === val));
47
+ props.push({
48
+ id: (0, uuid_1.v4)(),
49
+ statement,
50
+ isRightAnswer: false,
51
+ format: 'tex',
52
+ });
53
+ }
54
+ return (0, shuffle_1.shuffle)(props);
55
+ };
21
56
  const question = {
22
57
  startStatement: isCos
23
58
  ? `\\cos\\left(${remarkableValue.angle.toTex()}\\right)`
24
59
  : `\\sin\\left(${remarkableValue.angle.toTex()}\\right)`,
25
- answer: isCos ? remarkableValue.cos.toTex() : remarkableValue.sin.toTex(),
60
+ answer: answer,
26
61
  keys: ['pi', 'cos', 'sin'],
62
+ answerFormat: 'tex',
63
+ getPropositions,
27
64
  };
28
65
  return question;
29
66
  }
@@ -1 +1 @@
1
- {"version":3,"file":"remarkableValues.d.ts","sourceRoot":"","sources":["../../../src/exercises/trigonometry/remarkableValues.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAGjD,eAAO,MAAM,wBAAwB,EAAE,QAUtC,CAAC;AAEF,wBAAgB,mBAAmB,IAAI,QAAQ,CAW9C"}
1
+ {"version":3,"file":"remarkableValues.d.ts","sourceRoot":"","sources":["../../../src/exercises/trigonometry/remarkableValues.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,QAAQ,EAAe,QAAQ,EAAE,MAAM,aAAa,CAAC;AAI9D,eAAO,MAAM,wBAAwB,EAAE,QAUtC,CAAC;AAEF,wBAAgB,mBAAmB,IAAI,QAAQ,CAiD9C"}
@@ -3,7 +3,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getRemarkableValues = exports.remarkableValuesExercise = void 0;
4
4
  const remarkableValue_1 = require("../../math/trigonometry/remarkableValue");
5
5
  const coinFlip_1 = require("../../utils/coinFlip");
6
+ const shuffle_1 = require("../../utils/shuffle");
6
7
  const getDistinctQuestions_1 = require("../utils/getDistinctQuestions");
8
+ const uuid_1 = require("uuid");
7
9
  exports.remarkableValuesExercise = {
8
10
  id: 'remarkableValues',
9
11
  connector: '=',
@@ -18,12 +20,47 @@ exports.remarkableValuesExercise = {
18
20
  function getRemarkableValues() {
19
21
  const isCos = (0, coinFlip_1.coinFlip)();
20
22
  const remarkableValue = remarkableValue_1.RemarkableValueConstructor.simplifiable();
23
+ const answer = isCos ? remarkableValue.cos.toTex() : remarkableValue.sin.toTex();
24
+ const values = [
25
+ '-1',
26
+ '-\\frac{\\sqrt 3}{2}',
27
+ '-\\frac{\\sqrt 2}{2}',
28
+ '-\\frac{1}{2}',
29
+ '0',
30
+ '\\frac{\\sqrt 3}{2}',
31
+ '\\frac{\\sqrt 2}{2}',
32
+ '\\frac{1}{2}',
33
+ '1',
34
+ ];
35
+ (0, shuffle_1.shuffle)(values);
36
+ const getPropositions = (n) => {
37
+ const props = [
38
+ {
39
+ id: (0, uuid_1.v4)(),
40
+ statement: answer,
41
+ isRightAnswer: true,
42
+ format: 'tex',
43
+ },
44
+ ];
45
+ for (let i = 0; i < n - 1; i++) {
46
+ const statement = values.find((val) => !props.some((el) => el.statement === val));
47
+ props.push({
48
+ id: (0, uuid_1.v4)(),
49
+ statement,
50
+ isRightAnswer: false,
51
+ format: 'tex',
52
+ });
53
+ }
54
+ return props;
55
+ };
21
56
  const question = {
22
57
  startStatement: isCos
23
58
  ? `\\cos\\left(${remarkableValue.angle.toTex()}\\right)`
24
59
  : `\\sin\\left(${remarkableValue.angle.toTex()}\\right)`,
25
- answer: isCos ? remarkableValue.cos.toTex() : remarkableValue.sin.toTex(),
60
+ answer: answer,
26
61
  keys: ['pi', 'cos', 'sin'],
62
+ answerFormat: 'tex',
63
+ getPropositions,
27
64
  };
28
65
  return question;
29
66
  }
package/lib/index.d.ts CHANGED
@@ -1,7 +1,7 @@
1
- import { Exercise, Section } from './exercises/exercise';
1
+ import { Exercise, MathSection } from './exercises/exercise';
2
2
  declare const allMathExercises: Exercise[];
3
3
  declare const getAllMathExercisesBySection: () => {
4
- section: Section;
4
+ section: MathSection;
5
5
  exos: Exercise[];
6
6
  }[];
7
7
  export { allMathExercises, getAllMathExercisesBySection };
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAGzD,QAAA,MAAM,gBAAgB,YAAiB,CAAC;AAExC,QAAA,MAAM,4BAA4B;aACT,OAAO;UAAQ,QAAQ,EAAE;GAkBjD,CAAC;AACF,OAAO,EAAE,gBAAgB,EAAE,4BAA4B,EAAE,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAG7D,QAAA,MAAM,gBAAgB,YAAiB,CAAC;AAExC,QAAA,MAAM,4BAA4B;aACT,WAAW;UAAQ,QAAQ,EAAE;GAkBrD,CAAC;AACF,OAAO,EAAE,gBAAgB,EAAE,4BAA4B,EAAE,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "math-exercises",
3
- "version": "1.3.44",
3
+ "version": "1.3.47",
4
4
  "description": "Math exercises generator for middle school and high school",
5
5
  "main": "lib/index.js",
6
6
  "files": [