Skip to content

Commit 04e6e2d

Browse files
committed
Merge remote-tracking branch 'origin/develop' into develop
2 parents afd12d7 + 05080a9 commit 04e6e2d

File tree

20 files changed

+212
-4
lines changed

20 files changed

+212
-4
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ At the lowest level, mathjs has immutable factory functions which create immutab
133133
A common case is to implement a new function. This involves the following steps:
134134

135135
- Implement the function in the right category, for example `./src/function/arithmetic/myNewFunction.js`, where you can replace `arithmetic` with the proper category, and `myNewFunction` with the name of the new function. Add the new function to the index files `./src/factoriesAny.js` and possibly `./src/factoriesNumber.js`.
136-
- Write documentation on the function in the source code comment of `myNewFunction.js`. This documentation is used to auto generate documentation on the website.
136+
- Write documentation on the function in the source code comment of `myNewFunction.js`. This documentation is used to auto generate documentation on the website. It should include a History section with one line, indicating the upcoming version number in which the function will be created.
137137
- Write embedded documentation for the new function in `./src/expression/embeddedDocs/function/arithmetic/myNewFunction.js`. Add the new documentation to the index file `./src/expression/embeddedDocs/embeddedDocs.js`.
138138
- Write unit tests for the function in `./test/unit-tests/function/arithmetic/myNewFunction.test.js`.
139139
- Write the necessary TypeScript definitions for the new function in `./types/index.d.ts`, and write tests for it in `./test/typescript-tests/testTypes.ts`. This is described in [./types/EXPLANATION.md](./types/EXPLANATION.md) -- make sure to read that page, as Typescript definitions must be added in _multiple_ places in the code.

src/core/function/import.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,13 @@ export function importFactory (typed, load, math, importedFactories) {
5656
*
5757
* math.fibonacci(7) // returns 13
5858
*
59+
* History:
60+
*
61+
* v0.2 Created
62+
* v0.7 Changed second parameter to an options object
63+
* v2 Dropped support for direct import of a module by name
64+
* v14.2 Add facility for specifying the former name of an import
65+
*
5966
* @param {Object | Array} functions Object with functions to be imported.
6067
* @param {Object} [options] Import options.
6168
*/

src/expression/parse.js

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,23 @@ export const createParse = /* #__PURE__ */ factory(name, dependencies, ({
8080
*
8181
* evaluate, compile
8282
*
83+
* History:
84+
*
85+
* v0.9 Created
86+
* v0.13 Switched to one-based indices
87+
* v0.14 Added `[1,2;3,4]` notation for matrices
88+
* v0.18 Dropped the `function` keyword
89+
* v0.20 Added ternary conditional
90+
* v0.27 Allow multi-line expressions; allow functions that receive
91+
* unevaluated parameters (`rawArgs`)
92+
* v3 Add object notation; allow assignments internal to other
93+
* expressions
94+
* v7.3 Supported binary, octal, and hexadecimal notation
95+
* v9.5 Support for calculations with percentages
96+
* v12.4 Allow trailing commas in matrices
97+
* v14.8 Add nullish coalescing operator
98+
* v15.1 Add optional chaining operator
99+
*
83100
* @param {string | string[] | Matrix} expr Expression to be parsed
84101
* @param {{nodes: Object<string, Node>}} [options] Available options:
85102
* - `nodes` a set of custom nodes

src/function/algebra/polynomialRoot.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,10 @@ export const createPolynomialRoot = /* #__PURE__ */ factory(name, dependencies,
6161
* See also:
6262
* cbrt, sqrt
6363
*
64+
* History:
65+
*
66+
* v11.4 Created
67+
*
6468
* @param {... number | Complex} coeffs
6569
* The coefficients of the polynomial, starting with with the constant coefficent, followed
6670
* by the linear coefficient and subsequent coefficients of increasing powers.

src/function/arithmetic/log.js

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,19 @@ export const createLog = /* #__PURE__ */ factory(name, dependencies, ({ typed, t
3434
*
3535
* exp, log2, log10, log1p
3636
*
37+
* History:
38+
*
39+
* v0.0.2 Created
40+
* v0.2 Add optional base argument
41+
* v0.3 Handle Array input
42+
* v0.5 Handle Matrix input
43+
* v0.16 Handle BigNumber input
44+
* v0.21 Support negative BigNumbers
45+
* v11 Drop Array/Matrix support in favor of explicit map of
46+
* the scalar log function, to avoid confusion with the log
47+
* of a matrix
48+
* v14 Allow value and base to be Fractions, when the log is rational
49+
*
3750
* @param {number | BigNumber | Fraction | Complex} x
3851
* Value for which to calculate the logarithm.
3952
* @param {number | BigNumber | Fraction | Complex} [base=e]

src/function/matrix/map.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,12 @@ export const createMap = /* #__PURE__ */ factory(name, dependencies, ({ typed })
4141
* // It can also be called with 2N + 1 arguments: for N arrays
4242
* // callback(value1, value2, index, BroadcastedArray1, BroadcastedArray2)
4343
*
44+
* History:
45+
*
46+
* v0.13 Created
47+
* v1.1 Clone the indices on each callback in case callback mutates
48+
* v13.1 Support multiple inputs to the callback
49+
*
4450
* See also:
4551
*
4652
* filter, forEach, sort

src/function/relational/compare.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,12 @@ export const createCompare = /* #__PURE__ */ factory(name, dependencies, ({ type
5858
*
5959
* equal, unequal, smaller, smallerEq, larger, largerEq, compareNatural, compareText
6060
*
61+
* History:
62+
*
63+
* v0.19 Created
64+
* v4 Changed to compare strings by numerical value
65+
* v13 Change to use separate relative and absolute tolerances
66+
*
6167
* @param {number | BigNumber | bigint | Fraction | Unit | string | Array | Matrix} x First value to compare
6268
* @param {number | BigNumber | bigint | Fraction | Unit | string | Array | Matrix} y Second value to compare
6369
* @return {number | BigNumber | bigint | Fraction | Array | Matrix} Returns the result of the comparison:

src/function/string/format.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,15 @@ export const createFormat = /* #__PURE__ */ factory(name, dependencies, ({ typed
119119
*
120120
* print
121121
*
122+
* History:
123+
*
124+
* v0.4 Created
125+
* v0.7 Round to a consistent number of digits (rather than decimals)
126+
* v0.15 Added multiple number notations and configurable precision
127+
* v3 Added support for JSON objects
128+
* v9 Added binary, hexadecimal, and octal notations
129+
* v10.4.2 Add `truncate` option
130+
*
122131
* @param {*} value Value to be stringified
123132
* @param {Object | Function | number} [options] Formatting options
124133
* @return {string} The formatted value

src/function/utils/numeric.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,12 @@ export const createNumeric = /* #__PURE__ */ factory(name, dependencies, ({ numb
4747
*
4848
* number, fraction, bignumber, bigint, string, format
4949
*
50+
* History:
51+
*
52+
* v6 Created
53+
* v13 Added `bigint` support
54+
* v14.2.1 Prefer mathjs `bigint()` to built-in `BigInt()`
55+
*
5056
* @param {string | number | BigNumber | bigint | Fraction } value
5157
* A numeric value or a string containing a numeric value
5258
* @param {string} outputType

src/type/bigint.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,11 @@ export const createBigint = /* #__PURE__ */ factory(name, dependencies, ({ typed
2424
*
2525
* number, bignumber, boolean, complex, index, matrix, string, unit
2626
*
27+
* History:
28+
*
29+
* v13 Created
30+
* v14.2.1 Added conversion options
31+
*
2732
* @param {string | number | BigNumber | bigint | Fraction | boolean | Array | Matrix | null} [value] Value to be converted
2833
* @return {bigint | Array | Matrix} The created bigint
2934
*/

0 commit comments

Comments
 (0)