mathjs 11.8.1 → 11.8.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/HISTORY.md +8 -0
- package/lib/browser/math.js +1 -1
- package/lib/browser/math.js.LICENSE.txt +2 -2
- package/lib/browser/math.js.map +1 -1
- package/lib/cjs/header.js +2 -2
- package/lib/cjs/version.js +1 -1
- package/lib/esm/version.js +1 -1
- package/package.json +6 -6
- package/types/index.d.ts +143 -44
package/lib/cjs/header.js
CHANGED
@@ -6,8 +6,8 @@
|
|
6
6
|
* It features real and complex numbers, units, matrices, a large set of
|
7
7
|
* mathematical functions, and a flexible expression parser.
|
8
8
|
*
|
9
|
-
* @version 11.8.
|
10
|
-
* @date 2023-06-
|
9
|
+
* @version 11.8.2
|
10
|
+
* @date 2023-06-20
|
11
11
|
*
|
12
12
|
* @license
|
13
13
|
* Copyright (C) 2013-2023 Jos de Jong <wjosdejong@gmail.com>
|
package/lib/cjs/version.js
CHANGED
@@ -4,7 +4,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
5
5
|
});
|
6
6
|
exports.version = void 0;
|
7
|
-
var version = '11.8.
|
7
|
+
var version = '11.8.2';
|
8
8
|
// Note: This file is automatically generated when building math.js.
|
9
9
|
// Changes made in this file will be overwritten.
|
10
10
|
exports.version = version;
|
package/lib/esm/version.js
CHANGED
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "mathjs",
|
3
|
-
"version": "11.8.
|
3
|
+
"version": "11.8.2",
|
4
4
|
"description": "Math.js is an extensive math library for JavaScript and Node.js. It features a flexible expression parser with support for symbolic computation, comes with a large set of built-in functions and constants, and offers an integrated solution to work with different data types like numbers, big numbers, complex numbers, fractions, units, and matrices.",
|
5
5
|
"author": "Jos de Jong <wjosdejong@gmail.com> (https://github.com/josdejong)",
|
6
6
|
"homepage": "https://mathjs.org",
|
@@ -43,17 +43,17 @@
|
|
43
43
|
"@babel/register": "7.22.5",
|
44
44
|
"@types/assert": "1.5.6",
|
45
45
|
"@types/mocha": "10.0.1",
|
46
|
-
"@typescript-eslint/eslint-plugin": "5.
|
47
|
-
"@typescript-eslint/parser": "5.
|
46
|
+
"@typescript-eslint/eslint-plugin": "5.60.0",
|
47
|
+
"@typescript-eslint/parser": "5.60.0",
|
48
48
|
"assert": "2.0.0",
|
49
49
|
"babel-loader": "9.1.2",
|
50
50
|
"benchmark": "2.1.4",
|
51
|
-
"c8": "
|
51
|
+
"c8": "8.0.0",
|
52
52
|
"codecov": "3.8.3",
|
53
53
|
"core-js": "3.31.0",
|
54
54
|
"del": "6.1.1",
|
55
55
|
"dtslint": "4.2.1",
|
56
|
-
"eslint": "8.
|
56
|
+
"eslint": "8.43.0",
|
57
57
|
"eslint-config-prettier": "8.8.0",
|
58
58
|
"eslint-config-standard": "17.1.0",
|
59
59
|
"eslint-plugin-import": "2.27.5",
|
@@ -90,7 +90,7 @@
|
|
90
90
|
"sylvester": "0.0.21",
|
91
91
|
"ts-node": "10.9.1",
|
92
92
|
"typescript": "5.1.3",
|
93
|
-
"webpack": "5.
|
93
|
+
"webpack": "5.87.0",
|
94
94
|
"zeros": "1.0.0"
|
95
95
|
},
|
96
96
|
"type": "module",
|
package/types/index.d.ts
CHANGED
@@ -13,10 +13,12 @@ type NoLiteralType<T> = T extends number
|
|
13
13
|
: T
|
14
14
|
|
15
15
|
declare namespace math {
|
16
|
+
// TODO: introduce generics for MathCollection, MathMatrix, and MathArray
|
16
17
|
type MathNumericType = number | BigNumber | Fraction | Complex
|
17
|
-
type
|
18
|
+
type MathScalarType = MathNumericType | Unit
|
19
|
+
type MathArray = MathNumericType[] | MathNumericType[][] // TODO: MathArray can also contain Unit
|
18
20
|
type MathCollection = MathArray | Matrix
|
19
|
-
type MathType =
|
21
|
+
type MathType = MathScalarType | MathCollection
|
20
22
|
type MathExpression = string | string[] | MathCollection
|
21
23
|
|
22
24
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
@@ -2595,35 +2597,60 @@ declare namespace math {
|
|
2595
2597
|
* of a multi dimensional array, the maximum of the flattened array will
|
2596
2598
|
* be calculated. When dim is provided, the maximum over the selected
|
2597
2599
|
* dimension will be calculated. Parameter dim is zero-based.
|
2598
|
-
* @param args
|
2600
|
+
* @param args Multiple scalar values
|
2601
|
+
* @returns The maximum value
|
2602
|
+
*/
|
2603
|
+
max<T extends MathScalarType>(...args: T[]): T
|
2604
|
+
/**
|
2605
|
+
* @param args Multiple scalar values
|
2599
2606
|
* @returns The maximum value
|
2600
2607
|
*/
|
2601
|
-
max
|
2608
|
+
max(...args: MathScalarType[]): MathScalarType
|
2602
2609
|
/**
|
2603
2610
|
* @param A A single matrix
|
2604
|
-
* @param
|
2611
|
+
* @param dimension The maximum over the selected dimension
|
2605
2612
|
* @returns The maximum value
|
2606
2613
|
*/
|
2607
|
-
|
2608
|
-
|
2614
|
+
max<T extends MathScalarType>(
|
2615
|
+
A: T[] | T[][],
|
2616
|
+
dimension?: number | BigNumber
|
2617
|
+
): T
|
2618
|
+
/**
|
2619
|
+
* @param A A single matrix
|
2620
|
+
* @param dimension The maximum over the selected dimension
|
2621
|
+
* @returns The maximum value
|
2622
|
+
*/
|
2623
|
+
max(A: MathCollection, dimension?: number | BigNumber): MathScalarType
|
2609
2624
|
|
2610
2625
|
/**
|
2611
2626
|
* Compute the mean value of matrix or a list with values. In case of a
|
2612
2627
|
* multi dimensional array, the mean of the flattened array will be
|
2613
2628
|
* calculated. When dim is provided, the maximum over the selected
|
2614
2629
|
* dimension will be calculated. Parameter dim is zero-based.
|
2615
|
-
* @param args
|
2630
|
+
* @param args Multiple scalar values
|
2616
2631
|
* @returns The mean of all values
|
2617
2632
|
*/
|
2618
|
-
|
2619
|
-
|
2633
|
+
mean<T extends MathScalarType>(...args: T[]): T
|
2634
|
+
/**
|
2635
|
+
* @param args Multiple scalar values
|
2636
|
+
* @returns The mean value
|
2637
|
+
*/
|
2638
|
+
mean(...args: MathScalarType[]): MathScalarType
|
2620
2639
|
/**
|
2621
2640
|
* @param A A single matrix
|
2622
|
-
* @param
|
2623
|
-
* @returns The mean
|
2641
|
+
* @param dimension The mean over the selected dimension
|
2642
|
+
* @returns The mean value
|
2624
2643
|
*/
|
2625
|
-
|
2626
|
-
|
2644
|
+
mean<T extends MathScalarType>(
|
2645
|
+
A: T[] | T[][],
|
2646
|
+
dimension?: number | BigNumber
|
2647
|
+
): T
|
2648
|
+
/**
|
2649
|
+
* @param A A single matrix
|
2650
|
+
* @param dimension The mean over the selected dimension
|
2651
|
+
* @returns The mean value
|
2652
|
+
*/
|
2653
|
+
mean(A: MathCollection, dimension?: number | BigNumber): MathScalarType
|
2627
2654
|
|
2628
2655
|
/**
|
2629
2656
|
* Compute the median of a matrix or a list with values. The values are
|
@@ -2632,48 +2659,103 @@ declare namespace math {
|
|
2632
2659
|
* types of values are: Number, BigNumber, Unit In case of a (multi
|
2633
2660
|
* dimensional) array or matrix, the median of all elements will be
|
2634
2661
|
* calculated.
|
2635
|
-
* @param args
|
2636
|
-
* @returns The median
|
2662
|
+
* @param args Multiple scalar values
|
2663
|
+
* @returns The median value
|
2637
2664
|
*/
|
2638
|
-
|
2639
|
-
|
2665
|
+
median<T extends MathScalarType>(...args: T[]): T
|
2666
|
+
/**
|
2667
|
+
* @param args Multiple scalar values
|
2668
|
+
* @returns The median value
|
2669
|
+
*/
|
2670
|
+
median(...args: MathScalarType[]): MathScalarType
|
2671
|
+
/**
|
2672
|
+
* @param A A single matrix
|
2673
|
+
* @returns The median value
|
2674
|
+
*/
|
2675
|
+
median<T extends MathScalarType>(A: T[] | T[][]): T
|
2676
|
+
/**
|
2677
|
+
* @param A A single matrix
|
2678
|
+
* @returns The median value
|
2679
|
+
*/
|
2680
|
+
median(A: MathCollection): MathScalarType
|
2640
2681
|
|
2641
2682
|
/**
|
2642
2683
|
* Compute the minimum value of a matrix or a list of values. In case of
|
2643
2684
|
* a multi dimensional array, the minimum of the flattened array will be
|
2644
2685
|
* calculated. When dim is provided, the minimum over the selected
|
2645
2686
|
* dimension will be calculated. Parameter dim is zero-based.
|
2646
|
-
* @param args
|
2687
|
+
* @param args multiple scalar values
|
2647
2688
|
* @returns The minimum value
|
2648
2689
|
*/
|
2649
|
-
min<T extends
|
2690
|
+
min<T extends MathScalarType>(...args: T[]): T
|
2691
|
+
/**
|
2692
|
+
* @param args Multiple scalar values
|
2693
|
+
* @returns The minimum value
|
2694
|
+
*/
|
2695
|
+
min(...args: MathScalarType[]): MathScalarType
|
2650
2696
|
/**
|
2651
2697
|
* @param A A single matrix
|
2652
|
-
* @param
|
2698
|
+
* @param dimension The minimum over the selected dimension
|
2653
2699
|
* @returns The minimum value
|
2654
2700
|
*/
|
2655
|
-
|
2656
|
-
|
2701
|
+
min<T extends MathScalarType>(
|
2702
|
+
A: T[] | T[][],
|
2703
|
+
dimension?: number | BigNumber
|
2704
|
+
): T
|
2705
|
+
/**
|
2706
|
+
* @param A A single matrix
|
2707
|
+
* @param dimension The minimum over the selected dimension
|
2708
|
+
* @returns The minimum value
|
2709
|
+
*/
|
2710
|
+
min(A: MathCollection, dimension?: number | BigNumber): MathScalarType
|
2657
2711
|
|
2658
2712
|
/**
|
2659
2713
|
* Computes the mode of a set of numbers or a list with values(numbers
|
2660
2714
|
* or characters). If there are more than one modes, it returns a list
|
2661
2715
|
* of those values.
|
2662
|
-
* @param args
|
2716
|
+
* @param args Multiple scalar values
|
2663
2717
|
* @returns The mode of all values
|
2664
2718
|
*/
|
2665
|
-
|
2666
|
-
|
2719
|
+
mode<T extends MathScalarType>(...args: T[]): T
|
2720
|
+
/**
|
2721
|
+
* @param args Multiple scalar values
|
2722
|
+
* @returns The mode of all values
|
2723
|
+
*/
|
2724
|
+
mode(...args: MathScalarType[]): MathScalarType
|
2725
|
+
/**
|
2726
|
+
* @param A A single matrix
|
2727
|
+
* @returns The median value
|
2728
|
+
*/
|
2729
|
+
mode<T extends MathScalarType>(A: T[] | T[][]): T
|
2730
|
+
/**
|
2731
|
+
* @param A A single matrix
|
2732
|
+
* @returns The mode of all values
|
2733
|
+
*/
|
2734
|
+
mode(A: MathCollection): MathScalarType
|
2667
2735
|
|
2668
2736
|
/**
|
2669
2737
|
* Compute the product of a matrix or a list with values. In case of a
|
2670
2738
|
* (multi dimensional) array or matrix, the sum of all elements will be
|
2671
2739
|
* calculated.
|
2672
|
-
* @param args
|
2740
|
+
* @param args Multiple scalar values
|
2673
2741
|
* @returns The product of all values
|
2674
2742
|
*/
|
2675
|
-
|
2676
|
-
|
2743
|
+
prod<T extends MathScalarType>(...args: T[]): T
|
2744
|
+
/**
|
2745
|
+
* @param args Multiple scalar values
|
2746
|
+
* @returns The product of all values
|
2747
|
+
*/
|
2748
|
+
prod(...args: MathScalarType[]): MathScalarType
|
2749
|
+
/**
|
2750
|
+
* @param A A single matrix
|
2751
|
+
* @returns The product of all values
|
2752
|
+
*/
|
2753
|
+
prod<T extends MathScalarType>(A: T[] | T[][]): T
|
2754
|
+
/**
|
2755
|
+
* @param A A single matrix
|
2756
|
+
* @returns The product of all values
|
2757
|
+
*/
|
2758
|
+
prod(A: MathCollection): MathScalarType
|
2677
2759
|
|
2678
2760
|
/**
|
2679
2761
|
* Compute the prob order quantile of a matrix or a list with values.
|
@@ -2705,10 +2787,15 @@ declare namespace math {
|
|
2705
2787
|
* values: 'unbiased' (default) The sum of squared errors is divided by
|
2706
2788
|
* (n - 1) 'uncorrected' The sum of squared errors is divided by n
|
2707
2789
|
* 'biased' The sum of squared errors is divided by (n + 1)
|
2708
|
-
* @param
|
2709
|
-
* @returns The standard deviation
|
2790
|
+
* @param args variadic argument of number to calculate standard deviation
|
2791
|
+
* @returns The standard deviation
|
2792
|
+
*/
|
2793
|
+
std<T extends MathScalarType>(...args: T[]): T
|
2794
|
+
/**
|
2795
|
+
* @param args Multiple scalar values
|
2796
|
+
* @returns The standard deviation
|
2710
2797
|
*/
|
2711
|
-
std(...
|
2798
|
+
std(...args: MathScalarType[]): MathScalarType
|
2712
2799
|
/**
|
2713
2800
|
* Compute the standard deviation of a matrix or a list with values. The
|
2714
2801
|
* standard deviations is defined as the square root of the variance:
|
@@ -2730,7 +2817,7 @@ declare namespace math {
|
|
2730
2817
|
array: MathCollection,
|
2731
2818
|
dimension?: number,
|
2732
2819
|
normalization?: 'unbiased' | 'uncorrected' | 'biased'
|
2733
|
-
):
|
2820
|
+
): MathNumericType[]
|
2734
2821
|
/**
|
2735
2822
|
* Compute the standard deviation of a matrix or a list with values. The
|
2736
2823
|
* standard deviations is defined as the square root of the variance:
|
@@ -2750,7 +2837,7 @@ declare namespace math {
|
|
2750
2837
|
std(
|
2751
2838
|
array: MathCollection,
|
2752
2839
|
normalization: 'unbiased' | 'uncorrected' | 'biased'
|
2753
|
-
):
|
2840
|
+
): MathNumericType
|
2754
2841
|
|
2755
2842
|
/**
|
2756
2843
|
* Compute the sum of a matrix or a list with values. In case of a
|
@@ -2759,14 +2846,27 @@ declare namespace math {
|
|
2759
2846
|
* @param args A single matrix or multiple scalar values
|
2760
2847
|
* @returns The sum of all values
|
2761
2848
|
*/
|
2762
|
-
|
2763
|
-
sum(...args: Array<number | BigNumber | Fraction>): any
|
2849
|
+
sum<T extends MathScalarType>(...args: T[]): T
|
2764
2850
|
/**
|
2765
|
-
* @param
|
2851
|
+
* @param args Multiple scalar values
|
2766
2852
|
* @returns The sum of all values
|
2767
2853
|
*/
|
2768
|
-
|
2769
|
-
|
2854
|
+
sum(...args: MathScalarType[]): MathScalarType
|
2855
|
+
/**
|
2856
|
+
* @param A A single matrix
|
2857
|
+
* @param dimension The sum over the selected dimension
|
2858
|
+
* @returns The sum of all values
|
2859
|
+
*/
|
2860
|
+
sum<T extends MathScalarType>(
|
2861
|
+
A: T[] | T[][],
|
2862
|
+
dimension?: number | BigNumber
|
2863
|
+
): T
|
2864
|
+
/**
|
2865
|
+
* @param A A single matrix
|
2866
|
+
* @param dimension The sum over the selected dimension
|
2867
|
+
* @returns The sum of all values
|
2868
|
+
*/
|
2869
|
+
sum(A: MathCollection, dimension?: number | BigNumber): MathScalarType
|
2770
2870
|
|
2771
2871
|
/**
|
2772
2872
|
* Count the number of elements of a matrix, array or string.
|
@@ -2804,8 +2904,7 @@ declare namespace math {
|
|
2804
2904
|
* @param args A single matrix or multiple scalar values
|
2805
2905
|
* @returns The variance
|
2806
2906
|
*/
|
2807
|
-
variance(...args:
|
2808
|
-
|
2907
|
+
variance(...args: MathNumericType[]): MathNumericType
|
2809
2908
|
/**
|
2810
2909
|
* Compute the variance of a matrix or a list with values. In case of a
|
2811
2910
|
* (multi dimensional) array or matrix, the variance over all elements
|
@@ -2828,7 +2927,7 @@ declare namespace math {
|
|
2828
2927
|
array: MathCollection,
|
2829
2928
|
dimension?: number,
|
2830
2929
|
normalization?: 'unbiased' | 'uncorrected' | 'biased'
|
2831
|
-
):
|
2930
|
+
): MathNumericType[]
|
2832
2931
|
/**
|
2833
2932
|
* @param array A single matrix
|
2834
2933
|
* @param normalization normalization Determines how to normalize the
|
@@ -2839,7 +2938,7 @@ declare namespace math {
|
|
2839
2938
|
variance(
|
2840
2939
|
array: MathCollection,
|
2841
2940
|
normalization: 'unbiased' | 'uncorrected' | 'biased'
|
2842
|
-
):
|
2941
|
+
): MathNumericType
|
2843
2942
|
|
2844
2943
|
/*************************************************************************
|
2845
2944
|
* String functions
|
@@ -3781,7 +3880,7 @@ declare namespace math {
|
|
3781
3880
|
equalBase(unit: Unit): boolean
|
3782
3881
|
equals(unit: Unit): boolean
|
3783
3882
|
multiply(unit: Unit): Unit
|
3784
|
-
divide(unit: Unit): Unit
|
3883
|
+
divide(unit: Unit): Unit | number
|
3785
3884
|
pow(unit: Unit): Unit
|
3786
3885
|
abs(unit: Unit): Unit
|
3787
3886
|
to(unit: string): Unit
|