Skip to content

Commit b3b477d

Browse files
authored
Merge branch 'develop' into faster-map-mulitple
2 parents 5bed3be + d8a88a1 commit b3b477d

33 files changed

+1351
-2188
lines changed

AUTHORS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -274,5 +274,6 @@ Elia Alesiani <elia.alesiani@gmail.com>
274274
lucaQ <lucaquercetti@gmail.com>
275275
EliaAlesiani <105418798+EliaAlesiani@users.noreply.github.com>
276276
kyle-compute <kyle@intelvis.ai>
277+
DongKwanKho <70864292+dodokw@users.noreply.github.com>
277278

278279
# Generated by tools/update-authors.js

HISTORY.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,17 @@
11
# History
22

3+
# 2025-09-05, 14.7.0
4+
5+
- Feat: faster `DenseMatrix` symbol iterator (#3521). Thanks @dvd101x.
6+
- Feat: implement serialization support for `Parser`, fixing #3509 (#3525).
7+
- Fix: #3519, #3368 categories "Core functions" and "Construction functions"
8+
missing from the generated function overview.
9+
- Fix: #3517 `printTransformDependencies` not exported in the type definitions.
10+
- Fix: add missing type definition for function `diff` (#3520). Thanks @dodokw.
11+
- Fix: #3396 improve documentation of function `range`.
12+
- Fix: #3523 cleanup old polyfills from the browser bundle
13+
by removing `core-js` (#3524).
14+
315
# 2025-07-25, 14.6.0
416

517
- Feat: new function `toBest(unit, unitList, offset)`, and corresponding

docs/expressions/parsing.md

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -234,3 +234,31 @@ Some care is taken to mutate the same object that is passed into mathjs, so they
234234
For less reliance on this blacklist, scope can also be a `Map`, which allows mathjs expressions to define variables and functions of any name.
235235

236236
For more, see [examples of custom scopes](../../examples/advanced/custom_scope_objects.js).
237+
238+
## Serialization
239+
240+
All mathjs data types can be serialized. A scope containing variables can therefore be safely serialized too. However, in the expression parser it is possible to define functions, like:
241+
242+
```
243+
f(x) = x^2
244+
```
245+
246+
Such a custom function cannot be serialized on its own, since it may be bound to other variables in the scope.
247+
248+
A [`Parser`](#parser) can safely serialize all variables and functions evaluated via the expression parser:
249+
250+
```js
251+
const parser = math.parser()
252+
253+
// evaluate some expressions
254+
parser.evaluate('w = 2')
255+
parser.evaluate('f(x) = x^w')
256+
parser.evaluate('c = f(3)') // 9
257+
258+
// serialize the parser with its state
259+
const str = JSON.stringify(parser)
260+
261+
// deserialize the parser again
262+
const parser2 = JSON.parse(str, math.reviver)
263+
parser.evaluate('f(4)') // 16
264+
```
File renamed without changes.

0 commit comments

Comments
 (0)