ziko 0.0.12 → 0.0.13

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 (277) hide show
  1. package/dist/ziko.cjs +2896 -2290
  2. package/dist/ziko.js +2896 -2290
  3. package/dist/ziko.min.js +2 -2
  4. package/dist/ziko.mjs +2888 -2290
  5. package/package.json +39 -12
  6. package/src/__helpers__/index.js +41 -0
  7. package/src/app/accessibility/index.js +0 -0
  8. package/src/app/app.js +46 -0
  9. package/src/app/component/index.js +38 -0
  10. package/src/app/globals/index.js +20 -0
  11. package/src/app/index.js +12 -0
  12. package/src/app/params/index.js +40 -0
  13. package/src/app/router/index.js +67 -0
  14. package/src/app/seo/index.js +43 -0
  15. package/src/app/themes/dark.js +885 -0
  16. package/src/app/themes/index.js +11 -0
  17. package/src/app/themes/light.js +255 -0
  18. package/src/data/api/fetchdom.js +14 -0
  19. package/src/data/api/index.js +4 -0
  20. package/src/data/api/preload.js +11 -0
  21. package/src/data/converter/adoc.js +130 -0
  22. package/src/data/converter/array.js +43 -0
  23. package/src/data/converter/canvas.js +25 -0
  24. package/src/data/converter/csv.js +33 -0
  25. package/src/data/converter/idea.txt +10 -0
  26. package/src/data/converter/index.js +34 -0
  27. package/src/data/converter/json.js +80 -0
  28. package/src/data/converter/markdown.js +95 -0
  29. package/src/data/converter/object.js +70 -0
  30. package/src/data/converter/svg.js +11 -0
  31. package/src/data/decorators.js +0 -0
  32. package/src/data/index.js +74 -0
  33. package/src/data/parser/markdown.js +0 -0
  34. package/src/data/parser/xml.js +47 -0
  35. package/src/data/string/index.js +1 -0
  36. package/src/data/string/patterns.js +12 -0
  37. package/src/data/string/string.js +170 -0
  38. package/src/graphics/canvas/_canvas_offscreen +0 -0
  39. package/src/graphics/canvas/canvas.js +189 -0
  40. package/src/graphics/canvas/elements/Basic/arc.js +43 -0
  41. package/src/graphics/canvas/elements/Basic/image.js +0 -0
  42. package/src/graphics/canvas/elements/Basic/line.js +26 -0
  43. package/src/graphics/canvas/elements/Basic/path.js +0 -0
  44. package/src/graphics/canvas/elements/Basic/points.js +48 -0
  45. package/src/graphics/canvas/elements/Basic/polygon.js +7 -0
  46. package/src/graphics/canvas/elements/Basic/polyline.js +0 -0
  47. package/src/graphics/canvas/elements/Basic/rect.js +46 -0
  48. package/src/graphics/canvas/elements/Basic/text.js +0 -0
  49. package/src/graphics/canvas/elements/Chart/histogram.js +0 -0
  50. package/src/graphics/canvas/elements/Chart/plot.js +0 -0
  51. package/src/graphics/canvas/elements/Chart/scatter.js +2 -0
  52. package/src/graphics/canvas/elements/Chart/stem.js +0 -0
  53. package/src/graphics/canvas/elements/Element.js +115 -0
  54. package/src/graphics/canvas/elements/Groupe.js +0 -0
  55. package/src/graphics/canvas/elements/grid.js +0 -0
  56. package/src/graphics/canvas/elements/index.js +13 -0
  57. package/src/graphics/canvas/filter/index.js +0 -0
  58. package/src/graphics/canvas/index.js +15 -0
  59. package/src/graphics/canvas/paint/index.js +0 -0
  60. package/src/graphics/canvas/utils/color.js +8 -0
  61. package/src/graphics/canvas/utils/floodFill.js +58 -0
  62. package/src/graphics/index.js +69 -0
  63. package/src/graphics/svg/Elements/Basic/circle.js +26 -0
  64. package/src/graphics/svg/Elements/Basic/ellipse.js +21 -0
  65. package/src/graphics/svg/Elements/Basic/foreignObject.js +33 -0
  66. package/src/graphics/svg/Elements/Basic/groupe.js +29 -0
  67. package/src/graphics/svg/Elements/Basic/image.js +33 -0
  68. package/src/graphics/svg/Elements/Basic/line.js +29 -0
  69. package/src/graphics/svg/Elements/Basic/link.js +30 -0
  70. package/src/graphics/svg/Elements/Basic/path.js +59 -0
  71. package/src/graphics/svg/Elements/Basic/polygon.js +32 -0
  72. package/src/graphics/svg/Elements/Basic/polyline.js +4 -0
  73. package/src/graphics/svg/Elements/Basic/rect.js +43 -0
  74. package/src/graphics/svg/Elements/Basic/text.js +26 -0
  75. package/src/graphics/svg/Elements/Derived/grid.js +9 -0
  76. package/src/graphics/svg/Elements/ZikoSvgElement.js +46 -0
  77. package/src/graphics/svg/Elements/index.js +14 -0
  78. package/src/graphics/svg/index.js +2 -0
  79. package/src/graphics/svg/svg.js +115 -0
  80. package/src/index.js +88 -0
  81. package/src/math/absract.js +1 -0
  82. package/src/math/calculus/index.js +1 -0
  83. package/src/math/calculus/special-functions/bessel.js +31 -0
  84. package/src/math/calculus/special-functions/beta.js +38 -0
  85. package/src/math/calculus/special-functions/gamma.js +30 -0
  86. package/src/math/calculus/special-functions/index.js +4 -0
  87. package/src/math/complex/Fractals/julia.js +0 -0
  88. package/src/math/complex/index.js +203 -0
  89. package/src/math/const.js +3 -0
  90. package/src/math/discret/Combinaison/index.js +34 -0
  91. package/src/math/discret/Conversion/index.js +86 -0
  92. package/src/math/discret/Logic/index.js +46 -0
  93. package/src/math/discret/Permutation/index.js +31 -0
  94. package/src/math/discret/Set/index.js +2 -0
  95. package/src/math/discret/Set/power-set.js +15 -0
  96. package/src/math/discret/Set/sub-set.js +10 -0
  97. package/src/math/discret/index.js +23 -0
  98. package/src/math/functions/index.js +182 -0
  99. package/src/math/index.js +189 -0
  100. package/src/math/matrix/Decomposition.js +90 -0
  101. package/src/math/matrix/LinearSystem.js +10 -0
  102. package/src/math/matrix/Matrix.js +717 -0
  103. package/src/math/matrix/index.js +3 -0
  104. package/src/math/numeric/index.js +0 -0
  105. package/src/math/random/index.js +173 -0
  106. package/src/math/signal/__np.py.txt +40 -0
  107. package/src/math/signal/conv.js +175 -0
  108. package/src/math/signal/fft.js +55 -0
  109. package/src/math/signal/filter.js +39 -0
  110. package/src/math/signal/functions.js +146 -0
  111. package/src/math/signal/index.js +110 -0
  112. package/src/math/statistics/Functions/index.js +100 -0
  113. package/src/math/statistics/index.js +16 -0
  114. package/src/math/utils/arithmetic.js +139 -0
  115. package/src/math/utils/checkers.js +29 -0
  116. package/src/math/utils/comparaison.js +1 -0
  117. package/src/math/utils/conversions.js +19 -0
  118. package/src/math/utils/discret.js +51 -0
  119. package/src/math/utils/index.js +102 -0
  120. package/src/math/utils/mapfun.js +50 -0
  121. package/src/reactivity/events/Global/Click.js +56 -0
  122. package/src/reactivity/events/Global/Clipboard.js +84 -0
  123. package/src/reactivity/events/Global/CustomEvent.js +53 -0
  124. package/src/reactivity/events/Global/Drag.js +137 -0
  125. package/src/reactivity/events/Global/Focus.js +56 -0
  126. package/src/reactivity/events/Global/Key.js +104 -0
  127. package/src/reactivity/events/Global/Mouse.js +230 -0
  128. package/src/reactivity/events/Global/Pointer.js +234 -0
  129. package/src/reactivity/events/Global/Swipe.js +147 -0
  130. package/src/reactivity/events/Global/Touch.js +0 -0
  131. package/src/reactivity/events/Global/Wheel.js +44 -0
  132. package/src/reactivity/events/Partiel/Hash.js +44 -0
  133. package/src/reactivity/events/Partiel/Input.js +59 -0
  134. package/src/reactivity/events/Partiel/Media.js +1 -0
  135. package/src/reactivity/events/ZikoEvent.js +91 -0
  136. package/src/reactivity/events/index.js +63 -0
  137. package/src/reactivity/hooks/Contexte/index.js +1 -0
  138. package/src/reactivity/hooks/Contexte/useSuccesifKeys.js +14 -0
  139. package/src/reactivity/hooks/Decorators/index.js +6 -0
  140. package/src/reactivity/hooks/Decorators/time.js +17 -0
  141. package/src/reactivity/hooks/Decorators/type.js +88 -0
  142. package/src/reactivity/hooks/Interactions/index.js +4 -0
  143. package/src/reactivity/hooks/Interactions/useBluetooth.js +48 -0
  144. package/src/reactivity/hooks/Interactions/useChannel.js +50 -0
  145. package/src/reactivity/hooks/Interactions/useEventEmmiter.js +64 -0
  146. package/src/reactivity/hooks/Interactions/useSerial.js +0 -0
  147. package/src/reactivity/hooks/Interactions/useThread.js +44 -0
  148. package/src/reactivity/hooks/Interactions/useUsb.js +0 -0
  149. package/src/reactivity/hooks/Sensors/index.js +2 -0
  150. package/src/reactivity/hooks/Sensors/useBattery.js +36 -0
  151. package/src/reactivity/hooks/Sensors/useCamera.js +0 -0
  152. package/src/reactivity/hooks/Sensors/useGeolocation.js +17 -0
  153. package/src/reactivity/hooks/Sensors/useMicro.js +0 -0
  154. package/src/reactivity/hooks/Sensors/useOrientation.js +0 -0
  155. package/src/reactivity/hooks/Storage/index.js +1 -0
  156. package/src/reactivity/hooks/Storage/useCookie.js +0 -0
  157. package/src/reactivity/hooks/Storage/useIndexedDb.js +0 -0
  158. package/src/reactivity/hooks/Storage/useStorage.js +73 -0
  159. package/src/reactivity/hooks/UI/index.js +5 -0
  160. package/src/reactivity/hooks/UI/useCssLink.js +0 -0
  161. package/src/reactivity/hooks/UI/useCssText.js +21 -0
  162. package/src/reactivity/hooks/UI/useFavIcon.js +38 -0
  163. package/src/reactivity/hooks/UI/useLinearGradient.js +0 -0
  164. package/src/reactivity/hooks/UI/useMediaQuery.js +43 -0
  165. package/src/reactivity/hooks/UI/useRadialGradient.js +0 -0
  166. package/src/reactivity/hooks/UI/useStyle.js +79 -0
  167. package/src/reactivity/hooks/UI/useTheme.js +62 -0
  168. package/src/reactivity/hooks/UI/useTitle.js +30 -0
  169. package/src/reactivity/hooks/index.js +85 -0
  170. package/src/reactivity/hooks/todo.md +26 -0
  171. package/src/reactivity/idea +2 -0
  172. package/src/reactivity/index.js +22 -0
  173. package/src/reactivity/observer/attributes.js +28 -0
  174. package/src/reactivity/observer/children.js +37 -0
  175. package/src/reactivity/observer/index.js +44 -0
  176. package/src/reactivity/observer/intersection.js +44 -0
  177. package/src/reactivity/observer/mutation.js +113 -0
  178. package/src/reactivity/observer/resize.js +47 -0
  179. package/src/reactivity/observer/screen.js +45 -0
  180. package/src/reactivity/observer/screen.js.txt +84 -0
  181. package/src/reactivity/observer/screen.txt +13 -0
  182. package/src/time/animation.js +76 -0
  183. package/src/time/index.js +54 -0
  184. package/src/time/loop.js +87 -0
  185. package/src/time/utils/decorators.js +17 -0
  186. package/src/time/utils/ease.js +144 -0
  187. package/src/time/utils/index.js +18 -0
  188. package/src/time/utils/performance.js +16 -0
  189. package/src/time/utils/ui.js +26 -0
  190. package/src/user-interface/elements/derived/Flex.js +103 -0
  191. package/src/user-interface/elements/derived/Grid.js +33 -0
  192. package/src/user-interface/elements/derived/elements/Notification.js +0 -0
  193. package/src/user-interface/elements/derived/elements/Popover.js +0 -0
  194. package/src/user-interface/elements/derived/elements/Popup.js +0 -0
  195. package/src/user-interface/elements/derived/elements/Swipper.js +4 -0
  196. package/src/user-interface/elements/derived/elements/Timeline.js +0 -0
  197. package/src/user-interface/elements/derived/elements/Toast.js +0 -0
  198. package/src/user-interface/elements/derived/elements/Treeview.js +0 -0
  199. package/src/user-interface/elements/derived/elements/accordion/accordion.js +45 -0
  200. package/src/user-interface/elements/derived/elements/accordion/collapsible.js +82 -0
  201. package/src/user-interface/elements/derived/elements/accordion/index.js +2 -0
  202. package/src/user-interface/elements/derived/elements/alert/alert.js +80 -0
  203. package/src/user-interface/elements/derived/elements/alert/index.js +1 -0
  204. package/src/user-interface/elements/derived/elements/alert/palette.js +52 -0
  205. package/src/user-interface/elements/derived/elements/carousel/index.js +50 -0
  206. package/src/user-interface/elements/derived/elements/code-note/SubElements.js.txt +105 -0
  207. package/src/user-interface/elements/derived/elements/code-note/code-cell.js +195 -0
  208. package/src/user-interface/elements/derived/elements/code-note/code-note.js +72 -0
  209. package/src/user-interface/elements/derived/elements/code-note/index.js +2 -0
  210. package/src/user-interface/elements/derived/elements/code-note/sub-elements.js +67 -0
  211. package/src/user-interface/elements/derived/elements/columns.js +1 -0
  212. package/src/user-interface/elements/derived/elements/fab.js +0 -0
  213. package/src/user-interface/elements/derived/elements/index.js +9 -0
  214. package/src/user-interface/elements/derived/elements/menu/index.js +1 -0
  215. package/src/user-interface/elements/derived/elements/menu/menu3d.js +260 -0
  216. package/src/user-interface/elements/derived/elements/modal/index.js +92 -0
  217. package/src/user-interface/elements/derived/elements/pagination/breadcrumbs.js +54 -0
  218. package/src/user-interface/elements/derived/elements/pagination/index.js +1 -0
  219. package/src/user-interface/elements/derived/elements/splitter/__ZikoUISplitter__.js +62 -0
  220. package/src/user-interface/elements/derived/elements/splitter/hsplitter.js +40 -0
  221. package/src/user-interface/elements/derived/elements/splitter/index.js +2 -0
  222. package/src/user-interface/elements/derived/elements/splitter/vsplitter.js +40 -0
  223. package/src/user-interface/elements/derived/elements/tabs/index.js +180 -0
  224. package/src/user-interface/elements/derived/index.js +3 -0
  225. package/src/user-interface/elements/primitives/ZikoUIContainerElement.js +127 -0
  226. package/src/user-interface/elements/primitives/ZikoUIElement.js +478 -0
  227. package/src/user-interface/elements/primitives/embaded/index.js +1 -0
  228. package/src/user-interface/elements/primitives/index.js +8 -0
  229. package/src/user-interface/elements/primitives/io/Form/index.js +42 -0
  230. package/src/user-interface/elements/primitives/io/Form/index.js.txt +104 -0
  231. package/src/user-interface/elements/primitives/io/Inputs/__helpers__.js +52 -0
  232. package/src/user-interface/elements/primitives/io/Inputs/index.js +12 -0
  233. package/src/user-interface/elements/primitives/io/Inputs/input/index.js +98 -0
  234. package/src/user-interface/elements/primitives/io/Inputs/input-camera/index.js +26 -0
  235. package/src/user-interface/elements/primitives/io/Inputs/input-checkbox/index.js +26 -0
  236. package/src/user-interface/elements/primitives/io/Inputs/input-color/index.js +16 -0
  237. package/src/user-interface/elements/primitives/io/Inputs/input-date-time/index.js +3 -0
  238. package/src/user-interface/elements/primitives/io/Inputs/input-date-time/input-date-time.js +14 -0
  239. package/src/user-interface/elements/primitives/io/Inputs/input-date-time/input-date.js +14 -0
  240. package/src/user-interface/elements/primitives/io/Inputs/input-date-time/input-time.js +14 -0
  241. package/src/user-interface/elements/primitives/io/Inputs/input-email-password/index.js +2 -0
  242. package/src/user-interface/elements/primitives/io/Inputs/input-email-password/input-email.js +15 -0
  243. package/src/user-interface/elements/primitives/io/Inputs/input-email-password/input-password.js +14 -0
  244. package/src/user-interface/elements/primitives/io/Inputs/input-file/index.js +1 -0
  245. package/src/user-interface/elements/primitives/io/Inputs/input-file/input-file.js +0 -0
  246. package/src/user-interface/elements/primitives/io/Inputs/input-file/input-image.js +43 -0
  247. package/src/user-interface/elements/primitives/io/Inputs/input-number/index.js +37 -0
  248. package/src/user-interface/elements/primitives/io/Inputs/input-radio/index.js +26 -0
  249. package/src/user-interface/elements/primitives/io/Inputs/input-search/index.js +45 -0
  250. package/src/user-interface/elements/primitives/io/Inputs/input-slider/index.js +34 -0
  251. package/src/user-interface/elements/primitives/io/Select/index.js +20 -0
  252. package/src/user-interface/elements/primitives/io/Textarea/index.js +18 -0
  253. package/src/user-interface/elements/primitives/io/index.js +4 -0
  254. package/src/user-interface/elements/primitives/list/elements.js +0 -0
  255. package/src/user-interface/elements/primitives/list/index.js +139 -0
  256. package/src/user-interface/elements/primitives/media/Audio/index.js +17 -0
  257. package/src/user-interface/elements/primitives/media/Image/figure.js +19 -0
  258. package/src/user-interface/elements/primitives/media/Image/image.js +36 -0
  259. package/src/user-interface/elements/primitives/media/Image/index.js +2 -0
  260. package/src/user-interface/elements/primitives/media/Video/index.js +27 -0
  261. package/src/user-interface/elements/primitives/media/__ZikoUIDynamicMediaELement__.js +47 -0
  262. package/src/user-interface/elements/primitives/media/index.js +3 -0
  263. package/src/user-interface/elements/primitives/misc/index.js +99 -0
  264. package/src/user-interface/elements/primitives/semantic/index.js +82 -0
  265. package/src/user-interface/elements/primitives/table/elements.js +94 -0
  266. package/src/user-interface/elements/primitives/table/index.js +3 -0
  267. package/src/user-interface/elements/primitives/table/table.js +115 -0
  268. package/src/user-interface/elements/primitives/table/utils.js +12 -0
  269. package/src/user-interface/elements/primitives/text/__ZikoUIText__.js +71 -0
  270. package/src/user-interface/elements/primitives/text/heading.js +36 -0
  271. package/src/user-interface/elements/primitives/text/index.js +3 -0
  272. package/src/user-interface/elements/primitives/text/p.js +26 -0
  273. package/src/user-interface/elements/primitives/text/pre.js +0 -0
  274. package/src/user-interface/elements/primitives/text/text.js +81 -0
  275. package/src/user-interface/index.js +188 -0
  276. package/src/user-interface/style/index.js +510 -0
  277. package/src/user-interface/utils/index.js +70 -0
@@ -0,0 +1,203 @@
1
+ import ZikoMath from "../absract.js";
2
+ import{
3
+ cos,
4
+ sin,
5
+ tan,
6
+ pow,
7
+ floor,
8
+ hypot,
9
+ cosh,
10
+ sinh,
11
+ sqrtn,
12
+ atan2,
13
+ sqrt,
14
+ ln
15
+ }from "../functions/index.js"
16
+ import { Matrix } from "../matrix/index.js";
17
+ import {sum,prod,deg2rad} from "../utils/index.js";
18
+ class Complex extends ZikoMath{
19
+ constructor(a = 0, b = 0) {
20
+ super()
21
+ if(a instanceof Complex){
22
+ this.a=a.a;
23
+ this.b=a.b;
24
+ }
25
+ else if(typeof(a)==="object"){
26
+ if(("a" in b && "b" in a)){
27
+ this.a=a.a;
28
+ this.b=a.b;
29
+ }
30
+ else if(("a" in b && "z" in a)){
31
+ this.a=a.a;
32
+ this.b=sqrt((a.z**2)-(a.a**2));
33
+ }
34
+ else if(("a" in b && "phi" in a)){
35
+ this.a=a.a;
36
+ this.b=a.a*tan(a.phi);
37
+ }
38
+ else if(("b" in b && "z" in a)){
39
+ this.b=a.b;
40
+ this.a=sqrt((a.z**2)-(a.b**2));
41
+ }
42
+ else if(("b" in b && "phi" in a)){
43
+ this.b=b;
44
+ this.a=a.b/tan(a.phi);
45
+ }
46
+ else if(("z" in b && "phi" in a)){
47
+ this.a=a.z*cos(a.phi);
48
+ this.a=a.z*sin(a.phi);
49
+ }
50
+ }
51
+ else if(typeof(a)==="number"&&typeof(b)==="number"){
52
+ this.a = +a.toFixed(32);
53
+ this.b = +b.toFixed(32);
54
+ }
55
+ }
56
+ toString(){
57
+ let str = "";
58
+ if (this.a !== 0)
59
+ this.b >= 0
60
+ ? (str = `${this.a}+${this.b}*i`)
61
+ : (str = `${this.a}-${Math.abs(this.b)}*i`);
62
+ else
63
+ this.b >= 0
64
+ ? (str = `${this.b}*i`)
65
+ : (str = `-${Math.abs(this.b)}*i`);
66
+ return str;
67
+ }
68
+
69
+ get clone() {
70
+ return new Complex(this.a, this.b);
71
+ }
72
+ get z(){
73
+ return hypot(this.a,this.b);
74
+ }
75
+ get phi(){
76
+ return atan2(this.b , this.a);
77
+ }
78
+ static Zero() {
79
+ return new Complex(0, 0);
80
+ }
81
+ get conj() {
82
+ return new Complex(this.a, -this.b);
83
+ }
84
+ get inv() {
85
+ return new Complex(this.a / (pow(this.a, 2) + pow(this.b, 2)), -this.b / (pow(this.a, 2) + pow(this.b, 2)));
86
+ }
87
+ add(...z) {
88
+ for (let i = 0; i < z.length; i++) {
89
+ if (typeof z[i] === "number") z[i] = new Complex(z[i], 0);
90
+ }
91
+ let re = z.map((n) => n.a);
92
+ let im = z.map((n) => n.b);
93
+ this.a+=+sum(...re).toFixed(15);
94
+ this.b+=+sum(...im).toFixed(15);
95
+ return this;
96
+ }
97
+ sub(...z) {
98
+ for (let i = 0; i < z.length; i++) {
99
+ if (typeof z[i] === "number") z[i] = new Complex(z[i], 0);
100
+ }
101
+ let re = z.map((n) => n.a);
102
+ let im = z.map((n) => n.b);
103
+ this.a-=+sum(...re).toFixed(15);
104
+ this.b-=+sum(...im).toFixed(15);
105
+ return this;
106
+ }
107
+ mul(...z){
108
+ for (let i = 0; i < z.length; i++) {
109
+ if (typeof z[i] === "number") z[i] = new Complex(z[i], 0);
110
+ }
111
+ let Z=+prod(this.z,...z.map(n=>n.z)).toFixed(15);
112
+ let phi=+sum(this.phi,...z.map(n=>n.phi)).toFixed(15);
113
+ this.a=+(Z*cos(phi).toFixed(15)).toFixed(14);
114
+ this.b=+(Z*sin(phi).toFixed(15)).toFixed(14);
115
+ return this;
116
+ }
117
+ div(...z) {
118
+ for (let i = 0; i < z.length; i++) {
119
+ if (typeof z[i] === "number") z[i] = new Complex(z[i], 0);
120
+ }
121
+ let Z=+(this.z/prod(...z.map(n=>n.z))).toFixed(15);
122
+ let phi=+(this.phi-sum(...z.map(n=>n.phi))).toFixed(15);
123
+ this.a=+(Z*cos(phi).toFixed(15)).toFixed(15);
124
+ this.b=+(Z*sin(phi).toFixed(15)).toFixed(15);
125
+ return this;
126
+ }
127
+ pow(n) {
128
+ if (floor(n) === n && n > 0) {
129
+ let z=+(this.z**n).toFixed(15);
130
+ let phi=+(this.phi*n).toFixed(15);
131
+ this.a=+(z*cos(phi).toFixed(15)).toFixed(15);
132
+ this.b=+(z*sin(phi).toFixed(15)).toFixed(15);
133
+ }
134
+ return this;
135
+ }
136
+ static fromExpo(z, phi) {
137
+ return new Complex(
138
+ +(z * cos(phi)).toFixed(13),
139
+ +(z * sin(phi)).toFixed(13)
140
+ );
141
+ }
142
+ get expo() {
143
+ return [this.z, this.phi];
144
+ }
145
+ static add(c,...z) {
146
+ return c.clone.add(...z);
147
+ }
148
+ static sub(c,...z) {
149
+ return c.clone.sub(...z);
150
+ }
151
+ static mul(c,...z) {
152
+ return c.clone.mul(...z);
153
+ }
154
+ static div(c,...z) {
155
+ return c.clone.div(...z);
156
+ }
157
+ static pow(z,n){
158
+ return z.clone.pow(n);
159
+ }
160
+ static xpowZ(x){
161
+ return complex((x**this.a)*cos(this.b*ln(x)),(x**this.a)*sin(this.b*ln(x)));
162
+ }
163
+ sqrtn(n=2){
164
+ return complex(sqrtn(this.z,n)*cos(this.phi/n),sqrtn(this.z,n)*sin(this.phi/n));
165
+ }
166
+ get sqrt(){
167
+ return this.sqrtn(2);
168
+ }
169
+ get log(){
170
+ return complex(this.z,this.phi);
171
+ }
172
+ get cos(){
173
+ return complex(cos(this.a)*cosh(this.b),sin(this.a)*sinh(this.b))
174
+ }
175
+ get sin(){
176
+ return complex(sin(this.a)*cosh(this.b),cos(this.a)*sinh(this.b))
177
+ }
178
+ get tan(){
179
+ const de=cos(this.a*2)+cosh(this.b*2);
180
+ return complex(sin(2*this.a)/de,sinh(2*this.b)/de);
181
+ }
182
+ printInConsole() {
183
+ let string = this.a + " + " + this.b + " * i";
184
+ console.log(string);
185
+ return string;
186
+ }
187
+ print() {
188
+ //return text(this.a + " + i * " + this.b);
189
+ }
190
+ UI() {
191
+ return "<span>" + this.a + " + i * " + this.b + "</span>";
192
+ }
193
+ }
194
+ const complex=(a,b)=>{
195
+ if((a instanceof Array||ArrayBuffer.isView(a)) && (b instanceof Array||ArrayBuffer.isView(a)))return a.map((n,i)=>complex(a[i],b[i]));
196
+ if(a instanceof Matrix && b instanceof Matrix){
197
+ if((a.shape[0]!==b.shape[0])||(a.shape[1]!==b.shape[1]))return Error(0)
198
+ const arr=a.arr.map((n,i)=>complex(a.arr[i],b.arr[i]))
199
+ return new Matrix(a.rows,a.cols,...arr)
200
+ }
201
+ return new Complex(a,b)
202
+ }
203
+ export{complex,Complex}
@@ -0,0 +1,3 @@
1
+ const { PI, E } = Math;
2
+ const EPSILON=Number.EPSILON
3
+ export{PI,E,EPSILON}
@@ -0,0 +1,34 @@
1
+ class Combinaison {
2
+ static withDiscount(comboOptions, comboLength) {
3
+ if (comboLength === 1) {
4
+ return comboOptions.map((comboOption) => [comboOption]);
5
+ }
6
+ const combos = [];
7
+ comboOptions.forEach((currentOption, optionIndex) => {
8
+ const smallerCombos = this.withDiscount(comboOptions.slice(optionIndex), comboLength - 1);
9
+ smallerCombos.forEach((smallerCombo) => {
10
+ combos.push([currentOption].concat(smallerCombo));
11
+ });
12
+ });
13
+ return combos;
14
+ }
15
+ static withoutDiscount(comboOptions, comboLength) {
16
+ if (comboLength === 1) {
17
+ return comboOptions.map((comboOption) => [comboOption]);
18
+ }
19
+ const combos = [];
20
+ comboOptions.forEach((currentOption, optionIndex) => {
21
+ const smallerCombos = this.withoutDiscount(comboOptions.slice(optionIndex + 1), comboLength - 1);
22
+ smallerCombos.forEach((smallerCombo) => {
23
+ combos.push([currentOption].concat(smallerCombo));
24
+ });
25
+ });
26
+
27
+ return combos;
28
+ }
29
+ }
30
+ const combinaison=(comboOptions, comboLength, discount=false)=>Combinaison[discount?"withDiscount":"withoutDiscount"](comboOptions, comboLength)
31
+ export{
32
+ Combinaison,
33
+ combinaison
34
+ }
@@ -0,0 +1,86 @@
1
+ import { Complex } from "../../complex/index.js";
2
+ import { Matrix } from "../../matrix/Matrix.js";
3
+ const Base={
4
+ _mode:Number,
5
+ _map:function(func,number,toBase){
6
+ if (number instanceof Matrix)
7
+ return new Matrix(
8
+ number.rows,
9
+ number.cols,
10
+ number.arr.flat(1).map(n=>func(n,toBase))
11
+ );
12
+ else if (number instanceof Complex) return new Complex(func(number.a,toBase),func(number.b,toBase));
13
+ else if (number instanceof Array) return number.map((n) =>func(n,toBase));
14
+ },
15
+ dec2base(dec,base){
16
+ base<=10?this._mode=Number:this._mode=String
17
+ //this._mode=String
18
+ if (typeof dec === "number") return this._mode((dec >>> 0).toString(base));
19
+ return this._map(this.dec2base,dec,base)
20
+ },
21
+ dec2bin(dec){
22
+ return this.dec2base(dec,2);
23
+ },
24
+ dec2oct(dec){
25
+ return this.dec2base(dec,8);
26
+ },
27
+ dec2hex(dec){
28
+ return this.dec2base(dec,16);
29
+ },
30
+ bin2base(bin, base) {
31
+ return this.dec2base(this.bin2dec(bin),base)
32
+ },
33
+ bin2dec(bin){
34
+ return this._mode("0b"+bin);
35
+ },
36
+ bin2oct(bin){
37
+ return this.bin2base(bin,8);
38
+ },
39
+ bin2hex(bin){
40
+ return this.bin2base(bin,16);
41
+ },
42
+ oct2dec(oct){
43
+ return this._mode("0o"+oct);
44
+ },
45
+ oct2bin(oct){
46
+ return this.dec2bin(this.oct2dec(oct))
47
+ },
48
+ oct2hex(oct){
49
+ return this.dec2hex(this.oct2dec(oct))
50
+ },
51
+ oct2base(oct, base) {
52
+ return this.dec2base(this.oct2dec(oct),base)
53
+ },
54
+ hex2dec(hex){
55
+ return this._mode("0x"+hex);
56
+ },
57
+ hex2bin(hex){
58
+ return this.dec2bin(this.hex2dec(hex))
59
+ },
60
+ hex2oct(hex){
61
+ return this.dec2oct(this.hex2dec(hex))
62
+ },
63
+ hex2base(hex, base) {
64
+ return this.dec2base(this.hex2dec(hex),base)
65
+ },
66
+ IEEE32toDec(Bin){
67
+ let IEEE32=Bin.split(" ").join("").padEnd(32,"0");
68
+ let s=IEEE32[0];
69
+ let e=2**(+("0b"+IEEE32.slice(1,9))-127)
70
+ let m=IEEE32.slice(9,32).split("").map(n=>+n)
71
+ let M=m.map((n,i)=>n*(2**(-i-1))).reduce((a,b)=>a+b,0);
72
+ let dec=(-1)**s*(1+M)*e;
73
+ return dec
74
+ },
75
+ IEEE64toDec(Bin){
76
+ let IEEE64=Bin.split(" ").join("").padEnd(64,"0");
77
+ let s=IEEE64[0];
78
+ let e=2**(+("0b"+IEEE64.slice(1,12))-1023)
79
+ let m=IEEE64.slice(13,64).split("").map(n=>+n)
80
+ let M=m.map((n,i)=>n*(2**(-i-1))).reduce((a,b)=>a+b,0);
81
+ let dec=(-1)**s*(1+M)*e;
82
+ return dec;
83
+ }
84
+ }
85
+
86
+ export{Base}
@@ -0,0 +1,46 @@
1
+ import { Complex } from "../../complex/index.js";
2
+ import { Matrix } from "../../matrix/Matrix.js";
3
+ const Logic={
4
+ _mode:Number,
5
+ _map:function(func,a,b){
6
+ if (a instanceof Matrix)
7
+ return new Matrix(
8
+ a.rows,
9
+ a.cols,
10
+ a.arr.flat(1).map((n) => func(n, b))
11
+ );
12
+ else if (a instanceof Complex) return new Complex(func(a.a, b), func(a.b, b));
13
+ else if (a instanceof Array) return a.map((n) => func(n, b));
14
+ },
15
+ not:function(input){
16
+ if(["number","boolean"].includes(typeof input)) return Logic._mode(!input);
17
+ else return this._map(this.not,input)
18
+ },
19
+ and:function(a, ...b){
20
+ if(["number","boolean"].includes(typeof a))return Logic._mode(b.reduce((n, m) => (n &= m), a));
21
+ else return this._map(this.and,a,b)
22
+ },
23
+ or:function(a, ...b) {
24
+ if(["number","boolean"].includes(typeof a)) return Logic._mode(b.reduce((n, m) => (n |= m), a));
25
+ else return this._map(this.or,a,b);
26
+ },
27
+ nand:function(a, ...b) {
28
+ return this.not(this.and(a, b));
29
+ },
30
+ nor:function(a, ...b) {
31
+ return this.not(this.or(a, b));
32
+ },
33
+ xor:function(a,...b){
34
+ let arr=[a,...b]
35
+ if(["number","boolean"].includes(typeof a))return this._mode(arr.reduce((length,cur)=>{
36
+ if(+cur===1)length+=1;
37
+ return length;
38
+ },0)===1);
39
+ else return this._map(this.xor,a,b);
40
+ },
41
+ xnor:function(a,...b){
42
+ return Logic.not(Logic.xor(a,b))
43
+ }
44
+
45
+ }
46
+ export{Logic}
@@ -0,0 +1,31 @@
1
+ class Permutation {
2
+ static withDiscount(arr, l = arr.length) {
3
+ if (l === 1) return arr.map((n) => [n]);
4
+ const permutations = [];
5
+ let smallerPermutations;
6
+ smallerPermutations = this.withDiscount(arr, l - 1);
7
+ arr.forEach((currentOption) => {
8
+ smallerPermutations.forEach((smallerPermutation) => {
9
+ permutations.push([currentOption].concat(smallerPermutation));
10
+ });
11
+ });
12
+ return permutations;
13
+ }
14
+ static withoutDiscount(arr) {
15
+ const l = arr.length;
16
+ if (l === 1) return arr.map((n) => [n]);
17
+ const permutations = [];
18
+ const smallerPermutations = this.withoutDiscount(arr.slice(1));
19
+ const firstOption = arr[0];
20
+ for (let i = 0; i < smallerPermutations.length; i++) {
21
+ const smallerPermutation = smallerPermutations[i];
22
+ for (let j = 0; j <= smallerPermutation.length; j++) {
23
+ const permutationPrefix = smallerPermutation.slice(0, j);
24
+ const permutationSuffix = smallerPermutation.slice(j);
25
+ permutations.push(permutationPrefix.concat([firstOption], permutationSuffix));
26
+ }
27
+ }
28
+ return permutations;
29
+ }
30
+ }
31
+ export { Permutation }
@@ -0,0 +1,2 @@
1
+ export * from "./power-set.js";
2
+ export * from "./sub-set.js";
@@ -0,0 +1,15 @@
1
+ const powerSet=originalSet=>{
2
+ const subSets = [];
3
+ const NUMBER_OF_COMBINATIONS = 2 ** originalSet.length;
4
+ for (let i = 0; i < NUMBER_OF_COMBINATIONS; i += 1) {
5
+ const subSet = [];
6
+ for (let j = 0; j < originalSet.length; j += 1) {
7
+ if (i & (1 << j)) {
8
+ subSet.push(originalSet[j]);
9
+ }
10
+ }
11
+ subSets.push(subSet);
12
+ }
13
+ return subSets;
14
+ }
15
+ export{powerSet}
@@ -0,0 +1,10 @@
1
+ import { arange } from "../../utils/index.js";
2
+
3
+ // const subSet = (...arr) => {
4
+ // let list = arange(0, 2 ** arr.length, 1);
5
+ // let bin = list.map((n) => n.toString(2).padStart(arr.length, '0')).map((n) => n.split("").map((n) => +n));
6
+ // let sub = bin.map((n) => n.map((m, i) => (m === 1 ? arr[i] : null))).map((n) => n.filter((x) => x !== null));
7
+ // return sub;
8
+ // };
9
+ const subSet = null
10
+ export { subSet };
@@ -0,0 +1,23 @@
1
+ import { powerSet , subSet } from "./Set/index.js";
2
+ import { Base } from "./Conversion/index.js";
3
+ import { Logic } from "./Logic/index.js";
4
+ import {
5
+ Permutation,
6
+ } from "./Permutation/index.js"
7
+ import {
8
+ Combinaison,
9
+ combinaison,
10
+ } from "./Combinaison/index.js"
11
+
12
+
13
+ const Discret={
14
+ Logic,
15
+ Base,
16
+ Permutation,
17
+ Combinaison,
18
+ combinaison,
19
+ powerSet,
20
+ subSet
21
+ }
22
+ export default Discret;
23
+ export{Logic,Base,Permutation,Combinaison,powerSet,subSet}
@@ -0,0 +1,182 @@
1
+ import { Complex } from "../complex/index.js";
2
+ import { mapfun } from "../utils/mapfun.js";
3
+ import {
4
+ min,
5
+ max
6
+ }from "../statistics/index.js";
7
+ import {
8
+ gamma,
9
+ bessel,
10
+ beta
11
+ } from "../calculus/index.js";
12
+ export const Fixed={
13
+ cos:x=>+Math.cos(x).toFixed(15),
14
+ sin:x=>+Math.sin(x).toFixed(15),
15
+ tan:x=>+Math.tan(x).toFixed(31),
16
+ sinc:x=>+Math.sin(Math.PI*x)/(Math.PI*x),
17
+ sec:x=>+1/Math.cos(x).toFixed(15),
18
+ csc:x=>+1/Math.sin(x).toFixed(15),
19
+ cot:x=>+1/Math.tan(x).toFixed(15),
20
+ acos:x=>+Math.acos(x).toFixed(15),
21
+ asin:x=>+Math.asin(x).toFixed(15),
22
+ atan:x=>+Math.atan(x).toFixed(15),
23
+ acot:x=>+Math.PI/2-Math.atan(x).toFixed(15),
24
+ cosh:x=>+Math.cosh(x).toFixed(15),
25
+ sinh:x=>+Math.sinh(x).toFixed(15),
26
+ tanh:x=>+Math.tanh(x).toFixed(15),
27
+ coth:n=>+(1/2*Math.log((1+n)/(1-n))).toFixed(15),
28
+ acosh:x=>+Math.acosh(x).toFixed(15),
29
+ asinh:x=>+Math.asinh(x).toFixed(15),
30
+ atanh:x=>+Math.atanh(x).toFixed(15),
31
+
32
+
33
+ }
34
+ const abs=(...x)=>mapfun(Math.abs,...x);
35
+ const sqrt=(...x)=>mapfun(Math.sqrt,...x);
36
+ const pow=(x,n)=>{
37
+ if(typeof x === "number"){
38
+ if(typeof n === "number")return Math.pow(x,n);
39
+ else if(n instanceof Complex)return Complex.fromExpo(x**n.a,n.b*ln(x))
40
+ else return mapfun(a=>pow(x,a),...n);
41
+ }
42
+ else if(x instanceof Complex){
43
+ if(typeof n === "number")return Complex.fromExpo(x.z**n,x.phi*n);
44
+ else if(n instanceof Complex)return Complex.fromExpo(
45
+ x.z**n.a*e(-x.phi*n.b),
46
+ ln(x.z)*n.b+n.a*x.phi
47
+ )
48
+ else return mapfun(a=>pow(x,a),...n);
49
+ }
50
+ else if(x instanceof Array){
51
+ if(typeof n === "number") return mapfun(a=>pow(a,n),...x);
52
+ else if(n instanceof Array){
53
+ const Y=[];
54
+ for(let i=0;i<x.length;i++){
55
+ Y.push(mapfun(a=>pow(x[i],a),...n))
56
+ }
57
+ return Y;
58
+ }
59
+ }
60
+ }
61
+ const sqrtn=(x,n)=>{
62
+ if(typeof x === "number"){
63
+ if(typeof n === "number")return Math.pow(x,1/n);
64
+ else return mapfun(a=>sqrtn(x,a),...n);
65
+ }
66
+ else if(x instanceof Complex){
67
+ if(typeof n === "number")return Complex.fromExpo(sqrtn(x.z,n),x.phi/n);
68
+ else return mapfun(a=>sqrtn(x,a),...n);
69
+ }
70
+ else if(x instanceof Array){
71
+ if(typeof n === "number") return mapfun(a=>sqrtn(a,n),...x);
72
+ else if(n instanceof Array){
73
+ const Y=[];
74
+ for(let i=0;i<x.length;i++){
75
+ Y.push(mapfun(a=>sqrtn(x[i],a),...n))
76
+ }
77
+ return Y;
78
+ }
79
+ }
80
+ }
81
+ const e=(...x)=>mapfun(Math.exp,...x);
82
+ const ln=(...x)=>mapfun(Math.log,...x);
83
+ const cos=(...x)=>mapfun(Fixed.cos,...x);
84
+ const sin=(...x)=>mapfun(Fixed.sin,...x);
85
+ const tan=(...x)=>mapfun(Fixed.tan,...x);
86
+ const sec=(...x)=>mapfun(Fixed.sec,...x);
87
+ const sinc=(...x)=>mapfun(Fixed.sinc,...x)
88
+ const csc=(...x)=>mapfun(Fixed.csc,...x);
89
+ const cot=(...x)=>mapfun(Fixed.cot,...x);
90
+ const acos=(...x)=>mapfun(Fixed.acos,...x);
91
+ const asin=(...x)=>mapfun(Fixed.asin,...x);
92
+ const atan=(...x)=>mapfun(Fixed.atan,...x);
93
+ const acot=(...x)=>mapfun(Fixed.acot,...x);
94
+ const cosh=(...x)=>mapfun(Fixed.cosh,...x);
95
+ const sinh=(...x)=>mapfun(Fixed.sinh,...x);
96
+ const tanh=(...x)=>mapfun(Fixed.tanh,...x);
97
+ const coth=(...x)=>mapfun(Fixed.coth,...x);
98
+ const acosh=(...x)=>mapfun(Fixed.acosh,...x);
99
+ const asinh=(...x)=>mapfun(Fixed.asinh,...x);
100
+ const atanh=(...x)=>mapfun(Fixed.atanh,...x);
101
+ const ceil=(...x)=>mapfun(Math.ceil,...x);
102
+ const floor=(...x)=>mapfun(Math.floor,...x);
103
+ const round=(...x)=>mapfun(Math.round,...x);
104
+ const atan2=(x,y,rad=true)=>{
105
+ if(typeof x === "number"){
106
+ if(typeof y === "number")return rad?Math.atan2(x,y):Math.atan2(x,y)*180/Math.PI;
107
+ else return mapfun(a=>atan2(x,a,rad),...y);
108
+ }
109
+ // else if(x instanceof Complex){
110
+ // if(typeof n === "number")return Complex.fromExpo(x.z**n,x.phi*n);
111
+ // else return mapfun(a=>pow(x,a),...n);
112
+ // }
113
+ else if(x instanceof Array){
114
+ if(typeof y === "number") return mapfun(a=>atan2(a,y,rad),...x);
115
+ else if(y instanceof Array){
116
+ const Y=[];
117
+ for(let i=0;i<x.length;i++){
118
+ Y.push(mapfun(a=>pow(x[i],a,rad),...y))
119
+ }
120
+ return Y;
121
+ }
122
+ }
123
+ }
124
+ const fact=(...x)=>mapfun(n=> {
125
+ let i,
126
+ y = 1;
127
+ if (n == 0) y = 1;
128
+ else if (n > 0) for (i = 1; i <= n; i++) y *= i;
129
+ else y = NaN;
130
+ return y;
131
+ },...x);
132
+ const sign=(...x)=>mapfun(Math.sign,...x);
133
+
134
+ const sig=(...x)=>mapfun(n=>1/(1+e(-n)),...x);
135
+
136
+ const hypot=(...x)=>{
137
+ if(x.every(n=>typeof n === "number"))return Math.hypot(...x);
138
+ if(x.every(n=>n instanceof Array))return mapfun(
139
+ Math.hypot,
140
+ ...x
141
+ )
142
+ }
143
+
144
+ export{
145
+ cos,
146
+ sin,
147
+ tan,
148
+ sinc,
149
+ cot,
150
+ sec,
151
+ csc,
152
+ abs,
153
+ sqrt,
154
+ pow,
155
+ sqrtn,
156
+ e,
157
+ ln,
158
+ acos,
159
+ asin,
160
+ atan,
161
+ acot,
162
+ cosh,
163
+ sinh,
164
+ tanh,
165
+ coth,
166
+ acosh,
167
+ asinh,
168
+ atanh,
169
+ min,
170
+ max,
171
+ sign,
172
+ floor,
173
+ ceil,
174
+ round,
175
+ fact,
176
+ hypot,
177
+ sig,
178
+ atan2,
179
+ gamma,
180
+ bessel,
181
+ beta
182
+ };