pimath 0.0.128 → 0.0.129

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 (160) hide show
  1. package/dist/main.d.ts +39 -0
  2. package/dist/maths/algebra/equation.d.ts +120 -0
  3. package/dist/maths/algebra/linearSystem.d.ts +40 -0
  4. package/dist/maths/algebra/logicalset.d.ts +28 -0
  5. package/dist/maths/algebra/monom.d.ts +207 -0
  6. package/dist/maths/algebra/polynom.d.ts +155 -0
  7. package/dist/maths/algebra/rational.d.ts +44 -0
  8. package/dist/maths/algebra/study/rationalStudy.d.ts +14 -0
  9. package/dist/maths/algebra/study.d.ts +140 -0
  10. package/dist/maths/coefficients/fraction.d.ts +90 -0
  11. package/dist/maths/coefficients/nthRoot.d.ts +23 -0
  12. package/dist/maths/geometry/circle.d.ts +46 -0
  13. package/dist/maths/geometry/line.d.ts +102 -0
  14. package/dist/maths/geometry/point.d.ts +36 -0
  15. package/dist/maths/geometry/triangle.d.ts +92 -0
  16. package/dist/maths/geometry/vector.d.ts +38 -0
  17. package/dist/maths/numeric.d.ts +28 -0
  18. package/dist/maths/numexp.d.ts +19 -0
  19. package/dist/maths/randomization/random.d.ts +26 -0
  20. package/dist/maths/randomization/randomCore.d.ts +7 -0
  21. package/dist/maths/randomization/rndFraction.d.ts +13 -0
  22. package/dist/maths/randomization/rndGeometryCircle.d.ts +13 -0
  23. package/dist/maths/randomization/rndGeometryLine.d.ts +13 -0
  24. package/dist/maths/randomization/rndGeometryPoint.d.ts +13 -0
  25. package/dist/maths/randomization/rndHelpers.d.ts +23 -0
  26. package/dist/maths/randomization/rndMonom.d.ts +13 -0
  27. package/dist/maths/randomization/rndPolynom.d.ts +14 -0
  28. package/dist/maths/randomization/rndTypes.d.ts +40 -0
  29. package/dist/maths/shutingyard.d.ts +59 -0
  30. package/dist/pimath.js +85 -85
  31. package/package.json +10 -12
  32. package/.eslintrc.js +0 -24
  33. package/.idea/$CACHE_FILE$ +0 -6
  34. package/.idea/PI.iml +0 -14
  35. package/.idea/codeStyles/codeStyleConfig.xml +0 -5
  36. package/.idea/inspectionProfiles/Project_Default.xml +0 -6
  37. package/.idea/jsLibraryMappings.xml +0 -6
  38. package/.idea/misc.xml +0 -6
  39. package/.idea/modules.xml +0 -8
  40. package/.idea/php.xml +0 -19
  41. package/.idea/shelf/Uncommitted_changes_before_Checkout_at_07_11_2023_08_30_[Default_Changelist]/shelved.patch +0 -192
  42. package/.idea/shelf/Uncommitted_changes_before_Checkout_at_07_11_2023_08_30_[Default_Changelist]1/shelved.patch +0 -0
  43. package/.idea/shelf/Uncommitted_changes_before_Checkout_at_07_11_2023_08_30__Default_Changelist_.xml +0 -4
  44. package/.idea/shelf/Uncommitted_changes_before_Checkout_at_09_11_2023_10_43_[Default_Changelist]/shelved.patch +0 -2404
  45. package/.idea/shelf/Uncommitted_changes_before_Checkout_at_09_11_2023_10_43__Default_Changelist_.xml +0 -4
  46. package/.idea/shelf/Uncommitted_changes_before_Checkout_at_09_11_2023_11_01_[Default_Changelist]/shelved.patch +0 -1362
  47. package/.idea/shelf/Uncommitted_changes_before_Checkout_at_09_11_2023_11_01__Default_Changelist_.xml +0 -4
  48. package/.idea/shelf/Uncommitted_changes_before_Update_at_24_07_2023_15_31_[Default_Changelist]/shelved.patch +0 -90
  49. package/.idea/shelf/Uncommitted_changes_before_Update_at_24_07_2023_15_31__Default_Changelist_.xml +0 -4
  50. package/.idea/vcs.xml +0 -6
  51. package/dist/demo/exercises.html +0 -283
  52. package/dist/demo/matrices.html +0 -39
  53. package/dist/demo/playground.html +0 -20
  54. package/dist/demo.css +0 -3
  55. package/dist/pimath.umd.cjs +0 -15
  56. package/docs/.nojekyll +0 -1
  57. package/docs/assets/highlight.css +0 -78
  58. package/docs/assets/main.js +0 -59
  59. package/docs/assets/navigation.js +0 -1
  60. package/docs/assets/search.js +0 -1
  61. package/docs/assets/style.css +0 -1383
  62. package/docs/classes/Logicalset.Logicalset.html +0 -217
  63. package/docs/classes/Polynom.Rational.html +0 -397
  64. package/docs/classes/Vector-1.Vector.html +0 -490
  65. package/docs/classes/Vector.Point.html +0 -337
  66. package/docs/classes/algebra_equation.Equation.html +0 -790
  67. package/docs/classes/algebra_linearSystem.LinearSystem.html +0 -404
  68. package/docs/classes/algebra_monom.Monom.html +0 -962
  69. package/docs/classes/algebra_polynom.Polynom.html +0 -1275
  70. package/docs/classes/coefficients_fraction.Fraction.html +0 -934
  71. package/docs/classes/geometry_circle.Circle.html +0 -472
  72. package/docs/classes/geometry_line.Line.html +0 -774
  73. package/docs/classes/geometry_triangle.Triangle.html +0 -429
  74. package/docs/classes/numeric.Numeric.html +0 -265
  75. package/docs/classes/shutingyard.Shutingyard.html +0 -250
  76. package/docs/enums/algebra_equation.PARTICULAR_SOLUTION.html +0 -83
  77. package/docs/enums/geometry_line.LinePropriety.html +0 -97
  78. package/docs/enums/shutingyard.ShutingyardMode.html +0 -97
  79. package/docs/enums/shutingyard.ShutingyardType.html +0 -111
  80. package/docs/index.html +0 -63
  81. package/docs/interfaces/algebra_equation.ISolution.html +0 -105
  82. package/docs/interfaces/algebra_polynom.IEuclidian.html +0 -87
  83. package/docs/interfaces/geometry_triangle.remarquableLines.html +0 -163
  84. package/docs/modules/Logicalset.html +0 -65
  85. package/docs/modules/Polynom.html +0 -65
  86. package/docs/modules/Vector-1.html +0 -65
  87. package/docs/modules/Vector.html +0 -65
  88. package/docs/modules/algebra_equation.html +0 -69
  89. package/docs/modules/algebra_linearSystem.html +0 -61
  90. package/docs/modules/algebra_monom.html +0 -65
  91. package/docs/modules/algebra_polynom.html +0 -69
  92. package/docs/modules/coefficients_fraction.html +0 -65
  93. package/docs/modules/geometry_circle.html +0 -61
  94. package/docs/modules/geometry_line.html +0 -65
  95. package/docs/modules/geometry_triangle.html +0 -65
  96. package/docs/modules/numeric.html +0 -61
  97. package/docs/modules/shutingyard.html +0 -75
  98. package/docs/types/algebra_monom.literalType.html +0 -61
  99. package/docs/types/algebra_polynom.PolynomParsingType.html +0 -56
  100. package/docs/types/coefficients_fraction.FractionParsingType.html +0 -56
  101. package/docs/types/shutingyard.Token.html +0 -63
  102. package/docs/types/shutingyard.tokenType.html +0 -68
  103. package/docs/variables/shutingyard.tokenConstant.html +0 -61
  104. package/index.html +0 -15
  105. package/public/demo/exercises.html +0 -283
  106. package/public/demo/matrices.html +0 -39
  107. package/public/demo/playground.html +0 -20
  108. package/public/demo.css +0 -3
  109. package/src/demo/exercises.ts +0 -0
  110. package/src/demo/matrices.ts +0 -61
  111. package/src/demo/playground.ts +0 -153
  112. package/src/main.ts +0 -42
  113. package/src/maths/algebra/equation.ts +0 -897
  114. package/src/maths/algebra/linearSystem.ts +0 -370
  115. package/src/maths/algebra/logicalset.ts +0 -183
  116. package/src/maths/algebra/monom.ts +0 -1028
  117. package/src/maths/algebra/polynom.ts +0 -1537
  118. package/src/maths/algebra/rational.ts +0 -244
  119. package/src/maths/algebra/study/rationalStudy.ts +0 -287
  120. package/src/maths/algebra/study.ts +0 -506
  121. package/src/maths/coefficients/fraction.ts +0 -593
  122. package/src/maths/coefficients/nthRoot.ts +0 -148
  123. package/src/maths/geometry/circle.ts +0 -382
  124. package/src/maths/geometry/line.ts +0 -604
  125. package/src/maths/geometry/point.ts +0 -215
  126. package/src/maths/geometry/triangle.ts +0 -368
  127. package/src/maths/geometry/vector.ts +0 -242
  128. package/src/maths/numeric.ts +0 -162
  129. package/src/maths/numexp.ts +0 -184
  130. package/src/maths/randomization/random.ts +0 -80
  131. package/src/maths/randomization/randomCore.ts +0 -19
  132. package/src/maths/randomization/rndFraction.ts +0 -47
  133. package/src/maths/randomization/rndGeometryCircle.ts +0 -50
  134. package/src/maths/randomization/rndGeometryLine.ts +0 -53
  135. package/src/maths/randomization/rndGeometryPoint.ts +0 -69
  136. package/src/maths/randomization/rndHelpers.ts +0 -107
  137. package/src/maths/randomization/rndMonom.ts +0 -57
  138. package/src/maths/randomization/rndPolynom.ts +0 -90
  139. package/src/maths/randomization/rndTypes.ts +0 -43
  140. package/src/maths/shutingyard.ts +0 -496
  141. package/tests/algebra/equation.test.ts +0 -64
  142. package/tests/algebra/linear.test.ts +0 -58
  143. package/tests/algebra/monom.test.ts +0 -78
  144. package/tests/algebra/polynom.test.ts +0 -343
  145. package/tests/algebra/rationnal.test.ts +0 -64
  146. package/tests/algebra/study.test.ts +0 -48
  147. package/tests/coefficients/fraction.test.ts +0 -131
  148. package/tests/custom.test.ts +0 -33
  149. package/tests/geometry/circle.test.ts +0 -404
  150. package/tests/geometry/line.test.ts +0 -36
  151. package/tests/numeric.test.ts +0 -43
  152. package/tests/numexp.test.ts +0 -89
  153. package/tests/shutingyard.test.ts +0 -58
  154. package/tsconfig.json +0 -52
  155. package/tsconfig.testing.json +0 -28
  156. package/typedoc.katex.js +0 -11
  157. package/vite.config.js +0 -23
  158. package/webpack-production-min.config.js +0 -26
  159. package/webpack-production.config.js +0 -26
  160. package/webpack.config.js +0 -26
@@ -1,4 +0,0 @@
1
- <changelist name="Uncommitted_changes_before_Checkout_at_09_11_2023_11_01_[Default_Changelist]" date="1699524101881" recycled="false" toDelete="true">
2
- <option name="PATH" value="$PROJECT_DIR$/.idea/shelf/Uncommitted_changes_before_Checkout_at_09_11_2023_11_01_[Default_Changelist]/shelved.patch" />
3
- <option name="DESCRIPTION" value="Uncommitted changes before Checkout at 09.11.2023 11:01 [Default Changelist]" />
4
- </changelist>
@@ -1,90 +0,0 @@
1
- Index: src/maths/expressions/numexp.ts
2
- IDEA additional info:
3
- Subsystem: com.intellij.openapi.diff.impl.patch.BaseRevisionTextPatchEP
4
- <+>import {Shutingyard, ShutingyardMode, ShutingyardType, tokenConstant} from \"../shutingyard\";\r\nimport {Fraction} from \"../coefficients/fraction\";\r\n\r\nexport class NumExp {\r\n private _rpn: { token: string, tokenType: string }[]\r\n private _expression: string\r\n private _isValid: boolean\r\n\r\n constructor(value: string, uniformize?:boolean) {\r\n this._expression = value\r\n try {\r\n this._rpn = new Shutingyard(ShutingyardMode.NUMERIC).parse(value, uniformize || uniformize===undefined).rpn\r\n }catch(e){\r\n this._rpn = null\r\n this._isValid = false\r\n }\r\n }\r\n\r\n get rpn(): { token: string; tokenType: string }[] {\r\n return this._rpn;\r\n }\r\n\r\n get isValid(): boolean {\r\n if(this._isValid===undefined){\r\n try {\r\n const v = this.evaluate({x: 0})\r\n }catch{\r\n this._isValid = false\r\n }\r\n }\r\n return this._isValid\r\n }\r\n\r\n set isValid(value: boolean){\r\n this._isValid = value\r\n }\r\n\r\n get expression(): string {\r\n return this._expression;\r\n }\r\n\r\n private _extractDecimalPart(value: number): string {\r\n let decimal = value.toString()\r\n\r\n if (!decimal.includes('.')) {\r\n return ''\r\n }\r\n\r\n decimal = decimal.split('.')[1]\r\n\r\n return decimal.substring(0, decimal.length - 2)\r\n }\r\n\r\n private _numberCorrection(value: number): number {\r\n // Must modify the number if it's like:\r\n // a: 3.0000000000000003\r\n // b: 3.9999999999999994\r\n // remove the last character\r\n // check if around n last characters are either 0 or 9\r\n // if it is, 'round' the number.\r\n\r\n const epsilon = 0.00000000000001,\r\n number_of_digits = 6\r\n\r\n const decimal = this._extractDecimalPart(value)\r\n if(decimal===''){return value}\r\n\r\n const n9 = decimal.match(/9+$/g)\r\n const n0 = decimal.match(/0+$/g)\r\n\r\n if (n9 && n9[0].length >= number_of_digits) {\r\n // New tested values.\r\n const mod = this._extractDecimalPart(value + epsilon),\r\n mod0 = mod.match(/0+$/g)\r\n\r\n if(mod0 && mod0[0].length>= number_of_digits){\r\n // The value can be changed. Remove all zeros!\r\n return +((value+epsilon).toString().split(mod0[0])[0])\r\n }\r\n }\r\n\r\n if (n0 && n0[0].length >= number_of_digits) {\r\n // New tested values.\r\n const mod = this._extractDecimalPart(value - epsilon),\r\n mod9 = mod.match(/9+$/g)\r\n\r\n if(mod9 && mod9[0].length>= number_of_digits){\r\n // The value can be changed. Remove all nines!\r\n return +(value.toString().split(n0[0])[0])\r\n }\r\n }\r\n\r\n return value\r\n }\r\n\r\n private _addToStack(stack:number[], value: number): void {\r\n stack.push(this._numberCorrection(value))\r\n }\r\n\r\n evaluate(values: { [Key: string]: number }): number {\r\n const stack: number[] = []\r\n\r\n if(this._rpn===null){\r\n this._isValid = false\r\n return 0\r\n }\r\n\r\n this.isValid = true\r\n\r\n for (const element of this._rpn) {\r\n if (element.tokenType === ShutingyardType.COEFFICIENT) {\r\n // May be a numeric value or a Fraction.\r\n if (!isNaN(+element.token)) {\r\n this._addToStack(stack, +element.token)\r\n } else {\r\n this._addToStack(stack, new Fraction(element.token).value)\r\n }\r\n } else if (element.tokenType === ShutingyardType.VARIABLE) {\r\n if (values[element.token] !== undefined) {\r\n this._addToStack(stack, +values[element.token])\r\n }\r\n } else if (element.tokenType === ShutingyardType.CONSTANT) {\r\n this._addToStack(stack, tokenConstant[element.token])\r\n } else if (element.tokenType === ShutingyardType.OPERATION) {\r\n if (element.token === '*') {\r\n const b = stack.pop(),\r\n a = stack.pop()\r\n if(a === undefined || b === undefined){this.isValid = false}\r\n this._addToStack(stack, a * b)\r\n } else if (element.token === '/') {\r\n const b = stack.pop(),\r\n a = stack.pop()\r\n if(a === undefined || b === undefined){this.isValid = false}\r\n this._addToStack(stack, a / b)\r\n } else if (element.token === '+') {\r\n const b = stack.pop(),\r\n a = stack.pop()\r\n if(a === undefined || b === undefined){this.isValid = false}\r\n this._addToStack(stack, (+a) + (+b))\r\n } else if (element.token === '-') {\r\n const b = stack.pop(),\r\n a = stack.pop() || 0\r\n if(b === undefined){this.isValid = false}\r\n this._addToStack(stack, a - b)\r\n } else if (element.token === '^') {\r\n const b = stack.pop(),\r\n a = stack.pop()\r\n if(a === undefined || b === undefined){this.isValid = false}\r\n this._addToStack(stack, Math.pow(a, b))\r\n }\r\n } else if (element.tokenType === ShutingyardType.FUNCTION) {\r\n const a = stack.pop()\r\n if(a === undefined){this.isValid = false}\r\n if (element.token === 'sin') {\r\n this._addToStack(stack, Math.sin(a))\r\n } else if (element.token === 'cos') {\r\n this._addToStack(stack, Math.cos(a))\r\n } else if (element.token === 'tan') {\r\n this._addToStack(stack, Math.tan(a))\r\n } else if(element.token === 'sqrt') {\r\n this._addToStack(stack, Math.sqrt(a))\r\n }else if(element.token ==='nthrt') {\r\n // TODO: support nthrt in num. exp.\r\n let b = stack.pop()\r\n if(a%2===0 && b<0){\r\n this._addToStack(stack, NaN)\r\n }else {\r\n this._addToStack(stack, (b < 0 ? -1 : 1) * Math.pow(Math.abs(b), 1 / a))\r\n }\r\n } else if(element.token === 'ln'){\r\n this._addToStack(stack, Math.log(a))\r\n } else if(element.token === 'log') {\r\n this._addToStack(stack, Math.log10(a))\r\n }\r\n }\r\n }\r\n\r\n if (stack.length === 1) {\r\n return stack[0]\r\n } else {\r\n throw `There was a problem parsing: ${this._expression}`\r\n }\r\n }\r\n}\r\n
5
- ===================================================================
6
- diff --git a/src/maths/expressions/numexp.ts b/src/maths/expressions/numexp.ts
7
- --- a/src/maths/expressions/numexp.ts
8
- +++ b/src/maths/expressions/numexp.ts
9
- @@ -51,46 +51,47 @@
10
- return decimal.substring(0, decimal.length - 2)
11
- }
12
-
13
- - private _numberCorrection(value: number): number {
14
- + private _numberCorrection(value: number, number_of_digits=6): number {
15
- + return +value.toFixed(number_of_digits);
16
- // Must modify the number if it's like:
17
- // a: 3.0000000000000003
18
- // b: 3.9999999999999994
19
- // remove the last character
20
- // check if around n last characters are either 0 or 9
21
- // if it is, 'round' the number.
22
- -
23
- - const epsilon = 0.00000000000001,
24
- - number_of_digits = 6
25
- -
26
- - const decimal = this._extractDecimalPart(value)
27
- - if(decimal===''){return value}
28
- -
29
- - const n9 = decimal.match(/9+$/g)
30
- - const n0 = decimal.match(/0+$/g)
31
- -
32
- - if (n9 && n9[0].length >= number_of_digits) {
33
- - // New tested values.
34
- - const mod = this._extractDecimalPart(value + epsilon),
35
- - mod0 = mod.match(/0+$/g)
36
- -
37
- - if(mod0 && mod0[0].length>= number_of_digits){
38
- - // The value can be changed. Remove all zeros!
39
- - return +((value+epsilon).toString().split(mod0[0])[0])
40
- - }
41
- - }
42
- -
43
- - if (n0 && n0[0].length >= number_of_digits) {
44
- - // New tested values.
45
- - const mod = this._extractDecimalPart(value - epsilon),
46
- - mod9 = mod.match(/9+$/g)
47
- -
48
- - if(mod9 && mod9[0].length>= number_of_digits){
49
- - // The value can be changed. Remove all nines!
50
- - return +(value.toString().split(n0[0])[0])
51
- - }
52
- - }
53
- -
54
- - return value
55
- + //
56
- + // const epsilon = 0.00000000000001,
57
- + // number_of_digits = 6
58
- + //
59
- + // const decimal = this._extractDecimalPart(value)
60
- + // if(decimal===''){return value}
61
- + //
62
- + // const n9 = decimal.match(/9+$/g)
63
- + // const n0 = decimal.match(/0+$/g)
64
- + //
65
- + // if (n9 && n9[0].length >= number_of_digits) {
66
- + // // New tested values.
67
- + // const mod = this._extractDecimalPart(value + epsilon),
68
- + // mod0 = mod.match(/0+$/g)
69
- + //
70
- + // if(mod0 && mod0[0].length>= number_of_digits){
71
- + // // The value can be changed. Remove all zeros!
72
- + // return +((value+epsilon).toString().split(mod0[0])[0])
73
- + // }
74
- + // }
75
- + //
76
- + // if (n0 && n0[0].length >= number_of_digits) {
77
- + // // New tested values.
78
- + // const mod = this._extractDecimalPart(value - epsilon),
79
- + // mod9 = mod.match(/9+$/g)
80
- + //
81
- + // if(mod9 && mod9[0].length>= number_of_digits){
82
- + // // The value can be changed. Remove all nines!
83
- + // return +(value.toString().split(n0[0])[0])
84
- + // }
85
- + // }
86
- + //
87
- + // return value
88
- }
89
-
90
- private _addToStack(stack:number[], value: number): void {
@@ -1,4 +0,0 @@
1
- <changelist name="Uncommitted_changes_before_Update_at_24_07_2023_15_31_[Default_Changelist]" date="1690205520775" recycled="false" toDelete="true">
2
- <option name="PATH" value="$PROJECT_DIR$/.idea/shelf/Uncommitted_changes_before_Update_at_24_07_2023_15_31_[Default_Changelist]/shelved.patch" />
3
- <option name="DESCRIPTION" value="Uncommitted changes before Update at 24.07.2023 15:31 [Default Changelist]" />
4
- </changelist>
package/.idea/vcs.xml DELETED
@@ -1,6 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <project version="4">
3
- <component name="VcsDirectoryMappings">
4
- <mapping directory="$PROJECT_DIR$" vcs="Git" />
5
- </component>
6
- </project>
@@ -1,283 +0,0 @@
1
- <!DOCTYPE html>
2
- <html lang="fr">
3
-
4
- <head>
5
- <meta charset="utf-8">
6
- <meta name="viewport" content="width=device-width, initial-scale=1">
7
- <title>Getting Started</title>
8
-
9
- <script src="../../dist/pimath.js"></script>
10
-
11
- <!-- Alpine -->
12
- <script src="//unpkg.com/alpinejs" defer></script>
13
-
14
-
15
- <!-- KaTeX -->
16
- <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/katex@0.15.1/dist/katex.min.css"
17
- integrity="sha384-R4558gYOUz8mP9YWpZJjofhk+zx0AS11p36HnD2ZKj/6JR5z27gSSULCNHIRReVs" crossorigin="anonymous">
18
-
19
- <!-- The loading of KaTeX is deferred to speed up page rendering -->
20
- <script src="https://cdn.jsdelivr.net/npm/katex@0.15.1/dist/katex.min.js"
21
- integrity="sha384-z1fJDqw8ZApjGO3/unPWUPsIymfsJmyrDVWC8Tv/a1HeOtGmkwNd/7xUS0Xcnvsx"
22
- crossorigin="anonymous"></script>
23
-
24
- <!-- To automatically render math in text elements, include the auto-render extension: -->
25
- <script src="https://cdn.jsdelivr.net/npm/katex@0.15.1/dist/contrib/auto-render.min.js"
26
- integrity="sha384-+XBljXPPiv+OzfbB3cVmLHf4hdUFHlWNZN5spNQ7rmHTXpd7WvJum6fIACpNNfIR" crossorigin="anonymous"
27
- onload="renderMathInElement(document.body);"></script>
28
-
29
- <link href="../demo.css" rel="stylesheet">
30
- </head>
31
-
32
- <body>
33
-
34
- <div x-data="dev()">
35
- <template x-for="(item, index) of output" :key="index">
36
- <div class="katex-left" x-html="`\\[${item}\\]`"></div>
37
- </template>
38
- </div>
39
-
40
- <div x-data="triplets">
41
- <template x-for="(item, index) of tripletsPytha" :key="index">
42
- <div x-text="item.join(',')"></div>
43
- </template>
44
- </div>
45
- <script>
46
- function triplets() {
47
- let triplets = []
48
- let n = 9, v
49
-
50
- for (let u = 2; u <= n; u++) {
51
- v = (u % 2 === 0) ? 1 : 2
52
- while (v < u) {
53
- if (PiMath.Numeric.gcd(u, v) === 1) {
54
- triplets.push([
55
- u, v,
56
- u ** 2 - v ** 2,
57
- 2 * u * v,
58
- u ** 2 + v ** 2
59
- ])
60
- }
61
- v = v + 2
62
- }
63
- }
64
-
65
- let target = 13
66
- // Filtrer les triplets pour n'avoir que les valeurs 15.
67
- triplets = triplets.filter(x => x[x.length - 1] === target)
68
-
69
-
70
- // méthode inverse, à partir du triplet.
71
- triplets = []
72
- for (let u = 0; u <= target; u++) {
73
- for (let v = 0; v <= target; v++) {
74
- if (u ** 2 + v ** 2 === target ** 2) {
75
- triplets.push([u, v, target])
76
- }
77
- }
78
- }
79
-
80
- return {
81
- tripletsPytha: triplets
82
- }
83
- }
84
-
85
-
86
- function example() {
87
- let P = new PiMath.Polynom('3x^(2/3)-5x+5/3')
88
-
89
- console.log(P.tex)
90
-
91
- return {
92
- tex: katex.renderToString(P.tex)
93
- }
94
- }
95
-
96
- function dev() {
97
- let output = []
98
-
99
- ex1()
100
- // ex1()
101
- output = [
102
- '\\text{exercice 1}',
103
- ...ex1(),
104
- '--------------',
105
- '\\text{exercice 2}',
106
- ...ex2(),
107
- '--------------',
108
- '\\text{exercice 3}',
109
- ...ex3(),
110
- '--------------',
111
- '\\text{exercice 4}',
112
- ...ex4()]
113
-
114
- return {
115
- output
116
- }
117
- }
118
-
119
- function ex1() {
120
- // EXERCICE 1
121
- let cart = [
122
- 'A',
123
- 'x^2-10x+y^2-8y+37=0',
124
- 'x^2-4x+y^2+6y+20=0',
125
- '3x^2+3y^2+18y+3=0',
126
- '4x^2-16x+8y^2-16y-10=0',
127
- 'B',
128
- 'x^2+10x+y^2-8y+32=0',
129
- '5x^2+5y^2+80y+45=0',
130
- '3x^2-9x+5y^2-10y+45=0',
131
- 'x^2-8x+y^2+4x+36=0'
132
- ], C, texData = []
133
-
134
- for (let equ of cart) {
135
- if (equ.length === 1) {
136
- texData.push(`\\text{série ${equ}}`)
137
- continue
138
- }
139
- C = new PiMath.Geometry.Circle(equ)
140
- if (C.exists) {
141
- texData.push(equ + '\\implies ' + C.tex + '\\implies C' + C.center.tex + ',\\ r=' + C.radius.tex)
142
- } else {
143
- texData.push(equ + '\\implies' + '\\text{pas un cercle}')
144
- }
145
- }
146
-
147
- return texData
148
- }
149
-
150
- function ex2() {
151
- let Center1 = new PiMath.Geometry.Point(4, -2),
152
- C1 = new PiMath.Geometry.Circle(Center1, 10, true),
153
- droites1 = [
154
- 'x+3y-8=0',
155
- 'x-6y+6=0',
156
- '2x+y-1=0',
157
- '3x-4y-36=0'
158
- ],
159
- Center2 = new PiMath.Geometry.Point(8, 6),
160
- C2 = new PiMath.Geometry.Circle(
161
- Center2,
162
- 40,
163
- true),
164
- droites2 = [
165
- 'x-3y+30=0',
166
- '4x+11y-22=0',
167
- '3x-y+8=0',
168
- '2x+y-32=0'
169
- ],
170
- d, pr, out = []
171
-
172
- out.push('\\text{série A}')
173
- out.push('(\\Gamma_1):' + C1.tex)
174
- for (let equ of droites1) {
175
- d = new PiMath.Geometry.Line(equ)
176
- pr = C1.relativePosition(d)
177
-
178
- if (pr === 0) {
179
- out.push(d.tex.canonical + '\\implies \\delta = ' + d.distanceTo(C1.center).tex + '\\implies \\text{externe}\\ ')
180
- } else if (pr === 1) {
181
- out.push(d.tex.canonical + '\\implies \\text{tangent: }' + C1.lineIntersection(d)[0].tex)
182
- } else {
183
- out.push(d.tex.canonical + '\\implies \\delta = ' + d.distanceTo(C1.center).tex + '\\implies \\text{sécant:}\\ ' + C1.lineIntersection(d).map(x => x.tex).join('\\quad'))
184
- }
185
- }
186
-
187
- out.push('\\text{série B}')
188
- out.push('(\\Gamma_2):' + C2.tex)
189
- for (let equ of droites2) {
190
- d = new PiMath.Geometry.Line(equ)
191
- pr = C2.relativePosition(d)
192
- if (pr === 0) {
193
- out.push(d.tex.canonical + '\\implies \\delta = ' + d.distanceTo(C2.center).tex + '\\implies \\text{externe}')
194
- } else if (pr === 1) {
195
- out.push(d.tex.canonical + '\\implies \\text{tangent: }' + C2.lineIntersection(d)[0].tex)
196
- } else {
197
- out.push(d.tex.canonical + '\\implies \\delta = ' + d.distanceTo(C2.center).tex + '\\implies \\text{sécant:} ' + C2.lineIntersection(d).map(x => x.tex).join('\\quad'))
198
- }
199
- }
200
-
201
- return out
202
- }
203
-
204
- function ex3() {
205
- let C = new PiMath.Geometry.Circle(
206
- new PiMath.Geometry.Point(-14, 18),
207
- new PiMath.Geometry.Point(-2, 14),
208
- new PiMath.Geometry.Point(-10, 22)
209
- ), T1 = new PiMath.Geometry.Triangle(new PiMath.Geometry.Point(-14, 18),
210
- new PiMath.Geometry.Point(-2, 14),
211
- new PiMath.Geometry.Point(-10, 22))
212
-
213
- let E = new PiMath.Geometry.Circle(
214
- new PiMath.Geometry.Point(4, 10),
215
- new PiMath.Geometry.Point(5, 5),
216
- new PiMath.Geometry.Point(9, 11)
217
- ), T2 = new PiMath.Geometry.Triangle(
218
- new PiMath.Geometry.Point(4, 10),
219
- new PiMath.Geometry.Point(5, 5),
220
- new PiMath.Geometry.Point(9, 11)
221
- )
222
-
223
- return [
224
- '\\text{2 milieux, 2 normales, 2 médiatrices, 2 intersection, 1 rayon, 1 équation}',
225
- '\\text{série A}',
226
- (new PiMath.Geometry.Point().middleOf(T2.A, T2.B)).tex + '\\quad (m_{AB}):\\ ' + T2.remarquables.mediators.AB.tex.canonical,
227
- (new PiMath.Geometry.Point().middleOf(T2.A, T2.C)).tex + '\\quad (m_{AC}):\\ ' + T2.remarquables.mediators.AC.tex.canonical,
228
- (new PiMath.Geometry.Point().middleOf(T2.C, T2.B)).tex + '\\quad (m_{BC}):\\ ' + T2.remarquables.mediators.BC.tex.canonical,
229
- E.tex,
230
- '\\text{série B}',
231
- (new PiMath.Geometry.Point().middleOf(T1.A, T1.B)).tex + '\\quad (m_{AB}):\\ ' + T1.remarquables.mediators.AB.tex.canonical,
232
- (new PiMath.Geometry.Point().middleOf(T1.A, T1.C)).tex + '\\quad (m_{AC}):\\ ' + T1.remarquables.mediators.AC.tex.canonical,
233
- (new PiMath.Geometry.Point().middleOf(T1.C, T1.B)).tex + '\\quad (m_{BC}):\\ ' + T1.remarquables.mediators.BC.tex.canonical,
234
- C.tex,
235
-
236
- ]
237
- }
238
-
239
- function ex4() {
240
- // A
241
- let A = new PiMath.Geometry.Point(-6, -9),
242
- C = new PiMath.Geometry.Circle('(x+3)^2+(y+5)^2=25'),
243
- Oy = C.cartesian.clone().replaceBy('x', new PiMath.Polynom().zero()),
244
- Ox = C.cartesian.clone().replaceBy('y', new PiMath.Polynom().zero()),
245
- t = new PiMath.Geometry.Line(
246
- A,
247
- new PiMath.Geometry.Vector(A, C.center),
248
- PiMath.Geometry.Line.PERPENDICULAR
249
- )
250
-
251
- Oy.solve()
252
- Ox.solve()
253
-
254
- // B
255
- let A1 = new PiMath.Geometry.Point(-4, -14),
256
- C1 = new PiMath.Geometry.Circle('(x-10)^2+(y+6)^2=100'),
257
- Oy1 = C1.cartesian.clone().replaceBy('x', new PiMath.Polynom().zero()),
258
- Ox1 = C1.cartesian.clone().replaceBy('y', new PiMath.Polynom().zero()),
259
- t1 = new PiMath.Geometry.Line(
260
- A1,
261
- new PiMath.Geometry.Vector(A1, C1.center),
262
- PiMath.Geometry.Line.PERPENDICULAR
263
- )
264
-
265
- Oy1.solve()
266
- Ox1.solve()
267
-
268
- return [
269
- '\\text{série A}',
270
- '(Ox):\\ ' + Ox.solutions.map(y => `(${y.value};0)`),
271
- '(Oy):\\ ' + Oy.solutions.map(x => `(0;${x.value})`),
272
- '(t):\\ ' + t.tex.canonical,
273
- '\\text{série B}',
274
- '(Ox):\\ ' + Ox1.solutions.map(y => `(${y.value};0)`),
275
- '(Oy):\\ ' + Oy1.solutions.map(x => `(0;${x.value})`),
276
- '(t):\\ ' + t1.tex.canonical
277
- ]
278
- }
279
-
280
- </script>
281
- </body>
282
-
283
- </html>
@@ -1,39 +0,0 @@
1
- <!DOCTYPE html>
2
- <html lang="fr">
3
-
4
- <head>
5
- <meta charset="utf-8">
6
- <meta content="width=device-width, initial-scale=1" name="viewport">
7
- <title>Getting Started</title>
8
-
9
- <script type="module" src="../../src/main.ts"></script>
10
-
11
- <!-- KaTeX -->
12
- <link crossorigin="anonymous" href="https://cdn.jsdelivr.net/npm/katex@0.15.1/dist/katex.min.css"
13
- integrity="sha384-R4558gYOUz8mP9YWpZJjofhk+zx0AS11p36HnD2ZKj/6JR5z27gSSULCNHIRReVs" rel="stylesheet">
14
-
15
- <!-- The loading of KaTeX is deferred to speed up page rendering -->
16
- <script crossorigin="anonymous"
17
- integrity="sha384-z1fJDqw8ZApjGO3/unPWUPsIymfsJmyrDVWC8Tv/a1HeOtGmkwNd/7xUS0Xcnvsx"
18
- src="https://cdn.jsdelivr.net/npm/katex@0.15.1/dist/katex.min.js"></script>
19
-
20
- <!-- To automatically render math in text elements, include the auto-render extension: -->
21
- <script crossorigin="anonymous"
22
- integrity="sha384-+XBljXPPiv+OzfbB3cVmLHf4hdUFHlWNZN5spNQ7rmHTXpd7WvJum6fIACpNNfIR"
23
- onload="renderMathInElement(document.body);"
24
- src="https://cdn.jsdelivr.net/npm/katex@0.15.1/dist/contrib/auto-render.min.js"></script>
25
-
26
- <link href="../demo.css" rel="stylesheet">
27
- </head>
28
-
29
- <body>
30
-
31
- <div id="app">
32
- </div>
33
-
34
- <script type="module" src="../../src/demo/matrices.ts">
35
- </script>
36
-
37
- </body>
38
-
39
- </html>
@@ -1,20 +0,0 @@
1
- <!DOCTYPE html>
2
- <html>
3
- <head>
4
- <title>Getting Started</title>
5
- <script type="module" src="../../dist/pimath.js"></script>
6
-
7
- <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/katex@0.12.0/dist/katex.min.css" integrity="sha384-AfEj0r4/OFrOo5t7NnNe46zW/tFgW6x/bCJG8FqQCEo3+Aro6EYUG4+cU+KJWu/X" crossorigin="anonymous">
8
-
9
- <!-- The loading of KaTeX is deferred to speed up page rendering -->
10
- <script src="https://cdn.jsdelivr.net/npm/katex@0.12.0/dist/katex.min.js" integrity="sha384-g7c+Jr9ZivxKLnZTDUhnkOnsh30B4H0rpLUpJ4jAIKs4fnJI+sEnkvrMWph2EDg4" crossorigin="anonymous"></script>
11
- <script src="https://cdn.jsdelivr.net/npm/katex@0.12.0/dist/contrib/auto-render.min.js" integrity="sha384-mll67QQFJfxn0IYznZYonOWZ644AWYC+Pt2cHqMaRhXVrursRwvLnLaebdGIlYNa" crossorigin="anonymous"></script>
12
- </head>
13
- <body>
14
-
15
- <div id="app"></div>
16
-
17
- <script type="module" src="../../src/demo/playground.ts">
18
- </script>
19
- </body>
20
- </html>
package/dist/demo.css DELETED
@@ -1,3 +0,0 @@
1
- .katex-left > .katex-display > .katex,.katex-left > span > .katex-display > .katex {
2
- text-align: left !important;
3
- }