You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
constv=math.evaluate('[0, 1, 0] m/s') // [0 m / s, 1 m / s, 0 m / s]
85
+
constq=math.evaluate('1 C') // 1 C
86
86
87
87
constF=math.multiply(q, math.cross(v, B)) // [0 N, 0 N, -1 N]
88
88
```
@@ -93,14 +93,14 @@ In general you should avoid calculations using `celsius` and `fahrenheit`. Rathe
93
93
This example highlights some problems when using `celsius` and `fahrenheit` in calculations:
94
94
95
95
```js
96
-
constT_14F=math.unit('14 degF') // Unit 14 degF (263.15 K)
97
-
constT_28F=math.multiply(T1, 2) // Unit 487.67 degF (526.3 K), not 28 degF
96
+
constT_14F=math.unit('14 degF') // Unit 14 degF (263.15 K)
97
+
constT_28F=math.multiply(T1, 2) // Unit 487.67 degF (526.3 K), not 28 degF
98
98
99
-
constTnegative=math.unit(-13, 'degF') // Unit -13 degF (248.15 K)
100
-
constTpositive=math.abs(T1) // Unit -13 degF (248.15 K), not 13 degF
99
+
constTnegative=math.unit(-13, 'degF') // Unit -13 degF (248.15 K)
100
+
constTpositive=math.abs(T1) // Unit -13 degF (248.15 K), not 13 degF
101
101
102
-
constTrate1=math.eval('5 (degC/hour)')// Unit 5 degC/hour
103
-
constTrate2=math.eval('(5 degC)/hour')// Unit 278.15 degC/hour
102
+
constTrate1=math.evaluate('5 (degC/hour)') // Unit 5 degC/hour
103
+
constTrate2=math.evaluate('(5 degC)/hour') // Unit 278.15 degC/hour
104
104
```
105
105
106
106
The expression parser supports units too. This is described in the section about
@@ -112,15 +112,15 @@ You can add your own units to Math.js using the `math.createUnit` function. The
112
112
113
113
```js
114
114
math.createUnit('furlong', '220 yards')
115
-
math.eval('1 mile to furlong')// 8 furlong
115
+
math.evaluate('1 mile to furlong') // 8 furlong
116
116
```
117
117
118
118
If you cannot express the new unit in terms of any existing unit, then the second argument can be omitted. In this case, a new base unit is created:
119
119
120
120
```js
121
121
// A 'foo' cannot be expressed in terms of any other unit.
122
122
math.createUnit('foo')
123
-
math.eval('8 foo * 4 feet')// 32 foo feet
123
+
math.evaluate('8 foo * 4 feet') // 32 foo feet
124
124
```
125
125
126
126
The second argument to `createUnit` can also be a configuration object consisting of the following properties:
@@ -156,14 +156,14 @@ math.createUnit( {
156
156
{
157
157
override:true
158
158
})
159
-
math.eval('50000 kilofoo/s')// 4.5 gigabaz
159
+
math.evaluate('50000 kilofoo/s') // 4.5 gigabaz
160
160
```
161
161
162
162
### Return Value
163
163
`createUnit` returns the created unit, or, when multiple units are created, the last unit created. Since `createUnit` is also compatible with the expression parser, this allows you to do things like this:
164
164
165
165
```js
166
-
math.eval('45 mile/hour to createUnit("knot", "0.514444m/s")')
166
+
math.evaluate('45 mile/hour to createUnit("knot", "0.514444m/s")')
167
167
// 39.103964668651976 knot
168
168
```
169
169
@@ -229,7 +229,7 @@ determine the best fitting prefix for the unit.
229
229
230
230
## Unit reference
231
231
232
-
This section lists all available units, prefixes, and physical constants. These can be used via the Unit object, or via `math.eval()`.
232
+
This section lists all available units, prefixes, and physical constants. These can be used via the Unit object, or via `math.evaluate()`.
0 commit comments