pimath 0.0.68 → 0.0.71

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 (70) hide show
  1. package/dist/pi.js +8 -2
  2. package/dist/pi.js.map +1 -1
  3. package/dist/pi.min.js +1 -1
  4. package/dist/pi.min.js.map +1 -1
  5. package/esm/maths/algebra/equation.js +1 -1
  6. package/esm/maths/algebra/equation.js.map +1 -1
  7. package/esm/maths/algebra/polynom.js +1 -1
  8. package/esm/maths/algebra/polynom.js.map +1 -1
  9. package/esm/maths/coefficients/fraction.d.ts +1 -0
  10. package/esm/maths/coefficients/fraction.js +3 -0
  11. package/esm/maths/coefficients/fraction.js.map +1 -1
  12. package/esm/maths/expressions/expression.d.ts +6 -0
  13. package/esm/maths/expressions/expression.js +79 -1
  14. package/esm/maths/expressions/expression.js.map +1 -1
  15. package/esm/maths/expressions/expressionFactor.d.ts +8 -1
  16. package/esm/maths/expressions/expressionFactor.js +51 -4
  17. package/esm/maths/expressions/expressionFactor.js.map +1 -1
  18. package/esm/maths/expressions/expressionMember.d.ts +12 -1
  19. package/esm/maths/expressions/expressionMember.js +128 -19
  20. package/esm/maths/expressions/expressionMember.js.map +1 -1
  21. package/esm/maths/expressions/expressionParser.d.ts +2 -0
  22. package/esm/maths/expressions/expressionParser.js +74 -34
  23. package/esm/maths/expressions/expressionParser.js.map +1 -1
  24. package/esm/maths/expressions/factors/ExpFactor.d.ts +2 -2
  25. package/esm/maths/expressions/factors/ExpFactor.js +15 -3
  26. package/esm/maths/expressions/factors/ExpFactor.js.map +1 -1
  27. package/esm/maths/expressions/factors/ExpFactorConstant.d.ts +1 -0
  28. package/esm/maths/expressions/factors/ExpFactorConstant.js +3 -0
  29. package/esm/maths/expressions/factors/ExpFactorConstant.js.map +1 -1
  30. package/esm/maths/expressions/factors/ExpFactorExponential.d.ts +1 -0
  31. package/esm/maths/expressions/factors/ExpFactorExponential.js +4 -0
  32. package/esm/maths/expressions/factors/ExpFactorExponential.js.map +1 -1
  33. package/esm/maths/expressions/factors/ExpFactorNumber.d.ts +3 -2
  34. package/esm/maths/expressions/factors/ExpFactorNumber.js +23 -0
  35. package/esm/maths/expressions/factors/ExpFactorNumber.js.map +1 -1
  36. package/esm/maths/expressions/factors/ExpFactorPower.d.ts +5 -1
  37. package/esm/maths/expressions/factors/ExpFactorPower.js +15 -2
  38. package/esm/maths/expressions/factors/ExpFactorPower.js.map +1 -1
  39. package/esm/maths/expressions/factors/ExpFactorTrigo.d.ts +1 -0
  40. package/esm/maths/expressions/factors/ExpFactorTrigo.js +8 -0
  41. package/esm/maths/expressions/factors/ExpFactorTrigo.js.map +1 -1
  42. package/esm/maths/expressions/factors/ExpFactorVariable.d.ts +1 -0
  43. package/esm/maths/expressions/factors/ExpFactorVariable.js +3 -0
  44. package/esm/maths/expressions/factors/ExpFactorVariable.js.map +1 -1
  45. package/esm/maths/expressions/polynomexp.bkp.js +0 -1
  46. package/esm/maths/expressions/polynomexp.bkp.js.map +1 -1
  47. package/esm/maths/shutingyard.js +3 -0
  48. package/esm/maths/shutingyard.js.map +1 -1
  49. package/package.json +1 -1
  50. package/src/maths/algebra/equation.ts +1 -1
  51. package/src/maths/algebra/polynom.ts +1 -1
  52. package/src/maths/coefficients/fraction.ts +4 -0
  53. package/src/maths/expressions/expression.ts +115 -20
  54. package/src/maths/expressions/expressionFactor.ts +59 -7
  55. package/src/maths/expressions/expressionMember.ts +141 -22
  56. package/src/maths/expressions/expressionParser.ts +79 -33
  57. package/src/maths/expressions/factors/ExpFactor.ts +19 -6
  58. package/src/maths/expressions/factors/ExpFactorConstant.ts +4 -0
  59. package/src/maths/expressions/factors/ExpFactorExponential.ts +7 -0
  60. package/src/maths/expressions/factors/ExpFactorNumber.ts +32 -4
  61. package/src/maths/expressions/factors/ExpFactorPower.ts +21 -3
  62. package/src/maths/expressions/factors/ExpFactorTrigo.ts +10 -1
  63. package/src/maths/expressions/factors/ExpFactorVariable.ts +5 -0
  64. package/src/maths/expressions/polynomexp.bkp.ts +0 -1
  65. package/src/maths/shutingyard.ts +4 -1
  66. package/tests/expressions/expressions.test.ts +24 -3
  67. package/tests/geometry/circle.test.ts +6 -0
  68. package/esm/maths/expressions/factors/ExpFactorSin.d.ts +0 -7
  69. package/esm/maths/expressions/factors/ExpFactorSin.js +0 -22
  70. package/esm/maths/expressions/factors/ExpFactorSin.js.map +0 -1
@@ -189,6 +189,8 @@ export class Shutingyard {
189
189
  }
190
190
 
191
191
  normalize(expr: string): string {
192
+ if(expr.length===1){return expr}
193
+
192
194
  // Get the list of function token.
193
195
  let fnToken: string[] = [],
194
196
  kToken: string[] = []
@@ -207,6 +209,8 @@ export class Shutingyard {
207
209
  kToken.sort((a, b) => b.length - a.length)
208
210
 
209
211
 
212
+
213
+
210
214
  let normalizedExpr: string = "",
211
215
  i = 0,
212
216
  crtToken,
@@ -370,7 +374,6 @@ export class Shutingyard {
370
374
  // Normalize the input if required.
371
375
  if (this._uniformize) expr = this.normalize(expr)
372
376
 
373
-
374
377
  let securityLoopLvl1 = 50,
375
378
  securityLoopLvl2_default = 50,
376
379
  securityLoopLvl2;
@@ -17,10 +17,31 @@ describe('Expressions tests', () => { // the tests container
17
17
  // let a = new ExpressionParser('3x^(2/3)+5').expression
18
18
  // let a = new ExpressionParser('3x(x+4)').expression
19
19
  // let a = new ExpressionParser('sin(cos(3picos(3pi)-5))+sqrt(e-sin(3pi/2))').expression
20
- let a = new ExpressionParser('3+nthrt(x-3,5)').expression
21
- console.log('TeX output: ', a.tex)
22
- console.log(a.structure())
20
+ // let a = new ExpressionParser('3-nthrt(x-3,5)').expression
21
+ // console.log(a.isPolynom())
22
+ // let b = new ExpressionParser('3/2x^2-5x+7').expression
23
+ // console.log(b.tex, b.isPolynom())
24
+ // console.log(b.members[0].member.coefficient().tex)
25
+ // console.log(b.members[0].member.litteral().tex)
26
+ // console.log(b.structure())
27
+ //
23
28
 
29
+ // let c = new ExpressionParser('3/2x^2+5/3x-7').expression
30
+ // console.log(c.tex)
31
+ // console.log(c.display)
32
+
33
+ // let d = new ExpressionParser('sqrt(16)*sqrt(15^4)+9/15').expression
34
+ let d = new ExpressionParser('nthrt(16,4)').expression
35
+ console.log(d.tex)
36
+ console.log(d.members[0].member.reduce().tex)
37
+ console.log(d.structure())
38
+ // console.log(d.display)
39
+
40
+ // console.log(d.structure())
41
+ // console.log(c.display)
42
+ // console.log(c.members[0].member.literal().factors.length)
43
+ // console.log(c.members[0].member.reduce().tex);
44
+ // console.log(c.members[1].member.reduce().tex);
24
45
  })
25
46
 
26
47
  it('should make some operations', ()=>{
@@ -60,4 +60,10 @@ describe('Circle', function () {
60
60
 
61
61
  expect(pts.map(x=>x.x.display + ',' + x.y.display)).to.have.all.members([ '3,0', '3,-8', '7,-4', '-1,-4' ])
62
62
  });
63
+
64
+ it('should calculate the circle from center and radius', function(){
65
+ let circle = new Circle("x^2+6x+y^2-8y+12=0")
66
+
67
+ console.log(circle.tex)
68
+ })
63
69
  });
@@ -1,7 +0,0 @@
1
- import { ExpressionFactor } from "../expressionFactor";
2
- import { Expression } from "../expression";
3
- export declare class ExpFactorSin extends ExpressionFactor {
4
- derivative(variable: string): Expression;
5
- integrate(variable: string): Expression;
6
- makeTeX(): string;
7
- }
@@ -1,22 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ExpFactorSin = void 0;
4
- const expressionFactor_1 = require("../expressionFactor");
5
- class ExpFactorSin extends expressionFactor_1.ExpressionFactor {
6
- derivative(variable) {
7
- return undefined;
8
- }
9
- integrate(variable) {
10
- return undefined;
11
- }
12
- makeTeX() {
13
- let tex = "\\sin";
14
- if (this.root > 1) {
15
- tex += `^{ ${this.root} }`;
16
- }
17
- tex += `\\left( ${this.argument.tex} \\right)`;
18
- return this.texRoot(tex);
19
- }
20
- }
21
- exports.ExpFactorSin = ExpFactorSin;
22
- //# sourceMappingURL=ExpFactorSin.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ExpFactorSin.js","sourceRoot":"","sources":["../../../../src/maths/expressions/factors/ExpFactorSin.ts"],"names":[],"mappings":";;;AAAA,0DAAqD;AAGrD,MAAa,YAAa,SAAQ,mCAAgB;IAE9C,UAAU,CAAC,QAAgB;QACvB,OAAO,SAAS,CAAA;IACpB,CAAC;IAED,SAAS,CAAC,QAAgB;QACtB,OAAO,SAAS,CAAA;IACpB,CAAC;IAED,OAAO;QACH,IAAI,GAAG,GAAG,OAAO,CAAA;QACjB,IAAG,IAAI,CAAC,IAAI,GAAC,CAAC,EAAC;YACX,GAAG,IAAI,MAAM,IAAI,CAAC,IAAI,IAAI,CAAA;SAC7B;QAED,GAAG,IAAG,WAAW,IAAI,CAAC,QAAQ,CAAC,GAAG,WAAW,CAAA;QAC7C,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;IAC7B,CAAC;CACJ;AAnBD,oCAmBC"}