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