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