Numerical approximation (numeric)
Approximate a number with decimals.
How to write it
numeric(expr)
The usual double-precision approximation.
- expr
- Any expression: a number, a formula, a list or a matrix. Takes an expression.
numeric(expr, digits = n)
The approximation with the given number of digits.
- expr
- Any expression: a number, a formula, a list or a matrix. Takes an expression.
- digits = n
- How many digits to compute. Takes a whole number.
Examples
numeric(pi)In the solver,
Open in the solvernumeric(pi)gives3.141592653589793.numeric(pi, digits = 20)In the solver,
Open in the solvernumeric(pi, digits = 20)gives3.1415926535897932385.
Related functions
- rationalize
The simplest fraction equal to a decimal number.
- chop
A number with tiny parts replaced by zero.