Skip to content

Commit

Permalink
Merge branch 'develop' of https://github.com/dvd101x/mathjs into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
David Contreras committed Mar 12, 2024
2 parents 4718371 + 8d166ea commit c6a13d7
Show file tree
Hide file tree
Showing 85 changed files with 1,601 additions and 811 deletions.
7 changes: 6 additions & 1 deletion AUTHORS
Original file line number Diff line number Diff line change
Expand Up @@ -217,9 +217,9 @@ Evan Miller <evan@geteppo.com>
Timur <35872220+bornova@users.noreply.github.com>
Ari Markowitz <ariymarkowitz@gmail.com>
Jay Wang <xiao.hk1997@gmail.com>
David Contreras <david.contreras@guentner.com>
Jaeu Jeong <wodndb@gmail.com>
cyavictor88 <100557319+cyavictor88@users.noreply.github.com>
David Contreras <david.contreras@guentner.com>
Jakub Riegel <jakubriegel112@gmail.com>
Angus Comrie <accomrie@gmail.com>
TMTron <martin.trummer@tmtron.com>
Expand All @@ -238,5 +238,10 @@ Juan Pablo Alvarado <63080419+juancodeaudio@users.noreply.github.com>
Brooks Smith <brooks.smith@clearcalcs.com>
Alex Edgcomb <aedgcomb@gmail.com>
S.Y. Lee <sylee957@gmail.com>
Hudsxn <143907857+Hudsxn@users.noreply.github.com>
Rich Martinez <6185506+rich-martinez@users.noreply.github.com>
Rich Martinez <richmartinez@Edinas-MacBook-Pro.local>
RandomGamingDev <83996185+RandomGamingDev@users.noreply.github.com>
Brian Fugate <fugateb@yahoo.com>

# Generated by tools/update-authors.js
40 changes: 39 additions & 1 deletion HISTORY.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,52 @@
# History


# unpublished changes since 12.3.0
# unpublished changes since 12.4.0

- Fix #3163: `toTex` wrongly returning `Infinity` for large BigNumbers.
- Fix #3162: add license information about CSParse (#3164).


# 2024-02-22, 12.4.0

- Feat: implement support for trailing commas in matrices (#3154, #2968).
Thanks @dvd101x.
- Feat: improve the performance of `multiply` a lot by adding matrix type
inferencing (#3149). Thanks @RandomGamingDev.
- Fix: #3100 function `round` not handling round-off errors (#3136).
Thanks @BrianFugate.
- Fix: `PartitionedMap` and `ObjectWrappingMap` missing a property
`Symbol.iterator`, causing problems when trying `new Map(scope)` (#3156).
- Fix: type definitions of function `mode` (#3153). Thanks @rich-martinez.
- Docs: describe method `getAllAsMap` in the Parser docs (#3158, #3157).
Thanks @dvd101x.


# 2024-02-08, 12.3.2

- Improved the performance of custom defined functions in the expression
parser (#3150).
- Fix: #3143 cannot use `and` and `or` inside a function definition.
Regression since `v12.1.0` (#3150).


# 2024-02-01, 12.3.1

- Improved the typings of the arguments of `ArrayNode`, `FunctionNode`,
`IndexNode`, `OperatorNode`, and `RelationalNode` (#3123). Thanks @sylee957.
- Added a fully featured code editor example with CodeMirror and Katex (#3027).
Thanks @dvd101x.
- Fix: #3114 build warnings related to a number of wrong `/* #__PURE__ */`
annotations.
- Fix: #3142 support BigNumber values for the options of function `format`:
`precision`, `wordSize`, `lowerExp`, `upperExp`. Support BigNumber values
for the option `wordSize` in the functions `hex`, `bin`, and `oct`.
- Fix: #3125 type definitions of function `hypot` (#3144).
Thanks @silentmissile.
- Fix: #3141 `help(config)` altering the actual `config` when evaluating the
examples.
- Docs: #3145 fix documentation about REPL, it does require a build step
nowadays.


# 2024-01-12, 12.3.0
Expand Down
28 changes: 28 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,9 @@ Thanks Github Actions and BrowserStack for the generous free hosting of this ope

## License

mathjs is published under the Apache 2.0 license:

```
Copyright (C) 2013-2024 Jos de Jong <wjosdejong@gmail.com>
Licensed under the Apache License, Version 2.0 (the "License");
Expand All @@ -208,3 +211,28 @@ distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
```

mathjs contains a JavaScript port of the [CSparse](https://github.com/DrTimothyAldenDavis/SuiteSparse/tree/dev/CSparse/Source) library, published under the LGPL-2.1+ license:

```
CSparse: a Concise Sparse matrix package.
Copyright (c) 2006, Timothy A. Davis.
http://www.suitesparse.com
--------------------------------------------------------------------------------
CSparse is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
CSparse is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this Module; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
```
7 changes: 3 additions & 4 deletions docs/command_line_interface.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,10 +68,9 @@ $ mathjs --string --parenthesis=all

# Command line debugging (REPL)

For debugging purposes, `bin/repl.js` provides a REPL (Read Evaluate Print Loop)
for interactive testing of mathjs without having to build new build files after every
little change to the source files. You can either start it directly (`./bin/repl.js`) or
via node (`node bin/repl.js`).
The library also provides a REPL (Read Evaluate Print Loop) via `bin/repl.js` which
loads mathjs in a Node.js command line environment.
You can either start it directly (`./bin/repl.js`) or via node (`node bin/repl.js`).

You can exit using either [ctrl]-[C] or [ctrl]-[D].

Expand Down
4 changes: 2 additions & 2 deletions docs/datatypes/matrices.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ const array = [[2, 0], [-1, 3]] // Array
const matrix = math.matrix([[7, 1], [-2, 3]]) // Matrix

// perform a calculation on an array and matrix
math.square(array) // Array, [[4, 0], [1, 9]]
math.square(matrix) // Matrix, [[49, 1], [4, 9]]
math.map(array, math.square) // Array, [[4, 0], [1, 9]]
math.map(matrix, math.square) // Matrix, [[49, 1], [4, 9]]

// perform calculations with mixed array and matrix input
math.add(array, matrix) // Matrix, [[9, 1], [-3, 6]]
Expand Down
9 changes: 5 additions & 4 deletions docs/expressions/customization.md
Original file line number Diff line number Diff line change
Expand Up @@ -107,16 +107,17 @@ allowing the function to process the arguments in a customized way. Raw
functions are called as:

```
rawFunction(args: Node[], math: Object, scope: Object)
rawFunction(args: Node[], math: Object, scope: Map)
```

Where :

- `args` is an Array with nodes of the parsed arguments.
- `math` is the math namespace against which the expression was compiled.
- `scope` is a shallow _copy_ of the `scope` object provided when evaluating
the expression, optionally extended with nested variables like a function
parameter `x` of in a custom defined function like `f(x) = x^2`.
- `scope` is a `Map` containing the variables defined in the scope passed
via `evaluate(scope)`. In case of using a custom defined function like
`f(x) = rawFunction(x) ^ 2`, the scope passed to `rawFunction` also contains
the current value of parameter `x`.

Raw functions must be imported in the `math` namespace, as they need to be
processed at compile time. They are not supported when passed via a scope
Expand Down
4 changes: 3 additions & 1 deletion docs/expressions/parsing.md
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,9 @@ The parser contains the following functions:
- `get(name)`
Retrieve a variable or function from the parser's scope.
- `getAll()`
Retrieve a map with all defined a variables from the parser's scope.
Retrieve an object with all defined variables in the parser's scope.
- `getAllAsMap()`
Retrieve a map with all defined variables in the parser's scope.
- `remove(name)`
Remove a variable or function from the parser's scope.
- `set(name, value)`
Expand Down
13 changes: 0 additions & 13 deletions docs/expressions/syntax.md
Original file line number Diff line number Diff line change
Expand Up @@ -472,19 +472,6 @@ parser.evaluate('i * i') // Number, -1
parser.evaluate('sqrt(-4)') // Complex, 2i
```

Math.js does not automatically convert complex numbers with an imaginary part
of zero to numbers. They can be converted to a number using the function
`number`.

```js
// convert a complex number to a number
const parser = math.parser()
parser.evaluate('a = 2 + 3i') // Complex, 2 + 3i
parser.evaluate('b = a - 3i') // Complex, 2 + 0i
parser.evaluate('number(b)') // Number, 2
parser.evaluate('number(a)') // Error: unexpected type of argument
```


### Units

Expand Down
Loading

0 comments on commit c6a13d7

Please sign in to comment.