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
49 lines (33 loc) • 1.04 kB
Markdown
<!-- Note: This file is automatically generated from source code comments. Changes made in this file will be overridden. -->
Create a unit. Depending on the passed arguments, the function
will create and return a new math.Unit object.
When a matrix is provided, all elements will be converted to units.
```js
math.unit(unit : string)
math.unit(value : number, unit : string)
```
Parameter | Type | Description
--------- | ---- | -----------
`args` | * &
Type | Description
---- | -----------
Unit &
```js
const a = math.unit(5, 'cm') // returns Unit 50 mm
const b = math.unit('23 kg') // returns Unit 23 kg
a.to('m') // returns Unit 0.05 m
```
[ ](bignumber.md),
[ ](boolean.md),
[ ](complex.md),
[ ](index.md),
[ ](matrix.md),
[ ](number.md),
[ ](string.md),
[ ](createUnit.md)