mathjs 10.2.0 → 10.4.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (86) hide show
  1. package/HISTORY.md +43 -0
  2. package/docs/expressions/syntax.md +31 -2
  3. package/docs/reference/functions/cumsum.md +57 -0
  4. package/docs/reference/functions/format.md +1 -1
  5. package/docs/reference/functions/map.md +22 -5
  6. package/docs/reference/functions/subset.md +10 -2
  7. package/docs/reference/functions/sum.md +2 -1
  8. package/docs/reference/functions/symbolicEqual.md +62 -0
  9. package/docs/reference/functions.md +3 -1
  10. package/lib/browser/math.js +6 -6
  11. package/lib/browser/math.js.map +1 -1
  12. package/lib/cjs/entry/dependenciesAny/dependenciesCumSum.generated.js +26 -0
  13. package/lib/cjs/entry/dependenciesAny/dependenciesCumSumTransform.generated.js +26 -0
  14. package/lib/cjs/entry/dependenciesAny/dependenciesSymbolicEqual.generated.js +29 -0
  15. package/lib/cjs/entry/dependenciesAny.generated.js +24 -0
  16. package/lib/cjs/entry/dependenciesNumber/dependenciesCumSum.generated.js +26 -0
  17. package/lib/cjs/entry/dependenciesNumber/dependenciesCumSumTransform.generated.js +26 -0
  18. package/lib/cjs/entry/dependenciesNumber.generated.js +16 -0
  19. package/lib/cjs/entry/impureFunctionsAny.generated.js +22 -8
  20. package/lib/cjs/entry/impureFunctionsNumber.generated.js +6 -0
  21. package/lib/cjs/entry/pureFunctionsAny.generated.js +18 -12
  22. package/lib/cjs/entry/pureFunctionsNumber.generated.js +8 -2
  23. package/lib/cjs/expression/embeddedDocs/construction/fraction.js +3 -3
  24. package/lib/cjs/expression/embeddedDocs/embeddedDocs.js +240 -234
  25. package/lib/cjs/expression/embeddedDocs/function/algebra/symbolicEqual.js +15 -0
  26. package/lib/cjs/expression/embeddedDocs/function/matrix/subset.js +2 -2
  27. package/lib/cjs/expression/embeddedDocs/function/statistics/cumsum.js +15 -0
  28. package/lib/cjs/expression/node/FunctionNode.js +74 -55
  29. package/lib/cjs/expression/parse.js +12 -8
  30. package/lib/cjs/expression/transform/cumsum.transform.js +57 -0
  31. package/lib/cjs/expression/transform/sum.transform.js +1 -1
  32. package/lib/cjs/factoriesAny.js +24 -0
  33. package/lib/cjs/factoriesNumber.js +18 -2
  34. package/lib/cjs/function/algebra/simplify.js +8 -0
  35. package/lib/cjs/function/algebra/simplifyCore.js +2 -2
  36. package/lib/cjs/function/algebra/symbolicEqual.js +88 -0
  37. package/lib/cjs/function/matrix/eigs/complexEigs.js +39 -28
  38. package/lib/cjs/function/matrix/map.js +53 -15
  39. package/lib/cjs/function/matrix/subset.js +15 -5
  40. package/lib/cjs/function/statistics/cumsum.js +151 -0
  41. package/lib/cjs/function/statistics/sum.js +1 -1
  42. package/lib/cjs/function/string/format.js +1 -1
  43. package/lib/cjs/header.js +2 -2
  44. package/lib/cjs/type/fraction/function/fraction.js +20 -8
  45. package/lib/cjs/utils/collection.js +3 -27
  46. package/lib/cjs/utils/switch.js +31 -0
  47. package/lib/cjs/version.js +1 -1
  48. package/lib/esm/entry/dependenciesAny/dependenciesCumSum.generated.js +14 -0
  49. package/lib/esm/entry/dependenciesAny/dependenciesCumSumTransform.generated.js +14 -0
  50. package/lib/esm/entry/dependenciesAny/dependenciesSymbolicEqual.generated.js +16 -0
  51. package/lib/esm/entry/dependenciesAny.generated.js +3 -0
  52. package/lib/esm/entry/dependenciesNumber/dependenciesCumSum.generated.js +14 -0
  53. package/lib/esm/entry/dependenciesNumber/dependenciesCumSumTransform.generated.js +14 -0
  54. package/lib/esm/entry/dependenciesNumber.generated.js +2 -0
  55. package/lib/esm/entry/impureFunctionsAny.generated.js +22 -9
  56. package/lib/esm/entry/impureFunctionsNumber.generated.js +8 -2
  57. package/lib/esm/entry/pureFunctionsAny.generated.js +13 -8
  58. package/lib/esm/entry/pureFunctionsNumber.generated.js +6 -1
  59. package/lib/esm/expression/embeddedDocs/construction/fraction.js +3 -3
  60. package/lib/esm/expression/embeddedDocs/embeddedDocs.js +220 -216
  61. package/lib/esm/expression/embeddedDocs/function/algebra/symbolicEqual.js +8 -0
  62. package/lib/esm/expression/embeddedDocs/function/matrix/subset.js +2 -2
  63. package/lib/esm/expression/embeddedDocs/function/statistics/cumsum.js +8 -0
  64. package/lib/esm/expression/node/FunctionNode.js +70 -53
  65. package/lib/esm/expression/parse.js +12 -8
  66. package/lib/esm/expression/transform/cumsum.transform.js +48 -0
  67. package/lib/esm/expression/transform/sum.transform.js +1 -1
  68. package/lib/esm/factoriesAny.js +3 -0
  69. package/lib/esm/factoriesNumber.js +2 -0
  70. package/lib/esm/function/algebra/simplify.js +8 -0
  71. package/lib/esm/function/algebra/simplifyCore.js +2 -2
  72. package/lib/esm/function/algebra/symbolicEqual.js +80 -0
  73. package/lib/esm/function/matrix/eigs/complexEigs.js +36 -25
  74. package/lib/esm/function/matrix/map.js +53 -15
  75. package/lib/esm/function/matrix/subset.js +15 -5
  76. package/lib/esm/function/statistics/cumsum.js +139 -0
  77. package/lib/esm/function/statistics/sum.js +1 -1
  78. package/lib/esm/function/string/format.js +1 -1
  79. package/lib/esm/type/fraction/function/fraction.js +20 -8
  80. package/lib/esm/utils/collection.js +1 -26
  81. package/lib/esm/utils/switch.js +24 -0
  82. package/lib/esm/version.js +1 -1
  83. package/package.json +15 -11
  84. package/types/index.d.ts +209 -23
  85. package/types/index.ts +274 -57
  86. package/types/tsconfig.json +2 -1
package/types/index.d.ts CHANGED
@@ -352,6 +352,8 @@ declare namespace math {
352
352
  RelationalNode: RelationalNodeCtor;
353
353
  SymbolNode: SymbolNodeCtor;
354
354
 
355
+ Matrix: MatrixCtor;
356
+
355
357
  /**
356
358
  * If null were to be included in this interface, it would be
357
359
  * auto-suggested as an import in VSCode. This causes issues because
@@ -365,7 +367,11 @@ declare namespace math {
365
367
  version: string;
366
368
 
367
369
  expression: MathNode;
368
- json: MathJsJson;
370
+
371
+ /**
372
+ * Returns reviver function that can be used as reviver in JSON.parse function.
373
+ */
374
+ reviver(): (key: any, value: any) => any;
369
375
 
370
376
  /*************************************************************************
371
377
  * Core functions
@@ -570,6 +576,11 @@ declare namespace math {
570
576
  * @returns The created unit
571
577
  */
572
578
  unit(unit: string): Unit;
579
+ /**
580
+ * @param unit The unit to be created
581
+ * @returns The created unit
582
+ */
583
+ unit(unit: Unit): Unit;
573
584
  /**
574
585
  * @param value The value of the unit to be created
575
586
  * @param unit The unit to be created
@@ -767,6 +778,7 @@ declare namespace math {
767
778
  * @param y Second value to add
768
779
  * @returns Sum of x and y
769
780
  */
781
+ add<T extends MathType>(x: T, y: T): T;
770
782
  add(x: MathType, y: MathType): MathType;
771
783
 
772
784
  /**
@@ -1116,8 +1128,7 @@ declare namespace math {
1116
1128
  * @param y Value to subtract from x
1117
1129
  * @returns Subtraction of x and y
1118
1130
  */
1119
- subtract(x: number, y: number): number;
1120
- subtract(x: Unit, y: Unit): Unit;
1131
+ subtract<T extends MathType>(x: T, y: T): T;
1121
1132
  subtract(x: MathType, y: MathType): MathType;
1122
1133
 
1123
1134
  /**
@@ -1723,7 +1734,7 @@ declare namespace math {
1723
1734
  /**
1724
1735
  * Get or set a subset of a matrix or string.
1725
1736
  * @param value An array, matrix, or string
1726
- * @param index An index containing ranges for each dimension
1737
+ * @param index For each dimension, an index or list of indices to get or set.
1727
1738
  * @param replacement An array, matrix, or scalar. If provided, the
1728
1739
  * subset is replaced with replacement. If not provided, the subset is
1729
1740
  * returned
@@ -2223,6 +2234,38 @@ declare namespace math {
2223
2234
  */
2224
2235
  quantileSeq(A: MathArray | Matrix, prob: number | BigNumber | MathArray, sorted?: boolean): number | BigNumber | Unit | MathArray;
2225
2236
 
2237
+ /**
2238
+ * Compute the standard deviation of a matrix or a list with values. The
2239
+ * standard deviations is defined as the square root of the variance:
2240
+ * std(A) = sqrt(variance(A)). In case of a (multi dimensional) array or
2241
+ * matrix, the standard deviation over all elements will be calculated.
2242
+ * Optionally, the type of normalization can be specified as second
2243
+ * parameter. The parameter normalization can be one of the following
2244
+ * values: 'unbiased' (default) The sum of squared errors is divided by
2245
+ * (n - 1) 'uncorrected' The sum of squared errors is divided by n
2246
+ * 'biased' The sum of squared errors is divided by (n + 1)
2247
+ * @param a variadic argument of number to calculate standard deviation
2248
+ * @returns The standard deviation array
2249
+ */
2250
+ std(...values: number[]): number
2251
+ /**
2252
+ * Compute the standard deviation of a matrix or a list with values. The
2253
+ * standard deviations is defined as the square root of the variance:
2254
+ * std(A) = sqrt(variance(A)). In case of a (multi dimensional) array or
2255
+ * matrix, the standard deviation over all elements will be calculated.
2256
+ * Optionally, the type of normalization can be specified as second
2257
+ * parameter. The parameter normalization can be one of the following
2258
+ * values: 'unbiased' (default) The sum of squared errors is divided by
2259
+ * (n - 1) 'uncorrected' The sum of squared errors is divided by n
2260
+ * 'biased' The sum of squared errors is divided by (n + 1)
2261
+ * @param array A single matrix to compute standard deviation.
2262
+ * @param dimension A dimension to calculate standard deviation
2263
+ * @param normalization Determines how to normalize the variance. Choose
2264
+ * ‘unbiased’ (default), ‘uncorrected’, or ‘biased’. Default value:
2265
+ * ‘unbiased’.
2266
+ * @returns The standard deviation array
2267
+ */
2268
+ std(array: MathArray | Matrix, dimension?: number, normalization?: 'unbiased' | 'uncorrected' | 'biased'): number[]
2226
2269
  /**
2227
2270
  * Compute the standard deviation of a matrix or a list with values. The
2228
2271
  * standard deviations is defined as the square root of the variance:
@@ -2239,7 +2282,7 @@ declare namespace math {
2239
2282
  * ‘unbiased’.
2240
2283
  * @returns The standard deviation
2241
2284
  */
2242
- std(array: MathArray | Matrix, normalization?: 'unbiased' | 'uncorrected' | 'biased' | 'unbiased'): number;
2285
+ std(array: MathArray | Matrix, normalization: 'unbiased' | 'uncorrected' | 'biased'): number
2243
2286
 
2244
2287
  /**
2245
2288
  * Compute the sum of a matrix or a list with values. In case of a
@@ -2255,6 +2298,21 @@ declare namespace math {
2255
2298
  */
2256
2299
  sum(array: MathArray | Matrix): any;
2257
2300
 
2301
+ /**
2302
+ * Compute the cumulative sum of a matrix or a list with values.
2303
+ * In case of a (multi dimensional) array or matrix, the cumulative sums
2304
+ * along a specified dimension (defaulting to the first) will be calculated.
2305
+ * @param args A single matrix or multiple scalar values
2306
+ * @returns The cumulative sums of the the values.
2307
+ */
2308
+ cumsum(...args: MathType[]): MathType[];
2309
+ /**
2310
+ * @param array A single matrix
2311
+ * @param dim The dimension along which to sum (defaults to 0)
2312
+ * @returns The cumulative sums along the given dimension
2313
+ */
2314
+ cumsum(array: MathArray | Matrix, dim?: number): MathArray | Matrix;
2315
+
2258
2316
  /**
2259
2317
  * Compute the variance of a matrix or a list with values. In case of a
2260
2318
  * (multi dimensional) array or matrix, the variance over all elements
@@ -2269,7 +2327,26 @@ declare namespace math {
2269
2327
  * @param args A single matrix or multiple scalar values
2270
2328
  * @returns The variance
2271
2329
  */
2272
- variance(...args: Array<number | BigNumber | Fraction>): any;
2330
+ variance(...args: Array<number | BigNumber | Fraction>): number;
2331
+ /**
2332
+ * Compute the variance of a matrix or a list with values. In case of a
2333
+ * (multi dimensional) array or matrix, the variance over all elements
2334
+ * will be calculated. Optionally, the type of normalization can be
2335
+ * specified as second parameter. The parameter normalization can be one
2336
+ * of the following values: 'unbiased' (default) The sum of squared
2337
+ * errors is divided by (n - 1) 'uncorrected' The sum of squared errors
2338
+ * is divided by n 'biased' The sum of squared errors is divided by (n +
2339
+ * 1) Note that older browser may not like the variable name var. In
2340
+ * that case, the function can be called as math['var'](...) instead of
2341
+ * math.variance(...).
2342
+ * @param array A matrix to compute variance.
2343
+ * @param dimension A dimension to compute variance on
2344
+ * @param normalization normalization Determines how to normalize the
2345
+ * variance. Choose ‘unbiased’ (default), ‘uncorrected’, or ‘biased’.
2346
+ * Default value: ‘unbiased’.
2347
+ * @returns variance matrix.
2348
+ */
2349
+ variance(array: MathArray | Matrix, dimension?: number, normalization?: 'unbiased' | 'uncorrected' | 'biased'): number[];
2273
2350
  /**
2274
2351
  * @param array A single matrix
2275
2352
  * @param normalization normalization Determines how to normalize the
@@ -2277,7 +2354,7 @@ declare namespace math {
2277
2354
  * Default value: ‘unbiased’.
2278
2355
  * @returns The variance
2279
2356
  */
2280
- variance(array: MathArray | Matrix, normalization?: 'unbiased' | 'uncorrected' | 'biased' | 'unbiased'): any;
2357
+ variance(array: MathArray | Matrix, normalization: 'unbiased' | 'uncorrected' | 'biased'): number;
2281
2358
 
2282
2359
  /*************************************************************************
2283
2360
  * String functions
@@ -2622,7 +2699,86 @@ declare namespace math {
2622
2699
  to(x: Unit | MathArray | Matrix, unit: Unit | string): Unit | MathArray | Matrix;
2623
2700
 
2624
2701
  /*************************************************************************
2625
- * Utils functions
2702
+ * Utils
2703
+ ************************************************************************/
2704
+ isNumber(x: unknown): x is number;
2705
+
2706
+ isBigNumber(x: unknown): x is BigNumber;
2707
+
2708
+ isComplex(x: unknown): x is Complex;
2709
+
2710
+ isFraction(x: unknown): x is Fraction;
2711
+
2712
+ isUnit(x: unknown): x is Unit;
2713
+
2714
+ isString(x: unknown): x is string;
2715
+
2716
+ isArray: ArrayConstructor['isArray'];
2717
+
2718
+ isMatrix(x: unknown): x is Matrix;
2719
+
2720
+ isCollection(x: unknown): x is (Matrix | any[]);
2721
+
2722
+ isDenseMatrix(x: unknown): x is Matrix;
2723
+
2724
+ isSparseMatrix(x: unknown): x is Matrix;
2725
+
2726
+ isRange(x: unknown): boolean;
2727
+
2728
+ isIndex(x: unknown): x is Index;
2729
+
2730
+ isBoolean(x: unknown): x is boolean;
2731
+
2732
+ isResultSet(x: unknown): boolean;
2733
+
2734
+ isHelp(x: unknown): x is Help;
2735
+
2736
+ isFunction(x: unknown): boolean;
2737
+
2738
+ isDate(x: unknown): x is Date;
2739
+
2740
+ isRegExp(x: unknown): x is RegExp;
2741
+
2742
+ isObject(x: unknown): boolean;
2743
+
2744
+ isNull(x: unknown): x is null;
2745
+
2746
+ isUndefined(x: unknown): x is undefined;
2747
+
2748
+ isAccessorNode(x: unknown): x is AccessorNode;
2749
+
2750
+ isArrayNode(x: unknown): x is ArrayNode;
2751
+
2752
+ isAssignmentNode(x: unknown): x is AssignmentNode;
2753
+
2754
+ isBlockNode(x: unknown): x is BlockNode;
2755
+
2756
+ isConditionalNode(x: unknown): x is ConditionalNode;
2757
+
2758
+ isConstantNode(x: unknown): x is ConstantNode;
2759
+
2760
+ isFunctionAssignmentNode(x: unknown): x is FunctionAssignmentNode;
2761
+
2762
+ isFunctionNode(x: unknown): x is FunctionNode;
2763
+
2764
+ isIndexNode(x: unknown): x is IndexNode;
2765
+
2766
+ isNode(x: unknown): x is MathNodeCommon;
2767
+
2768
+ isObjectNode(x: unknown): x is ObjectNode;
2769
+
2770
+ isOperatorNode(x: unknown): x is OperatorNode;
2771
+
2772
+ isParenthesisNode(x: unknown): x is ParenthesisNode;
2773
+
2774
+ isRangeNode(x: unknown): x is RangeNode;
2775
+
2776
+ isSymbolNode(x: unknown): x is SymbolNode;
2777
+
2778
+ isChain(x: unknown): x is MathJsChain;
2779
+
2780
+ /*************************************************************************
2781
+ * Functions -> Utils
2626
2782
  ************************************************************************/
2627
2783
 
2628
2784
  /**
@@ -3099,6 +3255,10 @@ declare namespace math {
3099
3255
  swapRows(i: number, j: number): Matrix;
3100
3256
  }
3101
3257
 
3258
+ interface MatrixCtor {
3259
+ new(): Matrix;
3260
+ }
3261
+
3102
3262
  interface BigNumber extends Decimal {} // tslint:disable-line no-empty-interface
3103
3263
 
3104
3264
  interface Fraction {
@@ -3218,8 +3378,6 @@ declare namespace math {
3218
3378
  ): MathNode;
3219
3379
 
3220
3380
  rules: SimplifyRule[];
3221
-
3222
- simplifyCore(expr: MathNode): MathNode;
3223
3381
  }
3224
3382
 
3225
3383
  interface UnitDefinition {
@@ -3458,13 +3616,6 @@ declare namespace math {
3458
3616
  randomSeed?: string | null;
3459
3617
  }
3460
3618
 
3461
- interface MathJsJson {
3462
- /**
3463
- * Returns reviver function that can be used as reviver in JSON.parse function.
3464
- */
3465
- reviver(): (key: any, value: any) => any;
3466
- }
3467
-
3468
3619
  interface MathJsChain {
3469
3620
  done(): any;
3470
3621
 
@@ -3682,6 +3833,8 @@ declare namespace math {
3682
3833
  */
3683
3834
  simplify(rules?: SimplifyRule[], scope?: object): MathJsChain;
3684
3835
 
3836
+ simplifyCore(expr: MathNode): MathNode;
3837
+
3685
3838
  /**
3686
3839
  * Calculate the Sparse Matrix LU decomposition with full pivoting.
3687
3840
  * Sparse Matrix A is decomposed in two matrices (L, U) and two
@@ -4319,7 +4472,7 @@ declare namespace math {
4319
4472
 
4320
4473
  /**
4321
4474
  * Get or set a subset of a matrix or string.
4322
- * @param index An index containing ranges for each dimension
4475
+ * @param index For each dimension, an index or list of indices to get or set
4323
4476
  * @param replacement An array, matrix, or scalar. If provided, the
4324
4477
  * subset is replaced with replacement. If not provided, the subset is
4325
4478
  * returned
@@ -4706,7 +4859,6 @@ declare namespace math {
4706
4859
  * @param sorted =false is data sorted in ascending order
4707
4860
  */
4708
4861
  quantileSeq(prob: number | BigNumber | MathArray, sorted?: boolean): MathJsChain;
4709
-
4710
4862
  /**
4711
4863
  * Compute the standard deviation of a matrix or a list with values. The
4712
4864
  * standard deviations is defined as the square root of the variance:
@@ -4717,13 +4869,29 @@ declare namespace math {
4717
4869
  * values: 'unbiased' (default) The sum of squared errors is divided by
4718
4870
  * (n - 1) 'uncorrected' The sum of squared errors is divided by n
4719
4871
  * 'biased' The sum of squared errors is divided by (n + 1)
4720
- * @param array A single matrix or multiple scalar values
4872
+ * @param dim A dimension to compute standard deviation.
4873
+ * @param normalization Determines how to normalize the variance. Choose
4874
+ * ‘unbiased’ (default), ‘uncorrected’, or ‘biased’. Default value:
4875
+ * ‘unbiased’.
4876
+ * @returns The standard deviation
4877
+ */
4878
+ std(dim?: number, normalization?: 'unbiased' | 'uncorrected' | 'biased'): MathJsChain;
4879
+ /**
4880
+ * Compute the standard deviation of a matrix or a list with values. The
4881
+ * standard deviations is defined as the square root of the variance:
4882
+ * std(A) = sqrt(variance(A)). In case of a (multi dimensional) array or
4883
+ * matrix, the standard deviation over all elements will be calculated.
4884
+ * Optionally, the type of normalization can be specified as second
4885
+ * parameter. The parameter normalization can be one of the following
4886
+ * values: 'unbiased' (default) The sum of squared errors is divided by
4887
+ * (n - 1) 'uncorrected' The sum of squared errors is divided by n
4888
+ * 'biased' The sum of squared errors is divided by (n + 1)
4721
4889
  * @param normalization Determines how to normalize the variance. Choose
4722
4890
  * ‘unbiased’ (default), ‘uncorrected’, or ‘biased’. Default value:
4723
4891
  * ‘unbiased’.
4724
4892
  * @returns The standard deviation
4725
4893
  */
4726
- std(normalization?: 'unbiased' | 'uncorrected' | 'biased' | 'unbiased'): MathJsChain;
4894
+ std(normalization: 'unbiased' | 'uncorrected' | 'biased'): MathJsChain;
4727
4895
 
4728
4896
  /**
4729
4897
  * Compute the sum of a matrix or a list with values. In case of a
@@ -4731,7 +4899,6 @@ declare namespace math {
4731
4899
  * calculated.
4732
4900
  */
4733
4901
  sum(): MathJsChain;
4734
-
4735
4902
  /**
4736
4903
  * Compute the variance of a matrix or a list with values. In case of a
4737
4904
  * (multi dimensional) array or matrix, the variance over all elements
@@ -4743,12 +4910,30 @@ declare namespace math {
4743
4910
  * 1) Note that older browser may not like the variable name var. In
4744
4911
  * that case, the function can be called as math['var'](...) instead of
4745
4912
  * math.variance(...).
4913
+ * @param dim a dimension to compute variance.
4746
4914
  * @param normalization normalization Determines how to normalize the
4747
4915
  * variance. Choose ‘unbiased’ (default), ‘uncorrected’, or ‘biased’.
4748
4916
  * Default value: ‘unbiased’.
4749
4917
  * @returns The variance
4750
4918
  */
4751
- variance(normalization?: 'unbiased' | 'uncorrected' | 'biased' | 'unbiased'): MathJsChain;
4919
+ variance(dim?: number, normalization?: 'unbiased' | 'uncorrected' | 'biased'): MathJsChain;
4920
+ /**
4921
+ * Compute the variance of a matrix or a list with values. In case of a
4922
+ * (multi dimensional) array or matrix, the variance over all elements
4923
+ * will be calculated. Optionally, the type of normalization can be
4924
+ * specified as second parameter. The parameter normalization can be one
4925
+ * of the following values: 'unbiased' (default) The sum of squared
4926
+ * errors is divided by (n - 1) 'uncorrected' The sum of squared errors
4927
+ * is divided by n 'biased' The sum of squared errors is divided by (n +
4928
+ * 1) Note that older browser may not like the variable name var. In
4929
+ * that case, the function can be called as math['var'](...) instead of
4930
+ * math.variance(...).
4931
+ * @param normalization normalization Determines how to normalize the
4932
+ * variance. Choose ‘unbiased’ (default), ‘uncorrected’, or ‘biased’.
4933
+ * Default value: ‘unbiased’.
4934
+ * @returns The variance
4935
+ */
4936
+ variance(normalization: 'unbiased' | 'uncorrected' | 'biased'): MathJsChain;
4752
4937
 
4753
4938
  /*************************************************************************
4754
4939
  * String functions
@@ -5026,4 +5211,5 @@ declare namespace math {
5026
5211
  interface ImportObject {
5027
5212
  [key: string]: any;
5028
5213
  }
5214
+
5029
5215
  }