mathjs
Version:
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 dif
54 lines (34 loc) • 1.29 kB
Markdown
<!-- Note: This file is automatically generated from source code comments. Changes made in this file will be overridden. -->
Add two or more values, `x + y`.
For matrices, the function is evaluated element wise.
```js
math.add(x, y)
math.add(x, y, z, ...)
```
Parameter | Type | Description
--------- | ---- | -----------
`x` | number &
`y` | number &
Type | Description
---- | -----------
number &
```js
math.add(2, 3) // returns number 5
math.add(2, 3, 4) // returns number 9
const a = math.complex(2, 3)
const b = math.complex(-4, 1)
math.add(a, b) // returns Complex -2 + 4i
math.add([1, 2, 3], 4) // returns Array [5, 6, 7]
const c = math.unit('5 cm')
const d = math.unit('2.1 mm')
math.add(c, d) // returns Unit 52.1 mm
math.add("2.3", "4") // returns number 6.3
```
[ ](subtract.md),
[ ](sum.md)