1 | import { Decimal } from 'decimal.js'
|
2 |
|
3 | declare const math: math.MathJsStatic
|
4 | export as namespace math
|
5 | export = math
|
6 |
|
7 | type NoLiteralType<T> = T extends number
|
8 | ? number
|
9 | : T extends string
|
10 | ? string
|
11 | : T extends boolean
|
12 | ? boolean
|
13 | : T
|
14 |
|
15 | declare namespace math {
|
16 | type MathNumericType = number | BigNumber | Fraction | Complex
|
17 | type MathArray = MathNumericType[] | MathNumericType[][]
|
18 | type MathCollection = MathArray | Matrix
|
19 | type MathType = MathNumericType | Unit | MathCollection
|
20 | type MathExpression = string | string[] | MathCollection
|
21 |
|
22 |
|
23 | type FactoryFunction<T> = (scope: any) => T
|
24 |
|
25 |
|
26 | interface FactoryFunctionMap {
|
27 |
|
28 | [key: string]: FactoryFunction<any> | FactoryFunctionMap
|
29 | }
|
30 |
|
31 |
|
32 | interface ParseOptions {
|
33 |
|
34 | nodes?: Record<string, MathNode>
|
35 | }
|
36 | |
37 |
|
38 |
|
39 |
|
40 |
|
41 |
|
42 |
|
43 |
|
44 |
|
45 |
|
46 |
|
47 |
|
48 |
|
49 |
|
50 |
|
51 |
|
52 |
|
53 |
|
54 |
|
55 |
|
56 |
|
57 |
|
58 |
|
59 |
|
60 |
|
61 |
|
62 |
|
63 |
|
64 |
|
65 |
|
66 |
|
67 |
|
68 |
|
69 | interface ParseFunction {
|
70 | |
71 |
|
72 |
|
73 |
|
74 |
|
75 |
|
76 |
|
77 |
|
78 | (expr: MathExpression, options?: ParseOptions): MathNode
|
79 |
|
80 | |
81 |
|
82 |
|
83 |
|
84 |
|
85 |
|
86 |
|
87 |
|
88 | (exprs: MathExpression[], options?: ParseOptions): MathNode[]
|
89 |
|
90 | |
91 |
|
92 |
|
93 |
|
94 |
|
95 |
|
96 |
|
97 |
|
98 |
|
99 |
|
100 |
|
101 |
|
102 |
|
103 |
|
104 |
|
105 |
|
106 |
|
107 | isAlpha(c: string, cPrev: string, cNext: string): boolean
|
108 | |
109 |
|
110 |
|
111 |
|
112 |
|
113 | isValidLatinOrGreek(c: string): boolean
|
114 | |
115 |
|
116 |
|
117 |
|
118 |
|
119 |
|
120 |
|
121 |
|
122 |
|
123 |
|
124 |
|
125 |
|
126 |
|
127 |
|
128 | isValidMathSymbol(high: string, low: string): boolean
|
129 | |
130 |
|
131 |
|
132 |
|
133 |
|
134 |
|
135 | isWhitespace(c: string, nestingLevel: number): boolean
|
136 | |
137 |
|
138 |
|
139 |
|
140 |
|
141 |
|
142 |
|
143 | isDecimalMark(c: string, cNext: string): boolean
|
144 | |
145 |
|
146 |
|
147 |
|
148 |
|
149 | isDigitDot(c: string): boolean
|
150 | |
151 |
|
152 |
|
153 |
|
154 |
|
155 | isDigit(c: string): boolean
|
156 | |
157 |
|
158 |
|
159 |
|
160 |
|
161 | isHexDigit(c: string): boolean
|
162 | }
|
163 |
|
164 | interface AccessorNode extends MathNodeCommon {
|
165 | type: 'AccessorNode'
|
166 | isAccessorNode: true
|
167 | object: MathNode
|
168 | index: IndexNode
|
169 | name: string
|
170 | }
|
171 | interface AccessorNodeCtor {
|
172 | new (object: MathNode, index: IndexNode): AccessorNode
|
173 | }
|
174 |
|
175 | interface ArrayNode extends MathNodeCommon {
|
176 | type: 'ArrayNode'
|
177 | isArrayNode: true
|
178 | items: MathNode[]
|
179 | }
|
180 | interface ArrayNodeCtor {
|
181 | new (items: MathNode[]): ArrayNode
|
182 | }
|
183 |
|
184 | interface AssignmentNode extends MathNodeCommon {
|
185 | type: 'AssignmentNode'
|
186 | isAssignmentNode: true
|
187 | object: SymbolNode | AccessorNode
|
188 | index: IndexNode | null
|
189 | value: MathNode
|
190 | name: string
|
191 | }
|
192 | interface AssignmentNodeCtor {
|
193 | new (object: SymbolNode, value: MathNode): AssignmentNode
|
194 | new (
|
195 | object: SymbolNode | AccessorNode,
|
196 | index: IndexNode,
|
197 | value: MathNode
|
198 | ): AssignmentNode
|
199 | }
|
200 |
|
201 | interface BlockNode extends MathNodeCommon {
|
202 | type: 'BlockNode'
|
203 | isBlockNode: true
|
204 | blocks: Array<{ node: MathNode; visible: boolean }>
|
205 | }
|
206 | interface BlockNodeCtor {
|
207 | new (
|
208 | arr: Array<{ node: MathNode } | { node: MathNode; visible: boolean }>
|
209 | ): BlockNode
|
210 | }
|
211 |
|
212 | interface ConditionalNode extends MathNodeCommon {
|
213 | type: 'ConditionalNode'
|
214 | isConditionalNode: boolean
|
215 | condition: MathNode
|
216 | trueExpr: MathNode
|
217 | falseExpr: MathNode
|
218 | }
|
219 | interface ConditionalNodeCtor {
|
220 | new (
|
221 | condition: MathNode,
|
222 | trueExpr: MathNode,
|
223 | falseExpr: MathNode
|
224 | ): ConditionalNode
|
225 | }
|
226 |
|
227 | interface ConstantNode extends MathNodeCommon {
|
228 | type: 'ConstantNode'
|
229 | isConstantNode: true
|
230 |
|
231 | value: any
|
232 | }
|
233 |
|
234 | interface ConstantNodeCtor {
|
235 | new (constant: number): ConstantNode
|
236 | }
|
237 |
|
238 | interface FunctionAssignmentNode extends MathNodeCommon {
|
239 | type: 'FunctionAssignmentNode'
|
240 | isFunctionAssignmentNode: true
|
241 | name: string
|
242 | params: string[]
|
243 | expr: MathNode
|
244 | }
|
245 | interface FunctionAssignmentNodeCtor {
|
246 | new (name: string, params: string[], expr: MathNode): FunctionAssignmentNode
|
247 | }
|
248 |
|
249 | interface FunctionNode extends MathNodeCommon {
|
250 | type: 'FunctionNode'
|
251 | isFunctionNode: true
|
252 | fn: SymbolNode
|
253 | args: MathNode[]
|
254 | }
|
255 | interface FunctionNodeCtor {
|
256 | new (fn: MathNode | string, args: MathNode[]): FunctionNode
|
257 | }
|
258 |
|
259 | interface IndexNode extends MathNodeCommon {
|
260 | type: 'IndexNode'
|
261 | isIndexNode: true
|
262 | dimensions: MathNode[]
|
263 | dotNotation: boolean
|
264 | }
|
265 | interface IndexNodeCtor {
|
266 | new (dimensions: MathNode[]): IndexNode
|
267 | new (dimensions: MathNode[], dotNotation: boolean): IndexNode
|
268 | }
|
269 |
|
270 | interface ObjectNode extends MathNodeCommon {
|
271 | type: 'ObjectNode'
|
272 | isObjectNode: true
|
273 | properties: Record<string, MathNode>
|
274 | }
|
275 | interface ObjectNodeCtor {
|
276 | new (properties: Record<string, MathNode>): ObjectNode
|
277 | }
|
278 |
|
279 | type OperatorNodeMap = {
|
280 | xor: 'xor'
|
281 | and: 'and'
|
282 | bitOr: '|'
|
283 | bitXor: '^|'
|
284 | bitAnd: '&'
|
285 | equal: '=='
|
286 | unequal: '!='
|
287 | smaller: '<'
|
288 | larger: '>'
|
289 | smallerEq: '<='
|
290 | leftShift: '<<'
|
291 | rightArithShift: '>>'
|
292 | rightLogShift: '>>>'
|
293 | to: 'to'
|
294 | add: '+'
|
295 | subtract: '-'
|
296 | multiply: '*'
|
297 | divide: '/'
|
298 | dotMultiply: '.*'
|
299 | dotDivide: './'
|
300 | mod: 'mod'
|
301 | unaryPlus: '+'
|
302 | unaryMinus: '-'
|
303 | bitNot: '~'
|
304 | not: 'not'
|
305 | pow: '^'
|
306 | dotPow: '.^'
|
307 | factorial: '!'
|
308 | }
|
309 |
|
310 | type OperatorNodeOp = OperatorNodeMap[keyof OperatorNodeMap]
|
311 | type OperatorNodeFn = keyof OperatorNodeMap
|
312 |
|
313 | interface OperatorNode<
|
314 | TOp extends OperatorNodeMap[TFn] = never,
|
315 | TFn extends OperatorNodeFn = never,
|
316 | TArgs extends MathNode[] = MathNode[]
|
317 | > extends MathNodeCommon {
|
318 | type: 'OperatorNode'
|
319 | isOperatorNode: true
|
320 | op: TOp
|
321 | fn: TFn
|
322 | args: TArgs
|
323 | implicit: boolean
|
324 | isUnary(): boolean
|
325 | isBinary(): boolean
|
326 | }
|
327 |
|
328 | interface OperatorNodeCtor extends MathNodeCommon {
|
329 | new <
|
330 | TOp extends OperatorNodeMap[TFn],
|
331 | TFn extends OperatorNodeFn,
|
332 | TArgs extends MathNode[]
|
333 | >(
|
334 | op: TOp,
|
335 | fn: TFn,
|
336 | args: TArgs,
|
337 | implicit?: boolean
|
338 | ): OperatorNode<TOp, TFn, TArgs>
|
339 | }
|
340 | interface ParenthesisNode extends MathNodeCommon {
|
341 | type: 'ParenthesisNode'
|
342 | isParenthesisNode: true
|
343 | content: MathNode
|
344 | }
|
345 | interface ParenthesisNodeCtor {
|
346 | new (content: MathNode): ParenthesisNode
|
347 | }
|
348 |
|
349 | interface RangeNode extends MathNodeCommon {
|
350 | type: 'RangeNode'
|
351 | isRangeNode: true
|
352 | start: MathNode
|
353 | end: MathNode
|
354 | step: MathNode | null
|
355 | }
|
356 | interface RangeNodeCtor {
|
357 | new (start: MathNode, end: MathNode, step?: MathNode): RangeNode
|
358 | }
|
359 |
|
360 | interface RelationalNode extends MathNodeCommon {
|
361 | type: 'RelationalNode'
|
362 | isRelationalNode: true
|
363 | conditionals: string[]
|
364 | params: MathNode[]
|
365 | }
|
366 | interface RelationalNodeCtor {
|
367 | new (conditionals: string[], params: MathNode[]): RelationalNode
|
368 | }
|
369 |
|
370 | interface SymbolNode extends MathNodeCommon {
|
371 | type: 'SymbolNode'
|
372 | isSymbolNode: true
|
373 | name: string
|
374 | }
|
375 | interface SymbolNodeCtor {
|
376 | new (name: string): SymbolNode
|
377 | }
|
378 |
|
379 | type MathNode =
|
380 | | AccessorNode
|
381 | | ArrayNode
|
382 | | AssignmentNode
|
383 | | BlockNode
|
384 | | ConditionalNode
|
385 | | ConstantNode
|
386 | | FunctionAssignmentNode
|
387 | | FunctionNode
|
388 | | IndexNode
|
389 | | ObjectNode
|
390 | | OperatorNode<OperatorNodeOp, OperatorNodeFn>
|
391 | | ParenthesisNode
|
392 | | RangeNode
|
393 | | RelationalNode
|
394 | | SymbolNode
|
395 |
|
396 | type MathJsFunctionName = keyof MathJsStatic
|
397 |
|
398 | interface LUDecomposition {
|
399 | L: MathCollection
|
400 | U: MathCollection
|
401 | p: number[]
|
402 | }
|
403 |
|
404 | interface SLUDecomposition extends LUDecomposition {
|
405 | q: number[]
|
406 | }
|
407 |
|
408 | interface QRDecomposition {
|
409 | Q: MathCollection
|
410 | R: MathCollection
|
411 | }
|
412 |
|
413 | interface FractionDefinition {
|
414 | a: number
|
415 | b: number
|
416 | }
|
417 |
|
418 | interface MathJsStatic extends FactoryDependencies {
|
419 | e: number
|
420 | pi: number
|
421 | i: number
|
422 | Infinity: number
|
423 | LN2: number
|
424 | LN10: number
|
425 | LOG2E: number
|
426 | LOG10E: number
|
427 | NaN: number
|
428 | phi: number
|
429 | SQRT1_2: number
|
430 | SQRT2: number
|
431 | tau: number
|
432 |
|
433 |
|
434 | AccessorNode: AccessorNodeCtor
|
435 | ArrayNode: ArrayNodeCtor
|
436 | AssignmentNode: AssignmentNodeCtor
|
437 | BlockNode: BlockNodeCtor
|
438 | ConditionalNode: ConditionalNodeCtor
|
439 | ConstantNode: ConstantNodeCtor
|
440 | FunctionAssignmentNode: FunctionAssignmentNodeCtor
|
441 | FunctionNode: FunctionNodeCtor
|
442 | IndexNode: IndexNodeCtor
|
443 | ObjectNode: ObjectNodeCtor
|
444 | OperatorNode: OperatorNodeCtor
|
445 | ParenthesisNode: ParenthesisNodeCtor
|
446 | RangeNode: RangeNodeCtor
|
447 | RelationalNode: RelationalNodeCtor
|
448 | SymbolNode: SymbolNodeCtor
|
449 |
|
450 | Matrix: MatrixCtor
|
451 |
|
452 | |
453 |
|
454 |
|
455 |
|
456 |
|
457 |
|
458 |
|
459 |
|
460 |
|
461 |
|
462 | uninitialized: any
|
463 | version: string
|
464 |
|
465 | expression: MathNode
|
466 |
|
467 | |
468 |
|
469 |
|
470 |
|
471 | reviver(): (key: any, value: any) => any
|
472 |
|
473 | |
474 |
|
475 |
|
476 |
|
477 | |
478 |
|
479 |
|
480 |
|
481 |
|
482 |
|
483 |
|
484 |
|
485 |
|
486 |
|
487 |
|
488 |
|
489 |
|
490 |
|
491 | config: (options: ConfigOptions) => ConfigOptions
|
492 | |
493 |
|
494 |
|
495 |
|
496 |
|
497 |
|
498 |
|
499 |
|
500 |
|
501 |
|
502 | typed: (
|
503 | name: string,
|
504 |
|
505 | signatures: Record<string, (...args: any[]) => any>
|
506 |
|
507 | ) => (...args: any[]) => any
|
508 |
|
509 | |
510 |
|
511 |
|
512 |
|
513 | |
514 |
|
515 |
|
516 |
|
517 |
|
518 |
|
519 |
|
520 | bignumber(
|
521 | x?: number | string | Fraction | BigNumber | boolean | Fraction | null
|
522 | ): BigNumber
|
523 | bignumber<T extends MathCollection>(x: T): T
|
524 |
|
525 | |
526 |
|
527 |
|
528 |
|
529 |
|
530 |
|
531 |
|
532 |
|
533 | boolean(x: string | number | boolean | null): boolean
|
534 | boolean(x: MathCollection): MathCollection
|
535 |
|
536 | |
537 |
|
538 |
|
539 |
|
540 |
|
541 |
|
542 |
|
543 |
|
544 |
|
545 |
|
546 |
|
547 |
|
548 |
|
549 |
|
550 | chain<TValue>(value?: TValue): MathJsChain<TValue>
|
551 |
|
552 | |
553 |
|
554 |
|
555 |
|
556 |
|
557 |
|
558 | complex(arg?: Complex | string | PolarCoordinates): Complex
|
559 | complex(arg?: MathCollection): MathCollection
|
560 | |
561 |
|
562 |
|
563 |
|
564 |
|
565 |
|
566 | complex(re: number, im: number): Complex
|
567 |
|
568 | |
569 |
|
570 |
|
571 |
|
572 |
|
573 |
|
574 |
|
575 |
|
576 |
|
577 |
|
578 |
|
579 |
|
580 |
|
581 |
|
582 | createUnit(
|
583 | name: string,
|
584 | definition?: string | UnitDefinition,
|
585 | options?: CreateUnitOptions
|
586 | ): Unit
|
587 | |
588 |
|
589 |
|
590 |
|
591 |
|
592 |
|
593 | createUnit(
|
594 | units: Record<string, string | UnitDefinition>,
|
595 | options?: CreateUnitOptions
|
596 | ): Unit
|
597 |
|
598 | |
599 |
|
600 |
|
601 |
|
602 |
|
603 |
|
604 | fraction(
|
605 | value: number | string | BigNumber | Fraction | FractionDefinition
|
606 | ): Fraction
|
607 | fraction(values: MathCollection): MathCollection
|
608 | |
609 |
|
610 |
|
611 |
|
612 |
|
613 |
|
614 | fraction(numerator: number, denominator: number): Fraction
|
615 |
|
616 | |
617 |
|
618 |
|
619 |
|
620 |
|
621 |
|
622 |
|
623 |
|
624 | index(...ranges: any[]): Index
|
625 |
|
626 | |
627 |
|
628 |
|
629 |
|
630 |
|
631 |
|
632 |
|
633 |
|
634 | matrix(format?: 'sparse' | 'dense'): Matrix
|
635 | |
636 |
|
637 |
|
638 |
|
639 |
|
640 |
|
641 | matrix(
|
642 | data: MathCollection,
|
643 | format?: 'sparse' | 'dense',
|
644 | dataType?: string
|
645 | ): Matrix
|
646 |
|
647 | |
648 |
|
649 |
|
650 |
|
651 |
|
652 |
|
653 | number(
|
654 | value?: string | number | BigNumber | Fraction | boolean | Unit | null
|
655 | ): number
|
656 | number(value?: MathCollection): number | MathCollection
|
657 | |
658 |
|
659 |
|
660 |
|
661 |
|
662 |
|
663 | number(unit: Unit, valuelessUnit: Unit | string): number
|
664 |
|
665 | |
666 |
|
667 |
|
668 |
|
669 |
|
670 |
|
671 |
|
672 |
|
673 |
|
674 | sparse(data?: MathCollection, dataType?: string): Matrix
|
675 |
|
676 | |
677 |
|
678 |
|
679 |
|
680 |
|
681 |
|
682 |
|
683 | splitUnit(unit: Unit, parts: Unit[]): Unit[]
|
684 |
|
685 | |
686 |
|
687 |
|
688 |
|
689 |
|
690 |
|
691 | string(value: MathNumericType | string | Unit | null): string
|
692 | string(value: MathCollection): MathCollection
|
693 |
|
694 | |
695 |
|
696 |
|
697 |
|
698 |
|
699 |
|
700 |
|
701 | unit(unit: string): Unit
|
702 | |
703 |
|
704 |
|
705 |
|
706 | unit(unit: Unit): Unit
|
707 | |
708 |
|
709 |
|
710 |
|
711 |
|
712 | unit(value: number | BigNumber, unit: string): Unit
|
713 | unit(value: MathCollection, unit: string): Unit[]
|
714 |
|
715 | |
716 |
|
717 |
|
718 |
|
719 | |
720 |
|
721 |
|
722 |
|
723 |
|
724 |
|
725 | compile(expr: MathExpression): EvalFunction
|
726 | |
727 |
|
728 |
|
729 |
|
730 | compile(exprs: MathExpression[]): EvalFunction[]
|
731 |
|
732 |
|
733 | |
734 |
|
735 |
|
736 |
|
737 |
|
738 |
|
739 | evaluate(
|
740 | expr: MathExpression | Matrix,
|
741 | scope?: object
|
742 |
|
743 | ): any
|
744 | evaluate(
|
745 | expr: MathExpression[],
|
746 | scope?: object
|
747 |
|
748 | ): any[]
|
749 |
|
750 | |
751 |
|
752 |
|
753 |
|
754 |
|
755 |
|
756 |
|
757 | help(search: () => any): Help
|
758 |
|
759 | |
760 |
|
761 |
|
762 |
|
763 | parse: ParseFunction
|
764 |
|
765 | |
766 |
|
767 |
|
768 |
|
769 |
|
770 | parser(): Parser
|
771 |
|
772 | |
773 |
|
774 |
|
775 | |
776 |
|
777 |
|
778 |
|
779 |
|
780 |
|
781 |
|
782 | derivative(
|
783 | expr: MathNode | string,
|
784 | variable: MathNode | string,
|
785 | options?: { simplify: boolean }
|
786 | ): MathNode
|
787 |
|
788 | |
789 |
|
790 |
|
791 |
|
792 |
|
793 |
|
794 |
|
795 | lsolve(L: Matrix, b: Matrix | MathArray): Matrix
|
796 | lsolve(L: MathArray, b: Matrix | MathArray): MathArray
|
797 |
|
798 | |
799 |
|
800 |
|
801 |
|
802 |
|
803 |
|
804 |
|
805 |
|
806 |
|
807 | lup(A?: Matrix | MathArray): LUDecomposition
|
808 |
|
809 | |
810 |
|
811 |
|
812 |
|
813 |
|
814 |
|
815 |
|
816 |
|
817 |
|
818 |
|
819 |
|
820 |
|
821 | lusolve(
|
822 | A: Matrix,
|
823 | b: Matrix | MathArray,
|
824 | order?: number,
|
825 | threshold?: number
|
826 | ): Matrix
|
827 |
|
828 | lusolve(
|
829 | A: MathArray,
|
830 | b: Matrix | MathArray,
|
831 | order?: number,
|
832 | threshold?: number
|
833 | ): MathArray
|
834 |
|
835 | |
836 |
|
837 |
|
838 |
|
839 |
|
840 |
|
841 |
|
842 |
|
843 | qr(A: Matrix | MathArray): QRDecomposition
|
844 |
|
845 | rationalize(
|
846 | expr: MathNode | string,
|
847 | optional?: object | boolean,
|
848 | detailed?: false
|
849 | ): MathNode
|
850 | |
851 |
|
852 |
|
853 |
|
854 |
|
855 |
|
856 |
|
857 |
|
858 |
|
859 |
|
860 |
|
861 |
|
862 | rationalize(
|
863 | expr: MathNode | string,
|
864 | optional?: object | boolean,
|
865 | detailed?: true
|
866 | ): {
|
867 | expression: MathNode | string
|
868 | variables: string[]
|
869 | coefficients: MathType[]
|
870 | }
|
871 |
|
872 | |
873 |
|
874 |
|
875 |
|
876 |
|
877 |
|
878 |
|
879 |
|
880 |
|
881 |
|
882 |
|
883 | simplify: Simplify
|
884 |
|
885 | |
886 |
|
887 |
|
888 |
|
889 |
|
890 |
|
891 | resolve(node: MathNode, scope?: Record<string, any>): MathNode
|
892 |
|
893 | resolve(node: MathNode[], scope?: Record<string, any>): MathNode[]
|
894 |
|
895 | |
896 |
|
897 |
|
898 |
|
899 |
|
900 |
|
901 |
|
902 |
|
903 |
|
904 |
|
905 |
|
906 |
|
907 |
|
908 |
|
909 |
|
910 |
|
911 |
|
912 |
|
913 |
|
914 | slu(A: Matrix, order: number, threshold: number): SLUDecomposition
|
915 |
|
916 | |
917 |
|
918 |
|
919 |
|
920 |
|
921 |
|
922 |
|
923 | usolve(U: Matrix, b: Matrix | MathArray): Matrix
|
924 | usolve(U: MathArray, b: Matrix | MathArray): MathArray
|
925 |
|
926 | |
927 |
|
928 |
|
929 |
|
930 | |
931 |
|
932 |
|
933 |
|
934 |
|
935 |
|
936 | abs(x: number): number
|
937 | abs(x: BigNumber): BigNumber
|
938 | abs(x: Fraction): Fraction
|
939 | abs(x: Complex): Complex
|
940 | abs(x: MathArray): MathArray
|
941 | abs(x: Matrix): Matrix
|
942 | abs(x: Unit): Unit
|
943 |
|
944 | |
945 |
|
946 |
|
947 |
|
948 |
|
949 |
|
950 |
|
951 | add<T extends MathType>(x: T, y: T): T
|
952 | add(x: MathType, y: MathType): MathType
|
953 |
|
954 | |
955 |
|
956 |
|
957 |
|
958 |
|
959 |
|
960 |
|
961 |
|
962 |
|
963 | cbrt(x: number, allRoots?: boolean): number
|
964 | cbrt(x: BigNumber, allRoots?: boolean): BigNumber
|
965 | cbrt(x: Complex, allRoots?: boolean): Complex
|
966 | cbrt(x: MathArray, allRoots?: boolean): MathArray
|
967 | cbrt(x: Matrix, allRoots?: boolean): Matrix
|
968 |
|
969 |
|
970 |
|
971 |
|
972 | |
973 |
|
974 |
|
975 |
|
976 |
|
977 |
|
978 |
|
979 |
|
980 | ceil<T extends MathNumericType | MathCollection>(
|
981 | x: T,
|
982 | n?: number | BigNumber
|
983 | ): NoLiteralType<T>
|
984 | ceil<U extends MathCollection>(x: MathNumericType, n: U): U
|
985 |
|
986 | |
987 |
|
988 |
|
989 |
|
990 |
|
991 |
|
992 |
|
993 | fix<T extends MathNumericType | MathCollection>(
|
994 | x: T,
|
995 | n?: number | BigNumber
|
996 | ): NoLiteralType<T>
|
997 | fix<U extends MathCollection>(x: MathNumericType, n: U): U
|
998 |
|
999 | |
1000 |
|
1001 |
|
1002 |
|
1003 |
|
1004 |
|
1005 |
|
1006 | floor<T extends MathNumericType | MathCollection>(
|
1007 | x: T,
|
1008 | n?: number | BigNumber
|
1009 | ): NoLiteralType<T>
|
1010 | floor<U extends MathCollection>(x: MathNumericType, n: U): U
|
1011 |
|
1012 | |
1013 |
|
1014 |
|
1015 |
|
1016 |
|
1017 |
|
1018 |
|
1019 | round<T extends MathNumericType | MathCollection>(
|
1020 | x: T,
|
1021 | n?: number | BigNumber
|
1022 | ): NoLiteralType<T>
|
1023 | round<U extends MathCollection>(x: MathNumericType, n: U): U
|
1024 |
|
1025 |
|
1026 |
|
1027 | |
1028 |
|
1029 |
|
1030 |
|
1031 |
|
1032 |
|
1033 | cube(x: number): number
|
1034 | cube(x: BigNumber): BigNumber
|
1035 | cube(x: Fraction): Fraction
|
1036 | cube(x: Complex): Complex
|
1037 | cube(x: MathArray): MathArray
|
1038 | cube(x: Matrix): Matrix
|
1039 | cube(x: Unit): Unit
|
1040 |
|
1041 | |
1042 |
|
1043 |
|
1044 |
|
1045 |
|
1046 |
|
1047 |
|
1048 | divide(x: Unit, y: Unit): Unit | number
|
1049 | divide(x: Unit, y: number): Unit
|
1050 | divide(x: number, y: number): number
|
1051 | divide(x: MathType, y: MathType): MathType
|
1052 |
|
1053 | |
1054 |
|
1055 |
|
1056 |
|
1057 |
|
1058 |
|
1059 |
|
1060 | dotDivide(x: MathType, y: MathType): MathType
|
1061 |
|
1062 | |
1063 |
|
1064 |
|
1065 |
|
1066 |
|
1067 |
|
1068 |
|
1069 | dotMultiply(x: MathType, y: MathType): MathType
|
1070 |
|
1071 | |
1072 |
|
1073 |
|
1074 |
|
1075 |
|
1076 |
|
1077 | dotPow(x: MathType, y: MathType): MathType
|
1078 |
|
1079 | |
1080 |
|
1081 |
|
1082 |
|
1083 |
|
1084 |
|
1085 | exp(x: number): number
|
1086 | exp(x: BigNumber): BigNumber
|
1087 | exp(x: Complex): Complex
|
1088 | exp(x: MathArray): MathArray
|
1089 | exp(x: Matrix): Matrix
|
1090 |
|
1091 | |
1092 |
|
1093 |
|
1094 |
|
1095 |
|
1096 |
|
1097 | expm1(x: number): number
|
1098 | expm1(x: BigNumber): BigNumber
|
1099 | expm1(x: Complex): Complex
|
1100 | expm1(x: MathArray): MathArray
|
1101 | expm1(x: Matrix): Matrix
|
1102 |
|
1103 | |
1104 |
|
1105 |
|
1106 |
|
1107 |
|
1108 |
|
1109 | gcd(...args: number[]): number
|
1110 | gcd(...args: BigNumber[]): BigNumber
|
1111 | gcd(...args: Fraction[]): Fraction
|
1112 | gcd(...args: MathArray[]): MathArray
|
1113 | gcd(...args: Matrix[]): Matrix
|
1114 |
|
1115 | |
1116 |
|
1117 |
|
1118 |
|
1119 |
|
1120 |
|
1121 |
|
1122 |
|
1123 |
|
1124 |
|
1125 | hypot(...args: number[]): number
|
1126 | hypot(...args: BigNumber[]): BigNumber
|
1127 |
|
1128 | |
1129 |
|
1130 |
|
1131 |
|
1132 |
|
1133 |
|
1134 |
|
1135 |
|
1136 | lcm(a: number, b: number): number
|
1137 | lcm(a: BigNumber, b: BigNumber): BigNumber
|
1138 | lcm(a: MathArray, b: MathArray): MathArray
|
1139 | lcm(a: Matrix, b: Matrix): Matrix
|
1140 |
|
1141 | |
1142 |
|
1143 |
|
1144 |
|
1145 |
|
1146 |
|
1147 |
|
1148 |
|
1149 | log<T extends number | BigNumber | Complex | MathCollection>(
|
1150 | x: T,
|
1151 | base?: number | BigNumber | Complex
|
1152 | ): NoLiteralType<T>
|
1153 |
|
1154 | |
1155 |
|
1156 |
|
1157 |
|
1158 |
|
1159 |
|
1160 | log10(x: number): number
|
1161 | log10(x: BigNumber): BigNumber
|
1162 | log10(x: Complex): Complex
|
1163 | log10(x: MathArray): MathArray
|
1164 | log10(x: Matrix): Matrix
|
1165 |
|
1166 | |
1167 |
|
1168 |
|
1169 |
|
1170 |
|
1171 |
|
1172 | log1p(x: number, base?: number | BigNumber | Complex): number
|
1173 | log1p(x: BigNumber, base?: number | BigNumber | Complex): BigNumber
|
1174 | log1p(x: Complex, base?: number | BigNumber | Complex): Complex
|
1175 | log1p(x: MathArray, base?: number | BigNumber | Complex): MathArray
|
1176 | log1p(x: Matrix, base?: number | BigNumber | Complex): Matrix
|
1177 |
|
1178 | |
1179 |
|
1180 |
|
1181 |
|
1182 |
|
1183 |
|
1184 | log2(x: number): number
|
1185 | log2(x: BigNumber): BigNumber
|
1186 | log2(x: Complex): Complex
|
1187 | log2(x: MathArray): MathArray
|
1188 | log2(x: Matrix): Matrix
|
1189 |
|
1190 | |
1191 |
|
1192 |
|
1193 |
|
1194 |
|
1195 |
|
1196 |
|
1197 |
|
1198 |
|
1199 | mod<T extends number | BigNumber | Fraction | MathCollection>(
|
1200 | x: T,
|
1201 | y: number | BigNumber | Fraction | MathCollection
|
1202 | ): NoLiteralType<T>
|
1203 |
|
1204 | |
1205 |
|
1206 |
|
1207 |
|
1208 |
|
1209 |
|
1210 |
|
1211 | multiply<T extends Matrix | MathArray>(x: T, y: MathType): T
|
1212 | multiply(x: Unit, y: Unit): Unit
|
1213 | multiply(x: number, y: number): number
|
1214 | multiply(x: MathType, y: MathType): MathType
|
1215 |
|
1216 | |
1217 |
|
1218 |
|
1219 |
|
1220 |
|
1221 |
|
1222 |
|
1223 |
|
1224 |
|
1225 | norm(
|
1226 | x: number | BigNumber | Complex | MathCollection,
|
1227 | p?: number | BigNumber | string
|
1228 | ): number | BigNumber
|
1229 |
|
1230 | |
1231 |
|
1232 |
|
1233 |
|
1234 |
|
1235 |
|
1236 |
|
1237 |
|
1238 | nthRoot(
|
1239 | a: number | BigNumber | MathCollection | Complex,
|
1240 | root?: number | BigNumber
|
1241 | ): number | Complex | MathCollection
|
1242 |
|
1243 | |
1244 |
|
1245 |
|
1246 |
|
1247 |
|
1248 |
|
1249 |
|
1250 | pow(x: MathType, y: number | BigNumber | Complex): MathType
|
1251 |
|
1252 | |
1253 |
|
1254 |
|
1255 |
|
1256 |
|
1257 |
|
1258 |
|
1259 | sign(x: number): number
|
1260 | sign(x: BigNumber): BigNumber
|
1261 | sign(x: Fraction): Fraction
|
1262 | sign(x: Complex): Complex
|
1263 | sign(x: MathArray): MathArray
|
1264 | sign(x: Matrix): Matrix
|
1265 | sign(x: Unit): Unit
|
1266 |
|
1267 | |
1268 |
|
1269 |
|
1270 |
|
1271 |
|
1272 |
|
1273 | sqrt(x: number): number
|
1274 | sqrt(x: BigNumber): BigNumber
|
1275 | sqrt(x: Complex): Complex
|
1276 | sqrt(x: MathArray): MathArray
|
1277 | sqrt(x: Matrix): Matrix
|
1278 | sqrt(x: Unit): Unit
|
1279 |
|
1280 | |
1281 |
|
1282 |
|
1283 |
|
1284 |
|
1285 |
|
1286 | square(x: number): number
|
1287 | square(x: BigNumber): BigNumber
|
1288 | square(x: Fraction): Fraction
|
1289 | square(x: Complex): Complex
|
1290 | square(x: MathArray): MathArray
|
1291 | square(x: Matrix): Matrix
|
1292 | square(x: Unit): Unit
|
1293 |
|
1294 | |
1295 |
|
1296 |
|
1297 |
|
1298 |
|
1299 |
|
1300 |
|
1301 | subtract<T extends MathType>(x: T, y: T): T
|
1302 | subtract(x: MathType, y: MathType): MathType
|
1303 |
|
1304 | |
1305 |
|
1306 |
|
1307 |
|
1308 |
|
1309 |
|
1310 |
|
1311 |
|
1312 | unaryMinus(x: number): number
|
1313 | unaryMinus(x: BigNumber): BigNumber
|
1314 | unaryMinus(x: Fraction): Fraction
|
1315 | unaryMinus(x: Complex): Complex
|
1316 | unaryMinus(x: MathArray): MathArray
|
1317 | unaryMinus(x: Matrix): Matrix
|
1318 | unaryMinus(x: Unit): Unit
|
1319 |
|
1320 | |
1321 |
|
1322 |
|
1323 |
|
1324 |
|
1325 |
|
1326 |
|
1327 |
|
1328 | unaryPlus(x: number): number
|
1329 | unaryPlus(x: BigNumber): BigNumber
|
1330 | unaryPlus(x: Fraction): Fraction
|
1331 | unaryPlus(x: string): string
|
1332 | unaryPlus(x: Complex): Complex
|
1333 | unaryPlus(x: MathArray): MathArray
|
1334 | unaryPlus(x: Matrix): Matrix
|
1335 | unaryPlus(x: Unit): Unit
|
1336 |
|
1337 | |
1338 |
|
1339 |
|
1340 |
|
1341 |
|
1342 |
|
1343 |
|
1344 |
|
1345 | xgcd(a: number | BigNumber, b: number | BigNumber): MathArray
|
1346 |
|
1347 | |
1348 |
|
1349 |
|
1350 |
|
1351 | |
1352 |
|
1353 |
|
1354 |
|
1355 |
|
1356 |
|
1357 |
|
1358 | bitAnd<T extends number | BigNumber | MathCollection>(
|
1359 | x: T,
|
1360 | y: number | BigNumber | MathCollection
|
1361 | ): NoLiteralType<T>
|
1362 |
|
1363 | |
1364 |
|
1365 |
|
1366 |
|
1367 |
|
1368 |
|
1369 |
|
1370 | bitNot(x: number): number
|
1371 | bitNot(x: BigNumber): BigNumber
|
1372 | bitNot(x: MathArray): MathArray
|
1373 | bitNot(x: Matrix): Matrix
|
1374 |
|
1375 | |
1376 |
|
1377 |
|
1378 |
|
1379 |
|
1380 |
|
1381 |
|
1382 |
|
1383 | bitOr(x: number, y: number): number
|
1384 | bitOr(x: BigNumber, y: BigNumber): BigNumber
|
1385 | bitOr(x: MathArray, y: MathArray): MathArray
|
1386 | bitOr(x: Matrix, y: Matrix): Matrix
|
1387 |
|
1388 | |
1389 |
|
1390 |
|
1391 |
|
1392 |
|
1393 |
|
1394 |
|
1395 | bitXor<T extends number | BigNumber | MathCollection>(
|
1396 | x: T,
|
1397 | y: number | BigNumber | MathCollection
|
1398 | ): NoLiteralType<T>
|
1399 |
|
1400 | |
1401 |
|
1402 |
|
1403 |
|
1404 |
|
1405 |
|
1406 |
|
1407 |
|
1408 | leftShift<T extends number | BigNumber | MathCollection>(
|
1409 | x: T,
|
1410 | y: number | BigNumber
|
1411 | ): NoLiteralType<T>
|
1412 |
|
1413 | |
1414 |
|
1415 |
|
1416 |
|
1417 |
|
1418 |
|
1419 |
|
1420 |
|
1421 | rightArithShift<T extends number | BigNumber | MathCollection>(
|
1422 | x: T,
|
1423 | y: number | BigNumber
|
1424 | ): NoLiteralType<T>
|
1425 |
|
1426 | |
1427 |
|
1428 |
|
1429 |
|
1430 |
|
1431 |
|
1432 |
|
1433 |
|
1434 | rightLogShift<T extends number | MathCollection>(
|
1435 | x: T,
|
1436 | y: number
|
1437 | ): NoLiteralType<T>
|
1438 |
|
1439 | |
1440 |
|
1441 |
|
1442 |
|
1443 | |
1444 |
|
1445 |
|
1446 |
|
1447 |
|
1448 |
|
1449 |
|
1450 |
|
1451 | bellNumbers(n: number): number
|
1452 | bellNumbers(n: BigNumber): BigNumber
|
1453 |
|
1454 | |
1455 |
|
1456 |
|
1457 |
|
1458 |
|
1459 |
|
1460 |
|
1461 | catalan(n: number): number
|
1462 | catalan(n: BigNumber): BigNumber
|
1463 |
|
1464 | |
1465 |
|
1466 |
|
1467 |
|
1468 |
|
1469 |
|
1470 |
|
1471 | composition<T extends number | BigNumber>(
|
1472 | n: T,
|
1473 | k: number | BigNumber
|
1474 | ): NoLiteralType<T>
|
1475 |
|
1476 | |
1477 |
|
1478 |
|
1479 |
|
1480 |
|
1481 |
|
1482 |
|
1483 |
|
1484 |
|
1485 |
|
1486 | stirlingS2<T extends number | BigNumber>(
|
1487 | n: T,
|
1488 | k: number | BigNumber
|
1489 | ): NoLiteralType<T>
|
1490 |
|
1491 | |
1492 |
|
1493 |
|
1494 |
|
1495 | |
1496 |
|
1497 |
|
1498 |
|
1499 |
|
1500 |
|
1501 |
|
1502 | arg(x: number | Complex): number
|
1503 | arg(x: BigNumber | Complex): BigNumber
|
1504 | arg(x: MathArray): MathArray
|
1505 | arg(x: Matrix): Matrix
|
1506 |
|
1507 | |
1508 |
|
1509 |
|
1510 |
|
1511 |
|
1512 |
|
1513 |
|
1514 | conj<T extends number | BigNumber | Complex | MathCollection>(
|
1515 | x: T
|
1516 | ): NoLiteralType<T>
|
1517 |
|
1518 | |
1519 |
|
1520 |
|
1521 |
|
1522 |
|
1523 |
|
1524 |
|
1525 | im(x: MathJsChain<number | Complex>): MathJsChain<number>
|
1526 | im(x: MathJsChain<BigNumber>): MathJsChain<BigNumber>
|
1527 | im(x: MathJsChain<MathCollection>): MathJsChain<MathCollection>
|
1528 |
|
1529 | |
1530 |
|
1531 |
|
1532 |
|
1533 |
|
1534 |
|
1535 |
|
1536 | re(x: MathJsChain<number | Complex>): MathJsChain<number>
|
1537 | re(x: MathJsChain<BigNumber>): MathJsChain<BigNumber>
|
1538 | re(x: MathJsChain<MathCollection>): MathJsChain<MathCollection>
|
1539 |
|
1540 | |
1541 |
|
1542 |
|
1543 |
|
1544 | |
1545 |
|
1546 |
|
1547 |
|
1548 |
|
1549 |
|
1550 |
|
1551 |
|
1552 |
|
1553 |
|
1554 |
|
1555 |
|
1556 | distance(
|
1557 | x: MathCollection | object,
|
1558 | y: MathCollection | object
|
1559 | ): number | BigNumber
|
1560 |
|
1561 | |
1562 |
|
1563 |
|
1564 |
|
1565 |
|
1566 |
|
1567 |
|
1568 |
|
1569 |
|
1570 |
|
1571 |
|
1572 |
|
1573 |
|
1574 |
|
1575 |
|
1576 | intersect(
|
1577 | w: MathCollection,
|
1578 | x: MathCollection,
|
1579 | y: MathCollection,
|
1580 | z: MathCollection
|
1581 | ): MathArray
|
1582 |
|
1583 | |
1584 |
|
1585 |
|
1586 |
|
1587 | |
1588 |
|
1589 |
|
1590 |
|
1591 |
|
1592 |
|
1593 |
|
1594 |
|
1595 |
|
1596 | and(
|
1597 | x: number | BigNumber | Complex | Unit | MathCollection,
|
1598 | y: number | BigNumber | Complex | Unit | MathCollection
|
1599 | ): boolean | MathCollection
|
1600 |
|
1601 | |
1602 |
|
1603 |
|
1604 |
|
1605 |
|
1606 |
|
1607 | not(
|
1608 | x: number | BigNumber | Complex | Unit | MathCollection
|
1609 | ): boolean | MathCollection
|
1610 |
|
1611 | |
1612 |
|
1613 |
|
1614 |
|
1615 |
|
1616 |
|
1617 |
|
1618 |
|
1619 |
|
1620 | or(
|
1621 | x: number | BigNumber | Complex | Unit | MathCollection,
|
1622 | y: number | BigNumber | Complex | Unit | MathCollection
|
1623 | ): boolean | MathCollection
|
1624 |
|
1625 | |
1626 |
|
1627 |
|
1628 |
|
1629 |
|
1630 |
|
1631 |
|
1632 |
|
1633 |
|
1634 | xor(
|
1635 | x: number | BigNumber | Complex | Unit | MathCollection,
|
1636 | y: number | BigNumber | Complex | Unit | MathCollection
|
1637 | ): boolean | MathCollection
|
1638 |
|
1639 | |
1640 |
|
1641 |
|
1642 |
|
1643 | |
1644 |
|
1645 |
|
1646 |
|
1647 |
|
1648 |
|
1649 |
|
1650 |
|
1651 |
|
1652 |
|
1653 | apply<T extends MathCollection>(
|
1654 | array: T,
|
1655 | dim: number,
|
1656 | callback: (array: MathCollection) => number
|
1657 | ): T
|
1658 |
|
1659 | |
1660 |
|
1661 |
|
1662 |
|
1663 |
|
1664 |
|
1665 |
|
1666 | concat(...args: Array<MathCollection | number | BigNumber>): MathCollection
|
1667 |
|
1668 | |
1669 |
|
1670 |
|
1671 |
|
1672 |
|
1673 |
|
1674 |
|
1675 |
|
1676 |
|
1677 | cross(x: MathCollection, y: MathCollection): Matrix | MathArray
|
1678 |
|
1679 | |
1680 |
|
1681 |
|
1682 |
|
1683 |
|
1684 | det(x: MathCollection): number
|
1685 |
|
1686 | |
1687 |
|
1688 |
|
1689 |
|
1690 |
|
1691 |
|
1692 |
|
1693 |
|
1694 |
|
1695 |
|
1696 |
|
1697 |
|
1698 |
|
1699 |
|
1700 | diag(X: MathCollection, format?: string): Matrix
|
1701 | diag(
|
1702 | X: MathCollection,
|
1703 | k: number | BigNumber,
|
1704 | format?: string
|
1705 | ): Matrix | MathArray
|
1706 |
|
1707 | |
1708 |
|
1709 |
|
1710 |
|
1711 |
|
1712 |
|
1713 |
|
1714 |
|
1715 | dot(x: MathCollection, y: MathCollection): number
|
1716 |
|
1717 | |
1718 |
|
1719 |
|
1720 |
|
1721 |
|
1722 |
|
1723 |
|
1724 |
|
1725 |
|
1726 |
|
1727 |
|
1728 |
|
1729 |
|
1730 | eigs(
|
1731 | x: MathCollection,
|
1732 | prec?: number | BigNumber
|
1733 | ): { values: MathCollection; vectors: MathCollection }
|
1734 |
|
1735 | |
1736 |
|
1737 |
|
1738 |
|
1739 |
|
1740 |
|
1741 |
|
1742 |
|
1743 |
|
1744 | expm(x: Matrix): Matrix
|
1745 |
|
1746 | |
1747 |
|
1748 |
|
1749 |
|
1750 |
|
1751 |
|
1752 |
|
1753 | identity(
|
1754 | size: number | number[] | Matrix | MathArray,
|
1755 | format?: string
|
1756 | ): Matrix | MathArray | number
|
1757 | |
1758 |
|
1759 |
|
1760 |
|
1761 |
|
1762 |
|
1763 | identity(m: number, n: number, format?: string): Matrix | MathArray | number
|
1764 |
|
1765 | |
1766 |
|
1767 |
|
1768 |
|
1769 |
|
1770 |
|
1771 |
|
1772 |
|
1773 |
|
1774 | filter(
|
1775 | x: Matrix | MathArray | string[],
|
1776 | test:
|
1777 | | ((
|
1778 |
|
1779 | value: any,
|
1780 |
|
1781 | index: any,
|
1782 | matrix: Matrix | MathArray | string[]
|
1783 | ) => boolean)
|
1784 | | RegExp
|
1785 | ): Matrix | MathArray
|
1786 |
|
1787 | |
1788 |
|
1789 |
|
1790 |
|
1791 |
|
1792 | flatten<T extends MathCollection>(x: T): T
|
1793 |
|
1794 | |
1795 |
|
1796 |
|
1797 |
|
1798 |
|
1799 |
|
1800 |
|
1801 |
|
1802 | forEach<T extends Matrix | MathArray>(
|
1803 | x: T,
|
1804 |
|
1805 | callback: (value: any, index: any, matrix: T) => void
|
1806 | ): void
|
1807 |
|
1808 | |
1809 |
|
1810 |
|
1811 |
|
1812 |
|
1813 | inv<T extends number | Complex | MathCollection>(x: T): NoLiteralType<T>
|
1814 |
|
1815 | |
1816 |
|
1817 |
|
1818 |
|
1819 |
|
1820 |
|
1821 | kron(x: Matrix | MathArray, y: Matrix | MathArray): Matrix
|
1822 |
|
1823 | |
1824 |
|
1825 |
|
1826 |
|
1827 |
|
1828 |
|
1829 |
|
1830 |
|
1831 |
|
1832 | map<T extends Matrix | MathArray>(
|
1833 | x: T,
|
1834 |
|
1835 | callback: (value: any, index: any, matrix: T) => MathType | string
|
1836 | ): T
|
1837 |
|
1838 | |
1839 |
|
1840 |
|
1841 |
|
1842 |
|
1843 |
|
1844 |
|
1845 | ones(size: number | number[], format?: string): MathCollection
|
1846 | |
1847 |
|
1848 |
|
1849 |
|
1850 |
|
1851 |
|
1852 | ones(m: number, n: number, format?: string): MathCollection
|
1853 |
|
1854 | |
1855 |
|
1856 |
|
1857 |
|
1858 |
|
1859 |
|
1860 |
|
1861 |
|
1862 |
|
1863 |
|
1864 | partitionSelect(
|
1865 | x: MathCollection,
|
1866 | k: number,
|
1867 |
|
1868 | compare?: 'asc' | 'desc' | ((a: any, b: any) => number)
|
1869 | // eslint-disable-next-line @typescript-eslint/no-explicit-any
|
1870 | ): any
|
1871 |
|
1872 | /**
|
1873 | * Create an array from a range. By default, the range end is excluded.
|
1874 | * This can be customized by providing an extra parameter includeEnd.
|
1875 | * @param str A string 'start:end' or 'start:step:end'
|
1876 | * @param start Start of the range
|
1877 | * @param end End of the range, excluded by default, included when
|
1878 | * parameter includeEnd=true
|
1879 | * @param step Step size. Default value is 1.
|
1880 | * @param includeEnd: Option to specify whether to include the end or
|
1881 | * not. False by default
|
1882 | * @returns Parameters describing the ranges start, end, and optional
|
1883 | * step.
|
1884 | */
|
1885 | range(str: string, includeEnd?: boolean): Matrix
|
1886 | range(
|
1887 | start: number | BigNumber,
|
1888 | end: number | BigNumber,
|
1889 | includeEnd?: boolean
|
1890 | ): Matrix
|
1891 | range(
|
1892 | start: number | BigNumber,
|
1893 | end: number | BigNumber,
|
1894 | step: number | BigNumber,
|
1895 | includeEnd?: boolean
|
1896 | ): Matrix
|
1897 |
|
1898 | /**
|
1899 | * Reshape a multi dimensional array to fit the specified dimensions
|
1900 | * @param x Matrix to be reshaped
|
1901 | * @param sizes One dimensional array with integral sizes for each
|
1902 | * dimension
|
1903 | * @returns A reshaped clone of matrix x
|
1904 | */
|
1905 | reshape<T extends MathCollection>(x: T, sizes: number[]): T
|
1906 |
|
1907 | /**
|
1908 | * Resize a matrix
|
1909 | * @param x Matrix to be resized
|
1910 | * @param size One dimensional array with numbers
|
1911 | * @param defaultValue Zero by default, except in case of a string, in
|
1912 | * that case defaultValue = ' ' Default value: 0.
|
1913 | * @returns A resized clone of matrix x
|
1914 | */
|
1915 | resize<T extends MathCollection>(
|
1916 | x: T,
|
1917 | size: MathCollection,
|
1918 | defaultValue?: number | string
|
1919 | ): T
|
1920 |
|
1921 | /**
|
1922 | * Return a row from a Matrix.
|
1923 | * @param value An array or matrix
|
1924 | * @param row The index of the row
|
1925 | * @returns The retrieved row
|
1926 | */
|
1927 | row<T extends MathCollection>(value: T, row: number): T
|
1928 |
|
1929 | /**
|
1930 | * Return a column from a Matrix.
|
1931 | * @param value An array or matrix
|
1932 | * @param column The index of the column
|
1933 | * @returns The retrieved column
|
1934 | */
|
1935 | column<T extends MathCollection>(value: T, column: number): T
|
1936 |
|
1937 | /**
|
1938 | * Return a rotated matrix.
|
1939 | * @param {Array | Matrix} w Vector to rotate
|
1940 | * @param {number | BigNumber | Complex | Unit} theta Rotation angle
|
1941 | * @param {Array | Matrix} [v] Rotation axis
|
1942 | * @return {Array | Matrix} Multiplication of the rotation matrix and w
|
1943 | */
|
1944 | rotate<T extends MathCollection>(
|
1945 | w: T,
|
1946 | theta: number | BigNumber | Complex | Unit,
|
1947 | v?: T
|
1948 | ): T
|
1949 |
|
1950 | /**
|
1951 | * Calculate the size of a matrix or scalar.
|
1952 | * @param A matrix
|
1953 | * @returns A vector with the size of x
|
1954 | */
|
1955 | size(
|
1956 | x: boolean | number | Complex | Unit | string | MathCollection
|
1957 | ): MathCollection
|
1958 |
|
1959 | /**
|
1960 | * Sort the items in a matrix
|
1961 | * @param x A one dimensional matrix or array to sort
|
1962 | * @param compare An optional _comparator function or name. The function
|
1963 | * is called as compare(a, b), and must return 1 when a > b, -1 when a <
|
1964 | * b, and 0 when a == b. Default value: ‘asc’
|
1965 | * @returns Returns the sorted matrix
|
1966 | */
|
1967 | sort<T extends Matrix | MathArray>(
|
1968 | x: T,
|
1969 |
|
1970 | compare: ((a: any, b: any) => number) | 'asc' | 'desc' | 'natural'
|
1971 | ): T
|
1972 |
|
1973 | /**
|
1974 | * Calculate the principal square root of a square matrix. The principal
|
1975 | * square root matrix X of another matrix A is such that X * X = A.
|
1976 | * @param A The square matrix A
|
1977 | * @returns The principal square root of matrix A
|
1978 | */
|
1979 | sqrtm<T extends MathCollection>(A: T): T
|
1980 |
|
1981 | /**
|
1982 | * Squeeze a matrix, remove inner and outer singleton dimensions from a
|
1983 | * matrix.
|
1984 | * @param x Matrix to be squeezed
|
1985 | * @returns Squeezed matrix
|
1986 | */
|
1987 | squeeze<T extends MathCollection>(x: T): T
|
1988 |
|
1989 | /**
|
1990 | * Get or set a subset of a matrix or string.
|
1991 | * @param value An array, matrix, or string
|
1992 | * @param index For each dimension, an index or list of indices to get or set.
|
1993 | * @param replacement An array, matrix, or scalar. If provided, the
|
1994 | * subset is replaced with replacement. If not provided, the subset is
|
1995 | * returned
|
1996 | * @param defaultValue Default value, filled in on new entries when the
|
1997 | * matrix is resized. If not provided, math.matrix elements will be left
|
1998 | * undefined. Default value: undefined.
|
1999 | * @returns Either the retrieved subset or the updated matrix
|
2000 | */
|
2001 | subset<T extends MathCollection | string>(
|
2002 | value: T,
|
2003 | index: Index,
|
2004 |
|
2005 | replacement?: any,
|
2006 |
|
2007 | defaultValue?: any
|
2008 | ): T
|
2009 |
|
2010 | /**
|
2011 | * Calculate the trace of a matrix: the sum of the elements on the main
|
2012 | * diagonal of a square matrix.
|
2013 | * @param x A matrix
|
2014 | * @returns The trace of x
|
2015 | */
|
2016 | trace(x: MathCollection): number
|
2017 |
|
2018 | /**
|
2019 | * Transpose a matrix. All values of the matrix are reflected over its
|
2020 | * main diagonal. Only two dimensional matrices are supported.
|
2021 | * @param x Matrix to be transposed
|
2022 | * @returns The transposed matrix
|
2023 | */
|
2024 | transpose<T extends MathCollection>(x: T): T
|
2025 |
|
2026 | /**
|
2027 | * Create a matrix filled with zeros. The created matrix can have one or
|
2028 | * multiple dimensions.
|
2029 | * @param size The size of each dimension of the matrix
|
2030 | * @param format The matrix storage format
|
2031 | * @returns A matrix filled with zeros
|
2032 | */
|
2033 | zeros(size: number | number[], format?: string): MathCollection
|
2034 | /**
|
2035 | * @param m The x dimension of the matrix
|
2036 | * @param n The y dimension of the matrix
|
2037 | * @param format The matrix storage format
|
2038 | * @returns A matrix filled with zeros
|
2039 | */
|
2040 | zeros(m: number, n: number, format?: string): MathCollection
|
2041 |
|
2042 | /**
|
2043 | * Calculate N-dimensional fourier transform
|
2044 | * @param {Array | Matrix} arr An array or matrix
|
2045 | * @return {Array | Matrix} N-dimensional fourier transformation of the array
|
2046 | */
|
2047 | fft<T extends MathCollection>(arr: T): T
|
2048 |
|
2049 | /**
|
2050 | * Calculate N-dimensional inverse fourier transform
|
2051 | * @param {Array | Matrix} arr An array or matrix
|
2052 | * @return {Array | Matrix} N-dimensional fourier transformation of the array
|
2053 | */
|
2054 | ifft<T extends MathCollection>(arr: T): T
|
2055 |
|
2056 | /*************************************************************************
|
2057 | * Probability functions
|
2058 | ************************************************************************/
|
2059 |
|
2060 | /**
|
2061 | * Compute the number of ways of picking k unordered outcomes from n
|
2062 | * possibilities. Combinations only takes integer arguments. The
|
2063 | * following condition must be enforced: k <= n.
|
2064 | * @param n Total number of objects in the set
|
2065 | * @param k Number of objects in the subset
|
2066 | * @returns Number of possible combinations
|
2067 | */
|
2068 | combinations<T extends number | BigNumber>(
|
2069 | n: T,
|
2070 | k: number | BigNumber
|
2071 | ): NoLiteralType<T>
|
2072 |
|
2073 | /**
|
2074 | * Compute the factorial of a value Factorial only supports an integer
|
2075 | * value as argument. For matrices, the function is evaluated element
|
2076 | * wise.
|
2077 | * @param n An integer number
|
2078 | * @returns The factorial of n
|
2079 | */
|
2080 | factorial<T extends number | BigNumber | MathCollection>(
|
2081 | n: T
|
2082 | ): NoLiteralType<T>
|
2083 |
|
2084 | /**
|
2085 | * Compute the gamma function of a value using Lanczos approximation for
|
2086 | * small values, and an extended Stirling approximation for large
|
2087 | * values. For matrices, the function is evaluated element wise.
|
2088 | * @param n A real or complex number
|
2089 | * @returns The gamma of n
|
2090 | */
|
2091 | gamma<T extends number | BigNumber | Complex | MathCollection>(
|
2092 | n: T
|
2093 | ): NoLiteralType<T>
|
2094 |
|
2095 | /**
|
2096 | * Calculate the Kullback-Leibler (KL) divergence between two
|
2097 | * distributions
|
2098 | * @param q First vector
|
2099 | * @param p Second vector
|
2100 | * @returns Returns disance between q and p
|
2101 | */
|
2102 | kldivergence(q: MathCollection, p: MathCollection): number
|
2103 |
|
2104 | /**
|
2105 | * Compute the log gamma function of a value, using Lanczos approximation for numbers and Stirling series for complex numbers.
|
2106 | * @param n A real or complex number
|
2107 | * @returns The log gamma of `n`
|
2108 | */
|
2109 | lgamma<T extends number | Complex>(n: T): NoLiteralType<T>
|
2110 |
|
2111 | /**
|
2112 | * Multinomial Coefficients compute the number of ways of picking a1,
|
2113 | * a2, ..., ai unordered outcomes from n possibilities. multinomial
|
2114 | * takes one array of integers as an argument. The following condition
|
2115 | * must be enforced: every ai <= 0
|
2116 | * @param a Integer number of objects in the subset
|
2117 | * @returns multinomial coefficent
|
2118 | */
|
2119 | multinomial<T extends number | BigNumber>(a: T[]): NoLiteralType<T>
|
2120 |
|
2121 | /**
|
2122 | * Compute the number of ways of obtaining an ordered subset of k
|
2123 | * elements from a set of n elements. Permutations only takes integer
|
2124 | * arguments. The following condition must be enforced: k <= n.
|
2125 | * @param n The number of objects in total
|
2126 | * @param k The number of objects in the subset
|
2127 | * @returns The number of permutations
|
2128 | */
|
2129 | permutations<T extends number | BigNumber>(
|
2130 | n: T,
|
2131 | k?: number | BigNumber
|
2132 | ): NoLiteralType<T>
|
2133 |
|
2134 | /**
|
2135 | * Random pick a value from a one dimensional array. Array element is
|
2136 | * picked using a random function with uniform distribution.
|
2137 | * @param array A one dimensional array
|
2138 | * @param number An int or float
|
2139 | * @param weights An array of ints or floats
|
2140 | * @returns Returns a single random value from array when number is 1 or
|
2141 | * undefined. Returns an array with the configured number of elements
|
2142 | * when number is > 1.
|
2143 | */
|
2144 | pickRandom(
|
2145 | array: number[],
|
2146 | number?: number,
|
2147 | weights?: number[]
|
2148 | ): number | number[]
|
2149 |
|
2150 | /**
|
2151 | * Return a random number larger or equal to min and smaller than max
|
2152 | * using a uniform distribution.
|
2153 | * @param size If provided, an array or matrix with given size and
|
2154 | * filled with random values is returned
|
2155 | * @param min Minimum boundary for the random value, included
|
2156 | * @param max Maximum boundary for the random value, excluded
|
2157 | * @returns A random number
|
2158 | */
|
2159 | random(min?: number, max?: number): number
|
2160 | random<T extends MathCollection>(size: T, min?: number, max?: number): T
|
2161 |
|
2162 | /**
|
2163 | * Return a random integer number larger or equal to min and smaller
|
2164 | * than max using a uniform distribution.
|
2165 | * @param size If provided, an array or matrix with given size and
|
2166 | * filled with random values is returned
|
2167 | * @param min Minimum boundary for the random value, included
|
2168 | * @param max Maximum boundary for the random value, excluded
|
2169 | * @returns A random number
|
2170 | */
|
2171 | randomInt(min: number, max?: number): number
|
2172 | randomInt<T extends MathCollection>(size: T, min?: number, max?: number): T
|
2173 |
|
2174 | /*************************************************************************
|
2175 | * Relational functions
|
2176 | ************************************************************************/
|
2177 |
|
2178 | /**
|
2179 | * Compare two values. Returns 1 when x > y, -1 when x < y, and 0 when x
|
2180 | * == y. x and y are considered equal when the relative difference
|
2181 | * between x and y is smaller than the configured epsilon. The function
|
2182 | * cannot be used to compare values smaller than approximately 2.22e-16.
|
2183 | * For matrices, the function is evaluated element wise.
|
2184 | * @param x First value to compare
|
2185 | * @param y Second value to compare
|
2186 | * @returns Returns the result of the comparison: 1 when x > y, -1 when
|
2187 | * x < y, and 0 when x == y.
|
2188 | */
|
2189 | compare(
|
2190 | x: MathType | string,
|
2191 | y: MathType | string
|
2192 | ): number | BigNumber | Fraction | MathCollection
|
2193 |
|
2194 | /**
|
2195 | * Compare two values of any type in a deterministic, natural way. For
|
2196 | * numeric values, the function works the same as math.compare. For
|
2197 | * types of values that can’t be compared mathematically, the function
|
2198 | * compares in a natural way.
|
2199 | * @param x First value to compare
|
2200 | * @param y Second value to compare
|
2201 | * @returns Returns the result of the comparison: 1 when x > y, -1 when
|
2202 | * x < y, and 0 when x == y.
|
2203 | */
|
2204 | // eslint-disable-next-line @typescript-eslint/no-explicit-any
|
2205 | compareNatural(x: any, y: any): number
|
2206 |
|
2207 | /**
|
2208 | * Compare two strings lexically. Comparison is case sensitive. Returns
|
2209 | * 1 when x > y, -1 when x < y, and 0 when x == y. For matrices, the
|
2210 | * function is evaluated element wise.
|
2211 | * @param x First string to compare
|
2212 | * @param y Second string to compare
|
2213 | * @returns Returns the result of the comparison: 1 when x > y, -1 when
|
2214 | * x < y, and 0 when x == y.
|
2215 | */
|
2216 | compareText(
|
2217 | x: string | MathCollection,
|
2218 | y: string | MathCollection
|
2219 | ): number | MathCollection
|
2220 |
|
2221 | /**
|
2222 | * Test element wise whether two matrices are equal. The function
|
2223 | * accepts both matrices and scalar values.
|
2224 | * @param x First matrix to compare
|
2225 | * @param y Second amtrix to compare
|
2226 | * @returns Returns true when the input matrices have the same size and
|
2227 | * each of their elements is equal.
|
2228 | */
|
2229 | deepEqual(
|
2230 | x: MathType,
|
2231 | y: MathType
|
2232 | ): number | BigNumber | Fraction | Complex | Unit | MathCollection
|
2233 |
|
2234 | /**
|
2235 | * Test whether two values are equal.
|
2236 | *
|
2237 | * The function tests whether the relative difference between x and y is
|
2238 | * smaller than the configured epsilon. The function cannot be used to
|
2239 | * compare values smaller than approximately 2.22e-16. For matrices, the
|
2240 | * function is evaluated element wise. In case of complex numbers, x.re
|
2241 | * must equal y.re, and x.im must equal y.im. Values null and undefined
|
2242 | * are compared strictly, thus null is only equal to null and nothing
|
2243 | * else, and undefined is only equal to undefined and nothing else.
|
2244 | * @param x First value to compare
|
2245 | * @param y Second value to compare
|
2246 | * @returns Returns true when the compared values are equal, else
|
2247 | * returns false
|
2248 | */
|
2249 | equal(x: MathType | string, y: MathType | string): boolean | MathCollection
|
2250 |
|
2251 | /**
|
2252 | * Check equality of two strings. Comparison is case sensitive. For
|
2253 | * matrices, the function is evaluated element wise.
|
2254 | * @param x First string to compare
|
2255 | * @param y Second string to compare
|
2256 | * @returns Returns true if the values are equal, and false if not.
|
2257 | */
|
2258 | equalText(
|
2259 | x: string | MathCollection,
|
2260 | y: string | MathCollection
|
2261 | ): number | MathCollection
|
2262 |
|
2263 | /**
|
2264 | * Test whether value x is larger than y. The function returns true when
|
2265 | * x is larger than y and the relative difference between x and y is
|
2266 | * larger than the configured epsilon. The function cannot be used to
|
2267 | * compare values smaller than approximately 2.22e-16. For matrices, the
|
2268 | * function is evaluated element wise.
|
2269 | * @param x First value to compare
|
2270 | * @param y Second value to vcompare
|
2271 | * @returns Returns true when x is larger than y, else returns false
|
2272 | */
|
2273 | larger(x: MathType | string, y: MathType | string): boolean | MathCollection
|
2274 |
|
2275 | /**
|
2276 | * Test whether value x is larger or equal to y. The function returns
|
2277 | * true when x is larger than y or the relative difference between x and
|
2278 | * y is smaller than the configured epsilon. The function cannot be used
|
2279 | * to compare values smaller than approximately 2.22e-16. For matrices,
|
2280 | * the function is evaluated element wise.
|
2281 | * @param x First value to compare
|
2282 | * @param y Second value to vcompare
|
2283 | * @returns Returns true when x is larger than or equal to y, else
|
2284 | * returns false
|
2285 | */
|
2286 | largerEq(
|
2287 | x: MathType | string,
|
2288 | y: MathType | string
|
2289 | ): boolean | MathCollection
|
2290 |
|
2291 | /**
|
2292 | * Test whether value x is smaller than y. The function returns true
|
2293 | * when x is smaller than y and the relative difference between x and y
|
2294 | * is smaller than the configured epsilon. The function cannot be used
|
2295 | * to compare values smaller than approximately 2.22e-16. For matrices,
|
2296 | * the function is evaluated element wise.
|
2297 | * @param x First value to compare
|
2298 | * @param y Second value to vcompare
|
2299 | * @returns Returns true when x is smaller than y, else returns false
|
2300 | */
|
2301 | smaller(
|
2302 | x: MathType | string,
|
2303 | y: MathType | string
|
2304 | ): boolean | MathCollection
|
2305 |
|
2306 | /**
|
2307 | * Test whether value x is smaller or equal to y. The function returns
|
2308 | * true when x is smaller than y or the relative difference between x
|
2309 | * and y is smaller than the configured epsilon. The function cannot be
|
2310 | * used to compare values smaller than approximately 2.22e-16. For
|
2311 | * matrices, the function is evaluated element wise.
|
2312 | * @param x First value to compare
|
2313 | * @param y Second value to vcompare
|
2314 | * @returns Returns true when x is smaller than or equal to y, else
|
2315 | * returns false
|
2316 | */
|
2317 | smallerEq(
|
2318 | x: MathType | string,
|
2319 | y: MathType | string
|
2320 | ): boolean | MathCollection
|
2321 |
|
2322 | /**
|
2323 | * Test whether two values are unequal. The function tests whether the
|
2324 | * relative difference between x and y is larger than the configured
|
2325 | * epsilon. The function cannot be used to compare values smaller than
|
2326 | * approximately 2.22e-16. For matrices, the function is evaluated
|
2327 | * element wise. In case of complex numbers, x.re must unequal y.re, or
|
2328 | * x.im must unequal y.im. Values null and undefined are compared
|
2329 | * strictly, thus null is unequal with everything except null, and
|
2330 | * undefined is unequal with everything except undefined.
|
2331 | * @param x First value to compare
|
2332 | * @param y Second value to vcompare
|
2333 | * @returns Returns true when the compared values are unequal, else
|
2334 | * returns false
|
2335 | */
|
2336 | unequal(
|
2337 | x: MathType | string,
|
2338 | y: MathType | string
|
2339 | ): boolean | MathCollection
|
2340 |
|
2341 | /*************************************************************************
|
2342 | * Set functions
|
2343 | ************************************************************************/
|
2344 |
|
2345 | /**
|
2346 | * Create the cartesian product of two (multi)sets. Multi-dimension
|
2347 | * arrays will be converted to single-dimension arrays and the values
|
2348 | * will be sorted in ascending order before the operation.
|
2349 | * @param a1 A (multi)set
|
2350 | * @param a2 A (multi)set
|
2351 | * @returns The cartesian product of two (multi)sets
|
2352 | */
|
2353 | setCartesian<T extends MathCollection>(a1: T, a2: MathCollection): T
|
2354 |
|
2355 | /**
|
2356 | * Create the difference of two (multi)sets: every element of set1, that
|
2357 | * is not the element of set2. Multi-dimension arrays will be converted
|
2358 | * to single-dimension arrays before the operation
|
2359 | * @param a1 A (multi)set
|
2360 | * @param a2 A (multi)set
|
2361 | * @returns The difference of two (multi)sets
|
2362 | */
|
2363 | setDifference<T extends MathCollection>(a1: T, a2: MathCollection): T
|
2364 |
|
2365 | /**
|
2366 | * Collect the distinct elements of a multiset. A multi-dimension array
|
2367 | * will be converted to a single-dimension array before the operation.
|
2368 | * @param a A multiset
|
2369 | * @returns A set containing the distinct elements of the multiset
|
2370 | */
|
2371 | setDistinct<T extends MathCollection>(a: T): T
|
2372 |
|
2373 | /**
|
2374 | * Create the intersection of two (multi)sets. Multi-dimension arrays
|
2375 | * will be converted to single-dimension arrays before the operation.
|
2376 | * @param a1 A (multi)set
|
2377 | * @param a2 A (multi)set
|
2378 | * @returns The intersection of two (multi)sets
|
2379 | */
|
2380 | setIntersect<T extends MathCollection>(a1: T, a2: MathCollection): T
|
2381 |
|
2382 | /**
|
2383 | * Check whether a (multi)set is a subset of another (multi)set. (Every
|
2384 | * element of set1 is the element of set2.) Multi-dimension arrays will
|
2385 | * be converted to single-dimension arrays before the operation.
|
2386 | * @param a1 A (multi)set
|
2387 | * @param a2 A (multi)set
|
2388 | * @returns True if a1 is subset of a2, else false
|
2389 | */
|
2390 | setIsSubset(a1: MathCollection, a2: MathCollection): boolean
|
2391 |
|
2392 | /**
|
2393 | * Count the multiplicity of an element in a multiset. A multi-dimension
|
2394 | * array will be converted to a single-dimension array before the
|
2395 | * operation.
|
2396 | * @param e An element in the multiset
|
2397 | * @param a A multiset
|
2398 | * @returns The number of how many times the multiset contains the
|
2399 | * element
|
2400 | */
|
2401 | setMultiplicity(
|
2402 | e: number | BigNumber | Fraction | Complex,
|
2403 | a: MathCollection
|
2404 | ): number
|
2405 |
|
2406 | /**
|
2407 | * Create the powerset of a (multi)set. (The powerset contains very
|
2408 | * possible subsets of a (multi)set.) A multi-dimension array will be
|
2409 | * converted to a single-dimension array before the operation.
|
2410 | * @param a A multiset
|
2411 | * @returns The powerset of the (multi)set
|
2412 | */
|
2413 | setPowerset<T extends MathCollection>(a: T): T
|
2414 |
|
2415 | /**
|
2416 | * Count the number of elements of a (multi)set. When a second parameter
|
2417 | * is ‘true’, count only the unique values. A multi-dimension array will
|
2418 | * be converted to a single-dimension array before the operation.
|
2419 | * @param a A multiset
|
2420 | * @returns The number of elements of the (multi)set
|
2421 | */
|
2422 | setSize(a: MathCollection): number
|
2423 |
|
2424 | /**
|
2425 | * Create the symmetric difference of two (multi)sets. Multi-dimension
|
2426 | * arrays will be converted to single-dimension arrays before the
|
2427 | * operation.
|
2428 | * @param a1 A (multi)set
|
2429 | * @param a2 A (multi)set
|
2430 | * @returns The symmetric difference of two (multi)sets
|
2431 | */
|
2432 | setSymDifference<T extends MathCollection>(a1: T, a2: MathCollection): T
|
2433 |
|
2434 | /**
|
2435 | * Create the union of two (multi)sets. Multi-dimension arrays will be
|
2436 | * converted to single-dimension arrays before the operation.
|
2437 | * @param a1 A (multi)set
|
2438 | * @param a2 A (multi)set
|
2439 | * @returns The union of two (multi)sets
|
2440 | */
|
2441 | setUnion<T extends MathCollection>(a1: T, a2: MathCollection): T
|
2442 |
|
2443 | /*************************************************************************
|
2444 | * Special functions
|
2445 | ************************************************************************/
|
2446 |
|
2447 | /**
|
2448 | * Compute the erf function of a value using a rational Chebyshev
|
2449 | * approximations for different intervals of x.
|
2450 | * @param x A real number
|
2451 | * @returns The erf of x
|
2452 | */
|
2453 | erf<T extends number | MathCollection>(x: T): NoLiteralType<T>
|
2454 |
|
2455 | /*************************************************************************
|
2456 | * Statistics functions
|
2457 | ************************************************************************/
|
2458 |
|
2459 | /**
|
2460 | * Compute the median absolute deviation of a matrix or a list with
|
2461 | * values. The median absolute deviation is defined as the median of the
|
2462 | * absolute deviations from the median.
|
2463 | * @param array A single matrix or multiple scalar values.
|
2464 | * @returns The median absolute deviation
|
2465 | */
|
2466 | // eslint-disable-next-line @typescript-eslint/no-explicit-any
|
2467 | mad(array: MathCollection): any
|
2468 |
|
2469 | /**
|
2470 | * Compute the maximum value of a matrix or a list with values. In case
|
2471 | * of a multi dimensional array, the maximum of the flattened array will
|
2472 | * be calculated. When dim is provided, the maximum over the selected
|
2473 | * dimension will be calculated. Parameter dim is zero-based.
|
2474 | * @param args A single matrix or multiple scalar values
|
2475 | * @returns The maximum value
|
2476 | */
|
2477 | // eslint-disable-next-line @typescript-eslint/no-explicit-any
|
2478 | max(...args: MathType[]): any
|
2479 | /**
|
2480 | * @param A A single matrix
|
2481 | * @param dim The maximum over the selected dimension
|
2482 | * @returns The maximum value
|
2483 | */
|
2484 | // eslint-disable-next-line @typescript-eslint/no-explicit-any
|
2485 | max(A: MathCollection, dim?: number): any
|
2486 |
|
2487 | /**
|
2488 | * Compute the mean value of matrix or a list with values. In case of a
|
2489 | * multi dimensional array, the mean of the flattened array will be
|
2490 | * calculated. When dim is provided, the maximum over the selected
|
2491 | * dimension will be calculated. Parameter dim is zero-based.
|
2492 | * @param args A single matrix or multiple scalar values
|
2493 | * @returns The mean of all values
|
2494 | */
|
2495 | // eslint-disable-next-line @typescript-eslint/no-explicit-any
|
2496 | mean(...args: MathType[]): any
|
2497 | /**
|
2498 | * @param A A single matrix
|
2499 | * @param dim The mean over the selected dimension
|
2500 | * @returns The mean of all values
|
2501 | */
|
2502 | // eslint-disable-next-line @typescript-eslint/no-explicit-any
|
2503 | mean(A: MathCollection, dim?: number): any
|
2504 |
|
2505 | /**
|
2506 | * Compute the median of a matrix or a list with values. The values are
|
2507 | * sorted and the middle value is returned. In case of an even number of
|
2508 | * values, the average of the two middle values is returned. Supported
|
2509 | * types of values are: Number, BigNumber, Unit In case of a (multi
|
2510 | * dimensional) array or matrix, the median of all elements will be
|
2511 | * calculated.
|
2512 | * @param args A single matrix or or multiple scalar values
|
2513 | * @returns The median
|
2514 | */
|
2515 | // eslint-disable-next-line @typescript-eslint/no-explicit-any
|
2516 | median(...args: MathType[]): any
|
2517 |
|
2518 | /**
|
2519 | * Compute the maximum value of a matrix or a list of values. In case of
|
2520 | * a multi dimensional array, the maximum of the flattened array will be
|
2521 | * calculated. When dim is provided, the maximum over the selected
|
2522 | * dimension will be calculated. Parameter dim is zero-based.
|
2523 | * @param args A single matrix or or multiple scalar values
|
2524 | * @returns The minimum value
|
2525 | */
|
2526 | // eslint-disable-next-line @typescript-eslint/no-explicit-any
|
2527 | min(...args: MathType[]): any
|
2528 | /**
|
2529 | * @param A A single matrix
|
2530 | * @param dim The minimum over the selected dimension
|
2531 | * @returns The minimum value
|
2532 | */
|
2533 | // eslint-disable-next-line @typescript-eslint/no-explicit-any
|
2534 | min(A: MathCollection, dim?: number): any
|
2535 |
|
2536 | /**
|
2537 | * Computes the mode of a set of numbers or a list with values(numbers
|
2538 | * or characters). If there are more than one modes, it returns a list
|
2539 | * of those values.
|
2540 | * @param args A single matrix
|
2541 | * @returns The mode of all values
|
2542 | */
|
2543 | // eslint-disable-next-line @typescript-eslint/no-explicit-any
|
2544 | mode(...args: MathType[]): any
|
2545 |
|
2546 | /**
|
2547 | * Compute the product of a matrix or a list with values. In case of a
|
2548 | * (multi dimensional) array or matrix, the sum of all elements will be
|
2549 | * calculated.
|
2550 | * @param args A single matrix or multiple scalar values
|
2551 | * @returns The product of all values
|
2552 | */
|
2553 | // eslint-disable-next-line @typescript-eslint/no-explicit-any
|
2554 | prod(...args: MathType[]): any
|
2555 |
|
2556 | /**
|
2557 | * Compute the prob order quantile of a matrix or a list with values.
|
2558 | * The sequence is sorted and the middle value is returned. Supported
|
2559 | * types of sequence values are: Number, BigNumber, Unit Supported types
|
2560 | * of probability are: Number, BigNumber In case of a (multi
|
2561 | * dimensional) array or matrix, the prob order quantile of all elements
|
2562 | * will be calculated.
|
2563 | * @param A A single matrix or array
|
2564 | * @param probOrN prob is the order of the quantile, while N is the
|
2565 | * amount of evenly distributed steps of probabilities; only one of
|
2566 | * these options can be provided
|
2567 | * @param sorted =false is data sorted in ascending order
|
2568 | * @returns Quantile(s)
|
2569 | */
|
2570 | quantileSeq(
|
2571 | A: MathCollection,
|
2572 | prob: number | BigNumber | MathArray,
|
2573 | sorted?: boolean
|
2574 | ): number | BigNumber | Unit | MathArray
|
2575 |
|
2576 | /**
|
2577 | * Compute the standard deviation of a matrix or a list with values. The
|
2578 | * standard deviations is defined as the square root of the variance:
|
2579 | * std(A) = sqrt(variance(A)). In case of a (multi dimensional) array or
|
2580 | * matrix, the standard deviation over all elements will be calculated.
|
2581 | * Optionally, the type of normalization can be specified as second
|
2582 | * parameter. The parameter normalization can be one of the following
|
2583 | * values: 'unbiased' (default) The sum of squared errors is divided by
|
2584 | * (n - 1) 'uncorrected' The sum of squared errors is divided by n
|
2585 | * 'biased' The sum of squared errors is divided by (n + 1)
|
2586 | * @param a variadic argument of number to calculate standard deviation
|
2587 | * @returns The standard deviation array
|
2588 | */
|
2589 | std(...values: number[]): number
|
2590 | /**
|
2591 | * Compute the standard deviation of a matrix or a list with values. The
|
2592 | * standard deviations is defined as the square root of the variance:
|
2593 | * std(A) = sqrt(variance(A)). In case of a (multi dimensional) array or
|
2594 | * matrix, the standard deviation over all elements will be calculated.
|
2595 | * Optionally, the type of normalization can be specified as second
|
2596 | * parameter. The parameter normalization can be one of the following
|
2597 | * values: 'unbiased' (default) The sum of squared errors is divided by
|
2598 | * (n - 1) 'uncorrected' The sum of squared errors is divided by n
|
2599 | * 'biased' The sum of squared errors is divided by (n + 1)
|
2600 | * @param array A single matrix to compute standard deviation.
|
2601 | * @param dimension A dimension to calculate standard deviation
|
2602 | * @param normalization Determines how to normalize the variance. Choose
|
2603 | * ‘unbiased’ (default), ‘uncorrected’, or ‘biased’. Default value:
|
2604 | * ‘unbiased’.
|
2605 | * @returns The standard deviation array
|
2606 | */
|
2607 | std(
|
2608 | array: MathCollection,
|
2609 | dimension?: number,
|
2610 | normalization?: 'unbiased' | 'uncorrected' | 'biased'
|
2611 | ): number[]
|
2612 | /**
|
2613 | * Compute the standard deviation of a matrix or a list with values. The
|
2614 | * standard deviations is defined as the square root of the variance:
|
2615 | * std(A) = sqrt(variance(A)). In case of a (multi dimensional) array or
|
2616 | * matrix, the standard deviation over all elements will be calculated.
|
2617 | * Optionally, the type of normalization can be specified as second
|
2618 | * parameter. The parameter normalization can be one of the following
|
2619 | * values: 'unbiased' (default) The sum of squared errors is divided by
|
2620 | * (n - 1) 'uncorrected' The sum of squared errors is divided by n
|
2621 | * 'biased' The sum of squared errors is divided by (n + 1)
|
2622 | * @param array A single matrix or multiple scalar values
|
2623 | * @param normalization Determines how to normalize the variance. Choose
|
2624 | * ‘unbiased’ (default), ‘uncorrected’, or ‘biased’. Default value:
|
2625 | * ‘unbiased’.
|
2626 | * @returns The standard deviation
|
2627 | */
|
2628 | std(
|
2629 | array: MathCollection,
|
2630 | normalization: 'unbiased' | 'uncorrected' | 'biased'
|
2631 | ): number
|
2632 |
|
2633 | /**
|
2634 | * Compute the sum of a matrix or a list with values. In case of a
|
2635 | * (multi dimensional) array or matrix, the sum of all elements will be
|
2636 | * calculated.
|
2637 | * @param args A single matrix or multiple scalar values
|
2638 | * @returns The sum of all values
|
2639 | */
|
2640 | // eslint-disable-next-line @typescript-eslint/no-explicit-any
|
2641 | sum(...args: Array<number | BigNumber | Fraction>): any
|
2642 | /**
|
2643 | * @param array A single matrix
|
2644 | * @returns The sum of all values
|
2645 | */
|
2646 | // eslint-disable-next-line @typescript-eslint/no-explicit-any
|
2647 | sum(array: MathCollection): any
|
2648 |
|
2649 | /**
|
2650 | * Compute the cumulative sum of a matrix or a list with values.
|
2651 | * In case of a (multi dimensional) array or matrix, the cumulative sums
|
2652 | * along a specified dimension (defaulting to the first) will be calculated.
|
2653 | * @param args A single matrix or multiple scalar values
|
2654 | * @returns The cumulative sums of the the values.
|
2655 | */
|
2656 | cumsum(...args: MathType[]): MathType[]
|
2657 | /**
|
2658 | * @param array A single matrix
|
2659 | * @param dim The dimension along which to sum (defaults to 0)
|
2660 | * @returns The cumulative sums along the given dimension
|
2661 | */
|
2662 | cumsum(array: MathCollection, dim?: number): MathCollection
|
2663 |
|
2664 | /**
|
2665 | * Compute the variance of a matrix or a list with values. In case of a
|
2666 | * (multi dimensional) array or matrix, the variance over all elements
|
2667 | * will be calculated. Optionally, the type of normalization can be
|
2668 | * specified as second parameter. The parameter normalization can be one
|
2669 | * of the following values: 'unbiased' (default) The sum of squared
|
2670 | * errors is divided by (n - 1) 'uncorrected' The sum of squared errors
|
2671 | * is divided by n 'biased' The sum of squared errors is divided by (n +
|
2672 | * 1) Note that older browser may not like the variable name var. In
|
2673 | * that case, the function can be called as math['var'](...) instead of
|
2674 | * math.variance(...).
|
2675 | * @param args A single matrix or multiple scalar values
|
2676 | * @returns The variance
|
2677 | */
|
2678 | variance(...args: Array<number | BigNumber | Fraction>): number
|
2679 |
|
2680 | /**
|
2681 | * Compute the variance of a matrix or a list with values. In case of a
|
2682 | * (multi dimensional) array or matrix, the variance over all elements
|
2683 | * will be calculated. Optionally, the type of normalization can be
|
2684 | * specified as second parameter. The parameter normalization can be one
|
2685 | * of the following values: 'unbiased' (default) The sum of squared
|
2686 | * errors is divided by (n - 1) 'uncorrected' The sum of squared errors
|
2687 | * is divided by n 'biased' The sum of squared errors is divided by (n +
|
2688 | * 1) Note that older browser may not like the variable name var. In
|
2689 | * that case, the function can be called as math['var'](...) instead of
|
2690 | * math.variance(...).
|
2691 | * @param array A matrix to compute variance.
|
2692 | * @param dimension A dimension to compute variance on
|
2693 | * @param normalization normalization Determines how to normalize the
|
2694 | * variance. Choose ‘unbiased’ (default), ‘uncorrected’, or ‘biased’.
|
2695 | * Default value: ‘unbiased’.
|
2696 | * @returns variance matrix.
|
2697 | */
|
2698 | variance(
|
2699 | array: MathCollection,
|
2700 | dimension?: number,
|
2701 | normalization?: 'unbiased' | 'uncorrected' | 'biased'
|
2702 | ): number[]
|
2703 | /**
|
2704 | * @param array A single matrix
|
2705 | * @param normalization normalization Determines how to normalize the
|
2706 | * variance. Choose ‘unbiased’ (default), ‘uncorrected’, or ‘biased’.
|
2707 | * Default value: ‘unbiased’.
|
2708 | * @returns The variance
|
2709 | */
|
2710 | variance(
|
2711 | array: MathCollection,
|
2712 | normalization: 'unbiased' | 'uncorrected' | 'biased'
|
2713 | ): number
|
2714 |
|
2715 | /*************************************************************************
|
2716 | * String functions
|
2717 | ************************************************************************/
|
2718 |
|
2719 | /**
|
2720 | * Format a value of any type into a string.
|
2721 | * @param value The value to be formatted
|
2722 | * @param options An object with formatting options.
|
2723 | * @param callback A custom formatting function, invoked for all numeric
|
2724 | * elements in value, for example all elements of a matrix, or the real
|
2725 | * and imaginary parts of a complex number. This callback can be used to
|
2726 | * override the built-in numeric notation with any type of formatting.
|
2727 | * Function callback is called with value as parameter and must return a
|
2728 | * string.
|
2729 | * @see http://mathjs.org/docs/reference/functions/format.html
|
2730 | * @returns The formatted value
|
2731 | */
|
2732 | format(
|
2733 |
|
2734 | value: any,
|
2735 |
|
2736 | options?: FormatOptions | number | ((item: any) => string),
|
2737 |
|
2738 | callback?: (value: any) => string
|
2739 | ): string
|
2740 |
|
2741 | /**
|
2742 | * Interpolate values into a string template.
|
2743 | * @param template A string containing variable placeholders.
|
2744 | * @param values An object containing variables which will be filled in
|
2745 | * in the template.
|
2746 | * @param precision Number of digits to format numbers. If not provided,
|
2747 | * the value will not be rounded.
|
2748 | * @param options Formatting options, or the number of digits to format
|
2749 | * numbers. See function math.format for a description of all options.
|
2750 | * @returns Interpolated string
|
2751 | */
|
2752 | print(
|
2753 | template: string,
|
2754 |
|
2755 | values: any,
|
2756 | precision?: number,
|
2757 | options?: number | object
|
2758 | ): void
|
2759 |
|
2760 | /*************************************************************************
|
2761 | * Trigonometry functions
|
2762 | ************************************************************************/
|
2763 |
|
2764 | /**
|
2765 | * Calculate the inverse cosine of a value. For matrices, the function
|
2766 | * is evaluated element wise.
|
2767 | * @param x Function input
|
2768 | * @returns The arc cosine of x
|
2769 | */
|
2770 | acos(x: number): number
|
2771 | acos(x: BigNumber): BigNumber
|
2772 | acos(x: Complex): Complex
|
2773 | acos(x: MathArray): MathArray
|
2774 | acos(x: Matrix): Matrix
|
2775 |
|
2776 | /**
|
2777 | * Calculate the hyperbolic arccos of a value, defined as acosh(x) =
|
2778 | * ln(sqrt(x^2 - 1) + x). For matrices, the function is evaluated
|
2779 | * element wise.
|
2780 | * @param x Function input
|
2781 | * @returns The hyperbolic arccosine of x
|
2782 | */
|
2783 | acosh(x: number): number
|
2784 | acosh(x: BigNumber): BigNumber
|
2785 | acosh(x: Complex): Complex
|
2786 | acosh(x: MathArray): MathArray
|
2787 | acosh(x: Matrix): Matrix
|
2788 |
|
2789 | /**
|
2790 | * Calculate the inverse cotangent of a value. For matrices, the
|
2791 | * function is evaluated element wise.
|
2792 | * @param x Function input
|
2793 | * @returns The arc cotangent of x
|
2794 | */
|
2795 | acot(x: number): number
|
2796 | acot(x: BigNumber): BigNumber
|
2797 | acot(x: MathArray): MathArray
|
2798 | acot(x: Matrix): Matrix
|
2799 |
|
2800 | /**
|
2801 | * Calculate the hyperbolic arccotangent of a value, defined as acoth(x)
|
2802 | * = (ln((x+1)/x) + ln(x/(x-1))) / 2. For matrices, the function is
|
2803 | * evaluated element wise.
|
2804 | * @param x Function input
|
2805 | * @returns The hyperbolic arccotangent of x
|
2806 | */
|
2807 | acoth(x: number): number
|
2808 | acoth(x: BigNumber): BigNumber
|
2809 | acoth(x: MathArray): MathArray
|
2810 | acoth(x: Matrix): Matrix
|
2811 |
|
2812 | /**
|
2813 | * Calculate the inverse cosecant of a value. For matrices, the function
|
2814 | * is evaluated element wise.
|
2815 | * @param x Function input
|
2816 | * @returns The arc cosecant of x
|
2817 | */
|
2818 | acsc(x: number): number
|
2819 | acsc(x: BigNumber): BigNumber
|
2820 | acsc(x: MathArray): MathArray
|
2821 | acsc(x: Matrix): Matrix
|
2822 |
|
2823 | /**
|
2824 | * Calculate the hyperbolic arccosecant of a value, defined as acsch(x)
|
2825 | * = ln(1/x + sqrt(1/x^2 + 1)). For matrices, the function is evaluated
|
2826 | * element wise.
|
2827 | * @param x Function input
|
2828 | * @returns The hyperbolic arccosecant of x
|
2829 | */
|
2830 | acsch(x: number): number
|
2831 | acsch(x: BigNumber): BigNumber
|
2832 | acsch(x: MathArray): MathArray
|
2833 | acsch(x: Matrix): Matrix
|
2834 |
|
2835 | /**
|
2836 | * Calculate the inverse secant of a value. For matrices, the function
|
2837 | * is evaluated element wise.
|
2838 | * @param x Function input
|
2839 | * @returns The arc secant of x
|
2840 | */
|
2841 | asec(x: number): number
|
2842 | asec(x: BigNumber): BigNumber
|
2843 | asec(x: MathArray): MathArray
|
2844 | asec(x: Matrix): Matrix
|
2845 |
|
2846 | /**
|
2847 | * Calculate the hyperbolic arcsecant of a value, defined as asech(x) =
|
2848 | * ln(sqrt(1/x^2 - 1) + 1/x). For matrices, the function is evaluated
|
2849 | * element wise.
|
2850 | * @param x Function input
|
2851 | * @returns The hyperbolic arcsecant of x
|
2852 | */
|
2853 | asech(x: number): number
|
2854 | asech(x: BigNumber): BigNumber
|
2855 | asech(x: MathArray): MathArray
|
2856 | asech(x: Matrix): Matrix
|
2857 |
|
2858 | /**
|
2859 | * Calculate the inverse sine of a value. For matrices, the function is
|
2860 | * evaluated element wise.
|
2861 | * @param x Function input
|
2862 | * @returns The arc sine of x
|
2863 | */
|
2864 | asin(x: number): number
|
2865 | asin(x: BigNumber): BigNumber
|
2866 | asin(x: Complex): Complex
|
2867 | asin(x: MathArray): MathArray
|
2868 | asin(x: Matrix): Matrix
|
2869 |
|
2870 | /**
|
2871 | * Calculate the hyperbolic arcsine of a value, defined as asinh(x) =
|
2872 | * ln(x + sqrt(x^2 + 1)). For matrices, the function is evaluated
|
2873 | * element wise.
|
2874 | * @param x Function input
|
2875 | * @returns The hyperbolic arcsine of x
|
2876 | */
|
2877 | asinh(x: number): number
|
2878 | asinh(x: BigNumber): BigNumber
|
2879 | asinh(x: MathArray): MathArray
|
2880 | asinh(x: Matrix): Matrix
|
2881 |
|
2882 | /**
|
2883 | * Calculate the inverse tangent of a value. For matrices, the function
|
2884 | * is evaluated element wise.
|
2885 | * @param x Function input
|
2886 | * @returns The arc tangent of x
|
2887 | */
|
2888 | atan(x: number): number
|
2889 | atan(x: BigNumber): BigNumber
|
2890 | atan(x: MathArray): MathArray
|
2891 | atan(x: Matrix): Matrix
|
2892 |
|
2893 | /**
|
2894 | * Calculate the inverse tangent function with two arguments, y/x. By
|
2895 | * providing two arguments, the right quadrant of the computed angle can
|
2896 | * be determined. For matrices, the function is evaluated element wise.
|
2897 | * @param x Function input
|
2898 | * @returns Four quadrant inverse tangent
|
2899 | */
|
2900 | atan2(y: number, x: number): number
|
2901 | atan2(y: MathCollection, x: MathCollection): MathCollection
|
2902 |
|
2903 | /**
|
2904 | * Calculate the hyperbolic arctangent of a value, defined as atanh(x) =
|
2905 | * ln((1 + x)/(1 - x)) / 2. For matrices, the function is evaluated
|
2906 | * element wise.
|
2907 | * @param x Function input
|
2908 | * @returns The hyperbolic arctangent of x
|
2909 | */
|
2910 | atanh(x: number): number
|
2911 | atanh(x: BigNumber): BigNumber
|
2912 | atanh(x: MathArray): MathArray
|
2913 | atanh(x: Matrix): Matrix
|
2914 |
|
2915 | /**
|
2916 | * Calculate the cosine of a value. For matrices, the function is
|
2917 | * evaluated element wise.
|
2918 | * @param x Function input
|
2919 | * @returns The cosine of x
|
2920 | */
|
2921 | cos(x: number | Unit): number
|
2922 | cos(x: BigNumber): BigNumber
|
2923 | cos(x: Complex): Complex
|
2924 | cos(x: MathArray): MathArray
|
2925 | cos(x: Matrix): Matrix
|
2926 |
|
2927 | /**
|
2928 | * Calculate the hyperbolic cosine of a value, defined as cosh(x) = 1/2
|
2929 | * * (exp(x) + exp(-x)). For matrices, the function is evaluated element
|
2930 | * wise.
|
2931 | * @param x Function input
|
2932 | * @returns The hyperbolic cosine of x
|
2933 | */
|
2934 | cosh(x: number | Unit): number
|
2935 | cosh(x: BigNumber): BigNumber
|
2936 | cosh(x: Complex): Complex
|
2937 | cosh(x: MathArray): MathArray
|
2938 | cosh(x: Matrix): Matrix
|
2939 |
|
2940 | /**
|
2941 | * Calculate the cotangent of a value. cot(x) is defined as 1 / tan(x).
|
2942 | * For matrices, the function is evaluated element wise.
|
2943 | * @param x Function input
|
2944 | * @returns The cotangent of x
|
2945 | */
|
2946 | cot(x: number | Unit): number
|
2947 | cot(x: Complex): Complex
|
2948 | cot(x: MathArray): MathArray
|
2949 | cot(x: Matrix): Matrix
|
2950 |
|
2951 | /**
|
2952 | * Calculate the hyperbolic cotangent of a value, defined as coth(x) = 1
|
2953 | * / tanh(x). For matrices, the function is evaluated element wise.
|
2954 | * @param x Function input
|
2955 | * @returns The hyperbolic cotangent of x
|
2956 | */
|
2957 | coth(x: number | Unit): number
|
2958 | coth(x: Complex): Complex
|
2959 | coth(x: MathArray): MathArray
|
2960 | coth(x: Matrix): Matrix
|
2961 |
|
2962 | /**
|
2963 | * Calculate the cosecant of a value, defined as csc(x) = 1/sin(x). For
|
2964 | * matrices, the function is evaluated element wise.
|
2965 | * @param x Function input
|
2966 | * @returns The cosecant hof x
|
2967 | */
|
2968 | csc(x: number | Unit): number
|
2969 | csc(x: Complex): Complex
|
2970 | csc(x: MathArray): MathArray
|
2971 | csc(x: Matrix): Matrix
|
2972 |
|
2973 | /**
|
2974 | * Calculate the hyperbolic cosecant of a value, defined as csch(x) = 1
|
2975 | * / sinh(x). For matrices, the function is evaluated element wise.
|
2976 | * @param x Function input
|
2977 | * @returns The hyperbolic cosecant of x
|
2978 | */
|
2979 | csch(x: number | Unit): number
|
2980 | csch(x: Complex): Complex
|
2981 | csch(x: MathArray): MathArray
|
2982 | csch(x: Matrix): Matrix
|
2983 |
|
2984 | /**
|
2985 | * Calculate the secant of a value, defined as sec(x) = 1/cos(x). For
|
2986 | * matrices, the function is evaluated element wise.
|
2987 | * @param x Function input
|
2988 | * @returns The secant of x
|
2989 | */
|
2990 | sec(x: number | Unit): number
|
2991 | sec(x: Complex): Complex
|
2992 | sec(x: MathArray): MathArray
|
2993 | sec(x: Matrix): Matrix
|
2994 |
|
2995 | /**
|
2996 | * Calculate the hyperbolic secant of a value, defined as sech(x) = 1 /
|
2997 | * cosh(x). For matrices, the function is evaluated element wise.
|
2998 | * @param x Function input
|
2999 | * @returns The hyperbolic secant of x
|
3000 | */
|
3001 | sech(x: number | Unit): number
|
3002 | sech(x: Complex): Complex
|
3003 | sech(x: MathArray): MathArray
|
3004 | sech(x: Matrix): Matrix
|
3005 |
|
3006 | /**
|
3007 | * Calculate the sine of a value. For matrices, the function is
|
3008 | * evaluated element wise.
|
3009 | * @param x Function input
|
3010 | * @returns The sine of x
|
3011 | */
|
3012 | sin(x: number | Unit): number
|
3013 | sin(x: BigNumber): BigNumber
|
3014 | sin(x: Complex): Complex
|
3015 | sin(x: MathArray): MathArray
|
3016 | sin(x: Matrix): Matrix
|
3017 |
|
3018 | /**
|
3019 | * Calculate the hyperbolic sine of a value, defined as sinh(x) = 1/2 *
|
3020 | * (exp(x) - exp(-x)). For matrices, the function is evaluated element
|
3021 | * wise.
|
3022 | * @param x Function input
|
3023 | * @returns The hyperbolic sine of x
|
3024 | */
|
3025 | sinh(x: number | Unit): number
|
3026 | sinh(x: BigNumber): BigNumber
|
3027 | sinh(x: Complex): Complex
|
3028 | sinh(x: MathArray): MathArray
|
3029 | sinh(x: Matrix): Matrix
|
3030 |
|
3031 | /**
|
3032 | * Calculate the tangent of a value. tan(x) is equal to sin(x) / cos(x).
|
3033 | * For matrices, the function is evaluated element wise.
|
3034 | * @param x Function input
|
3035 | * @returns The tangent of x
|
3036 | */
|
3037 | tan(x: number | Unit): number
|
3038 | tan(x: BigNumber): BigNumber
|
3039 | tan(x: Complex): Complex
|
3040 | tan(x: MathArray): MathArray
|
3041 | tan(x: Matrix): Matrix
|
3042 |
|
3043 | /**
|
3044 | * Calculate the hyperbolic tangent of a value, defined as tanh(x) =
|
3045 | * (exp(2 * x) - 1) / (exp(2 * x) + 1). For matrices, the function is
|
3046 | * evaluated element wise.
|
3047 | * @param x Function input
|
3048 | * @returns The hyperbolic tangent of x
|
3049 | */
|
3050 | tanh(x: number | Unit): number
|
3051 | tanh(x: BigNumber): BigNumber
|
3052 | tanh(x: Complex): Complex
|
3053 | tanh(x: MathArray): MathArray
|
3054 | tanh(x: Matrix): Matrix
|
3055 |
|
3056 | /*************************************************************************
|
3057 | * Unit functions
|
3058 | ************************************************************************/
|
3059 |
|
3060 | /**
|
3061 | * Change the unit of a value. For matrices, the function is evaluated
|
3062 | * element wise.
|
3063 | * @param x The unit to be converted.
|
3064 | * @param unit New unit. Can be a string like "cm" or a unit without
|
3065 | * value.
|
3066 | * @returns Value with changed, fixed unit
|
3067 | */
|
3068 | to(x: Unit | MathCollection, unit: Unit | string): Unit | MathCollection
|
3069 |
|
3070 | /*************************************************************************
|
3071 | * Utils
|
3072 | ************************************************************************/
|
3073 | isNumber(x: unknown): x is number
|
3074 |
|
3075 | isBigNumber(x: unknown): x is BigNumber
|
3076 |
|
3077 | isComplex(x: unknown): x is Complex
|
3078 |
|
3079 | isFraction(x: unknown): x is Fraction
|
3080 |
|
3081 | isUnit(x: unknown): x is Unit
|
3082 |
|
3083 | isString(x: unknown): x is string
|
3084 |
|
3085 | isArray: ArrayConstructor['isArray']
|
3086 |
|
3087 | isMatrix(x: unknown): x is Matrix
|
3088 |
|
3089 | // eslint-disable-next-line @typescript-eslint/no-explicit-any
|
3090 | isCollection(x: unknown): x is Matrix | any[]
|
3091 |
|
3092 | isDenseMatrix(x: unknown): x is Matrix
|
3093 |
|
3094 | isSparseMatrix(x: unknown): x is Matrix
|
3095 |
|
3096 | isRange(x: unknown): boolean
|
3097 |
|
3098 | isIndex(x: unknown): x is Index
|
3099 |
|
3100 | isBoolean(x: unknown): x is boolean
|
3101 |
|
3102 | isResultSet(x: unknown): boolean
|
3103 |
|
3104 | isHelp(x: unknown): x is Help
|
3105 |
|
3106 | isFunction(x: unknown): boolean
|
3107 |
|
3108 | isDate(x: unknown): x is Date
|
3109 |
|
3110 | isRegExp(x: unknown): x is RegExp
|
3111 |
|
3112 | isObject(x: unknown): boolean
|
3113 |
|
3114 | isNull(x: unknown): x is null
|
3115 |
|
3116 | isUndefined(x: unknown): x is undefined
|
3117 |
|
3118 | isAccessorNode(x: unknown): x is AccessorNode
|
3119 |
|
3120 | isArrayNode(x: unknown): x is ArrayNode
|
3121 |
|
3122 | isAssignmentNode(x: unknown): x is AssignmentNode
|
3123 |
|
3124 | isBlockNode(x: unknown): x is BlockNode
|
3125 |
|
3126 | isConditionalNode(x: unknown): x is ConditionalNode
|
3127 |
|
3128 | isConstantNode(x: unknown): x is ConstantNode
|
3129 |
|
3130 | isFunctionAssignmentNode(x: unknown): x is FunctionAssignmentNode
|
3131 |
|
3132 | isFunctionNode(x: unknown): x is FunctionNode
|
3133 |
|
3134 | isIndexNode(x: unknown): x is IndexNode
|
3135 |
|
3136 | isNode(x: unknown): x is MathNodeCommon
|
3137 |
|
3138 | isObjectNode(x: unknown): x is ObjectNode
|
3139 |
|
3140 | isOperatorNode(
|
3141 | x: unknown
|
3142 | ): x is OperatorNode<OperatorNodeOp, OperatorNodeFn>
|
3143 |
|
3144 | isParenthesisNode(x: unknown): x is ParenthesisNode
|
3145 |
|
3146 | isRangeNode(x: unknown): x is RangeNode
|
3147 |
|
3148 | isSymbolNode(x: unknown): x is SymbolNode
|
3149 |
|
3150 | isChain(x: unknown): x is MathJsChain<unknown>
|
3151 |
|
3152 | /*************************************************************************
|
3153 | * Functions -> Utils
|
3154 | ************************************************************************/
|
3155 |
|
3156 | /**
|
3157 | * Clone an object.
|
3158 | * @param x Object to be cloned
|
3159 | * @returns A clone of object x
|
3160 | */
|
3161 | // eslint-disable-next-line @typescript-eslint/no-explicit-any
|
3162 | clone<TType>(x: TType): TType
|
3163 |
|
3164 | /**
|
3165 | * Test whether a value is an numeric value. In case of a string,
|
3166 | * true is returned if the string contains a numeric value.
|
3167 | * @param x Value to be tested
|
3168 | * @returns Returns true when x is a number, BigNumber, Fraction, Boolean, or a String containing number.
|
3169 | * Returns false for other types.
|
3170 | * Throws an error in case of unknown types.
|
3171 | */
|
3172 | // eslint-disable-next-line @typescript-eslint/no-explicit-any
|
3173 | hasNumericValue(x: any): boolean | boolean[]
|
3174 |
|
3175 | /**
|
3176 | * Test whether a value is an integer number. The function supports
|
3177 | * number, BigNumber, and Fraction. The function is evaluated
|
3178 | * element-wise in case of Array or Matrix input.
|
3179 | * @param x Value to be tested
|
3180 | * @returns Returns true when x contains a numeric, integer value.
|
3181 | * Throws an error in case of an unknown data type.
|
3182 | */
|
3183 | isInteger(x: number | BigNumber | Fraction | MathCollection): boolean
|
3184 |
|
3185 | /**
|
3186 | * Test whether a value is NaN (not a number). The function supports
|
3187 | * types number, BigNumber, Fraction, Unit and Complex. The function is
|
3188 | * evaluated element-wise in case of Array or Matrix input.
|
3189 | * @param x Value to be tested
|
3190 | * @returns Returns true when x is NaN. Throws an error in case of an
|
3191 | * unknown data type.
|
3192 | */
|
3193 | isNaN(x: number | BigNumber | Fraction | MathCollection | Unit): boolean
|
3194 |
|
3195 | /**
|
3196 | * Test whether a value is negative: smaller than zero. The function
|
3197 | * supports types number, BigNumber, Fraction, and Unit. The function is
|
3198 | * evaluated element-wise in case of Array or Matrix input.
|
3199 | * @param x Value to be tested
|
3200 | * @returns Returns true when x is larger than zero. Throws an error in
|
3201 | * case of an unknown data type.
|
3202 | */
|
3203 | isNegative(
|
3204 | x: number | BigNumber | Fraction | MathCollection | Unit
|
3205 | ): boolean
|
3206 |
|
3207 | /**
|
3208 | * Test whether a value is an numeric value. The function is evaluated
|
3209 | * element-wise in case of Array or Matrix input.
|
3210 | * @param x Value to be tested
|
3211 | * @returns Returns true when x is a number, BigNumber, Fraction, or
|
3212 | * boolean. Returns false for other types. Throws an error in case of
|
3213 | * unknown types.
|
3214 | */
|
3215 | // eslint-disable-next-line @typescript-eslint/no-explicit-any
|
3216 | isNumeric(x: any): x is number | BigNumber | Fraction | boolean
|
3217 |
|
3218 | /**
|
3219 | * Test whether a value is positive: larger than zero. The function
|
3220 | * supports types number, BigNumber, Fraction, and Unit. The function is
|
3221 | * evaluated element-wise in case of Array or Matrix input.
|
3222 | * @param x Value to be tested
|
3223 | * @returns Returns true when x is larger than zero. Throws an error in
|
3224 | * case of an unknown data type.
|
3225 | */
|
3226 | isPositive(
|
3227 | x: number | BigNumber | Fraction | MathCollection | Unit
|
3228 | ): boolean
|
3229 |
|
3230 | /**
|
3231 | * Test whether a value is prime: has no divisors other than itself and
|
3232 | * one. The function supports type number, bignumber. The function is
|
3233 | * evaluated element-wise in case of Array or Matrix input.
|
3234 | * @param x Value to be tested
|
3235 | * @returns Returns true when x is larger than zero. Throws an error in
|
3236 | * case of an unknown data type.
|
3237 | */
|
3238 | isPrime(x: number | BigNumber | MathCollection): boolean
|
3239 |
|
3240 | /**
|
3241 | * Test whether a value is zero. The function can check for zero for
|
3242 | * types number, BigNumber, Fraction, Complex, and Unit. The function is
|
3243 | * evaluated element-wise in case of Array or Matrix input.
|
3244 | * @param x Value to be tested
|
3245 | * @returns Returns true when x is zero. Throws an error in case of an
|
3246 | * unknown data type.
|
3247 | */
|
3248 | isZero(
|
3249 | x: number | BigNumber | Fraction | MathCollection | Unit | Complex
|
3250 | ): boolean
|
3251 |
|
3252 | /**
|
3253 | * Determine the type of a variable.
|
3254 | * @param x The variable for which to test the type
|
3255 | * @returns Returns the name of the type. Primitive types are lower
|
3256 | * case, non-primitive types are upper-camel-case. For example ‘number’,
|
3257 | * ‘string’, ‘Array’, ‘Date’.
|
3258 | */
|
3259 | // eslint-disable-next-line @typescript-eslint/no-explicit-any
|
3260 | typeOf(x: any): string
|
3261 |
|
3262 | /**
|
3263 | * Import functions from an object or a module
|
3264 | * To avoid errors when using one of the imported functions extend module like this:
|
3265 | *
|
3266 | * @example
|
3267 | * // imported_math_functions.ts
|
3268 | * declare module 'mathjs' {
|
3269 | * interface MathJsStatic {
|
3270 | * hello(a: number): number;
|
3271 | * }
|
3272 | * }
|
3273 | *
|
3274 | * @param object An object with functions to be imported.
|
3275 | * @param options An object with import options.
|
3276 | */
|
3277 | import(object: ImportObject | ImportObject[], options?: ImportOptions): void
|
3278 | }
|
3279 |
|
3280 | /*************************************************************************
|
3281 | * Factory and Dependencies
|
3282 | ************************************************************************/
|
3283 | interface FactoryDependencies {
|
3284 | create: (
|
3285 | factories: FactoryFunctionMap,
|
3286 | config?: ConfigOptions
|
3287 | ) => MathJsStatic
|
3288 | factory: <T>(
|
3289 | name: string,
|
3290 | dependencies: MathJsFunctionName[],
|
3291 | create: (injected: Partial<MathJsStatic>) => T,
|
3292 |
|
3293 | meta?: any
|
3294 | ) => FactoryFunction<T>
|
3295 | all: FactoryFunctionMap
|
3296 |
|
3297 | typedDependencies: FactoryFunctionMap
|
3298 | ResultSetDependencies: FactoryFunctionMap
|
3299 | BigNumberDependencies: FactoryFunctionMap
|
3300 | ComplexDependencies: FactoryFunctionMap
|
3301 | FractionDependencies: FactoryFunctionMap
|
3302 | RangeDependencies: FactoryFunctionMap
|
3303 | MatrixDependencies: FactoryFunctionMap
|
3304 | DenseMatrixDependencies: FactoryFunctionMap
|
3305 | cloneDependencies: FactoryFunctionMap
|
3306 | isIntegerDependencies: FactoryFunctionMap
|
3307 | isNegativeDependencies: FactoryFunctionMap
|
3308 | isNumericDependencies: FactoryFunctionMap
|
3309 | hasNumericValueDependencies: FactoryFunctionMap
|
3310 | isPositiveDependencies: FactoryFunctionMap
|
3311 | isZeroDependencies: FactoryFunctionMap
|
3312 | isNaNDependencies: FactoryFunctionMap
|
3313 | typeOfDependencies: FactoryFunctionMap
|
3314 | typeofDependencies: FactoryFunctionMap
|
3315 | equalScalarDependencies: FactoryFunctionMap
|
3316 | SparseMatrixDependencies: FactoryFunctionMap
|
3317 | numberDependencies: FactoryFunctionMap
|
3318 | stringDependencies: FactoryFunctionMap
|
3319 | booleanDependencies: FactoryFunctionMap
|
3320 | bignumberDependencies: FactoryFunctionMap
|
3321 | complexDependencies: FactoryFunctionMap
|
3322 | fractionDependencies: FactoryFunctionMap
|
3323 | matrixDependencies: FactoryFunctionMap
|
3324 | splitUnitDependencies: FactoryFunctionMap
|
3325 | unaryMinusDependencies: FactoryFunctionMap
|
3326 | unaryPlusDependencies: FactoryFunctionMap
|
3327 | absDependencies: FactoryFunctionMap
|
3328 | applyDependencies: FactoryFunctionMap
|
3329 | addScalarDependencies: FactoryFunctionMap
|
3330 | cbrtDependencies: FactoryFunctionMap
|
3331 | ceilDependencies: FactoryFunctionMap
|
3332 | cubeDependencies: FactoryFunctionMap
|
3333 | expDependencies: FactoryFunctionMap
|
3334 | expm1Dependencies: FactoryFunctionMap
|
3335 | fixDependencies: FactoryFunctionMap
|
3336 | floorDependencies: FactoryFunctionMap
|
3337 | gcdDependencies: FactoryFunctionMap
|
3338 | lcmDependencies: FactoryFunctionMap
|
3339 | log10Dependencies: FactoryFunctionMap
|
3340 | log2Dependencies: FactoryFunctionMap
|
3341 | modDependencies: FactoryFunctionMap
|
3342 | multiplyScalarDependencies: FactoryFunctionMap
|
3343 | multiplyDependencies: FactoryFunctionMap
|
3344 | nthRootDependencies: FactoryFunctionMap
|
3345 | signDependencies: FactoryFunctionMap
|
3346 | sqrtDependencies: FactoryFunctionMap
|
3347 | squareDependencies: FactoryFunctionMap
|
3348 | subtractDependencies: FactoryFunctionMap
|
3349 | xgcdDependencies: FactoryFunctionMap
|
3350 | dotMultiplyDependencies: FactoryFunctionMap
|
3351 | bitAndDependencies: FactoryFunctionMap
|
3352 | bitNotDependencies: FactoryFunctionMap
|
3353 | bitOrDependencies: FactoryFunctionMap
|
3354 | bitXorDependencies: FactoryFunctionMap
|
3355 | argDependencies: FactoryFunctionMap
|
3356 | conjDependencies: FactoryFunctionMap
|
3357 | imDependencies: FactoryFunctionMap
|
3358 | reDependencies: FactoryFunctionMap
|
3359 | notDependencies: FactoryFunctionMap
|
3360 | orDependencies: FactoryFunctionMap
|
3361 | xorDependencies: FactoryFunctionMap
|
3362 | concatDependencies: FactoryFunctionMap
|
3363 | columnDependencies: FactoryFunctionMap
|
3364 | crossDependencies: FactoryFunctionMap
|
3365 | diagDependencies: FactoryFunctionMap
|
3366 | eyeDependencies: FactoryFunctionMap
|
3367 | filterDependencies: FactoryFunctionMap
|
3368 | flattenDependencies: FactoryFunctionMap
|
3369 | forEachDependencies: FactoryFunctionMap
|
3370 | getMatrixDataTypeDependencies: FactoryFunctionMap
|
3371 | identityDependencies: FactoryFunctionMap
|
3372 | kronDependencies: FactoryFunctionMap
|
3373 | mapDependencies: FactoryFunctionMap
|
3374 | onesDependencies: FactoryFunctionMap
|
3375 | rangeDependencies: FactoryFunctionMap
|
3376 | reshapeDependencies: FactoryFunctionMap
|
3377 | resizeDependencies: FactoryFunctionMap
|
3378 | rowDependencies: FactoryFunctionMap
|
3379 | sizeDependencies: FactoryFunctionMap
|
3380 | squeezeDependencies: FactoryFunctionMap
|
3381 | subsetDependencies: FactoryFunctionMap
|
3382 | transposeDependencies: FactoryFunctionMap
|
3383 | ctransposeDependencies: FactoryFunctionMap
|
3384 | zerosDependencies: FactoryFunctionMap
|
3385 | erfDependencies: FactoryFunctionMap
|
3386 | modeDependencies: FactoryFunctionMap
|
3387 | prodDependencies: FactoryFunctionMap
|
3388 | formatDependencies: FactoryFunctionMap
|
3389 | printDependencies: FactoryFunctionMap
|
3390 | toDependencies: FactoryFunctionMap
|
3391 | isPrimeDependencies: FactoryFunctionMap
|
3392 | numericDependencies: FactoryFunctionMap
|
3393 | divideScalarDependencies: FactoryFunctionMap
|
3394 | powDependencies: FactoryFunctionMap
|
3395 | roundDependencies: FactoryFunctionMap
|
3396 | logDependencies: FactoryFunctionMap
|
3397 | log1pDependencies: FactoryFunctionMap
|
3398 | nthRootsDependencies: FactoryFunctionMap
|
3399 | dotPowDependencies: FactoryFunctionMap
|
3400 | dotDivideDependencies: FactoryFunctionMap
|
3401 | lsolveDependencies: FactoryFunctionMap
|
3402 | usolveDependencies: FactoryFunctionMap
|
3403 | leftShiftDependencies: FactoryFunctionMap
|
3404 | rightArithShiftDependencies: FactoryFunctionMap
|
3405 | rightLogShiftDependencies: FactoryFunctionMap
|
3406 | andDependencies: FactoryFunctionMap
|
3407 | compareDependencies: FactoryFunctionMap
|
3408 | compareNaturalDependencies: FactoryFunctionMap
|
3409 | compareTextDependencies: FactoryFunctionMap
|
3410 | equalDependencies: FactoryFunctionMap
|
3411 | equalTextDependencies: FactoryFunctionMap
|
3412 | smallerDependencies: FactoryFunctionMap
|
3413 | smallerEqDependencies: FactoryFunctionMap
|
3414 | largerDependencies: FactoryFunctionMap
|
3415 | largerEqDependencies: FactoryFunctionMap
|
3416 | deepEqualDependencies: FactoryFunctionMap
|
3417 | unequalDependencies: FactoryFunctionMap
|
3418 | partitionSelectDependencies: FactoryFunctionMap
|
3419 | sortDependencies: FactoryFunctionMap
|
3420 | maxDependencies: FactoryFunctionMap
|
3421 | minDependencies: FactoryFunctionMap
|
3422 | ImmutableDenseMatrixDependencies: FactoryFunctionMap
|
3423 | IndexDependencies: FactoryFunctionMap
|
3424 | FibonacciHeapDependencies: FactoryFunctionMap
|
3425 | SpaDependencies: FactoryFunctionMap
|
3426 | UnitDependencies: FactoryFunctionMap
|
3427 | unitDependencies: FactoryFunctionMap
|
3428 | sparseDependencies: FactoryFunctionMap
|
3429 | createUnitDependencies: FactoryFunctionMap
|
3430 | acosDependencies: FactoryFunctionMap
|
3431 | acoshDependencies: FactoryFunctionMap
|
3432 | acotDependencies: FactoryFunctionMap
|
3433 | acothDependencies: FactoryFunctionMap
|
3434 | acscDependencies: FactoryFunctionMap
|
3435 | acschDependencies: FactoryFunctionMap
|
3436 | asecDependencies: FactoryFunctionMap
|
3437 | asechDependencies: FactoryFunctionMap
|
3438 | asinDependencies: FactoryFunctionMap
|
3439 | asinhDependencies: FactoryFunctionMap
|
3440 | atanDependencies: FactoryFunctionMap
|
3441 | atan2Dependencies: FactoryFunctionMap
|
3442 | atanhDependencies: FactoryFunctionMap
|
3443 | cosDependencies: FactoryFunctionMap
|
3444 | coshDependencies: FactoryFunctionMap
|
3445 | cotDependencies: FactoryFunctionMap
|
3446 | cothDependencies: FactoryFunctionMap
|
3447 | cscDependencies: FactoryFunctionMap
|
3448 | cschDependencies: FactoryFunctionMap
|
3449 | secDependencies: FactoryFunctionMap
|
3450 | sechDependencies: FactoryFunctionMap
|
3451 | sinDependencies: FactoryFunctionMap
|
3452 | sinhDependencies: FactoryFunctionMap
|
3453 | tanDependencies: FactoryFunctionMap
|
3454 | tanhDependencies: FactoryFunctionMap
|
3455 | setCartesianDependencies: FactoryFunctionMap
|
3456 | setDifferenceDependencies: FactoryFunctionMap
|
3457 | setDistinctDependencies: FactoryFunctionMap
|
3458 | setIntersectDependencies: FactoryFunctionMap
|
3459 | setIsSubsetDependencies: FactoryFunctionMap
|
3460 | setMultiplicityDependencies: FactoryFunctionMap
|
3461 | setPowersetDependencies: FactoryFunctionMap
|
3462 | setSizeDependencies: FactoryFunctionMap
|
3463 | setSymDifferenceDependencies: FactoryFunctionMap
|
3464 | setUnionDependencies: FactoryFunctionMap
|
3465 | addDependencies: FactoryFunctionMap
|
3466 | hypotDependencies: FactoryFunctionMap
|
3467 | normDependencies: FactoryFunctionMap
|
3468 | dotDependencies: FactoryFunctionMap
|
3469 | traceDependencies: FactoryFunctionMap
|
3470 | indexDependencies: FactoryFunctionMap
|
3471 | NodeDependencies: FactoryFunctionMap
|
3472 | AccessorNodeDependencies: FactoryFunctionMap
|
3473 | ArrayNodeDependencies: FactoryFunctionMap
|
3474 | AssignmentNodeDependencies: FactoryFunctionMap
|
3475 | BlockNodeDependencies: FactoryFunctionMap
|
3476 | ConditionalNodeDependencies: FactoryFunctionMap
|
3477 | ConstantNodeDependencies: FactoryFunctionMap
|
3478 | FunctionAssignmentNodeDependencies: FactoryFunctionMap
|
3479 | IndexNodeDependencies: FactoryFunctionMap
|
3480 | ObjectNodeDependencies: FactoryFunctionMap
|
3481 | OperatorNodeDependencies: FactoryFunctionMap
|
3482 | ParenthesisNodeDependencies: FactoryFunctionMap
|
3483 | RangeNodeDependencies: FactoryFunctionMap
|
3484 | RelationalNodeDependencies: FactoryFunctionMap
|
3485 | SymbolNodeDependencies: FactoryFunctionMap
|
3486 | FunctionNodeDependencies: FactoryFunctionMap
|
3487 | parseDependencies: FactoryFunctionMap
|
3488 | compileDependencies: FactoryFunctionMap
|
3489 | evaluateDependencies: FactoryFunctionMap
|
3490 | evalDependencies: FactoryFunctionMap
|
3491 | ParserDependencies: FactoryFunctionMap
|
3492 | parserDependencies: FactoryFunctionMap
|
3493 | lupDependencies: FactoryFunctionMap
|
3494 | qrDependencies: FactoryFunctionMap
|
3495 | sluDependencies: FactoryFunctionMap
|
3496 | lusolveDependencies: FactoryFunctionMap
|
3497 | HelpDependencies: FactoryFunctionMap
|
3498 | ChainDependencies: FactoryFunctionMap
|
3499 | helpDependencies: FactoryFunctionMap
|
3500 | chainDependencies: FactoryFunctionMap
|
3501 | detDependencies: FactoryFunctionMap
|
3502 | invDependencies: FactoryFunctionMap
|
3503 | expmDependencies: FactoryFunctionMap
|
3504 | sqrtmDependencies: FactoryFunctionMap
|
3505 | divideDependencies: FactoryFunctionMap
|
3506 | distanceDependencies: FactoryFunctionMap
|
3507 | intersectDependencies: FactoryFunctionMap
|
3508 | sumDependencies: FactoryFunctionMap
|
3509 | meanDependencies: FactoryFunctionMap
|
3510 | medianDependencies: FactoryFunctionMap
|
3511 | madDependencies: FactoryFunctionMap
|
3512 | varianceDependencies: FactoryFunctionMap
|
3513 | varDependencies: FactoryFunctionMap
|
3514 | quantileSeqDependencies: FactoryFunctionMap
|
3515 | stdDependencies: FactoryFunctionMap
|
3516 | combinationsDependencies: FactoryFunctionMap
|
3517 | gammaDependencies: FactoryFunctionMap
|
3518 | factorialDependencies: FactoryFunctionMap
|
3519 | kldivergenceDependencies: FactoryFunctionMap
|
3520 | multinomialDependencies: FactoryFunctionMap
|
3521 | permutationsDependencies: FactoryFunctionMap
|
3522 | pickRandomDependencies: FactoryFunctionMap
|
3523 | randomDependencies: FactoryFunctionMap
|
3524 | randomIntDependencies: FactoryFunctionMap
|
3525 | stirlingS2Dependencies: FactoryFunctionMap
|
3526 | bellNumbersDependencies: FactoryFunctionMap
|
3527 | catalanDependencies: FactoryFunctionMap
|
3528 | compositionDependencies: FactoryFunctionMap
|
3529 | simplifyDependencies: FactoryFunctionMap
|
3530 | derivativeDependencies: FactoryFunctionMap
|
3531 | rationalizeDependencies: FactoryFunctionMap
|
3532 | reviverDependencies: FactoryFunctionMap
|
3533 | eDependencies: FactoryFunctionMap
|
3534 | EDependencies: FactoryFunctionMap
|
3535 | falseDependencies: FactoryFunctionMap
|
3536 | iDependencies: FactoryFunctionMap
|
3537 | InfinityDependencies: FactoryFunctionMap
|
3538 | LN10Dependencies: FactoryFunctionMap
|
3539 | LN2Dependencies: FactoryFunctionMap
|
3540 | LOG10EDependencies: FactoryFunctionMap
|
3541 | LOG2EDependencies: FactoryFunctionMap
|
3542 | NaNDependencies: FactoryFunctionMap
|
3543 | nullDependencies: FactoryFunctionMap
|
3544 | phiDependencies: FactoryFunctionMap
|
3545 | piDependencies: FactoryFunctionMap
|
3546 | PIDependencies: FactoryFunctionMap
|
3547 | SQRT1_2Dependencies: FactoryFunctionMap
|
3548 | SQRT2Dependencies: FactoryFunctionMap
|
3549 | tauDependencies: FactoryFunctionMap
|
3550 | trueDependencies: FactoryFunctionMap
|
3551 | versionDependencies: FactoryFunctionMap
|
3552 | atomicMassDependencies: FactoryFunctionMap
|
3553 | avogadroDependencies: FactoryFunctionMap
|
3554 | bohrMagnetonDependencies: FactoryFunctionMap
|
3555 | bohrRadiusDependencies: FactoryFunctionMap
|
3556 | boltzmannDependencies: FactoryFunctionMap
|
3557 | classicalElectronRadiusDependencies: FactoryFunctionMap
|
3558 | conductanceQuantumDependencies: FactoryFunctionMap
|
3559 | coulombDependencies: FactoryFunctionMap
|
3560 | deuteronMassDependencies: FactoryFunctionMap
|
3561 | efimovFactorDependencies: FactoryFunctionMap
|
3562 | electricConstantDependencies: FactoryFunctionMap
|
3563 | electronMassDependencies: FactoryFunctionMap
|
3564 | elementaryChargeDependencies: FactoryFunctionMap
|
3565 | faradayDependencies: FactoryFunctionMap
|
3566 | fermiCouplingDependencies: FactoryFunctionMap
|
3567 | fineStructureDependencies: FactoryFunctionMap
|
3568 | firstRadiationDependencies: FactoryFunctionMap
|
3569 | gasConstantDependencies: FactoryFunctionMap
|
3570 | gravitationConstantDependencies: FactoryFunctionMap
|
3571 | gravityDependencies: FactoryFunctionMap
|
3572 | hartreeEnergyDependencies: FactoryFunctionMap
|
3573 | inverseConductanceQuantumDependencies: FactoryFunctionMap
|
3574 | klitzingDependencies: FactoryFunctionMap
|
3575 | loschmidtDependencies: FactoryFunctionMap
|
3576 | magneticConstantDependencies: FactoryFunctionMap
|
3577 | magneticFluxQuantumDependencies: FactoryFunctionMap
|
3578 | molarMassDependencies: FactoryFunctionMap
|
3579 | molarMassC12Dependencies: FactoryFunctionMap
|
3580 | molarPlanckConstantDependencies: FactoryFunctionMap
|
3581 | molarVolumeDependencies: FactoryFunctionMap
|
3582 | neutronMassDependencies: FactoryFunctionMap
|
3583 | nuclearMagnetonDependencies: FactoryFunctionMap
|
3584 | planckChargeDependencies: FactoryFunctionMap
|
3585 | planckConstantDependencies: FactoryFunctionMap
|
3586 | planckLengthDependencies: FactoryFunctionMap
|
3587 | planckMassDependencies: FactoryFunctionMap
|
3588 | planckTemperatureDependencies: FactoryFunctionMap
|
3589 | planckTimeDependencies: FactoryFunctionMap
|
3590 | protonMassDependencies: FactoryFunctionMap
|
3591 | quantumOfCirculationDependencies: FactoryFunctionMap
|
3592 | reducedPlanckConstantDependencies: FactoryFunctionMap
|
3593 | rydbergDependencies: FactoryFunctionMap
|
3594 | sackurTetrodeDependencies: FactoryFunctionMap
|
3595 | secondRadiationDependencies: FactoryFunctionMap
|
3596 | speedOfLightDependencies: FactoryFunctionMap
|
3597 | stefanBoltzmannDependencies: FactoryFunctionMap
|
3598 | thomsonCrossSectionDependencies: FactoryFunctionMap
|
3599 | vacuumImpedanceDependencies: FactoryFunctionMap
|
3600 | weakMixingAngleDependencies: FactoryFunctionMap
|
3601 | wienDisplacementDependencies: FactoryFunctionMap
|
3602 | applyTransformDependencies: FactoryFunctionMap
|
3603 | columnTransformDependencies: FactoryFunctionMap
|
3604 | filterTransformDependencies: FactoryFunctionMap
|
3605 | forEachTransformDependencies: FactoryFunctionMap
|
3606 | indexTransformDependencies: FactoryFunctionMap
|
3607 | mapTransformDependencies: FactoryFunctionMap
|
3608 | maxTransformDependencies: FactoryFunctionMap
|
3609 | meanTransformDependencies: FactoryFunctionMap
|
3610 | minTransformDependencies: FactoryFunctionMap
|
3611 | rangeTransformDependencies: FactoryFunctionMap
|
3612 | rowTransformDependencies: FactoryFunctionMap
|
3613 | subsetTransformDependencies: FactoryFunctionMap
|
3614 | concatTransformDependencies: FactoryFunctionMap
|
3615 | stdTransformDependencies: FactoryFunctionMap
|
3616 | sumTransformDependencies: FactoryFunctionMap
|
3617 | varianceTransformDependencies: FactoryFunctionMap
|
3618 | }
|
3619 |
|
3620 | interface Matrix {
|
3621 | type: string
|
3622 | storage(): string
|
3623 | datatype(): string
|
3624 | create(data: MathArray, datatype?: string): void
|
3625 | density(): number
|
3626 |
|
3627 | subset(index: Index, replacement?: any, defaultValue?: any): Matrix
|
3628 | apply(
|
3629 | dim: number,
|
3630 | callback: (array: MathCollection) => number
|
3631 | ): Matrix | MathArray
|
3632 |
|
3633 | get(index: number[]): any
|
3634 |
|
3635 | set(index: number[], value: any, defaultValue?: number | string): Matrix
|
3636 | resize(size: MathCollection, defaultValue?: number | string): Matrix
|
3637 | clone(): Matrix
|
3638 | size(): number[]
|
3639 | map(
|
3640 |
|
3641 | callback: (a: any, b: number, c: Matrix) => any,
|
3642 | skipZeros?: boolean
|
3643 | ): Matrix
|
3644 | forEach(
|
3645 |
|
3646 | callback: (a: any, b: number, c: Matrix) => void,
|
3647 | skipZeros?: boolean
|
3648 | ): void
|
3649 | toArray(): MathArray
|
3650 | valueOf(): MathArray
|
3651 |
|
3652 | format(options?: FormatOptions | number | ((value: any) => string)): string
|
3653 | toString(): string
|
3654 | // eslint-disable-next-line @typescript-eslint/no-explicit-any
|
3655 | toJSON(): any
|
3656 | // eslint-disable-next-line @typescript-eslint/no-explicit-any
|
3657 | diagonal(k?: number | BigNumber): any[]
|
3658 | swapRows(i: number, j: number): Matrix
|
3659 | }
|
3660 |
|
3661 | interface MatrixCtor {
|
3662 | new (): Matrix
|
3663 | }
|
3664 |
|
3665 | // eslint-disable-next-line @typescript-eslint/no-empty-interface
|
3666 | interface BigNumber extends Decimal {}
|
3667 |
|
3668 | interface Fraction {
|
3669 | s: number
|
3670 | n: number
|
3671 | d: number
|
3672 | }
|
3673 |
|
3674 | interface Complex {
|
3675 | re: number
|
3676 | im: number
|
3677 | clone(): Complex
|
3678 | equals(other: Complex): boolean
|
3679 | format(precision?: number): string
|
3680 | fromJSON(json: object): Complex
|
3681 | fromPolar(polar: object): Complex
|
3682 | fromPolar(r: number, phi: number): Complex
|
3683 | toJSON(): object
|
3684 | toPolar(): PolarCoordinates
|
3685 | toString(): string
|
3686 | compare(a: Complex, b: Complex): number
|
3687 | }
|
3688 |
|
3689 | interface PolarCoordinates {
|
3690 | r: number
|
3691 | phi: number
|
3692 | }
|
3693 |
|
3694 | interface MathJSON {
|
3695 | mathjs?: string
|
3696 | value: number
|
3697 | unit: string
|
3698 | fixPrefix?: boolean
|
3699 | }
|
3700 |
|
3701 | interface UnitComponent {
|
3702 | power: number
|
3703 | prefix: string
|
3704 | unit: {
|
3705 | name: string
|
3706 | base: {
|
3707 | dimensions: number[]
|
3708 | key: string
|
3709 | }
|
3710 | prefixes: Record<string, UnitPrefix>
|
3711 | value: number
|
3712 | offset: number
|
3713 | dimensions: number[]
|
3714 | }
|
3715 | }
|
3716 |
|
3717 | interface UnitPrefix {
|
3718 | name: string
|
3719 | value: number
|
3720 | scientific: boolean
|
3721 | }
|
3722 |
|
3723 | interface Unit {
|
3724 | valueOf(): string
|
3725 | clone(): Unit
|
3726 | // eslint-disable-next-line @typescript-eslint/no-explicit-any
|
3727 | hasBase(base: any): boolean
|
3728 | equalBase(unit: Unit): boolean
|
3729 | equals(unit: Unit): boolean
|
3730 | multiply(unit: Unit): Unit
|
3731 | divide(unit: Unit): Unit
|
3732 | pow(unit: Unit): Unit
|
3733 | abs(unit: Unit): Unit
|
3734 | to(unit: string): Unit
|
3735 | toNumber(unit?: string): number
|
3736 | toNumeric(unit?: string): number | Fraction | BigNumber
|
3737 | toSI(): Unit
|
3738 | toString(): string
|
3739 | toJSON(): MathJSON
|
3740 | formatUnits(): string
|
3741 | format(options: FormatOptions): string
|
3742 | simplify(): Unit
|
3743 | splitUnit(parts: ReadonlyArray<string | Unit>): Unit[]
|
3744 |
|
3745 | units: UnitComponent[]
|
3746 | dimensions: number[]
|
3747 | value: number
|
3748 | fixPrefix: boolean
|
3749 | skipAutomaticSimplification: true
|
3750 | }
|
3751 |
|
3752 | interface CreateUnitOptions {
|
3753 | prefixes?: 'none' | 'short' | 'long' | 'binary_short' | 'binary_long'
|
3754 | aliases?: string[]
|
3755 | offset?: number
|
3756 | override?: boolean
|
3757 | }
|
3758 |
|
3759 | interface SimplifyOptions {
|
3760 | /** A boolean which is `true` by default. */
|
3761 | exactFractions?: boolean
|
3762 | /**
|
3763 | * When `exactFractions` is true, a fraction will be returned only
|
3764 | * when both numerator and denominator are smaller than `fractionsLimit`.
|
3765 | * Default value is 10000.
|
3766 | */
|
3767 | fractionsLimit?: number
|
3768 | }
|
3769 |
|
3770 | type SimplifyRule =
|
3771 | | { l: string; r: string }
|
3772 | | string
|
3773 | | ((node: MathNode) => MathNode)
|
3774 |
|
3775 | interface Simplify {
|
3776 | (
|
3777 | expr: MathNode | string,
|
3778 | rules?: SimplifyRule[],
|
3779 | scope?: object,
|
3780 | options?: SimplifyOptions
|
3781 | ): MathNode
|
3782 | (
|
3783 | expr: MathNode | string,
|
3784 | scope?: object,
|
3785 | options?: SimplifyOptions
|
3786 | ): MathNode
|
3787 |
|
3788 | rules: SimplifyRule[]
|
3789 | }
|
3790 |
|
3791 | interface UnitDefinition {
|
3792 | definition?: string | Unit
|
3793 | prefixes?: string
|
3794 | offset?: number
|
3795 | aliases?: string[]
|
3796 | }
|
3797 |
|
3798 | // eslint-disable-next-line @typescript-eslint/no-empty-interface
|
3799 | interface Index {}
|
3800 |
|
3801 | interface EvalFunction {
|
3802 | // eslint-disable-next-line @typescript-eslint/no-explicit-any
|
3803 | evaluate(scope?: any): any
|
3804 | }
|
3805 |
|
3806 | interface MathNodeCommon {
|
3807 | isNode: true
|
3808 | comment: string
|
3809 | type:
|
3810 | | 'AccessorNode'
|
3811 | | 'ArrayNode'
|
3812 | | 'AssignmentNode'
|
3813 | | 'BlockNode'
|
3814 | | 'ConditionalNode'
|
3815 | | 'ConstantNode'
|
3816 | | 'FunctionAssignmentNode'
|
3817 | | 'FunctionNode'
|
3818 | | 'IndexNode'
|
3819 | | 'ObjectNode'
|
3820 | | 'OperatorNode'
|
3821 | | 'ParenthesisNode'
|
3822 | | 'RangeNode'
|
3823 | | 'RelationalNode'
|
3824 | | 'SymbolNode'
|
3825 |
|
3826 | isUpdateNode?: boolean
|
3827 |
|
3828 | /**
|
3829 | * Create a shallow clone of the node. The node itself is cloned, its
|
3830 | * childs are not cloned.
|
3831 | */
|
3832 | clone(): this
|
3833 | /**
|
3834 | * Create a deep clone of the node. Both the node as well as all its
|
3835 | * childs are cloned recursively.
|
3836 | */
|
3837 | cloneDeep(): this
|
3838 | /**
|
3839 | * Compile an expression into optimized JavaScript code. compile returns
|
3840 | * an object with a function evaluate([scope]) to evaluate. Example:
|
3841 | */
|
3842 | compile(): EvalFunction
|
3843 | /**
|
3844 | * Compile and eval an expression, this is the equivalent of doing
|
3845 | * node.compile().evaluate(scope). Example:
|
3846 | */
|
3847 | // eslint-disable-next-line @typescript-eslint/no-explicit-any
|
3848 | evaluate(expr?: any): any
|
3849 | /**
|
3850 | * Test whether this node equals an other node. Does a deep comparison
|
3851 | * of the values of both nodes.
|
3852 | */
|
3853 | equals(other: MathNode): boolean
|
3854 | /**
|
3855 | *
|
3856 | * Filter nodes in an expression tree. The callback function is called
|
3857 | * as callback(node: MathNode, path: string, parent: MathNode) : boolean
|
3858 | * for every node in the tree, and must return a boolean. The function
|
3859 | * filter returns an array with nodes for which the test returned true.
|
3860 | * Parameter path is a string containing a relative JSON Path.
|
3861 | *
|
3862 | * Example:
|
3863 | *
|
3864 | * ```
|
3865 | * var node = math.parse('x^2 + x/4 + 3*y');
|
3866 | * var filtered = node.filter(function (node) {
|
3867 | * return node.isSymbolMathNode && node.name == 'x';
|
3868 | * });
|
3869 | * // returns an array with two entries: two SymbolMathNodes 'x'
|
3870 | * ```
|
3871 | *
|
3872 | * The callback function is called as callback(node: MathNode, path:
|
3873 | * string, parent: MathNode) : boolean for every node in the tree, and
|
3874 | * must return a boolean. The function filter returns an array with
|
3875 | * nodes for which the test returned true. Parameter path is a string
|
3876 | * containing a relative JSON Path.
|
3877 | * @return Returns an array with nodes for which test returned true
|
3878 | */
|
3879 | filter(
|
3880 |
|
3881 | callback: (node: MathNode, path: string, parent: MathNode) => any
|
3882 | ): MathNode[]
|
3883 |
|
3884 | /**
|
3885 | * [forEach description]
|
3886 | */
|
3887 | forEach(
|
3888 |
|
3889 | callback: (node: MathNode, path: string, parent: MathNode) => any
|
3890 | ): MathNode[]
|
3891 |
|
3892 | /**
|
3893 | * Transform a node. Creates a new MathNode having it’s child's be the
|
3894 | * results of calling the provided callback function for each of the
|
3895 | * child's of the original node. The callback function is called as
|
3896 | * `callback(child: MathNode, path: string, parent: MathNode)` and must
|
3897 | * return a MathNode. Parameter path is a string containing a relative
|
3898 | * JSON Path.
|
3899 | *
|
3900 | *
|
3901 | * See also transform, which is a recursive version of map.
|
3902 | */
|
3903 | map(
|
3904 | callback: (node: MathNode, path: string, parent: MathNode) => MathNode
|
3905 | ): MathNode
|
3906 |
|
3907 | /**
|
3908 | * Get a HTML representation of the parsed expression.
|
3909 | */
|
3910 | toHTML(options?: object): string
|
3911 |
|
3912 | /**
|
3913 | * Get a string representation of the parsed expression. This is not
|
3914 | * exactly the same as the original input.
|
3915 | */
|
3916 | toString(options?: object): string
|
3917 |
|
3918 | /**
|
3919 | * Get a LaTeX representation of the expression.
|
3920 | */
|
3921 | toTex(options?: object): string
|
3922 |
|
3923 | /**
|
3924 | * Recursively transform an expression tree via a transform function.
|
3925 | * Similar to Array.map, but recursively executed on all nodes in the
|
3926 | * expression tree. The callback function is a mapping function
|
3927 | * accepting a node, and returning a replacement for the node or the
|
3928 | * original node. Function callback is called as callback(node:
|
3929 | * MathNode, path: string, parent: MathNode) for every node in the tree,
|
3930 | * and must return a MathNode. Parameter path is a string containing a
|
3931 | * relative JSON Path.
|
3932 | *
|
3933 | * For example, to replace all nodes of type SymbolMathNode having name
|
3934 | * ‘x’ with a ConstantMathNode with value 3:
|
3935 | * ```js
|
3936 | * var node = math.parse('x^2 + 5*x');
|
3937 | * var transformed = node.transform(function (node, path, parent) {
|
3938 | * if (node.SymbolMathNode && node.name == 'x') {
|
3939 | * return new math.expression.node.ConstantMathNode(3);
|
3940 | * }
|
3941 | * else {
|
3942 | * return node;
|
3943 | * }
|
3944 | * });
|
3945 | * transformed.toString(); // returns '(3 ^ 2) + (5 * 3)'
|
3946 | * ```
|
3947 | */
|
3948 | transform(
|
3949 | callback: (node: MathNode, path: string, parent: MathNode) => MathNode
|
3950 | ): MathNode
|
3951 |
|
3952 | /**
|
3953 | * `traverse(callback)`
|
3954 | *
|
3955 | * Recursively traverse all nodes in a node tree. Executes given
|
3956 | * callback for this node and each of its child nodes. Similar to
|
3957 | * Array.forEach, except recursive. The callback function is a mapping
|
3958 | * function accepting a node, and returning a replacement for the node
|
3959 | * or the original node. Function callback is called as callback(node:
|
3960 | * MathNode, path: string, parent: MathNode) for every node in the tree.
|
3961 | * Parameter path is a string containing a relative JSON Path. Example:
|
3962 | *
|
3963 | * ```
|
3964 | * var node = math.parse('3 * x + 2');
|
3965 | * node.traverse(function (node, path, parent) {
|
3966 | * switch (node.type) {
|
3967 | * case 'OperatorMathNode': console.log(node.type, node.op); break;
|
3968 | * case 'ConstantMathNode': console.log(node.type, node.value); break;
|
3969 | * case 'SymbolMathNode': console.log(node.type, node.name); break;
|
3970 | * default: console.log(node.type);
|
3971 | * }
|
3972 | * });
|
3973 | * // outputs:
|
3974 | * // OperatorMathNode +
|
3975 | * // OperatorMathNode *
|
3976 | * // ConstantMathNode 3
|
3977 | * // SymbolMathNode x
|
3978 | * // ConstantMathNode 2
|
3979 | * ```
|
3980 | */
|
3981 | traverse(
|
3982 | callback: (node: MathNode, path: string, parent: MathNode) => void
|
3983 |
|
3984 | ): any
|
3985 | }
|
3986 |
|
3987 | interface Parser {
|
3988 | // eslint-disable-next-line @typescript-eslint/no-explicit-any
|
3989 | evaluate(expr: string | string[]): any
|
3990 | // eslint-disable-next-line @typescript-eslint/no-explicit-any
|
3991 | get(variable: string): any
|
3992 | // eslint-disable-next-line @typescript-eslint/no-explicit-any
|
3993 | getAll(): { [key: string]: any }
|
3994 | // eslint-disable-next-line @typescript-eslint/no-explicit-any
|
3995 | set: (variable: string, value: any) => void
|
3996 | clear: () => void
|
3997 | }
|
3998 |
|
3999 | interface Distribution {
|
4000 |
|
4001 | random(size: any, min?: any, max?: any): any
|
4002 |
|
4003 | randomInt(min: any, max?: any): any
|
4004 |
|
4005 | pickRandom(array: any): any
|
4006 | }
|
4007 |
|
4008 | interface FormatOptions {
|
4009 | |
4010 |
|
4011 |
|
4012 |
|
4013 |
|
4014 |
|
4015 |
|
4016 |
|
4017 |
|
4018 | notation?: 'fixed' | 'exponential' | 'engineering' | 'auto'
|
4019 |
|
4020 | |
4021 |
|
4022 |
|
4023 |
|
4024 |
|
4025 |
|
4026 |
|
4027 | precision?: number
|
4028 |
|
4029 | |
4030 |
|
4031 |
|
4032 |
|
4033 | lowerExp?: number
|
4034 |
|
4035 | |
4036 |
|
4037 |
|
4038 |
|
4039 | upperExp?: number
|
4040 |
|
4041 | |
4042 |
|
4043 |
|
4044 |
|
4045 |
|
4046 | fraction?: string
|
4047 | }
|
4048 |
|
4049 | interface Help {
|
4050 | toString(): string
|
4051 | toJSON(): string
|
4052 | }
|
4053 |
|
4054 | interface ConfigOptions {
|
4055 | epsilon?: number
|
4056 | matrix?: 'Matrix' | 'Array'
|
4057 | number?: 'number' | 'BigNumber' | 'Fraction'
|
4058 | precision?: number
|
4059 | predictable?: boolean
|
4060 | randomSeed?: string | null
|
4061 | }
|
4062 |
|
4063 | interface MathJsChain<TValue> {
|
4064 |
|
4065 | done(): TValue
|
4066 |
|
4067 | |
4068 |
|
4069 |
|
4070 |
|
4071 | |
4072 |
|
4073 |
|
4074 |
|
4075 |
|
4076 | bignumber(
|
4077 | this: MathJsChain<
|
4078 | number | string | Fraction | BigNumber | boolean | Fraction | null
|
4079 | >
|
4080 | ): MathJsChain<BigNumber>
|
4081 | bignumber<T extends MathCollection>(this: MathJsChain<T>): MathJsChain<T>
|
4082 |
|
4083 | |
4084 |
|
4085 |
|
4086 |
|
4087 |
|
4088 |
|
4089 | boolean(
|
4090 | this: MathJsChain<string | number | boolean | null>
|
4091 | ): MathJsChain<boolean>
|
4092 | boolean(this: MathJsChain<MathCollection>): MathJsChain<MathCollection>
|
4093 |
|
4094 | |
4095 |
|
4096 |
|
4097 |
|
4098 |
|
4099 | complex(
|
4100 | this: MathJsChain<Complex | string | PolarCoordinates>,
|
4101 | im?: number
|
4102 | ): MathJsChain<Complex>
|
4103 | complex(this: MathJsChain<MathCollection>): MathJsChain<MathCollection>
|
4104 |
|
4105 | |
4106 |
|
4107 |
|
4108 |
|
4109 |
|
4110 |
|
4111 |
|
4112 |
|
4113 |
|
4114 |
|
4115 |
|
4116 |
|
4117 | createUnit(
|
4118 | this: MathJsChain<string>,
|
4119 | definition?: string | UnitDefinition,
|
4120 | options?: CreateUnitOptions
|
4121 | ): MathJsChain<Unit>
|
4122 | |
4123 |
|
4124 |
|
4125 |
|
4126 |
|
4127 |
|
4128 |
|
4129 |
|
4130 |
|
4131 |
|
4132 | createUnit(
|
4133 | this: MathJsChain<Record<string, string | UnitDefinition>>,
|
4134 | options?: CreateUnitOptions
|
4135 | ): MathJsChain<Unit>
|
4136 |
|
4137 | |
4138 |
|
4139 |
|
4140 |
|
4141 |
|
4142 | fraction(
|
4143 | this: MathJsChain<
|
4144 | number | string | BigNumber | Fraction | FractionDefinition
|
4145 | >,
|
4146 | denominator?: number
|
4147 | ): MathJsChain<Fraction>
|
4148 | fraction(this: MathJsChain<MathCollection>): MathJsChain<MathCollection>
|
4149 |
|
4150 | |
4151 |
|
4152 |
|
4153 |
|
4154 |
|
4155 |
|
4156 | index(this: MathJsChain<any[]>): MathJsChain<Index>
|
4157 |
|
4158 | |
4159 |
|
4160 |
|
4161 |
|
4162 |
|
4163 |
|
4164 | matrix(
|
4165 | this: MathJsChain<MathCollection>,
|
4166 | format?: 'sparse' | 'dense',
|
4167 | dataType?: string
|
4168 | ): MathJsChain<Matrix>
|
4169 |
|
4170 | |
4171 |
|
4172 |
|
4173 |
|
4174 |
|
4175 |
|
4176 | number(
|
4177 | this: MathJsChain<
|
4178 | string | number | BigNumber | Fraction | boolean | Unit | null
|
4179 | >,
|
4180 | valuelessUnit?: Unit | string
|
4181 | ): MathJsChain<number>
|
4182 | number(
|
4183 | this: MathJsChain<MathCollection>,
|
4184 | valuelessUnit?: Unit | string
|
4185 | ): MathJsChain<MathCollection>
|
4186 |
|
4187 | |
4188 |
|
4189 |
|
4190 |
|
4191 |
|
4192 |
|
4193 |
|
4194 | sparse(
|
4195 | this: MathJsChain<MathCollection>,
|
4196 | dataType?: string
|
4197 | ): MathJsChain<Matrix>
|
4198 |
|
4199 | |
4200 |
|
4201 |
|
4202 |
|
4203 |
|
4204 | splitUnit(this: MathJsChain<Unit>, parts: Unit[]): MathJsChain<Unit[]>
|
4205 |
|
4206 | |
4207 |
|
4208 |
|
4209 |
|
4210 | string(
|
4211 | this: MathJsChain<MathNumericType | string | Unit | null>
|
4212 | ): MathJsChain<string>
|
4213 | string(this: MathJsChain<MathCollection>): MathJsChain<MathCollection>
|
4214 |
|
4215 | |
4216 |
|
4217 |
|
4218 |
|
4219 |
|
4220 |
|
4221 | unit(this: MathJsChain<string>, unit?: string): MathJsChain<Unit>
|
4222 | unit(this: MathJsChain<Unit>, unit?: string): MathJsChain<Unit>
|
4223 | unit(
|
4224 | this: MathJsChain<number | BigNumber>,
|
4225 | unit?: string
|
4226 | ): MathJsChain<Unit>
|
4227 | unit(this: MathJsChain<MathCollection>, unit?: string): MathJsChain<Unit[]>
|
4228 |
|
4229 | |
4230 |
|
4231 |
|
4232 |
|
4233 | |
4234 |
|
4235 |
|
4236 |
|
4237 | compile(this: MathJsChain<MathExpression>): MathJsChain<EvalFunction>
|
4238 |
|
4239 |
|
4240 | |
4241 |
|
4242 |
|
4243 |
|
4244 | evaluate(
|
4245 | this: MathJsChain<MathExpression | Matrix>,
|
4246 | scope?: object
|
4247 |
|
4248 | ): MathJsChain<any>
|
4249 | evaluate(
|
4250 | this: MathJsChain<MathExpression[]>,
|
4251 | scope?: object
|
4252 |
|
4253 | ): MathJsChain<any[]>
|
4254 |
|
4255 | |
4256 |
|
4257 |
|
4258 |
|
4259 | help(this: MathJsChain<unknown>): MathJsChain<unknown>
|
4260 |
|
4261 | |
4262 |
|
4263 |
|
4264 | parse(
|
4265 | this: MathJsChain<MathExpression[]>,
|
4266 |
|
4267 | options?: any
|
4268 | ): MathJsChain<MathNode[]>
|
4269 |
|
4270 | |
4271 |
|
4272 |
|
4273 |
|
4274 |
|
4275 | parse(
|
4276 | this: MathJsChain<MathExpression>,
|
4277 |
|
4278 | options?: any
|
4279 | ): MathJsChain<MathNode>
|
4280 |
|
4281 | |
4282 |
|
4283 |
|
4284 |
|
4285 | resolve(
|
4286 | this: MathJsChain<MathNode>,
|
4287 |
|
4288 | scope?: Record<string, any>
|
4289 | ): MathJsChain<MathNode>
|
4290 | resolve(
|
4291 | this: MathJsChain<MathNode[]>,
|
4292 |
|
4293 | scope?: Record<string, any>
|
4294 | ): MathJsChain<MathNode[]>
|
4295 |
|
4296 | |
4297 |
|
4298 |
|
4299 | |
4300 |
|
4301 |
|
4302 |
|
4303 |
|
4304 | derivative(
|
4305 | this: MathJsChain<MathNode | string>,
|
4306 | variable: MathNode | string,
|
4307 | options?: { simplify: boolean }
|
4308 | ): MathJsChain<MathNode>
|
4309 |
|
4310 | |
4311 |
|
4312 |
|
4313 |
|
4314 |
|
4315 | lsolve(
|
4316 | this: MathJsChain<Matrix>,
|
4317 | b: Matrix | MathArray
|
4318 | ): MathJsChain<Matrix>
|
4319 | lsolve(
|
4320 | this: MathJsChain<MathArray>,
|
4321 | b: Matrix | MathArray
|
4322 | ): MathJsChain<MathArray>
|
4323 |
|
4324 | |
4325 |
|
4326 |
|
4327 |
|
4328 |
|
4329 | lup(this: MathJsChain<Matrix | MathArray>): MathJsChain<LUDecomposition>
|
4330 |
|
4331 | |
4332 |
|
4333 |
|
4334 |
|
4335 |
|
4336 |
|
4337 |
|
4338 |
|
4339 |
|
4340 | lusolve(
|
4341 | this: MathJsChain<Matrix>,
|
4342 | b: Matrix | MathArray,
|
4343 | order?: number,
|
4344 | threshold?: number
|
4345 | ): MathJsChain<Matrix>
|
4346 |
|
4347 | lusolve(
|
4348 | this: MathJsChain<MathArray>,
|
4349 | b: Matrix | MathArray,
|
4350 | order?: number,
|
4351 | threshold?: number
|
4352 | ): MathJsChain<MathArray>
|
4353 |
|
4354 | |
4355 |
|
4356 |
|
4357 |
|
4358 |
|
4359 | qr(this: MathJsChain<Matrix | MathArray>): MathJsChain<QRDecomposition>
|
4360 |
|
4361 | |
4362 |
|
4363 |
|
4364 |
|
4365 |
|
4366 |
|
4367 |
|
4368 |
|
4369 |
|
4370 |
|
4371 | rationalize(
|
4372 | this: MathJsChain<MathNode | string>,
|
4373 | optional?: object | boolean,
|
4374 | detailed?: boolean
|
4375 | ): MathJsChain<MathNode>
|
4376 |
|
4377 | |
4378 |
|
4379 |
|
4380 |
|
4381 |
|
4382 |
|
4383 |
|
4384 |
|
4385 | simplify(
|
4386 | this: MathJsChain<MathNode | string>,
|
4387 | rules?: SimplifyRule[],
|
4388 | scope?: object
|
4389 | ): MathJsChain<MathNode>
|
4390 |
|
4391 |
|
4392 | simplifyCore(expr: MathNode): MathNode
|
4393 |
|
4394 | |
4395 |
|
4396 |
|
4397 |
|
4398 |
|
4399 |
|
4400 |
|
4401 |
|
4402 |
|
4403 |
|
4404 |
|
4405 |
|
4406 |
|
4407 |
|
4408 |
|
4409 | slu(
|
4410 | this: MathJsChain<Matrix>,
|
4411 | order: number,
|
4412 | threshold: number
|
4413 | ): MathJsChain<SLUDecomposition>
|
4414 |
|
4415 | |
4416 |
|
4417 |
|
4418 |
|
4419 |
|
4420 | usolve(
|
4421 | this: MathJsChain<Matrix>,
|
4422 | b: Matrix | MathArray
|
4423 | ): MathJsChain<Matrix>
|
4424 | usolve(
|
4425 | this: MathJsChain<MathArray>,
|
4426 | b: Matrix | MathArray
|
4427 | ): MathJsChain<MathArray>
|
4428 |
|
4429 | |
4430 |
|
4431 |
|
4432 |
|
4433 | |
4434 |
|
4435 |
|
4436 |
|
4437 | abs(this: MathJsChain<number>): MathJsChain<number>
|
4438 | abs(this: MathJsChain<BigNumber>): MathJsChain<BigNumber>
|
4439 | abs(this: MathJsChain<Fraction>): MathJsChain<Fraction>
|
4440 | abs(this: MathJsChain<Complex>): MathJsChain<Complex>
|
4441 | abs(this: MathJsChain<MathArray>): MathJsChain<MathArray>
|
4442 | abs(this: MathJsChain<Matrix>): MathJsChain<Matrix>
|
4443 | abs(this: MathJsChain<Unit>): MathJsChain<Unit>
|
4444 |
|
4445 | |
4446 |
|
4447 |
|
4448 |
|
4449 |
|
4450 | add<T extends MathType>(this: MathJsChain<T>, y: T): MathJsChain<T>
|
4451 | add(this: MathJsChain<MathType>, y: MathType): MathJsChain<MathType>
|
4452 |
|
4453 | |
4454 |
|
4455 |
|
4456 |
|
4457 |
|
4458 |
|
4459 |
|
4460 |
|
4461 |
|
4462 | apply<T extends MathCollection>(
|
4463 | this: MathJsChain<T>,
|
4464 | dim: number,
|
4465 | callback: (array: Array<MathType> | Matrix) => number
|
4466 | ): MathJsChain<T>
|
4467 |
|
4468 | |
4469 |
|
4470 |
|
4471 |
|
4472 |
|
4473 |
|
4474 |
|
4475 | cbrt(this: MathJsChain<number>, allRoots?: boolean): MathJsChain<number>
|
4476 | cbrt(
|
4477 | this: MathJsChain<BigNumber>,
|
4478 | allRoots?: boolean
|
4479 | ): MathJsChain<BigNumber>
|
4480 | cbrt(this: MathJsChain<Complex>, allRoots?: boolean): MathJsChain<Complex>
|
4481 | cbrt(
|
4482 | this: MathJsChain<MathArray>,
|
4483 | allRoots?: boolean
|
4484 | ): MathJsChain<MathArray>
|
4485 | cbrt(this: MathJsChain<Matrix>, allRoots?: boolean): MathJsChain<Matrix>
|
4486 |
|
4487 |
|
4488 |
|
4489 | |
4490 |
|
4491 |
|
4492 |
|
4493 |
|
4494 |
|
4495 | ceil(
|
4496 | this: MathJsChain<MathNumericType>,
|
4497 | n?: number | BigNumber | MathCollection
|
4498 | ): MathJsChain<MathNumericType>
|
4499 | ceil(
|
4500 | this: MathJsChain<MathCollection>,
|
4501 | n?: number | BigNumber | MathCollection
|
4502 | ): MathJsChain<MathCollection>
|
4503 |
|
4504 | |
4505 |
|
4506 |
|
4507 |
|
4508 |
|
4509 | fix(
|
4510 | this: MathJsChain<MathNumericType>,
|
4511 | n?: number | BigNumber | MathCollection
|
4512 | ): MathJsChain<MathNumericType>
|
4513 | fix(
|
4514 | this: MathJsChain<MathCollection>,
|
4515 | n?: number | BigNumber | MathCollection
|
4516 | ): MathJsChain<MathCollection>
|
4517 |
|
4518 | |
4519 |
|
4520 |
|
4521 |
|
4522 |
|
4523 | floor(
|
4524 | this: MathJsChain<MathNumericType>,
|
4525 | n?: number | BigNumber | MathCollection
|
4526 | ): MathJsChain<MathNumericType>
|
4527 | floor(
|
4528 | this: MathJsChain<MathCollection>,
|
4529 | n?: number | BigNumber | MathCollection
|
4530 | ): MathJsChain<MathCollection>
|
4531 |
|
4532 | |
4533 |
|
4534 |
|
4535 |
|
4536 |
|
4537 | round(
|
4538 | this: MathJsChain<MathNumericType>,
|
4539 | n?: number | BigNumber | MathCollection
|
4540 | ): MathJsChain<MathNumericType>
|
4541 | round(
|
4542 | this: MathJsChain<MathCollection>,
|
4543 | n?: number | BigNumber | MathCollection
|
4544 | ): MathJsChain<MathCollection>
|
4545 |
|
4546 |
|
4547 |
|
4548 | |
4549 |
|
4550 |
|
4551 |
|
4552 | cube(this: MathJsChain<number>): MathJsChain<number>
|
4553 | cube(this: MathJsChain<BigNumber>): MathJsChain<BigNumber>
|
4554 | cube(this: MathJsChain<Fraction>): MathJsChain<Fraction>
|
4555 | cube(this: MathJsChain<Complex>): MathJsChain<Complex>
|
4556 | cube(this: MathJsChain<MathArray>): MathJsChain<MathArray>
|
4557 | cube(this: MathJsChain<Matrix>): MathJsChain<Matrix>
|
4558 | cube(this: MathJsChain<Unit>): MathJsChain<Unit>
|
4559 |
|
4560 | |
4561 |
|
4562 |
|
4563 |
|
4564 |
|
4565 | divide(this: MathJsChain<Unit>, y: Unit): MathJsChain<Unit | number>
|
4566 | divide(this: MathJsChain<Unit>, y: number): MathJsChain<Unit>
|
4567 | divide(this: MathJsChain<number>, y: number): MathJsChain<number>
|
4568 | divide(this: MathJsChain<MathType>, y: MathType): MathJsChain<MathType>
|
4569 |
|
4570 | |
4571 |
|
4572 |
|
4573 |
|
4574 |
|
4575 | dotDivide(this: MathJsChain<MathType>, y: MathType): MathJsChain<MathType>
|
4576 |
|
4577 | |
4578 |
|
4579 |
|
4580 |
|
4581 |
|
4582 | dotMultiply(this: MathJsChain<MathType>, y: MathType): MathJsChain<MathType>
|
4583 |
|
4584 | |
4585 |
|
4586 |
|
4587 |
|
4588 | dotPow(this: MathJsChain<MathType>, y: MathType): MathJsChain<MathType>
|
4589 |
|
4590 | |
4591 |
|
4592 |
|
4593 |
|
4594 | exp(this: MathJsChain<number>): MathJsChain<number>
|
4595 | exp(this: MathJsChain<BigNumber>): MathJsChain<BigNumber>
|
4596 | exp(this: MathJsChain<Complex>): MathJsChain<Complex>
|
4597 | exp(this: MathJsChain<MathArray>): MathJsChain<MathArray>
|
4598 | exp(this: MathJsChain<Matrix>): MathJsChain<Matrix>
|
4599 |
|
4600 | |
4601 |
|
4602 |
|
4603 |
|
4604 | expm1(this: MathJsChain<number>): MathJsChain<number>
|
4605 | expm1(this: MathJsChain<BigNumber>): MathJsChain<BigNumber>
|
4606 | expm1(this: MathJsChain<Complex>): MathJsChain<Complex>
|
4607 | expm1(this: MathJsChain<MathArray>): MathJsChain<MathArray>
|
4608 | expm1(this: MathJsChain<Matrix>): MathJsChain<Matrix>
|
4609 |
|
4610 | |
4611 |
|
4612 |
|
4613 |
|
4614 | gcd(this: MathJsChain<number[]>, ...args: number[]): MathJsChain<number>
|
4615 | gcd(
|
4616 | this: MathJsChain<BigNumber[]>,
|
4617 | ...args: BigNumber[]
|
4618 | ): MathJsChain<BigNumber>
|
4619 | gcd(this: MathJsChain<Complex[]>, ...args: Fraction[]): MathJsChain<Complex>
|
4620 | gcd(
|
4621 | this: MathJsChain<MathArray[]>,
|
4622 | ...args: MathArray[]
|
4623 | ): MathJsChain<MathArray>
|
4624 | gcd(this: MathJsChain<Matrix[]>, ...args: Matrix[]): MathJsChain<Matrix>
|
4625 |
|
4626 | |
4627 |
|
4628 |
|
4629 |
|
4630 |
|
4631 |
|
4632 | hypot(this: MathJsChain<number[]>): MathJsChain<number>
|
4633 | hypot(this: MathJsChain<BigNumber[]>): MathJsChain<BigNumber>
|
4634 |
|
4635 | |
4636 |
|
4637 |
|
4638 |
|
4639 |
|
4640 |
|
4641 | lcm(this: MathJsChain<number>, b: number): MathJsChain<number>
|
4642 | lcm(this: MathJsChain<BigNumber>, b: BigNumber): MathJsChain<BigNumber>
|
4643 | lcm(this: MathJsChain<MathArray>, b: MathArray): MathJsChain<MathArray>
|
4644 | lcm(this: MathJsChain<Matrix>, b: Matrix): MathJsChain<Matrix>
|
4645 |
|
4646 | |
4647 |
|
4648 |
|
4649 |
|
4650 |
|
4651 |
|
4652 | log<T extends number | BigNumber | Complex | MathCollection>(
|
4653 | this: MathJsChain<T>,
|
4654 | base?: number | BigNumber | Complex
|
4655 | ): MathJsChain<NoLiteralType<T>>
|
4656 |
|
4657 | |
4658 |
|
4659 |
|
4660 |
|
4661 |
|
4662 | log10(this: MathJsChain<number>): MathJsChain<number>
|
4663 | log10(this: MathJsChain<BigNumber>): MathJsChain<BigNumber>
|
4664 | log10(this: MathJsChain<Complex>): MathJsChain<Complex>
|
4665 | log10(this: MathJsChain<MathArray>): MathJsChain<MathArray>
|
4666 | log10(this: MathJsChain<Matrix>): MathJsChain<Matrix>
|
4667 |
|
4668 | |
4669 |
|
4670 |
|
4671 |
|
4672 | log1p(
|
4673 | this: MathJsChain<number>,
|
4674 | base?: number | BigNumber | Complex
|
4675 | ): MathJsChain<number>
|
4676 | log1p(
|
4677 | this: MathJsChain<BigNumber>,
|
4678 | base?: number | BigNumber | Complex
|
4679 | ): MathJsChain<BigNumber>
|
4680 | log1p(
|
4681 | this: MathJsChain<Complex>,
|
4682 | base?: number | BigNumber | Complex
|
4683 | ): MathJsChain<Complex>
|
4684 | log1p(
|
4685 | this: MathJsChain<MathArray>,
|
4686 | base?: number | BigNumber | Complex
|
4687 | ): MathJsChain<MathArray>
|
4688 | log1p(
|
4689 | this: MathJsChain<Matrix>,
|
4690 | base?: number | BigNumber | Complex
|
4691 | ): MathJsChain<Matrix>
|
4692 |
|
4693 | |
4694 |
|
4695 |
|
4696 |
|
4697 |
|
4698 | log2(this: MathJsChain<number>): MathJsChain<number>
|
4699 | log2(this: MathJsChain<BigNumber>): MathJsChain<BigNumber>
|
4700 | log2(this: MathJsChain<Complex>): MathJsChain<Complex>
|
4701 | log2(this: MathJsChain<MathArray>): MathJsChain<MathArray>
|
4702 | log2(this: MathJsChain<Matrix>): MathJsChain<Matrix>
|
4703 |
|
4704 | |
4705 |
|
4706 |
|
4707 |
|
4708 |
|
4709 |
|
4710 |
|
4711 | mod<T extends number | BigNumber | Fraction | MathCollection>(
|
4712 | this: MathJsChain<T>,
|
4713 | y: number | BigNumber | Fraction | MathCollection
|
4714 | ): MathJsChain<NoLiteralType<T>>
|
4715 |
|
4716 | |
4717 |
|
4718 |
|
4719 |
|
4720 |
|
4721 | multiply<T extends Matrix | MathArray>(
|
4722 | this: MathJsChain<T>,
|
4723 | y: MathType
|
4724 | ): MathJsChain<T>
|
4725 | multiply(this: MathJsChain<Unit>, y: Unit): MathJsChain<Unit>
|
4726 | multiply(this: MathJsChain<number>, y: number): MathJsChain<number>
|
4727 | multiply(this: MathJsChain<MathType>, y: MathType): MathJsChain<MathType>
|
4728 |
|
4729 | |
4730 |
|
4731 |
|
4732 |
|
4733 |
|
4734 |
|
4735 |
|
4736 | norm(
|
4737 | this: MathJsChain<number | BigNumber | Complex | MathCollection>,
|
4738 | p?: number | BigNumber | string
|
4739 | ): MathJsChain<number | BigNumber>
|
4740 |
|
4741 | |
4742 |
|
4743 |
|
4744 |
|
4745 |
|
4746 |
|
4747 | nthRoot(
|
4748 | this: MathJsChain<number | BigNumber | MathCollection | Complex>,
|
4749 | root?: number | BigNumber
|
4750 | ): MathJsChain<number | Complex | MathCollection>
|
4751 |
|
4752 | |
4753 |
|
4754 |
|
4755 |
|
4756 |
|
4757 | pow(
|
4758 | this: MathJsChain<MathType>,
|
4759 | y: number | BigNumber | Complex
|
4760 | ): MathJsChain<MathType>
|
4761 |
|
4762 | |
4763 |
|
4764 |
|
4765 |
|
4766 |
|
4767 |
|
4768 |
|
4769 | sign(this: MathJsChain<number>): MathJsChain<number>
|
4770 | sign(this: MathJsChain<BigNumber>): MathJsChain<BigNumber>
|
4771 | sign(this: MathJsChain<Fraction>): MathJsChain<Fraction>
|
4772 | sign(this: MathJsChain<Complex>): MathJsChain<Complex>
|
4773 | sign(this: MathJsChain<MathArray>): MathJsChain<MathArray>
|
4774 | sign(this: MathJsChain<Matrix>): MathJsChain<Matrix>
|
4775 | sign(this: MathJsChain<Unit>): MathJsChain<Unit>
|
4776 |
|
4777 | |
4778 |
|
4779 |
|
4780 |
|
4781 |
|
4782 | sqrt(this: MathJsChain<number>): MathJsChain<number>
|
4783 | sqrt(this: MathJsChain<BigNumber>): MathJsChain<BigNumber>
|
4784 | sqrt(this: MathJsChain<Complex>): MathJsChain<Complex>
|
4785 | sqrt(this: MathJsChain<MathArray>): MathJsChain<MathArray>
|
4786 | sqrt(this: MathJsChain<Matrix>): MathJsChain<Matrix>
|
4787 | sqrt(this: MathJsChain<Unit>): MathJsChain<Unit>
|
4788 |
|
4789 | |
4790 |
|
4791 |
|
4792 |
|
4793 |
|
4794 | square(this: MathJsChain<number>): MathJsChain<number>
|
4795 | square(this: MathJsChain<BigNumber>): MathJsChain<BigNumber>
|
4796 | square(this: MathJsChain<Fraction>): MathJsChain<Fraction>
|
4797 | square(this: MathJsChain<Complex>): MathJsChain<Complex>
|
4798 | square(this: MathJsChain<MathArray>): MathJsChain<MathArray>
|
4799 | square(this: MathJsChain<Matrix>): MathJsChain<Matrix>
|
4800 | square(this: MathJsChain<Unit>): MathJsChain<Unit>
|
4801 |
|
4802 | |
4803 |
|
4804 |
|
4805 |
|
4806 |
|
4807 | subtract<T extends MathType>(this: MathJsChain<T>, y: T): MathJsChain<T>
|
4808 | subtract(this: MathJsChain<MathType>, y: MathType): MathJsChain<MathType>
|
4809 |
|
4810 | |
4811 |
|
4812 |
|
4813 |
|
4814 |
|
4815 |
|
4816 |
|
4817 | unaryMinus(this: MathJsChain<number>): MathJsChain<number>
|
4818 | unaryMinus(this: MathJsChain<BigNumber>): MathJsChain<BigNumber>
|
4819 | unaryMinus(this: MathJsChain<Fraction>): MathJsChain<Fraction>
|
4820 | unaryMinus(this: MathJsChain<Complex>): MathJsChain<Complex>
|
4821 | unaryMinus(this: MathJsChain<MathArray>): MathJsChain<MathArray>
|
4822 | unaryMinus(this: MathJsChain<Matrix>): MathJsChain<Matrix>
|
4823 | unaryMinus(this: MathJsChain<Unit>): MathJsChain<Unit>
|
4824 |
|
4825 | |
4826 |
|
4827 |
|
4828 |
|
4829 |
|
4830 |
|
4831 | unaryPlus(this: MathJsChain<number>): MathJsChain<number>
|
4832 | unaryPlus(this: MathJsChain<BigNumber>): MathJsChain<BigNumber>
|
4833 | unaryPlus(this: MathJsChain<Fraction>): MathJsChain<Fraction>
|
4834 | unaryPlus(this: MathJsChain<string>): MathJsChain<string>
|
4835 | unaryPlus(this: MathJsChain<Complex>): MathJsChain<Complex>
|
4836 | unaryPlus(this: MathJsChain<MathArray>): MathJsChain<MathArray>
|
4837 | unaryPlus(this: MathJsChain<Matrix>): MathJsChain<Matrix>
|
4838 | unaryPlus(this: MathJsChain<Unit>): MathJsChain<Unit>
|
4839 |
|
4840 | |
4841 |
|
4842 |
|
4843 |
|
4844 |
|
4845 | xgcd(
|
4846 | this: MathJsChain<number | BigNumber>,
|
4847 | b: number | BigNumber
|
4848 | ): MathJsChain<MathArray>
|
4849 |
|
4850 | |
4851 |
|
4852 |
|
4853 |
|
4854 | |
4855 |
|
4856 |
|
4857 |
|
4858 |
|
4859 | bitAnd<T extends number | BigNumber | MathCollection>(
|
4860 | this: MathJsChain<T>,
|
4861 | y: number | BigNumber | MathCollection
|
4862 | ): MathJsChain<NoLiteralType<T>>
|
4863 |
|
4864 | |
4865 |
|
4866 |
|
4867 |
|
4868 |
|
4869 |
|
4870 | bitNot(this: MathJsChain<number>): MathJsChain<number>
|
4871 | bitNot(this: MathJsChain<BigNumber>): MathJsChain<BigNumber>
|
4872 | bitNot(this: MathJsChain<MathArray>): MathJsChain<MathArray>
|
4873 | bitNot(this: MathJsChain<Matrix>): MathJsChain<Matrix>
|
4874 |
|
4875 | |
4876 |
|
4877 |
|
4878 |
|
4879 |
|
4880 |
|
4881 | bitOr(this: MathJsChain<number>, y: number): MathJsChain<number>
|
4882 | bitOr(this: MathJsChain<BigNumber>, y: BigNumber): MathJsChain<BigNumber>
|
4883 | bitOr(this: MathJsChain<MathArray>, y: MathArray): MathJsChain<MathArray>
|
4884 | bitOr(this: MathJsChain<Matrix>, y: Matrix): MathJsChain<Matrix>
|
4885 |
|
4886 | |
4887 |
|
4888 |
|
4889 |
|
4890 |
|
4891 | bitXor<T extends number | BigNumber | MathCollection>(
|
4892 | this: MathJsChain<T>,
|
4893 | y: number | BigNumber | MathCollection
|
4894 | ): MathJsChain<NoLiteralType<T>>
|
4895 |
|
4896 | |
4897 |
|
4898 |
|
4899 |
|
4900 |
|
4901 |
|
4902 | leftShift<T extends number | BigNumber | MathCollection>(
|
4903 | this: MathJsChain<T>,
|
4904 | y: number | BigNumber
|
4905 | ): MathJsChain<NoLiteralType<T>>
|
4906 |
|
4907 | |
4908 |
|
4909 |
|
4910 |
|
4911 |
|
4912 |
|
4913 | rightArithShift<T extends number | BigNumber | MathCollection>(
|
4914 | this: MathJsChain<T>,
|
4915 | y: number | BigNumber
|
4916 | ): MathJsChain<NoLiteralType<T>>
|
4917 |
|
4918 | |
4919 |
|
4920 |
|
4921 |
|
4922 |
|
4923 |
|
4924 | rightLogShift<T extends number | MathCollection>(
|
4925 | this: MathJsChain<T>,
|
4926 | y: number
|
4927 | ): MathJsChain<NoLiteralType<T>>
|
4928 |
|
4929 | |
4930 |
|
4931 |
|
4932 |
|
4933 | |
4934 |
|
4935 |
|
4936 |
|
4937 |
|
4938 |
|
4939 |
|
4940 | bellNumbers(this: MathJsChain<number>): MathJsChain<number>
|
4941 | bellNumbers(this: MathJsChain<BigNumber>): MathJsChain<BigNumber>
|
4942 |
|
4943 | |
4944 |
|
4945 |
|
4946 |
|
4947 |
|
4948 |
|
4949 | catalan(this: MathJsChain<number>): MathJsChain<number>
|
4950 | catalan(this: MathJsChain<BigNumber>): MathJsChain<BigNumber>
|
4951 |
|
4952 | |
4953 |
|
4954 |
|
4955 |
|
4956 |
|
4957 | composition<T extends number | BigNumber>(
|
4958 | this: MathJsChain<T>,
|
4959 | k: number | BigNumber
|
4960 | ): MathJsChain<NoLiteralType<T>>
|
4961 |
|
4962 | |
4963 |
|
4964 |
|
4965 |
|
4966 |
|
4967 |
|
4968 |
|
4969 |
|
4970 | stirlingS2<T extends number | BigNumber>(
|
4971 | this: MathJsChain<T>,
|
4972 | k: number | BigNumber
|
4973 | ): MathJsChain<NoLiteralType<T>>
|
4974 |
|
4975 | |
4976 |
|
4977 |
|
4978 |
|
4979 | |
4980 |
|
4981 |
|
4982 |
|
4983 |
|
4984 |
|
4985 | arg(this: MathJsChain<number | Complex>): MathJsChain<number>
|
4986 | arg(this: MathJsChain<BigNumber | Complex>): MathJsChain<BigNumber>
|
4987 | arg(this: MathJsChain<MathArray>): MathJsChain<MathArray>
|
4988 | arg(this: MathJsChain<Matrix>): MathJsChain<Matrix>
|
4989 |
|
4990 | |
4991 |
|
4992 |
|
4993 |
|
4994 |
|
4995 | conj<T extends number | BigNumber | Complex | MathCollection>(
|
4996 | this: MathJsChain<T>
|
4997 | ): MathJsChain<NoLiteralType<T>>
|
4998 |
|
4999 | |
5000 |
|
5001 |
|
5002 |
|
5003 |
|
5004 | im(this: MathJsChain<number | Complex>): MathJsChain<number>
|
5005 | im(this: MathJsChain<BigNumber>): MathJsChain<BigNumber>
|
5006 | im(this: MathJsChain<MathCollection>): MathJsChain<MathCollection>
|
5007 |
|
5008 | |
5009 |
|
5010 |
|
5011 |
|
5012 |
|
5013 | re(this: MathJsChain<number | Complex>): MathJsChain<number>
|
5014 | re(this: MathJsChain<BigNumber>): MathJsChain<BigNumber>
|
5015 | re(this: MathJsChain<MathCollection>): MathJsChain<MathCollection>
|
5016 |
|
5017 | |
5018 |
|
5019 |
|
5020 |
|
5021 | |
5022 |
|
5023 |
|
5024 |
|
5025 |
|
5026 |
|
5027 |
|
5028 |
|
5029 |
|
5030 |
|
5031 | distance(
|
5032 | this: MathJsChain<MathCollection | object>,
|
5033 | y: MathCollection | object
|
5034 | ): MathJsChain<number | BigNumber>
|
5035 |
|
5036 | |
5037 |
|
5038 |
|
5039 |
|
5040 |
|
5041 |
|
5042 |
|
5043 |
|
5044 |
|
5045 |
|
5046 |
|
5047 |
|
5048 |
|
5049 | intersect(
|
5050 | this: MathJsChain<MathCollection>,
|
5051 | x: MathCollection,
|
5052 | y: MathCollection,
|
5053 | z: MathCollection
|
5054 | ): MathJsChain<MathArray>
|
5055 |
|
5056 | |
5057 |
|
5058 |
|
5059 |
|
5060 | |
5061 |
|
5062 |
|
5063 |
|
5064 |
|
5065 |
|
5066 | and(
|
5067 | this: MathJsChain<number | BigNumber | Complex | Unit | MathCollection>,
|
5068 | y: number | BigNumber | Complex | Unit | MathCollection
|
5069 | ): MathJsChain<boolean | MathCollection>
|
5070 |
|
5071 | |
5072 |
|
5073 |
|
5074 |
|
5075 | not(
|
5076 | this: MathJsChain<number | BigNumber | Complex | Unit | MathCollection>
|
5077 | ): MathJsChain<boolean | MathCollection>
|
5078 |
|
5079 | |
5080 |
|
5081 |
|
5082 |
|
5083 |
|
5084 |
|
5085 | or(
|
5086 | this: MathJsChain<number | BigNumber | Complex | Unit | MathCollection>,
|
5087 | y: number | BigNumber | Complex | Unit | MathCollection
|
5088 | ): MathJsChain<boolean | MathCollection>
|
5089 |
|
5090 | |
5091 |
|
5092 |
|
5093 |
|
5094 |
|
5095 |
|
5096 | xor(
|
5097 | this: MathJsChain<number | BigNumber | Complex | Unit | MathCollection>,
|
5098 | y: number | BigNumber | Complex | Unit | MathCollection
|
5099 | ): MathJsChain<boolean | MathCollection>
|
5100 |
|
5101 | |
5102 |
|
5103 |
|
5104 |
|
5105 | |
5106 |
|
5107 |
|
5108 |
|
5109 |
|
5110 |
|
5111 | concat(
|
5112 | this: MathJsChain<Array<MathCollection | number | BigNumber>>
|
5113 | ): MathJsChain<MathCollection>
|
5114 |
|
5115 | |
5116 |
|
5117 |
|
5118 |
|
5119 |
|
5120 |
|
5121 |
|
5122 | cross(
|
5123 | this: MathJsChain<MathCollection>,
|
5124 | y: MathCollection
|
5125 | ): MathJsChain<Matrix | MathArray>
|
5126 |
|
5127 | |
5128 |
|
5129 |
|
5130 |
|
5131 | det(this: MathJsChain<MathCollection>): MathJsChain<number>
|
5132 |
|
5133 | |
5134 |
|
5135 |
|
5136 |
|
5137 |
|
5138 |
|
5139 |
|
5140 |
|
5141 |
|
5142 |
|
5143 |
|
5144 | diag(
|
5145 | this: MathJsChain<MathCollection>,
|
5146 | format?: string
|
5147 | ): MathJsChain<Matrix>
|
5148 | diag(
|
5149 | this: MathJsChain<MathCollection>,
|
5150 | k: number | BigNumber,
|
5151 | format?: string
|
5152 | ): MathJsChain<Matrix | MathArray>
|
5153 |
|
5154 | |
5155 |
|
5156 |
|
5157 |
|
5158 |
|
5159 |
|
5160 | dot(
|
5161 | this: MathJsChain<MathCollection>,
|
5162 | y: MathCollection
|
5163 | ): MathJsChain<number>
|
5164 |
|
5165 | |
5166 |
|
5167 |
|
5168 |
|
5169 |
|
5170 |
|
5171 |
|
5172 |
|
5173 | expm(this: MathJsChain<Matrix>): MathJsChain<Matrix>
|
5174 |
|
5175 | |
5176 |
|
5177 |
|
5178 |
|
5179 |
|
5180 | identity(
|
5181 | this: MathJsChain<number | number[] | Matrix | MathArray>,
|
5182 | format?: string
|
5183 | ): MathJsChain<Matrix | MathArray | number>
|
5184 |
|
5185 | |
5186 |
|
5187 |
|
5188 |
|
5189 | identity(
|
5190 | this: MathJsChain<number>,
|
5191 | n: number,
|
5192 | format?: string
|
5193 | ): MathJsChain<Matrix | MathArray | number>
|
5194 |
|
5195 | |
5196 |
|
5197 |
|
5198 | filter(
|
5199 | this: MathJsChain<Matrix | MathArray | string[]>,
|
5200 | test:
|
5201 | | ((
|
5202 |
|
5203 | value: any,
|
5204 |
|
5205 | index: any,
|
5206 | matrix: Matrix | MathArray | string[]
|
5207 | ) => boolean)
|
5208 | | RegExp
|
5209 | ): MathJsChain<Matrix | MathArray>
|
5210 |
|
5211 | |
5212 |
|
5213 |
|
5214 |
|
5215 | flatten<T extends MathCollection>(x: MathJsChain<T>): MathJsChain<T>
|
5216 |
|
5217 | |
5218 |
|
5219 |
|
5220 |
|
5221 | forEach<T extends Matrix | MathArray>(
|
5222 | this: MathJsChain<T>,
|
5223 |
|
5224 | callback: (value: any, index: any, matrix: T) => void
|
5225 | ): MathJsChain<T>
|
5226 |
|
5227 | |
5228 |
|
5229 |
|
5230 |
|
5231 | inv<T extends number | Complex | MathCollection>(
|
5232 | this: MathJsChain<T>
|
5233 | ): MathJsChain<NoLiteralType<T>>
|
5234 |
|
5235 | |
5236 |
|
5237 |
|
5238 |
|
5239 | kron(
|
5240 | this: MathJsChain<Matrix | MathArray>,
|
5241 | y: Matrix | MathArray
|
5242 | ): MathJsChain<Matrix>
|
5243 |
|
5244 | |
5245 |
|
5246 |
|
5247 |
|
5248 |
|
5249 |
|
5250 |
|
5251 | map<T extends Matrix | MathArray>(
|
5252 | this: MathJsChain<T>,
|
5253 |
|
5254 | callback: (value: any, index: any, matrix: T) => MathType | string
|
5255 | ): MathJsChain<T>
|
5256 |
|
5257 | |
5258 |
|
5259 |
|
5260 |
|
5261 |
|
5262 | ones(
|
5263 | this: MathJsChain<number | number[]>,
|
5264 | format?: string
|
5265 | ): MathJsChain<MathCollection>
|
5266 |
|
5267 | |
5268 |
|
5269 |
|
5270 | ones(
|
5271 | this: MathJsChain<number>,
|
5272 | n: number,
|
5273 | format?: string
|
5274 | ): MathJsChain<MathCollection>
|
5275 |
|
5276 | |
5277 |
|
5278 |
|
5279 |
|
5280 |
|
5281 |
|
5282 |
|
5283 |
|
5284 | partitionSelect(
|
5285 | this: MathJsChain<MathCollection>,
|
5286 | k: number,
|
5287 |
|
5288 | compare?: 'asc' | 'desc' | ((a: any, b: any) => number)
|
5289 | ): MathJsChain<MathCollection>
|
5290 |
|
5291 | /**
|
5292 | * Create an array from a range. By default, the range end is excluded.
|
5293 | * This can be customized by providing an extra parameter includeEnd.
|
5294 | * @param end End of the range, excluded by default, included when
|
5295 | * parameter includeEnd=true
|
5296 | * @param step Step size. Default value is 1.
|
5297 | * @param includeEnd: Option to specify whether to include the end or
|
5298 | * not. False by default
|
5299 | */
|
5300 | range(this: MathJsChain<string>, includeEnd?: boolean): MathJsChain<Matrix>
|
5301 | range(
|
5302 | this: MathJsChain<number | BigNumber>,
|
5303 | end: number | BigNumber,
|
5304 | includeEnd?: boolean
|
5305 | ): MathJsChain<Matrix>
|
5306 | range(
|
5307 | this: MathJsChain<number | BigNumber>,
|
5308 | end: number | BigNumber,
|
5309 | step: number | BigNumber,
|
5310 | includeEnd?: boolean
|
5311 | ): MathJsChain<Matrix>
|
5312 |
|
5313 | /**
|
5314 | * Reshape a multi dimensional array to fit the specified dimensions
|
5315 | * @param sizes One dimensional array with integral sizes for each
|
5316 | * dimension
|
5317 | */
|
5318 | reshape<T extends MathCollection>(
|
5319 | this: MathJsChain<T>,
|
5320 | sizes: number[]
|
5321 | ): MathJsChain<T>
|
5322 |
|
5323 | /**
|
5324 | * Resize a matrix
|
5325 | * @param size One dimensional array with numbers
|
5326 | * @param defaultValue Zero by default, except in case of a string, in
|
5327 | * that case defaultValue = ' ' Default value: 0.
|
5328 | */
|
5329 | resize<T extends MathCollection>(
|
5330 | this: MathJsChain<T>,
|
5331 | size: MathCollection,
|
5332 | defaultValue?: number | string
|
5333 | ): MathJsChain<T>
|
5334 |
|
5335 | /**
|
5336 | * Calculate the size of a matrix or scalar.
|
5337 | */
|
5338 | size(
|
5339 | this: MathJsChain<
|
5340 | boolean | number | Complex | Unit | string | MathCollection
|
5341 | >
|
5342 | ): MathJsChain<MathCollection>
|
5343 |
|
5344 | /**
|
5345 | * Sort the items in a matrix
|
5346 | * @param compare An optional _comparator function or name. The function
|
5347 | * is called as compare(a, b), and must return 1 when a > b, -1 when a <
|
5348 | * b, and 0 when a == b. Default value: ‘asc’
|
5349 | */
|
5350 | sort<T extends Matrix | MathArray>(
|
5351 | this: MathJsChain<T>,
|
5352 |
|
5353 | compare: ((a: any, b: any) => number) | 'asc' | 'desc' | 'natural'
|
5354 | ): MathJsChain<T>
|
5355 |
|
5356 | /**
|
5357 | * Calculate the principal square root of a square matrix. The principal
|
5358 | * square root matrix X of another matrix A is such that X * X = A.
|
5359 | */
|
5360 |
|
5361 | sqrtm<T extends MathCollection>(A: MathJsChain<T>): MathJsChain<T>
|
5362 |
|
5363 | /**
|
5364 | * Squeeze a matrix, remove inner and outer singleton dimensions from a
|
5365 | * matrix.
|
5366 | */
|
5367 |
|
5368 | squeeze<T extends MathCollection>(x: MathJsChain<T>): MathJsChain<T>
|
5369 |
|
5370 | /**
|
5371 | * Get or set a subset of a matrix or string.
|
5372 | * @param index For each dimension, an index or list of indices to get or set
|
5373 | * @param replacement An array, matrix, or scalar. If provided, the
|
5374 | * subset is replaced with replacement. If not provided, the subset is
|
5375 | * returned
|
5376 | * @param defaultValue Default value, filled in on new entries when the
|
5377 | * matrix is resized. If not provided, math.matrix elements will be left
|
5378 | * undefined. Default value: undefined.
|
5379 | */
|
5380 | // eslint-disable-next-line @typescript-eslint/no-explicit-any
|
5381 | subset<T extends MathCollection | string>(
|
5382 | this: MathJsChain<T>,
|
5383 | index: Index,
|
5384 |
|
5385 | replacement?: any,
|
5386 |
|
5387 | defaultValue?: any
|
5388 | ): MathJsChain<T>
|
5389 |
|
5390 | /**
|
5391 | * Calculate the trace of a matrix: the sum of the elements on the main
|
5392 | * diagonal of a square matrix.
|
5393 | */
|
5394 |
|
5395 | trace(this: MathJsChain<MathCollection>): MathJsChain<number>
|
5396 |
|
5397 | /**
|
5398 | * Transpose a matrix. All values of the matrix are reflected over its
|
5399 | * main diagonal. Only two dimensional matrices are supported.
|
5400 | */
|
5401 |
|
5402 | transpose<T extends MathCollection>(x: MathJsChain<T>): MathJsChain<T>
|
5403 |
|
5404 | /**
|
5405 | * Create a matrix filled with zeros. The created matrix can have one or
|
5406 | * multiple dimensions.
|
5407 | * @param format The matrix storage format
|
5408 | * @returns A matrix filled with zeros
|
5409 | */
|
5410 | zeros(
|
5411 | this: MathJsChain<number | number[]>,
|
5412 | format?: string
|
5413 | ): MathJsChain<MathCollection>
|
5414 |
|
5415 | /**
|
5416 | * @param n The y dimension of the matrix
|
5417 | * @param format The matrix storage format
|
5418 | */
|
5419 | zeros(
|
5420 | this: MathJsChain<number>,
|
5421 | n: number,
|
5422 | format?: string
|
5423 | ): MathJsChain<MathCollection>
|
5424 |
|
5425 | /*************************************************************************
|
5426 | * Probability functions
|
5427 | ************************************************************************/
|
5428 |
|
5429 | /**
|
5430 | * Compute the number of ways of picking k unordered outcomes from n
|
5431 | * possibilities. Combinations only takes integer arguments. The
|
5432 | * following condition must be enforced: k <= n.
|
5433 | * @param k Number of objects in the subset
|
5434 | */
|
5435 | combinations<T extends number | BigNumber>(
|
5436 | n: MathJsChain<T>,
|
5437 | k: number | BigNumber
|
5438 | ): MathJsChain<NoLiteralType<T>>
|
5439 |
|
5440 | /**
|
5441 | * Compute the factorial of a value Factorial only supports an integer
|
5442 | * value as argument. For matrices, the function is evaluated element
|
5443 | * wise.
|
5444 | */
|
5445 |
|
5446 | factorial<T extends number | BigNumber | MathCollection>(
|
5447 | n: MathJsChain<T>
|
5448 | ): MathJsChain<NoLiteralType<T>>
|
5449 |
|
5450 | /**
|
5451 | * Compute the gamma function of a value using Lanczos approximation for
|
5452 | * small values, and an extended Stirling approximation for large
|
5453 | * values. For matrices, the function is evaluated element wise.
|
5454 | */
|
5455 |
|
5456 | gamma<T extends number | BigNumber | Complex | MathCollection>(
|
5457 | n: MathJsChain<T>
|
5458 | ): MathJsChain<NoLiteralType<T>>
|
5459 |
|
5460 | /**
|
5461 | * Calculate the Kullback-Leibler (KL) divergence between two
|
5462 | * distributions
|
5463 | * @param p Second vector
|
5464 | */
|
5465 | kldivergence(
|
5466 | this: MathJsChain<MathCollection>,
|
5467 | p: MathCollection
|
5468 | ): MathJsChain<number>
|
5469 |
|
5470 | /**
|
5471 | * Multinomial Coefficients compute the number of ways of picking a1,
|
5472 | * a2, ..., ai unordered outcomes from n possibilities. multinomial
|
5473 | * takes one array of integers as an argument. The following condition
|
5474 | * must be enforced: every ai <= 0
|
5475 | */
|
5476 |
|
5477 | multinomial<T extends number | BigNumber>(
|
5478 | a: MathJsChain<T[]>
|
5479 | ): MathJsChain<NoLiteralType<T>>
|
5480 |
|
5481 | /**
|
5482 | * Compute the number of ways of obtaining an ordered subset of k
|
5483 | * elements from a set of n elements. Permutations only takes integer
|
5484 | * arguments. The following condition must be enforced: k <= n.
|
5485 | * @param k The number of objects in the subset
|
5486 | */
|
5487 | permutations<T extends number | BigNumber>(
|
5488 | n: MathJsChain<T>,
|
5489 | k?: number | BigNumber
|
5490 | ): MathJsChain<NoLiteralType<T>>
|
5491 |
|
5492 | /**
|
5493 | * Random pick a value from a one dimensional array. Array element is
|
5494 | * picked using a random function with uniform distribution.
|
5495 | * @param number An int or float
|
5496 | * @param weights An array of ints or floats
|
5497 | */
|
5498 | pickRandom(
|
5499 | array: MathJsChain<number[]>,
|
5500 | number?: number,
|
5501 | weights?: number[]
|
5502 | ): MathJsChain<number | number[]>
|
5503 |
|
5504 | /**
|
5505 | * Return a random number larger or equal to min and smaller than max
|
5506 | * using a uniform distribution.
|
5507 | * @param min Minimum boundary for the random value, included
|
5508 | * @param max Maximum boundary for the random value, excluded
|
5509 | */
|
5510 | random(this: MathJsChain<number>, max?: number): MathJsChain<number>
|
5511 |
|
5512 | // tslint:disable-next-line unified-signatures
|
5513 | random<T extends MathCollection>(
|
5514 | this: MathJsChain<T>,
|
5515 | min?: number,
|
5516 | max?: number
|
5517 | ): MathJsChain<T>
|
5518 |
|
5519 | /**
|
5520 | * Return a random integer number larger or equal to min and smaller
|
5521 | * than max using a uniform distribution.
|
5522 | * @param min Minimum boundary for the random value, included
|
5523 | * @param max Maximum boundary for the random value, excluded
|
5524 | */
|
5525 | randomInt<T extends MathCollection>(
|
5526 | this: MathJsChain<T>,
|
5527 | max?: number
|
5528 | ): MathJsChain<T>
|
5529 | randomInt<T extends MathCollection>(
|
5530 | this: MathJsChain<T>,
|
5531 | max?: number
|
5532 | ): MathJsChain<T>
|
5533 | // tslint:disable-next-line unified-signatures
|
5534 | randomInt<T extends MathCollection>(
|
5535 | this: MathJsChain<T>,
|
5536 | min: number,
|
5537 | max: number
|
5538 | ): MathJsChain<T>
|
5539 |
|
5540 | /*************************************************************************
|
5541 | * Relational functions
|
5542 | ************************************************************************/
|
5543 |
|
5544 | /**
|
5545 | * Compare two values. Returns 1 when x > y, -1 when x < y, and 0 when x
|
5546 | * == y. x and y are considered equal when the relative difference
|
5547 | * between x and y is smaller than the configured epsilon. The function
|
5548 | * cannot be used to compare values smaller than approximately 2.22e-16.
|
5549 | * For matrices, the function is evaluated element wise.
|
5550 | * @param y Second value to compare
|
5551 | */
|
5552 | compare(
|
5553 | this: MathJsChain<MathType | string>,
|
5554 | y: MathType | string
|
5555 | ): MathJsChain<number | BigNumber | Fraction | MathCollection>
|
5556 |
|
5557 | /**
|
5558 | * Compare two values of any type in a deterministic, natural way. For
|
5559 | * numeric values, the function works the same as math.compare. For
|
5560 | * types of values that can’t be compared mathematically, the function
|
5561 | * compares in a natural way.
|
5562 | * @param y Second value to compare
|
5563 | */
|
5564 | // eslint-disable-next-line @typescript-eslint/no-explicit-any
|
5565 | compareNatural(this: MathJsChain<any>, y: any): MathJsChain<number>
|
5566 |
|
5567 | /**
|
5568 | * Compare two strings lexically. Comparison is case sensitive. Returns
|
5569 | * 1 when x > y, -1 when x < y, and 0 when x == y. For matrices, the
|
5570 | * function is evaluated element wise.
|
5571 | * @param y Second string to compare
|
5572 | */
|
5573 | compareText(
|
5574 | this: MathJsChain<string | MathCollection>,
|
5575 | y: string | MathCollection
|
5576 | ): MathJsChain<number | MathCollection>
|
5577 |
|
5578 | /**
|
5579 | * Test element wise whether two matrices are equal. The function
|
5580 | * accepts both matrices and scalar values.
|
5581 | * @param y Second amtrix to compare
|
5582 | */
|
5583 | deepEqual(
|
5584 | this: MathJsChain<MathType>,
|
5585 | y: MathType
|
5586 | ): MathJsChain<
|
5587 | number | BigNumber | Fraction | Complex | Unit | MathCollection
|
5588 | >
|
5589 |
|
5590 | /**
|
5591 | * Test whether two values are equal.
|
5592 | *
|
5593 | * The function tests whether the relative difference between x and y is
|
5594 | * smaller than the configured epsilon. The function cannot be used to
|
5595 | * compare values smaller than approximately 2.22e-16. For matrices, the
|
5596 | * function is evaluated element wise. In case of complex numbers, x.re
|
5597 | * must equal y.re, and x.im must equal y.im. Values null and undefined
|
5598 | * are compared strictly, thus null is only equal to null and nothing
|
5599 | * else, and undefined is only equal to undefined and nothing else.
|
5600 | * @param y Second value to compare
|
5601 | */
|
5602 | equal(
|
5603 | this: MathJsChain<MathType | string>,
|
5604 | y: MathType | string
|
5605 | ): MathJsChain<boolean | MathCollection>
|
5606 |
|
5607 | /**
|
5608 | * Check equality of two strings. Comparison is case sensitive. For
|
5609 | * matrices, the function is evaluated element wise.
|
5610 | * @param y Second string to compare
|
5611 | */
|
5612 | equalText(
|
5613 | this: MathJsChain<string | MathCollection>,
|
5614 | y: string | MathCollection
|
5615 | ): MathJsChain<number | MathCollection>
|
5616 |
|
5617 | /**
|
5618 | * Test whether value x is larger than y. The function returns true when
|
5619 | * x is larger than y and the relative difference between x and y is
|
5620 | * larger than the configured epsilon. The function cannot be used to
|
5621 | * compare values smaller than approximately 2.22e-16. For matrices, the
|
5622 | * function is evaluated element wise.
|
5623 | * @param y Second value to compare
|
5624 | */
|
5625 | larger(
|
5626 | this: MathJsChain<MathType | string>,
|
5627 | y: MathType | string
|
5628 | ): MathJsChain<boolean | MathCollection>
|
5629 |
|
5630 | /**
|
5631 | * Test whether value x is larger or equal to y. The function returns
|
5632 | * true when x is larger than y or the relative difference between x and
|
5633 | * y is smaller than the configured epsilon. The function cannot be used
|
5634 | * to compare values smaller than approximately 2.22e-16. For matrices,
|
5635 | * the function is evaluated element wise.
|
5636 | * @param y Second value to vcompare
|
5637 | */
|
5638 | largerEq(
|
5639 | this: MathJsChain<MathType | string>,
|
5640 | y: MathType | string
|
5641 | ): MathJsChain<boolean | MathCollection>
|
5642 |
|
5643 | /**
|
5644 | * Test whether value x is smaller than y. The function returns true
|
5645 | * when x is smaller than y and the relative difference between x and y
|
5646 | * is smaller than the configured epsilon. The function cannot be used
|
5647 | * to compare values smaller than approximately 2.22e-16. For matrices,
|
5648 | * the function is evaluated element wise.
|
5649 | * @param y Second value to vcompare
|
5650 | */
|
5651 | smaller(
|
5652 | this: MathJsChain<MathType | string>,
|
5653 | y: MathType | string
|
5654 | ): MathJsChain<boolean | MathCollection>
|
5655 |
|
5656 | /**
|
5657 | * Test whether value x is smaller or equal to y. The function returns
|
5658 | * true when x is smaller than y or the relative difference between x
|
5659 | * and y is smaller than the configured epsilon. The function cannot be
|
5660 | * used to compare values smaller than approximately 2.22e-16. For
|
5661 | * matrices, the function is evaluated element wise.
|
5662 | * @param y Second value to compare
|
5663 | */
|
5664 | smallerEq(
|
5665 | this: MathJsChain<MathType | string>,
|
5666 | y: MathType | string
|
5667 | ): MathJsChain<boolean | MathCollection>
|
5668 |
|
5669 | /**
|
5670 | * Test whether two values are unequal. The function tests whether the
|
5671 | * relative difference between x and y is larger than the configured
|
5672 | * epsilon. The function cannot be used to compare values smaller than
|
5673 | * approximately 2.22e-16. For matrices, the function is evaluated
|
5674 | * element wise. In case of complex numbers, x.re must unequal y.re, or
|
5675 | * x.im must unequal y.im. Values null and undefined are compared
|
5676 | * strictly, thus null is unequal with everything except null, and
|
5677 | * undefined is unequal with everything except undefined.
|
5678 | * @param y Second value to vcompare
|
5679 | */
|
5680 | unequal(
|
5681 | this: MathJsChain<MathType | string>,
|
5682 | y: MathType | string
|
5683 | ): MathJsChain<boolean | MathCollection>
|
5684 |
|
5685 | /*************************************************************************
|
5686 | * Set functions
|
5687 | ************************************************************************/
|
5688 |
|
5689 | /**
|
5690 | * Create the cartesian product of two (multi)sets. Multi-dimension
|
5691 | * arrays will be converted to single-dimension arrays and the values
|
5692 | * will be sorted in ascending order before the operation.
|
5693 | * @param a2 A (multi)set
|
5694 | */
|
5695 | setCartesian<T extends MathCollection>(
|
5696 | this: MathJsChain<T>,
|
5697 | a2: MathCollection
|
5698 | ): MathJsChain<T>
|
5699 |
|
5700 | /**
|
5701 | * Create the difference of two (multi)sets: every element of set1, that
|
5702 | * is not the element of set2. Multi-dimension arrays will be converted
|
5703 | * to single-dimension arrays before the operation
|
5704 | * @param a2 A (multi)set
|
5705 | */
|
5706 | setDifference<T extends MathCollection>(
|
5707 | this: MathJsChain<T>,
|
5708 | a2: MathCollection
|
5709 | ): MathJsChain<T>
|
5710 |
|
5711 | /**
|
5712 | * Collect the distinct elements of a multiset. A multi-dimension array
|
5713 | * will be converted to a single-dimension array before the operation.
|
5714 | */
|
5715 |
|
5716 | setDistinct<T extends MathCollection>(a: MathJsChain<T>): MathJsChain<T>
|
5717 |
|
5718 | /**
|
5719 | * Create the intersection of two (multi)sets. Multi-dimension arrays
|
5720 | * will be converted to single-dimension arrays before the operation.
|
5721 | * @param a2 A (multi)set
|
5722 | */
|
5723 | setIntersect<T extends MathCollection>(
|
5724 | this: MathJsChain<T>,
|
5725 | a2: MathCollection
|
5726 | ): MathJsChain<T>
|
5727 |
|
5728 | /**
|
5729 | * Check whether a (multi)set is a subset of another (multi)set. (Every
|
5730 | * element of set1 is the element of set2.) Multi-dimension arrays will
|
5731 | * be converted to single-dimension arrays before the operation.
|
5732 | * @param a2 A (multi)set
|
5733 | */
|
5734 | setIsSubset(
|
5735 | this: MathJsChain<MathCollection>,
|
5736 | a2: MathCollection
|
5737 | ): MathJsChain<boolean>
|
5738 |
|
5739 | /**
|
5740 | * Count the multiplicity of an element in a multiset. A multi-dimension
|
5741 | * array will be converted to a single-dimension array before the
|
5742 | * operation.
|
5743 | * @param a A multiset
|
5744 | */
|
5745 | setMultiplicity(
|
5746 | e: MathJsChain<number | BigNumber | Fraction | Complex>,
|
5747 | a: MathCollection
|
5748 | ): MathJsChain<number>
|
5749 |
|
5750 | /**
|
5751 | * Create the powerset of a (multi)set. (The powerset contains very
|
5752 | * possible subsets of a (multi)set.) A multi-dimension array will be
|
5753 | * converted to a single-dimension array before the operation.
|
5754 | */
|
5755 |
|
5756 | setPowerset<T extends MathCollection>(a: MathJsChain<T>): MathJsChain<T>
|
5757 |
|
5758 | /**
|
5759 | * Count the number of elements of a (multi)set. When a second parameter
|
5760 | * is ‘true’, count only the unique values. A multi-dimension array will
|
5761 | * be converted to a single-dimension array before the operation.
|
5762 | */
|
5763 |
|
5764 | setSize(this: MathJsChain<MathCollection>): MathJsChain<number>
|
5765 |
|
5766 | /**
|
5767 | * Create the symmetric difference of two (multi)sets. Multi-dimension
|
5768 | * arrays will be converted to single-dimension arrays before the
|
5769 | * operation.
|
5770 | * @param a2 A (multi)set
|
5771 | */
|
5772 | setSymDifference<T extends MathCollection>(
|
5773 | this: MathJsChain<T>,
|
5774 | a2: MathCollection
|
5775 | ): MathJsChain<T>
|
5776 |
|
5777 | /**
|
5778 | * Create the union of two (multi)sets. Multi-dimension arrays will be
|
5779 | * converted to single-dimension arrays before the operation.
|
5780 | * @param a2 A (multi)set
|
5781 | */
|
5782 | setUnion<T extends MathCollection>(
|
5783 | this: MathJsChain<T>,
|
5784 | a2: MathCollection
|
5785 | ): MathJsChain<T>
|
5786 |
|
5787 | /*************************************************************************
|
5788 | * Special functions
|
5789 | ************************************************************************/
|
5790 |
|
5791 | /**
|
5792 | * Compute the erf function of a value using a rational Chebyshev
|
5793 | * approximations for different intervals of x.
|
5794 | */
|
5795 | erf<T extends number | MathCollection>(
|
5796 | this: MathJsChain<T>
|
5797 | ): MathJsChain<NoLiteralType<T>>
|
5798 |
|
5799 | /*************************************************************************
|
5800 | * Statistics functions
|
5801 | ************************************************************************/
|
5802 |
|
5803 | /**
|
5804 | * Compute the median absolute deviation of a matrix or a list with
|
5805 | * values. The median absolute deviation is defined as the median of the
|
5806 | * absolute deviations from the median.
|
5807 | */
|
5808 | // eslint-disable-next-line @typescript-eslint/no-explicit-any
|
5809 | mad(this: MathJsChain<MathCollection>): MathJsChain<any>
|
5810 |
|
5811 | /**
|
5812 | * Compute the maximum value of a matrix or a list with values. In case
|
5813 | * of a multi dimensional array, the maximum of the flattened array will
|
5814 | * be calculated. When dim is provided, the maximum over the selected
|
5815 | * dimension will be calculated. Parameter dim is zero-based.
|
5816 | * @param dim The maximum over the selected dimension
|
5817 | */
|
5818 |
|
5819 | // eslint-disable-next-line @typescript-eslint/no-explicit-any
|
5820 | max(this: MathJsChain<MathType[]>, dim?: number): MathJsChain<any>
|
5821 | // eslint-disable-next-line @typescript-eslint/no-explicit-any
|
5822 | max(this: MathJsChain<MathCollection>, dim?: number): MathJsChain<any>
|
5823 |
|
5824 | /**
|
5825 | * Compute the mean value of matrix or a list with values. In case of a
|
5826 | * multi dimensional array, the mean of the flattened array will be
|
5827 | * calculated. When dim is provided, the maximum over the selected
|
5828 | * dimension will be calculated. Parameter dim is zero-based.
|
5829 | * @param dim The mean over the selected dimension
|
5830 | */
|
5831 | // eslint-disable-next-line @typescript-eslint/no-explicit-any
|
5832 | mean(this: MathJsChain<MathType[]>, dim?: number): MathJsChain<any>
|
5833 | // eslint-disable-next-line @typescript-eslint/no-explicit-any
|
5834 | mean(this: MathJsChain<MathCollection>, dim?: number): MathJsChain<any>
|
5835 |
|
5836 | /**
|
5837 | * Compute the median of a matrix or a list with values. The values are
|
5838 | * sorted and the middle value is returned. In case of an even number of
|
5839 | * values, the average of the two middle values is returned. Supported
|
5840 | * types of values are: Number, BigNumber, Unit In case of a (multi
|
5841 | * dimensional) array or matrix, the median of all elements will be
|
5842 | * calculated.
|
5843 | */
|
5844 | // eslint-disable-next-line @typescript-eslint/no-explicit-any
|
5845 | median(this: MathJsChain<MathType[]>, dim?: number): MathJsChain<any>
|
5846 | // eslint-disable-next-line @typescript-eslint/no-explicit-any
|
5847 | median(this: MathJsChain<MathCollection>, dim?: number): MathJsChain<any>
|
5848 |
|
5849 | /**
|
5850 | * Compute the maximum value of a matrix or a list of values. In case of
|
5851 | * a multi dimensional array, the maximum of the flattened array will be
|
5852 | * calculated. When dim is provided, the maximum over the selected
|
5853 | * dimension will be calculated. Parameter dim is zero-based.
|
5854 | * @param dim The minimum over the selected dimension
|
5855 | */
|
5856 | // eslint-disable-next-line @typescript-eslint/no-explicit-any
|
5857 | min(this: MathJsChain<MathType[]>): MathJsChain<MathType[]>
|
5858 | // eslint-disable-next-line @typescript-eslint/no-explicit-any
|
5859 | min(this: MathJsChain<MathCollection>, dim?: number): MathJsChain<any>
|
5860 |
|
5861 | /**
|
5862 | * Computes the mode of a set of numbers or a list with values(numbers
|
5863 | * or characters). If there are more than one modes, it returns a list
|
5864 | * of those values.
|
5865 | */
|
5866 |
|
5867 | mode(this: MathJsChain<MathType[]>): MathJsChain<MathType[]>
|
5868 |
|
5869 | /**
|
5870 | * Compute the product of a matrix or a list with values. In case of a
|
5871 | * (multi dimensional) array or matrix, the sum of all elements will be
|
5872 | * calculated.
|
5873 | */
|
5874 | // eslint-disable-next-line @typescript-eslint/no-explicit-any
|
5875 | prod(this: MathJsChain<MathType[]>): MathJsChain<any>
|
5876 |
|
5877 | /**
|
5878 | * Compute the prob order quantile of a matrix or a list with values.
|
5879 | * The sequence is sorted and the middle value is returned. Supported
|
5880 | * types of sequence values are: Number, BigNumber, Unit Supported types
|
5881 | * of probability are: Number, BigNumber In case of a (multi
|
5882 | * dimensional) array or matrix, the prob order quantile of all elements
|
5883 | * will be calculated.
|
5884 | * @param probOrN prob is the order of the quantile, while N is the
|
5885 | * amount of evenly distributed steps of probabilities; only one of
|
5886 | * these options can be provided
|
5887 | * @param sorted =false is data sorted in ascending order
|
5888 | */
|
5889 | quantileSeq(
|
5890 | A: MathJsChain<MathCollection>,
|
5891 | prob: number | BigNumber | MathArray,
|
5892 | sorted?: boolean
|
5893 | ): MathJsChain<number | BigNumber | Unit | MathArray>
|
5894 |
|
5895 | /**
|
5896 | * Compute the standard deviation of a matrix or a list with values. The
|
5897 | * standard deviations is defined as the square root of the variance:
|
5898 | * std(A) = sqrt(variance(A)). In case of a (multi dimensional) array or
|
5899 | * matrix, the standard deviation over all elements will be calculated.
|
5900 | * Optionally, the type of normalization can be specified as second
|
5901 | * parameter. The parameter normalization can be one of the following
|
5902 | * values: 'unbiased' (default) The sum of squared errors is divided by
|
5903 | * (n - 1) 'uncorrected' The sum of squared errors is divided by n
|
5904 | * 'biased' The sum of squared errors is divided by (n + 1)
|
5905 | * @param dim A dimension to compute standard deviation.
|
5906 | * @param normalization Determines how to normalize the variance. Choose
|
5907 | * ‘unbiased’ (default), ‘uncorrected’, or ‘biased’. Default value:
|
5908 | * ‘unbiased’.
|
5909 | * @returns The standard deviation
|
5910 | */
|
5911 | std(
|
5912 | this: MathJsChain<number[]>,
|
5913 | dim?: number,
|
5914 | normalization?: 'unbiased' | 'uncorrected' | 'biased'
|
5915 | ): MathJsChain<number>
|
5916 |
|
5917 | /**
|
5918 | * Compute the standard deviation of a matrix or a list with values. The
|
5919 | * standard deviations is defined as the square root of the variance:
|
5920 | * std(A) = sqrt(variance(A)). In case of a (multi dimensional) array or
|
5921 | * matrix, the standard deviation over all elements will be calculated.
|
5922 | * Optionally, the type of normalization can be specified as second
|
5923 | * parameter. The parameter normalization can be one of the following
|
5924 | * values: 'unbiased' (default) The sum of squared errors is divided by
|
5925 | * (n - 1) 'uncorrected' The sum of squared errors is divided by n
|
5926 | * 'biased' The sum of squared errors is divided by (n + 1)
|
5927 | * @param normalization Determines how to normalize the variance. Choose
|
5928 | * ‘unbiased’ (default), ‘uncorrected’, or ‘biased’. Default value:
|
5929 | * ‘unbiased’.
|
5930 | * @returns The standard deviation
|
5931 | */
|
5932 | std(
|
5933 | this: MathJsChain<MathCollection>,
|
5934 | dimension?: number,
|
5935 | normalization?: 'unbiased' | 'uncorrected' | 'biased'
|
5936 | ): MathJsChain<number[]>
|
5937 |
|
5938 | /**
|
5939 | * Compute the sum of a matrix or a list with values. In case of a
|
5940 | * (multi dimensional) array or matrix, the sum of all elements will be
|
5941 | * calculated.
|
5942 | */
|
5943 | std(
|
5944 | this: MathJsChain<MathCollection>,
|
5945 | normalization: 'unbiased' | 'uncorrected' | 'biased'
|
5946 | ): MathJsChain<number>
|
5947 |
|
5948 | /**
|
5949 | * Compute the variance of a matrix or a list with values. In case of a
|
5950 | * (multi dimensional) array or matrix, the variance over all elements
|
5951 | * will be calculated. Optionally, the type of normalization can be
|
5952 | * specified as second parameter. The parameter normalization can be one
|
5953 | * of the following values: 'unbiased' (default) The sum of squared
|
5954 | * errors is divided by (n - 1) 'uncorrected' The sum of squared errors
|
5955 | * is divided by n 'biased' The sum of squared errors is divided by (n +
|
5956 | * 1) Note that older browser may not like the variable name var. In
|
5957 | * that case, the function can be called as math['var'](...) instead of
|
5958 | * math.variance(...).
|
5959 | * @param dim a dimension to compute variance.
|
5960 | * @param normalization normalization Determines how to normalize the
|
5961 | * variance. Choose ‘unbiased’ (default), ‘uncorrected’, or ‘biased’.
|
5962 | * Default value: ‘unbiased’.
|
5963 | * @returns The variance
|
5964 | */
|
5965 | variance(
|
5966 | this: MathJsChain<Array<Array<number | BigNumber | Fraction>>>
|
5967 | ): MathJsChain<number>
|
5968 |
|
5969 | /**
|
5970 | * Compute the variance of a matrix or a list with values. In case of a
|
5971 | * (multi dimensional) array or matrix, the variance over all elements
|
5972 | * will be calculated. Optionally, the type of normalization can be
|
5973 | * specified as second parameter. The parameter normalization can be one
|
5974 | * of the following values: 'unbiased' (default) The sum of squared
|
5975 | * errors is divided by (n - 1) 'uncorrected' The sum of squared errors
|
5976 | * is divided by n 'biased' The sum of squared errors is divided by (n +
|
5977 | * 1) Note that older browser may not like the variable name var. In
|
5978 | * that case, the function can be called as math['var'](...) instead of
|
5979 | * math.variance(...).
|
5980 | * @param normalization normalization Determines how to normalize the
|
5981 | * variance. Choose ‘unbiased’ (default), ‘uncorrected’, or ‘biased’.
|
5982 | * Default value: ‘unbiased’.
|
5983 | * @returns The variance
|
5984 | */
|
5985 | variance(
|
5986 | this: MathJsChain<MathCollection>,
|
5987 | dimension?: number,
|
5988 | normalization?: 'unbiased' | 'uncorrected' | 'biased'
|
5989 | ): MathJsChain<number[]>
|
5990 |
|
5991 | variance(
|
5992 | this: MathJsChain<MathCollection>,
|
5993 | normalization: 'unbiased' | 'uncorrected' | 'biased'
|
5994 | ): MathJsChain<number>
|
5995 |
|
5996 | /*************************************************************************
|
5997 | * String functions
|
5998 | ************************************************************************/
|
5999 |
|
6000 | /**
|
6001 | * Format a value of any type into a string.
|
6002 | * @param options An object with formatting options.
|
6003 | * @param callback A custom formatting function, invoked for all numeric
|
6004 | * elements in value, for example all elements of a matrix, or the real
|
6005 | * and imaginary parts of a complex number. This callback can be used to
|
6006 | * override the built-in numeric notation with any type of formatting.
|
6007 | * Function callback is called with value as parameter and must return a
|
6008 | * string.
|
6009 | * @see http://mathjs.org/docs/reference/functions/format.html
|
6010 | */
|
6011 | format(
|
6012 |
|
6013 | this: MathJsChain<any>,
|
6014 |
|
6015 | value: any,
|
6016 |
|
6017 | options?: FormatOptions | number | ((item: any) => string),
|
6018 |
|
6019 | callback?: (value: any) => string
|
6020 | ): MathJsChain<string>
|
6021 |
|
6022 | /**
|
6023 | * Interpolate values into a string template.
|
6024 | * @param values An object containing variables which will be filled in
|
6025 | * in the template.
|
6026 | * @param precision Number of digits to format numbers. If not provided,
|
6027 | * the value will not be rounded.
|
6028 | * @param options Formatting options, or the number of digits to format
|
6029 | * numbers. See function math.format for a description of all options.
|
6030 | */
|
6031 | print(
|
6032 | this: MathJsChain<string>,
|
6033 |
|
6034 | values: any,
|
6035 | precision?: number,
|
6036 | options?: number | object
|
6037 | ): MathJsChain<string>
|
6038 |
|
6039 | /*************************************************************************
|
6040 | * Trigonometry functions
|
6041 | ************************************************************************/
|
6042 |
|
6043 | /**
|
6044 | * Calculate the inverse cosine of a value. For matrices, the function
|
6045 | * is evaluated element wise.
|
6046 | */
|
6047 |
|
6048 | acos(this: MathJsChain<number>): MathJsChain<number>
|
6049 | acos(this: MathJsChain<BigNumber>): MathJsChain<BigNumber>
|
6050 | acos(this: MathJsChain<Complex>): MathJsChain<Complex>
|
6051 | acos(this: MathJsChain<MathArray>): MathJsChain<MathArray>
|
6052 | acos(this: MathJsChain<Matrix>): MathJsChain<Matrix>
|
6053 |
|
6054 | /**
|
6055 | * Calculate the hyperbolic arccos of a value, defined as acosh(x) =
|
6056 | * ln(sqrt(x^2 - 1) + x). For matrices, the function is evaluated
|
6057 | * element wise.
|
6058 | */
|
6059 |
|
6060 | acosh(this: MathJsChain<number>): MathJsChain<number>
|
6061 | acosh(this: MathJsChain<BigNumber>): MathJsChain<BigNumber>
|
6062 | acosh(this: MathJsChain<Complex>): MathJsChain<Complex>
|
6063 | acosh(this: MathJsChain<MathArray>): MathJsChain<MathArray>
|
6064 | acosh(this: MathJsChain<Matrix>): MathJsChain<Matrix>
|
6065 |
|
6066 | /**
|
6067 | * Calculate the inverse cotangent of a value. For matrices, the
|
6068 | * function is evaluated element wise.
|
6069 | */
|
6070 |
|
6071 | acot(this: MathJsChain<number>): MathJsChain<number>
|
6072 | acot(this: MathJsChain<BigNumber>): MathJsChain<BigNumber>
|
6073 | acot(this: MathJsChain<MathArray>): MathJsChain<MathArray>
|
6074 | acot(this: MathJsChain<Matrix>): MathJsChain<Matrix>
|
6075 |
|
6076 | /**
|
6077 | * Calculate the hyperbolic arccotangent of a value, defined as acoth(x)
|
6078 | * = (ln((x+1)/x) + ln(x/(x-1))) / 2. For matrices, the function is
|
6079 | * evaluated element wise.
|
6080 | */
|
6081 |
|
6082 | acoth(this: MathJsChain<number>): MathJsChain<number>
|
6083 | acoth(this: MathJsChain<BigNumber>): MathJsChain<BigNumber>
|
6084 | acoth(this: MathJsChain<MathArray>): MathJsChain<MathArray>
|
6085 | acoth(this: MathJsChain<Matrix>): MathJsChain<Matrix>
|
6086 |
|
6087 | /**
|
6088 | * Calculate the inverse cosecant of a value. For matrices, the function
|
6089 | * is evaluated element wise.
|
6090 | */
|
6091 |
|
6092 | acsc(this: MathJsChain<number>): MathJsChain<number>
|
6093 | acsc(this: MathJsChain<BigNumber>): MathJsChain<BigNumber>
|
6094 | acsc(this: MathJsChain<MathArray>): MathJsChain<MathArray>
|
6095 | acsc(this: MathJsChain<Matrix>): MathJsChain<Matrix>
|
6096 |
|
6097 | /**
|
6098 | * Calculate the hyperbolic arccosecant of a value, defined as acsch(x)
|
6099 | * = ln(1/x + sqrt(1/x^2 + 1)). For matrices, the function is evaluated
|
6100 | * element wise.
|
6101 | */
|
6102 |
|
6103 | acsch(this: MathJsChain<number>): MathJsChain<number>
|
6104 | acsch(this: MathJsChain<BigNumber>): MathJsChain<BigNumber>
|
6105 | acsch(this: MathJsChain<MathArray>): MathJsChain<MathArray>
|
6106 | acsch(this: MathJsChain<Matrix>): MathJsChain<Matrix>
|
6107 |
|
6108 | /**
|
6109 | * Calculate the inverse secant of a value. For matrices, the function
|
6110 | * is evaluated element wise.
|
6111 | */
|
6112 |
|
6113 | asec(this: MathJsChain<number>): MathJsChain<number>
|
6114 | asec(this: MathJsChain<BigNumber>): MathJsChain<BigNumber>
|
6115 | asec(this: MathJsChain<MathArray>): MathJsChain<MathArray>
|
6116 | asec(this: MathJsChain<Matrix>): MathJsChain<Matrix>
|
6117 |
|
6118 | /**
|
6119 | * Calculate the hyperbolic arcsecant of a value, defined as asech(x) =
|
6120 | * ln(sqrt(1/x^2 - 1) + 1/x). For matrices, the function is evaluated
|
6121 | * element wise.
|
6122 | */
|
6123 |
|
6124 | asech(this: MathJsChain<number>): MathJsChain<number>
|
6125 | asech(this: MathJsChain<BigNumber>): MathJsChain<BigNumber>
|
6126 | asech(this: MathJsChain<MathArray>): MathJsChain<MathArray>
|
6127 | asech(this: MathJsChain<Matrix>): MathJsChain<Matrix>
|
6128 |
|
6129 | /**
|
6130 | * Calculate the inverse sine of a value. For matrices, the function is
|
6131 | * evaluated element wise.
|
6132 | */
|
6133 |
|
6134 | asin(this: MathJsChain<number>): MathJsChain<number>
|
6135 | asin(this: MathJsChain<BigNumber>): MathJsChain<BigNumber>
|
6136 | asin(this: MathJsChain<Complex>): MathJsChain<Complex>
|
6137 | asin(this: MathJsChain<MathArray>): MathJsChain<MathArray>
|
6138 | asin(this: MathJsChain<Matrix>): MathJsChain<Matrix>
|
6139 |
|
6140 | /**
|
6141 | * Calculate the hyperbolic arcsine of a value, defined as asinh(x) =
|
6142 | * ln(x + sqrt(x^2 + 1)). For matrices, the function is evaluated
|
6143 | * element wise.
|
6144 | */
|
6145 |
|
6146 | asinh(this: MathJsChain<number>): MathJsChain<number>
|
6147 | asinh(this: MathJsChain<BigNumber>): MathJsChain<BigNumber>
|
6148 | asinh(this: MathJsChain<MathArray>): MathJsChain<MathArray>
|
6149 | asinh(this: MathJsChain<Matrix>): MathJsChain<Matrix>
|
6150 |
|
6151 | /**
|
6152 | * Calculate the inverse tangent of a value. For matrices, the function
|
6153 | * is evaluated element wise.
|
6154 | */
|
6155 |
|
6156 | atan(this: MathJsChain<number>): MathJsChain<number>
|
6157 | atan(this: MathJsChain<BigNumber>): MathJsChain<BigNumber>
|
6158 | atan(this: MathJsChain<MathArray>): MathJsChain<MathArray>
|
6159 | atan(this: MathJsChain<Matrix>): MathJsChain<Matrix>
|
6160 |
|
6161 | /**
|
6162 | * Calculate the inverse tangent function with two arguments, y/x. By
|
6163 | * providing two arguments, the right quadrant of the computed angle can
|
6164 | * be determined. For matrices, the function is evaluated element wise.
|
6165 | */
|
6166 |
|
6167 | atan2(this: MathJsChain<number>, x: number): MathJsChain<number>
|
6168 | atan2(
|
6169 | this: MathJsChain<MathCollection>,
|
6170 | x: MathCollection
|
6171 | ): MathJsChain<MathCollection>
|
6172 |
|
6173 | /**
|
6174 | * Calculate the hyperbolic arctangent of a value, defined as atanh(x) =
|
6175 | * ln((1 + x)/(1 - x)) / 2. For matrices, the function is evaluated
|
6176 | * element wise.
|
6177 | */
|
6178 |
|
6179 | atanh(this: MathJsChain<number>): MathJsChain<number>
|
6180 | atanh(this: MathJsChain<BigNumber>): MathJsChain<BigNumber>
|
6181 | atanh(this: MathJsChain<MathArray>): MathJsChain<MathArray>
|
6182 | atanh(this: MathJsChain<Matrix>): MathJsChain<Matrix>
|
6183 |
|
6184 | /**
|
6185 | * Calculate the cosine of a value. For matrices, the function is
|
6186 | * evaluated element wise.
|
6187 | */
|
6188 |
|
6189 | cos(this: MathJsChain<number | Unit>): MathJsChain<number>
|
6190 | cos(this: MathJsChain<BigNumber>): MathJsChain<BigNumber>
|
6191 | cos(this: MathJsChain<Complex>): MathJsChain<Complex>
|
6192 | cos(this: MathJsChain<MathArray>): MathJsChain<MathArray>
|
6193 | cos(this: MathJsChain<Matrix>): MathJsChain<Matrix>
|
6194 |
|
6195 | /**
|
6196 | * Calculate the hyperbolic cosine of a value, defined as cosh(x) = 1/2
|
6197 | * * (exp(x) + exp(-x)). For matrices, the function is evaluated element
|
6198 | * wise.
|
6199 | */
|
6200 |
|
6201 | cosh(this: MathJsChain<number | Unit>): MathJsChain<number>
|
6202 | cosh(this: MathJsChain<BigNumber>): MathJsChain<BigNumber>
|
6203 | cosh(this: MathJsChain<Complex>): MathJsChain<Complex>
|
6204 | cosh(this: MathJsChain<MathArray>): MathJsChain<MathArray>
|
6205 | cosh(this: MathJsChain<Matrix>): MathJsChain<Matrix>
|
6206 |
|
6207 | /**
|
6208 | * Calculate the cotangent of a value. cot(x) is defined as 1 / tan(x).
|
6209 | * For matrices, the function is evaluated element wise.
|
6210 | */
|
6211 |
|
6212 | cot(this: MathJsChain<number | Unit>): MathJsChain<number>
|
6213 | cot(this: MathJsChain<Complex>): MathJsChain<Complex>
|
6214 | cot(this: MathJsChain<MathArray>): MathJsChain<MathArray>
|
6215 | cot(this: MathJsChain<Matrix>): MathJsChain<Matrix>
|
6216 |
|
6217 | /**
|
6218 | * Calculate the hyperbolic cotangent of a value, defined as coth(x) = 1
|
6219 | * / tanh(x). For matrices, the function is evaluated element wise.
|
6220 | */
|
6221 |
|
6222 | coth(this: MathJsChain<number | Unit>): MathJsChain<number>
|
6223 | coth(this: MathJsChain<Complex>): MathJsChain<Complex>
|
6224 | coth(this: MathJsChain<MathArray>): MathJsChain<MathArray>
|
6225 | coth(this: MathJsChain<Matrix>): MathJsChain<Matrix>
|
6226 |
|
6227 | /**
|
6228 | * Calculate the cosecant of a value, defined as csc(x) = 1/sin(x). For
|
6229 | * matrices, the function is evaluated element wise.
|
6230 | */
|
6231 |
|
6232 | csc(this: MathJsChain<number | Unit>): MathJsChain<number>
|
6233 | csc(this: MathJsChain<Complex>): MathJsChain<Complex>
|
6234 | csc(this: MathJsChain<MathArray>): MathJsChain<MathArray>
|
6235 | csc(this: MathJsChain<Matrix>): MathJsChain<Matrix>
|
6236 |
|
6237 | /**
|
6238 | * Calculate the hyperbolic cosecant of a value, defined as csch(x) = 1
|
6239 | * / sinh(x). For matrices, the function is evaluated element wise.
|
6240 | */
|
6241 |
|
6242 | csch(this: MathJsChain<number | Unit>): MathJsChain<number>
|
6243 | csch(this: MathJsChain<Complex>): MathJsChain<Complex>
|
6244 | csch(this: MathJsChain<MathArray>): MathJsChain<MathArray>
|
6245 | csch(this: MathJsChain<Matrix>): MathJsChain<Matrix>
|
6246 |
|
6247 | /**
|
6248 | * Calculate the secant of a value, defined as sec(x) = 1/cos(x). For
|
6249 | * matrices, the function is evaluated element wise.
|
6250 | */
|
6251 |
|
6252 | sec(this: MathJsChain<number | Unit>): MathJsChain<number>
|
6253 | sec(this: MathJsChain<Complex>): MathJsChain<Complex>
|
6254 | sec(this: MathJsChain<MathArray>): MathJsChain<MathArray>
|
6255 | sec(this: MathJsChain<Matrix>): MathJsChain<Matrix>
|
6256 |
|
6257 | /**
|
6258 | * Calculate the hyperbolic secant of a value, defined as sech(x) = 1 /
|
6259 | * cosh(x). For matrices, the function is evaluated element wise.
|
6260 | */
|
6261 |
|
6262 | sech(this: MathJsChain<number | Unit>): MathJsChain<number>
|
6263 | sech(this: MathJsChain<Complex>): MathJsChain<Complex>
|
6264 | sech(this: MathJsChain<MathArray>): MathJsChain<MathArray>
|
6265 | sech(this: MathJsChain<Matrix>): MathJsChain<Matrix>
|
6266 |
|
6267 | /**
|
6268 | * Calculate the sine of a value. For matrices, the function is
|
6269 | * evaluated element wise.
|
6270 | */
|
6271 |
|
6272 | sin(this: MathJsChain<number | Unit>): MathJsChain<number>
|
6273 | sin(this: MathJsChain<BigNumber>): MathJsChain<BigNumber>
|
6274 | sin(this: MathJsChain<Complex>): MathJsChain<Complex>
|
6275 | sin(this: MathJsChain<MathArray>): MathJsChain<MathArray>
|
6276 | sin(this: MathJsChain<Matrix>): MathJsChain<Matrix>
|
6277 |
|
6278 | /**
|
6279 | * Calculate the hyperbolic sine of a value, defined as sinh(x) = 1/2 *
|
6280 | * (exp(x) - exp(-x)). For matrices, the function is evaluated element
|
6281 | * wise.
|
6282 | */
|
6283 |
|
6284 | sinh(this: MathJsChain<number | Unit>): MathJsChain<number>
|
6285 | sinh(this: MathJsChain<BigNumber>): MathJsChain<BigNumber>
|
6286 | sinh(this: MathJsChain<Complex>): MathJsChain<Complex>
|
6287 | sinh(this: MathJsChain<MathArray>): MathJsChain<MathArray>
|
6288 | sinh(this: MathJsChain<Matrix>): MathJsChain<Matrix>
|
6289 |
|
6290 | /**
|
6291 | * Calculate the tangent of a value. tan(x) is equal to sin(x) / cos(x).
|
6292 | * For matrices, the function is evaluated element wise.
|
6293 | */
|
6294 |
|
6295 | tan(this: MathJsChain<number | Unit>): MathJsChain<number>
|
6296 | tan(this: MathJsChain<BigNumber>): MathJsChain<BigNumber>
|
6297 | tan(this: MathJsChain<Complex>): MathJsChain<Complex>
|
6298 | tan(this: MathJsChain<MathArray>): MathJsChain<MathArray>
|
6299 | tan(this: MathJsChain<Matrix>): MathJsChain<Matrix>
|
6300 |
|
6301 | /**
|
6302 | * Calculate the hyperbolic tangent of a value, defined as tanh(x) =
|
6303 | * (exp(2 * x) - 1) / (exp(2 * x) + 1). For matrices, the function is
|
6304 | * evaluated element wise.
|
6305 | */
|
6306 |
|
6307 | tanh(this: MathJsChain<number | Unit>): MathJsChain<number>
|
6308 | tanh(this: MathJsChain<BigNumber>): MathJsChain<BigNumber>
|
6309 | tanh(this: MathJsChain<Complex>): MathJsChain<Complex>
|
6310 | tanh(this: MathJsChain<MathArray>): MathJsChain<MathArray>
|
6311 | tanh(this: MathJsChain<Matrix>): MathJsChain<Matrix>
|
6312 |
|
6313 | /*************************************************************************
|
6314 | * Unit functions
|
6315 | ************************************************************************/
|
6316 |
|
6317 | /**
|
6318 | * Change the unit of a value. For matrices, the function is evaluated
|
6319 | * element wise.
|
6320 | * @param unit New unit. Can be a string like "cm" or a unit without
|
6321 | * value.
|
6322 | */
|
6323 | to(
|
6324 | this: MathJsChain<Unit | MathCollection>,
|
6325 | unit: Unit | string
|
6326 | ): MathJsChain<Unit | MathCollection>
|
6327 |
|
6328 | /*************************************************************************
|
6329 | * Utils functions
|
6330 | ************************************************************************/
|
6331 |
|
6332 | /**
|
6333 | * Clone an object.
|
6334 | */
|
6335 |
|
6336 | // eslint-disable-next-line @typescript-eslint/no-explicit-any
|
6337 | clone<TValue>(this: MathJsChain<TValue>): MathJsChain<TValue>
|
6338 |
|
6339 | /**
|
6340 | * Test whether a value is an integer number. The function supports
|
6341 | * number, BigNumber, and Fraction. The function is evaluated
|
6342 | * element-wise in case of Array or Matrix input.
|
6343 | */
|
6344 |
|
6345 | isInteger(
|
6346 | this: MathJsChain<number | BigNumber | Fraction | MathCollection>
|
6347 | ): MathJsChain<boolean>
|
6348 |
|
6349 | /**
|
6350 | * Test whether a value is NaN (not a number). The function supports
|
6351 | * types number, BigNumber, Fraction, Unit and Complex. The function is
|
6352 | * evaluated element-wise in case of Array or Matrix input.
|
6353 | */
|
6354 |
|
6355 | isNaN(
|
6356 | this: MathJsChain<number | BigNumber | Fraction | MathCollection | Unit>
|
6357 | ): MathJsChain<boolean>
|
6358 |
|
6359 | /**
|
6360 | * Test whether a value is negative: smaller than zero. The function
|
6361 | * supports types number, BigNumber, Fraction, and Unit. The function is
|
6362 | * evaluated element-wise in case of Array or Matrix input.
|
6363 | */
|
6364 |
|
6365 | isNegative(
|
6366 | this: MathJsChain<number | BigNumber | Fraction | MathCollection | Unit>
|
6367 | ): MathJsChain<boolean>
|
6368 |
|
6369 | /**
|
6370 | * Test whether a value is an numeric value. The function is evaluated
|
6371 | * element-wise in case of Array or Matrix input.
|
6372 | */
|
6373 |
|
6374 | // eslint-disable-next-line @typescript-eslint/no-explicit-any
|
6375 | isNumeric(this: MathJsChain<any>): MathJsChain<boolean>
|
6376 |
|
6377 | /**
|
6378 | * Test whether a value is positive: larger than zero. The function
|
6379 | * supports types number, BigNumber, Fraction, and Unit. The function is
|
6380 | * evaluated element-wise in case of Array or Matrix input.
|
6381 | */
|
6382 |
|
6383 | isPositive(
|
6384 | this: MathJsChain<number | BigNumber | Fraction | MathCollection | Unit>
|
6385 | ): MathJsChain<boolean>
|
6386 |
|
6387 | /**
|
6388 | * Test whether a value is prime: has no divisors other than itself and
|
6389 | * one. The function supports type number, bignumber. The function is
|
6390 | * evaluated element-wise in case of Array or Matrix input.
|
6391 | */
|
6392 |
|
6393 | isPrime(
|
6394 | this: MathJsChain<number | BigNumber | MathCollection>
|
6395 | ): MathJsChain<boolean>
|
6396 |
|
6397 | /**
|
6398 | * Test whether a value is zero. The function can check for zero for
|
6399 | * types number, BigNumber, Fraction, Complex, and Unit. The function is
|
6400 | * evaluated element-wise in case of Array or Matrix input.
|
6401 | */
|
6402 |
|
6403 | isZero(
|
6404 | this: MathJsChain<
|
6405 | number | BigNumber | Fraction | MathCollection | Unit | Complex
|
6406 | >
|
6407 | ): MathJsChain<boolean>
|
6408 |
|
6409 | /**
|
6410 | * Determine the type of a variable.
|
6411 | */
|
6412 |
|
6413 | // eslint-disable-next-line @typescript-eslint/no-explicit-any
|
6414 | typeOf(this: MathJsChain<any>): MathJsChain<string>
|
6415 | }
|
6416 |
|
6417 | interface ImportOptions {
|
6418 | override?: boolean
|
6419 | silent?: boolean
|
6420 | wrap?: boolean
|
6421 | }
|
6422 |
|
6423 | interface ImportObject {
|
6424 | // eslint-disable-next-line @typescript-eslint/no-explicit-any
|
6425 | [key: string]: any
|
6426 | }
|
6427 | }
|
6428 |
|
\ | No newline at end of file |