Numbers & operators
Math Notes evaluates expressions with the usual arithmetic operators, plus a set of word operators, number scales and rounding phrases that read like English.
Operators#
| Operator | Meaning |
|---|---|
+ |
Add |
- |
Subtract |
* |
Multiply |
/ |
Divide |
^ |
Power |
% |
Remainder |
! |
Factorial |
( ) |
Group |
(4 / 2) ^ 210 % 3Many more functions and operators are available — see the mathjs documentation. The reference lists the function aliases Math Notes adds.
Word operators#
Calculations can use words instead of symbols:
8 times 92 plus 310 minus 36 multiplied by 710 divided by 210 over 23 mul 4with and without combine and subtract durations:
2 hours with 30 minutes2 hours without 30 minutesNumber scales#
A repeated k multiplies by a thousand: 2k is 2,000, 1kk is 1,000,000, 1kkk is 1,000,000,000.
2k1kk1kkkPercentages#
Use of, on and off with %.
20% of 105% on 306% off 4050 as a % of 1005% of what is 6A percentage can be added to or taken from a value and chained with more terms, and it can be negative.
50 + 10% + 1-20% on 50Rounding#
Round a result with a phrase at the end of the line, or call round, ceil or floor directly. Rounding works with units and currencies too.
1/3 to 2 dpπ to 3 digits5.5 rounded5.5 rounded up5.5 rounded down37 to nearest 10$490 rounded to nearest hundred21 rounded up to nearest 50.534 to nearest 16thA step can carry its own unit, and a duration written in several units is rounded in the smallest one. Units and currencies round to a fraction too.
2 hours 17 minutes to nearest 1547 cm to nearest 5 cm2.3 in to nearest 16thNumber bases#
Convert a whole number with in, to or as: 255 in hex is 0xff, 255 to bin is 0b11111111, 255 as octal is 0o377, 0x9F31 to decimal is 40,753 and 5300 in sci is 5.3e+3. The bit operators <<, >>, &, |, ^| and ~ are exact for whole numbers well past 32 bits.
Constants and functions#
pi and π are available, along with the standard mathjs functions and these aliases:
| Alias | Meaning |
|---|---|
ln |
Natural logarithm |
fact |
Factorial |
arcsin, arccos, arctan |
Inverse trigonometric functions |
root(n, x) |
The x-th root of n |
fact(5)ln(e)root(8, 3)See Lists & sequences for sum, mean and the other aggregate functions, and Reference for the full table.