math-exercises 2.0.6 → 2.0.7

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 (77) hide show
  1. package/lib/exercises/calculLitteral/equation/index.d.ts +0 -2
  2. package/lib/exercises/calculLitteral/equation/index.d.ts.map +1 -1
  3. package/lib/exercises/calculLitteral/equation/index.js +0 -2
  4. package/lib/exercises/calculLitteral/simplifying/index.d.ts +0 -2
  5. package/lib/exercises/calculLitteral/simplifying/index.d.ts.map +1 -1
  6. package/lib/exercises/calculLitteral/simplifying/index.js +0 -2
  7. package/lib/exercises/exercise.d.ts +1 -1
  8. package/lib/exercises/exercise.d.ts.map +1 -1
  9. package/lib/exercises/functions/basics/graphicEquation.d.ts +8 -0
  10. package/lib/exercises/functions/basics/graphicEquation.d.ts.map +1 -0
  11. package/lib/exercises/functions/basics/graphicEquation.js +109 -0
  12. package/lib/exercises/functions/basics/graphicInequation.d.ts +16 -0
  13. package/lib/exercises/functions/basics/graphicInequation.d.ts.map +1 -0
  14. package/lib/exercises/functions/basics/graphicInequation.js +147 -0
  15. package/lib/exercises/functions/basics/index.d.ts +2 -0
  16. package/lib/exercises/functions/basics/index.d.ts.map +1 -1
  17. package/lib/exercises/functions/basics/index.js +2 -0
  18. package/lib/exercises/functions/exponential/expEquation.d.ts +8 -0
  19. package/lib/exercises/functions/exponential/expEquation.d.ts.map +1 -0
  20. package/lib/exercises/functions/exponential/expEquation.js +75 -0
  21. package/lib/exercises/functions/exponential/expSimplifiying.d.ts +10 -0
  22. package/lib/exercises/functions/exponential/expSimplifiying.d.ts.map +1 -0
  23. package/lib/exercises/functions/exponential/expSimplifiying.js +116 -0
  24. package/lib/exercises/functions/exponential/index.d.ts +3 -0
  25. package/lib/exercises/functions/exponential/index.d.ts.map +1 -0
  26. package/lib/exercises/functions/exponential/index.js +18 -0
  27. package/lib/exercises/functions/index.d.ts +2 -0
  28. package/lib/exercises/functions/index.d.ts.map +1 -1
  29. package/lib/exercises/functions/index.js +2 -0
  30. package/lib/exercises/functions/logarithm/index.d.ts +4 -0
  31. package/lib/exercises/functions/logarithm/index.d.ts.map +1 -0
  32. package/lib/exercises/functions/logarithm/index.js +20 -0
  33. package/lib/exercises/functions/logarithm/log10PowerSimplifying.d.ts +7 -0
  34. package/lib/exercises/functions/logarithm/log10PowerSimplifying.d.ts.map +1 -0
  35. package/lib/exercises/functions/logarithm/log10PowerSimplifying.js +53 -0
  36. package/lib/exercises/functions/logarithm/logEquation.d.ts +9 -0
  37. package/lib/exercises/functions/logarithm/logEquation.d.ts.map +1 -0
  38. package/lib/exercises/functions/logarithm/logEquation.js +74 -0
  39. package/lib/exercises/functions/logarithm/logPowerEquation.d.ts +6 -0
  40. package/lib/exercises/functions/logarithm/logPowerEquation.d.ts.map +1 -0
  41. package/lib/exercises/functions/logarithm/logPowerEquation.js +73 -0
  42. package/lib/exercises/functions/logarithm/logSimplifiying.d.ts +9 -0
  43. package/lib/exercises/functions/logarithm/logSimplifiying.d.ts.map +1 -0
  44. package/lib/exercises/functions/logarithm/logSimplifiying.js +77 -0
  45. package/lib/exercises/sets/intervals/inequalityToInterval.d.ts.map +1 -1
  46. package/lib/index.d.ts +32 -17
  47. package/lib/index.d.ts.map +1 -1
  48. package/lib/math/complex/complex.d.ts +1 -1
  49. package/lib/math/numbers/logarithms/ln.d.ts +12 -0
  50. package/lib/math/numbers/logarithms/ln.d.ts.map +1 -0
  51. package/lib/math/numbers/logarithms/ln.js +18 -0
  52. package/lib/tree/nodes/functions/functionNode.d.ts +3 -2
  53. package/lib/tree/nodes/functions/functionNode.d.ts.map +1 -1
  54. package/lib/tree/nodes/functions/functionNode.js +3 -2
  55. package/lib/tree/nodes/functions/log10Node.d.ts +18 -0
  56. package/lib/tree/nodes/functions/log10Node.d.ts.map +1 -0
  57. package/lib/tree/nodes/functions/log10Node.js +54 -0
  58. package/lib/tree/nodes/functions/logNode.js +1 -1
  59. package/lib/tree/nodes/inequations/inequationSolutionNode.d.ts +3 -2
  60. package/lib/tree/nodes/inequations/inequationSolutionNode.d.ts.map +1 -1
  61. package/lib/tree/nodes/inequations/inequationSolutionNode.js +15 -6
  62. package/lib/tree/nodes/operators/addNode.d.ts.map +1 -1
  63. package/lib/tree/nodes/operators/addNode.js +2 -0
  64. package/lib/tree/nodes/operators/powerNode.d.ts.map +1 -1
  65. package/lib/tree/nodes/sets/discreteSetNode.d.ts +3 -1
  66. package/lib/tree/nodes/sets/discreteSetNode.d.ts.map +1 -1
  67. package/lib/tree/nodes/sets/discreteSetNode.js +7 -1
  68. package/lib/tree/nodes/sets/intervalNode.d.ts +3 -1
  69. package/lib/tree/nodes/sets/intervalNode.d.ts.map +1 -1
  70. package/lib/tree/nodes/sets/intervalNode.js +7 -1
  71. package/lib/tree/nodes/sets/setNode.d.ts +9 -1
  72. package/lib/tree/nodes/sets/setNode.d.ts.map +1 -1
  73. package/lib/tree/nodes/sets/setNode.js +12 -0
  74. package/lib/tree/nodes/sets/unionIntervalNode.d.ts +3 -1
  75. package/lib/tree/nodes/sets/unionIntervalNode.d.ts.map +1 -1
  76. package/lib/tree/nodes/sets/unionIntervalNode.js +7 -1
  77. package/package.json +1 -1
@@ -11,7 +11,7 @@ function isLogNode(a) {
11
11
  exports.isLogNode = isLogNode;
12
12
  class LogNode {
13
13
  constructor(child, opts) {
14
- this.id = functionNode_1.FunctionsIds.opposite;
14
+ this.id = functionNode_1.FunctionsIds.log;
15
15
  this.child = child;
16
16
  this.type = node_1.NodeType.function;
17
17
  this.opts = opts;
@@ -1,5 +1,6 @@
1
1
  import { Node, NodeOptions, NodeType } from "../node";
2
2
  import { IntervalNode } from "../sets/intervalNode";
3
+ import { UnionIntervalNode } from "../sets/unionIntervalNode";
3
4
  type InequationSolutionNodeOptions = {
4
5
  variable?: string;
5
6
  opts?: NodeOptions;
@@ -7,9 +8,9 @@ type InequationSolutionNodeOptions = {
7
8
  export declare class InequationSolutionNode implements Node {
8
9
  type: NodeType;
9
10
  variable: string;
10
- intervalSolution: IntervalNode;
11
+ intervalSolution: IntervalNode | UnionIntervalNode;
11
12
  opts?: NodeOptions;
12
- constructor(intervalSolution: IntervalNode, params?: InequationSolutionNodeOptions);
13
+ constructor(intervalSolution: IntervalNode | UnionIntervalNode, params?: InequationSolutionNodeOptions);
13
14
  toAllTexs(): string[];
14
15
  toAllValidTexs(): string[];
15
16
  toEquivalentNodes(opts?: NodeOptions): (import("./inequationNode").InequationNode | InequationSolutionNode)[];
@@ -1 +1 @@
1
- {"version":3,"file":"inequationSolutionNode.d.ts","sourceRoot":"","sources":["../../../../src/tree/nodes/inequations/inequationSolutionNode.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AACtD,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAEpD,KAAK,6BAA6B,GAAG;IAAE,QAAQ,CAAC,EAAE,MAAM,CAAC;IAAC,IAAI,CAAC,EAAE,WAAW,CAAA;CAAE,CAAC;AAC/E,qBAAa,sBAAuB,YAAW,IAAI;IACjD,IAAI,EAAE,QAAQ,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;IACjB,gBAAgB,EAAE,YAAY,CAAC;IAC/B,IAAI,CAAC,EAAE,WAAW,CAAC;gBAEjB,gBAAgB,EAAE,YAAY,EAC9B,MAAM,CAAC,EAAE,6BAA6B;IAcxC,SAAS;IAUT,cAAc;IAId,iBAAiB,CAAC,IAAI,CAAC,EAAE,WAAW;IAQpC,YAAY;IAGZ,QAAQ;IAGR,KAAK;CAGN"}
1
+ {"version":3,"file":"inequationSolutionNode.d.ts","sourceRoot":"","sources":["../../../../src/tree/nodes/inequations/inequationSolutionNode.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AACtD,OAAO,EAAE,YAAY,EAAkB,MAAM,sBAAsB,CAAC;AACpE,OAAO,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AAE9D,KAAK,6BAA6B,GAAG;IAAE,QAAQ,CAAC,EAAE,MAAM,CAAC;IAAC,IAAI,CAAC,EAAE,WAAW,CAAA;CAAE,CAAC;AAC/E,qBAAa,sBAAuB,YAAW,IAAI;IACjD,IAAI,EAAE,QAAQ,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;IACjB,gBAAgB,EAAE,YAAY,GAAG,iBAAiB,CAAC;IACnD,IAAI,CAAC,EAAE,WAAW,CAAC;gBAEjB,gBAAgB,EAAE,YAAY,GAAG,iBAAiB,EAClD,MAAM,CAAC,EAAE,6BAA6B;IAcxC,SAAS;IAUT,cAAc;IAId,iBAAiB,CAAC,IAAI,CAAC,EAAE,WAAW;IAepC,YAAY;IAGZ,QAAQ;IAGR,KAAK;CAGN"}
@@ -2,6 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.InequationSolutionNode = void 0;
4
4
  const node_1 = require("../node");
5
+ const intervalNode_1 = require("../sets/intervalNode");
5
6
  class InequationSolutionNode {
6
7
  constructor(intervalSolution, params) {
7
8
  this.type = node_1.NodeType.set;
@@ -18,7 +19,7 @@ class InequationSolutionNode {
18
19
  const intervalTex = this.intervalSolution.toTex();
19
20
  const res = [
20
21
  this.toTex(),
21
- this.intervalSolution.toTex(),
22
+ intervalTex,
22
23
  `${this.variable}\\in${intervalTex}`,
23
24
  ];
24
25
  return res;
@@ -27,11 +28,19 @@ class InequationSolutionNode {
27
28
  return this.toEquivalentNodes(this.opts).flatMap((el) => el.toAllTexs());
28
29
  }
29
30
  toEquivalentNodes(opts) {
30
- const equivs = this.intervalSolution.toEquivalentNodes(opts ?? this.opts);
31
- return equivs.flatMap((equiv) => [
32
- new InequationSolutionNode(equiv, { variable: this.variable, opts }),
33
- ...equiv.toInequality().toEquivalentNodes(),
34
- ]);
31
+ if ((0, intervalNode_1.isIntervalNode)(this.intervalSolution)) {
32
+ const equivs = this.intervalSolution.toEquivalentNodes(opts ?? this.opts);
33
+ return equivs.flatMap((equiv) => [
34
+ new InequationSolutionNode(equiv, { variable: this.variable, opts }),
35
+ ...equiv.toInequality().toEquivalentNodes(),
36
+ ]);
37
+ }
38
+ else {
39
+ const equivs = this.intervalSolution.toEquivalentNodes(opts ?? this.opts);
40
+ return equivs.flatMap((equiv) => [
41
+ new InequationSolutionNode(equiv, { variable: this.variable, opts }),
42
+ ]);
43
+ }
35
44
  }
36
45
  toMathString() {
37
46
  return "";
@@ -1 +1 @@
1
- {"version":3,"file":"addNode.d.ts","sourceRoot":"","sources":["../../../../src/tree/nodes/operators/addNode.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AACtD,OAAO,EACL,uBAAuB,EACvB,WAAW,EAGZ,MAAM,gBAAgB,CAAC;AAKxB,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAEjD,wBAAgB,SAAS,CAAC,CAAC,EAAE,IAAI,GAAG,CAAC,IAAI,OAAO,CAE/C;AAKD,qBAAa,OAAQ,YAAW,uBAAuB;IACrD,EAAE,EAAE,WAAW,CAAC;IAChB,SAAS,EAAE,aAAa,CAAC;IACzB,UAAU,EAAE,aAAa,CAAC;IAC1B,IAAI,EAAE,QAAQ,CAAC;IACf,IAAI,CAAC,EAAE,WAAW,CAAC;gBAEjB,SAAS,EAAE,aAAa,EACxB,UAAU,EAAE,aAAa,EACzB,IAAI,CAAC,EAAE,WAAW;IAQpB,OAAO,aAGL;IAEF,YAAY,IAAI,MAAM;IAItB,iBAAiB,CAAC,IAAI,CAAC,EAAE,WAAW,GAAG,aAAa,EAAE;IAoCtD,SAAS,IAAI,MAAM,EAAE;IAIrB,cAAc,CAAC,IAAI,CAAC,EAAE,WAAW,GAAG,MAAM,EAAE;IAK5C,KAAK,IAAI,MAAM;IAIf,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC;CAMtC"}
1
+ {"version":3,"file":"addNode.d.ts","sourceRoot":"","sources":["../../../../src/tree/nodes/operators/addNode.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AACtD,OAAO,EACL,uBAAuB,EACvB,WAAW,EAGZ,MAAM,gBAAgB,CAAC;AAKxB,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAEjD,wBAAgB,SAAS,CAAC,CAAC,EAAE,IAAI,GAAG,CAAC,IAAI,OAAO,CAE/C;AAMD,qBAAa,OAAQ,YAAW,uBAAuB;IACrD,EAAE,EAAE,WAAW,CAAC;IAChB,SAAS,EAAE,aAAa,CAAC;IACzB,UAAU,EAAE,aAAa,CAAC;IAC1B,IAAI,EAAE,QAAQ,CAAC;IACf,IAAI,CAAC,EAAE,WAAW,CAAC;gBAEjB,SAAS,EAAE,aAAa,EACxB,UAAU,EAAE,aAAa,EACzB,IAAI,CAAC,EAAE,WAAW;IAQpB,OAAO,aAGL;IAEF,YAAY,IAAI,MAAM;IAItB,iBAAiB,CAAC,IAAI,CAAC,EAAE,WAAW,GAAG,aAAa,EAAE;IAoCtD,SAAS,IAAI,MAAM,EAAE;IAIrB,cAAc,CAAC,IAAI,CAAC,EAAE,WAAW,GAAG,MAAM,EAAE;IAK5C,KAAK,IAAI,MAAM;IAIf,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC;CAMtC"}
@@ -13,6 +13,8 @@ function isAddNode(a) {
13
13
  }
14
14
  exports.isAddNode = isAddNode;
15
15
  const addNodeToTex = (leftTex, rightTex) => {
16
+ if (rightTex === "0")
17
+ return leftTex;
16
18
  return `${leftTex}${rightTex[0] === "-" ? "" : "+"}${rightTex}`;
17
19
  };
18
20
  class AddNode {
@@ -1 +1 @@
1
- {"version":3,"file":"powerNode.d.ts","sourceRoot":"","sources":["../../../../src/tree/nodes/operators/powerNode.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AACtD,OAAO,EAAE,WAAW,EAAE,YAAY,EAAkB,MAAM,gBAAgB,CAAC;AAG3E,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAEjD,wBAAgB,WAAW,CAAC,CAAC,EAAE,IAAI,GAAG,CAAC,IAAI,SAAS,CAEnD;AAED,qBAAa,SAAU,YAAW,YAAY;IAC5C,IAAI,CAAC,EAAE,WAAW,CAAC;IACnB,EAAE,EAAE,WAAW,CAAC;IAChB,SAAS,EAAE,aAAa,CAAC;IACzB,UAAU,EAAE,aAAa,CAAC;IAC1B,IAAI,EAAE,QAAQ,CAAC;gBAEb,SAAS,EAAE,aAAa,EACxB,UAAU,EAAE,aAAa,EACzB,IAAI,CAAC,EAAE,WAAW;IASpB,YAAY,IAAI,MAAM;IAItB,iBAAiB;IAqBjB,cAAc,IAAI,MAAM,EAAE;IAI1B,KAAK,IAAI,MAAM;IAuBf,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC;CA0BtC;AAED,qBAAa,UAAW,SAAQ,SAAS;gBAC3B,KAAK,EAAE,aAAa,EAAE,IAAI,CAAC,EAAE,WAAW;CAGrD"}
1
+ {"version":3,"file":"powerNode.d.ts","sourceRoot":"","sources":["../../../../src/tree/nodes/operators/powerNode.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AACtD,OAAO,EAAE,WAAW,EAAE,YAAY,EAAkB,MAAM,gBAAgB,CAAC;AAG3E,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAKjD,wBAAgB,WAAW,CAAC,CAAC,EAAE,IAAI,GAAG,CAAC,IAAI,SAAS,CAEnD;AAED,qBAAa,SAAU,YAAW,YAAY;IAC5C,IAAI,CAAC,EAAE,WAAW,CAAC;IACnB,EAAE,EAAE,WAAW,CAAC;IAChB,SAAS,EAAE,aAAa,CAAC;IACzB,UAAU,EAAE,aAAa,CAAC;IAC1B,IAAI,EAAE,QAAQ,CAAC;gBAEb,SAAS,EAAE,aAAa,EACxB,UAAU,EAAE,aAAa,EACzB,IAAI,CAAC,EAAE,WAAW;IASpB,YAAY,IAAI,MAAM;IAItB,iBAAiB;IAqBjB,cAAc,IAAI,MAAM,EAAE;IAI1B,KAAK,IAAI,MAAM;IAuBf,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC;CA4CtC;AAED,qBAAa,UAAW,SAAQ,SAAS;gBAC3B,KAAK,EAAE,aAAa,EAAE,IAAI,CAAC,EAAE,WAAW;CAGrD"}
@@ -1,7 +1,9 @@
1
1
  import { Node, NodeOptions, NodeType } from "../node";
2
- import { SetNode } from "./setNode";
2
+ import { SetIds, SetNode } from "./setNode";
3
+ export declare function isUnionIntervalNode(a: Node): a is DiscreteSetNode;
3
4
  export declare class DiscreteSetNode implements SetNode {
4
5
  type: NodeType;
6
+ id: SetIds;
5
7
  opts?: NodeOptions | undefined;
6
8
  elements: Node[];
7
9
  constructor(elements: Node[], opts?: NodeOptions);
@@ -1 +1 @@
1
- {"version":3,"file":"discreteSetNode.d.ts","sourceRoot":"","sources":["../../../../src/tree/nodes/sets/discreteSetNode.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,IAAI,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AACtD,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC,qBAAa,eAAgB,YAAW,OAAO;IAC7C,IAAI,EAAE,QAAQ,CAAC;IACf,IAAI,CAAC,EAAE,WAAW,GAAG,SAAS,CAAC;IAC/B,QAAQ,EAAE,IAAI,EAAE,CAAC;gBACL,QAAQ,EAAE,IAAI,EAAE,EAAE,IAAI,CAAC,EAAE,WAAW;IAKhD,cAAc;IAGd,iBAAiB,CAAC,IAAI,CAAC,EAAE,WAAW;IAyBpC,YAAY;IAGZ,QAAQ;IAGR,KAAK;CAMN;AAED,eAAO,MAAM,QAAQ,iBAA0B,CAAC"}
1
+ {"version":3,"file":"discreteSetNode.d.ts","sourceRoot":"","sources":["../../../../src/tree/nodes/sets/discreteSetNode.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,IAAI,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AACtD,OAAO,EAAE,MAAM,EAAE,OAAO,EAAa,MAAM,WAAW,CAAC;AACvD,wBAAgB,mBAAmB,CAAC,CAAC,EAAE,IAAI,GAAG,CAAC,IAAI,eAAe,CAEjE;AACD,qBAAa,eAAgB,YAAW,OAAO;IAC7C,IAAI,EAAE,QAAQ,CAAC;IACf,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,CAAC,EAAE,WAAW,GAAG,SAAS,CAAC;IAC/B,QAAQ,EAAE,IAAI,EAAE,CAAC;gBACL,QAAQ,EAAE,IAAI,EAAE,EAAE,IAAI,CAAC,EAAE,WAAW;IAMhD,cAAc;IAGd,iBAAiB,CAAC,IAAI,CAAC,EAAE,WAAW;IAyBpC,YAAY;IAGZ,QAAQ;IAGR,KAAK;CAMN;AAED,eAAO,MAAM,QAAQ,iBAA0B,CAAC"}
@@ -1,12 +1,18 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.EmptySet = exports.DiscreteSetNode = void 0;
3
+ exports.EmptySet = exports.DiscreteSetNode = exports.isUnionIntervalNode = void 0;
4
4
  const cartesianProducts_1 = require("../../../utils/cartesianProducts");
5
5
  const permutations_1 = require("../../../utils/permutations");
6
6
  const node_1 = require("../node");
7
+ const setNode_1 = require("./setNode");
8
+ function isUnionIntervalNode(a) {
9
+ return (0, setNode_1.isSetNode)(a) && a.id === setNode_1.SetIds.discrete;
10
+ }
11
+ exports.isUnionIntervalNode = isUnionIntervalNode;
7
12
  class DiscreteSetNode {
8
13
  constructor(elements, opts) {
9
14
  this.type = node_1.NodeType.set;
15
+ this.id = setNode_1.SetIds.discrete;
10
16
  this.elements = elements;
11
17
  this.opts = opts;
12
18
  }
@@ -1,14 +1,16 @@
1
1
  import { InequationNode } from "../inequations/inequationNode";
2
2
  import { Node, NodeOptions, NodeType } from "../node";
3
- import { SetNode } from "./setNode";
3
+ import { SetIds, SetNode } from "./setNode";
4
4
  export declare enum ClosureType {
5
5
  FF = 0,
6
6
  FO = 1,
7
7
  OF = 2,
8
8
  OO = 3
9
9
  }
10
+ export declare function isIntervalNode(a: Node): a is IntervalNode;
10
11
  export declare class IntervalNode implements SetNode {
11
12
  type: NodeType;
13
+ id: SetIds;
12
14
  opts?: NodeOptions | undefined;
13
15
  closure: ClosureType;
14
16
  a: Node;
@@ -1 +1 @@
1
- {"version":3,"file":"intervalNode.d.ts","sourceRoot":"","sources":["../../../../src/tree/nodes/sets/intervalNode.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AAC/D,OAAO,EAAE,IAAI,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAGtD,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC,oBAAY,WAAW;IACrB,EAAE,IAAA;IACF,EAAE,IAAA;IACF,EAAE,IAAA;IACF,EAAE,IAAA;CACH;AAED,qBAAa,YAAa,YAAW,OAAO;IAC1C,IAAI,EAAE,QAAQ,CAAC;IACf,IAAI,CAAC,EAAE,WAAW,GAAG,SAAS,CAAC;IAC/B,OAAO,EAAE,WAAW,CAAC;IACrB,CAAC,EAAE,IAAI,CAAC;IACR,CAAC,EAAE,IAAI,CAAC;gBACI,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,WAAW,EAAE,IAAI,CAAC,EAAE,WAAW;IAQtE,cAAc;IAId,iBAAiB,CAAC,IAAI,CAAC,EAAE,WAAW;IAoBpC,YAAY,CAAC,WAAW,CAAC,EAAE,IAAI;IA4B/B,YAAY;IAIZ,QAAQ;IAIR,KAAK;CAWN"}
1
+ {"version":3,"file":"intervalNode.d.ts","sourceRoot":"","sources":["../../../../src/tree/nodes/sets/intervalNode.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AAC/D,OAAO,EAAE,IAAI,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAGtD,OAAO,EAAE,MAAM,EAAE,OAAO,EAAa,MAAM,WAAW,CAAC;AAEvD,oBAAY,WAAW;IACrB,EAAE,IAAA;IACF,EAAE,IAAA;IACF,EAAE,IAAA;IACF,EAAE,IAAA;CACH;AACD,wBAAgB,cAAc,CAAC,CAAC,EAAE,IAAI,GAAG,CAAC,IAAI,YAAY,CAEzD;AACD,qBAAa,YAAa,YAAW,OAAO;IAC1C,IAAI,EAAE,QAAQ,CAAC;IACf,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,CAAC,EAAE,WAAW,GAAG,SAAS,CAAC;IAC/B,OAAO,EAAE,WAAW,CAAC;IACrB,CAAC,EAAE,IAAI,CAAC;IACR,CAAC,EAAE,IAAI,CAAC;gBACI,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,WAAW,EAAE,IAAI,CAAC,EAAE,WAAW;IAStE,cAAc;IAId,iBAAiB,CAAC,IAAI,CAAC,EAAE,WAAW;IAoBpC,YAAY,CAAC,WAAW,CAAC,EAAE,IAAI;IA4B/B,YAAY;IAIZ,QAAQ;IAIR,KAAK;CAWN"}
@@ -1,11 +1,12 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.IntervalNode = exports.ClosureType = void 0;
3
+ exports.IntervalNode = exports.isIntervalNode = exports.ClosureType = void 0;
4
4
  const cartesianProducts_1 = require("../../../utils/cartesianProducts");
5
5
  const inequationNode_1 = require("../inequations/inequationNode");
6
6
  const node_1 = require("../node");
7
7
  const constantNode_1 = require("../numbers/constantNode");
8
8
  const variableNode_1 = require("../variables/variableNode");
9
+ const setNode_1 = require("./setNode");
9
10
  var ClosureType;
10
11
  (function (ClosureType) {
11
12
  ClosureType[ClosureType["FF"] = 0] = "FF";
@@ -13,9 +14,14 @@ var ClosureType;
13
14
  ClosureType[ClosureType["OF"] = 2] = "OF";
14
15
  ClosureType[ClosureType["OO"] = 3] = "OO";
15
16
  })(ClosureType || (exports.ClosureType = ClosureType = {}));
17
+ function isIntervalNode(a) {
18
+ return (0, setNode_1.isSetNode)(a) && a.id === setNode_1.SetIds.interval;
19
+ }
20
+ exports.isIntervalNode = isIntervalNode;
16
21
  class IntervalNode {
17
22
  constructor(a, b, closure, opts) {
18
23
  this.type = node_1.NodeType.set;
24
+ this.id = setNode_1.SetIds.interval;
19
25
  this.closure = closure;
20
26
  this.a = a;
21
27
  this.b = b;
@@ -1,4 +1,12 @@
1
- import { Node } from "../node";
1
+ import { Node, NodeOptions } from "../node";
2
+ export declare enum SetIds {
3
+ interval = 0,
4
+ discrete = 1,
5
+ union = 2
6
+ }
2
7
  export interface SetNode extends Node {
8
+ id: SetIds;
9
+ toEquivalentNodes: (opts?: NodeOptions) => SetNode[];
3
10
  }
11
+ export declare function isSetNode(a: Node): a is SetNode;
4
12
  //# sourceMappingURL=setNode.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"setNode.d.ts","sourceRoot":"","sources":["../../../../src/tree/nodes/sets/setNode.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAE/B,MAAM,WAAW,OAAQ,SAAQ,IAAI;CAAG"}
1
+ {"version":3,"file":"setNode.d.ts","sourceRoot":"","sources":["../../../../src/tree/nodes/sets/setNode.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,WAAW,EAAY,MAAM,SAAS,CAAC;AAEtD,oBAAY,MAAM;IAChB,QAAQ,IAAA;IACR,QAAQ,IAAA;IACR,KAAK,IAAA;CACN;AACD,MAAM,WAAW,OAAQ,SAAQ,IAAI;IACnC,EAAE,EAAE,MAAM,CAAC;IACX,iBAAiB,EAAE,CAAC,IAAI,CAAC,EAAE,WAAW,KAAK,OAAO,EAAE,CAAC;CACtD;AAED,wBAAgB,SAAS,CAAC,CAAC,EAAE,IAAI,GAAG,CAAC,IAAI,OAAO,CAE/C"}
@@ -1,2 +1,14 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.isSetNode = exports.SetIds = void 0;
4
+ const node_1 = require("../node");
5
+ var SetIds;
6
+ (function (SetIds) {
7
+ SetIds[SetIds["interval"] = 0] = "interval";
8
+ SetIds[SetIds["discrete"] = 1] = "discrete";
9
+ SetIds[SetIds["union"] = 2] = "union";
10
+ })(SetIds || (exports.SetIds = SetIds = {}));
11
+ function isSetNode(a) {
12
+ return a.type === node_1.NodeType.set;
13
+ }
14
+ exports.isSetNode = isSetNode;
@@ -1,13 +1,15 @@
1
1
  import { Node, NodeOptions, NodeType } from "../node";
2
- import { SetNode } from "./setNode";
2
+ import { SetIds, SetNode } from "./setNode";
3
3
  export declare enum ClosureType {
4
4
  FF = 0,
5
5
  FO = 1,
6
6
  OF = 2,
7
7
  OO = 3
8
8
  }
9
+ export declare function isUnionIntervalNode(a: Node): a is UnionIntervalNode;
9
10
  export declare class UnionIntervalNode implements Node {
10
11
  type: NodeType;
12
+ id: SetIds;
11
13
  opts?: NodeOptions | undefined;
12
14
  sets: SetNode[];
13
15
  constructor(sets: SetNode[], opts?: NodeOptions);
@@ -1 +1 @@
1
- {"version":3,"file":"unionIntervalNode.d.ts","sourceRoot":"","sources":["../../../../src/tree/nodes/sets/unionIntervalNode.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,IAAI,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AACtD,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC,oBAAY,WAAW;IACrB,EAAE,IAAA;IACF,EAAE,IAAA;IACF,EAAE,IAAA;IACF,EAAE,IAAA;CACH;AAED,qBAAa,iBAAkB,YAAW,IAAI;IAC5C,IAAI,EAAE,QAAQ,CAAC;IACf,IAAI,CAAC,EAAE,WAAW,GAAG,SAAS,CAAC;IAC/B,IAAI,EAAE,OAAO,EAAE,CAAC;gBACJ,IAAI,EAAE,OAAO,EAAE,EAAE,IAAI,CAAC,EAAE,WAAW;IAM/C,cAAc;IAId,iBAAiB,CAAC,IAAI,CAAC,EAAE,WAAW;IAcpC,YAAY;IAIZ,QAAQ;IAIR,KAAK;CAGN"}
1
+ {"version":3,"file":"unionIntervalNode.d.ts","sourceRoot":"","sources":["../../../../src/tree/nodes/sets/unionIntervalNode.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,IAAI,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AACtD,OAAO,EAAE,MAAM,EAAE,OAAO,EAAa,MAAM,WAAW,CAAC;AAEvD,oBAAY,WAAW;IACrB,EAAE,IAAA;IACF,EAAE,IAAA;IACF,EAAE,IAAA;IACF,EAAE,IAAA;CACH;AACD,wBAAgB,mBAAmB,CAAC,CAAC,EAAE,IAAI,GAAG,CAAC,IAAI,iBAAiB,CAEnE;AACD,qBAAa,iBAAkB,YAAW,IAAI;IAC5C,IAAI,EAAE,QAAQ,CAAC;IACf,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,CAAC,EAAE,WAAW,GAAG,SAAS,CAAC;IAC/B,IAAI,EAAE,OAAO,EAAE,CAAC;gBACJ,IAAI,EAAE,OAAO,EAAE,EAAE,IAAI,CAAC,EAAE,WAAW;IAO/C,cAAc;IAId,iBAAiB,CAAC,IAAI,CAAC,EAAE,WAAW;IAcpC,YAAY;IAIZ,QAAQ;IAIR,KAAK;CAGN"}
@@ -1,9 +1,10 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.UnionIntervalNode = exports.ClosureType = void 0;
3
+ exports.UnionIntervalNode = exports.isUnionIntervalNode = exports.ClosureType = void 0;
4
4
  const cartesianProducts_1 = require("../../../utils/cartesianProducts");
5
5
  const permutations_1 = require("../../../utils/permutations");
6
6
  const node_1 = require("../node");
7
+ const setNode_1 = require("./setNode");
7
8
  var ClosureType;
8
9
  (function (ClosureType) {
9
10
  ClosureType[ClosureType["FF"] = 0] = "FF";
@@ -11,9 +12,14 @@ var ClosureType;
11
12
  ClosureType[ClosureType["OF"] = 2] = "OF";
12
13
  ClosureType[ClosureType["OO"] = 3] = "OO";
13
14
  })(ClosureType || (exports.ClosureType = ClosureType = {}));
15
+ function isUnionIntervalNode(a) {
16
+ return (0, setNode_1.isSetNode)(a) && a.id === setNode_1.SetIds.union;
17
+ }
18
+ exports.isUnionIntervalNode = isUnionIntervalNode;
14
19
  class UnionIntervalNode {
15
20
  constructor(sets, opts) {
16
21
  this.type = node_1.NodeType.set;
22
+ this.id = setNode_1.SetIds.union;
17
23
  this.sets = sets;
18
24
  this.opts = opts;
19
25
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "math-exercises",
3
- "version": "2.0.6",
3
+ "version": "2.0.7",
4
4
  "description": "Math exercises generator for middle school and high school",
5
5
  "main": "lib/index.js",
6
6
  "files": [