Go to the first, previous, next, last section, table of contents.

### `eval`, `deval`

eval(obj[,prec])
deval(obj)
:: Evaluate obj numerically.
return
number or expression
obj
general expression
prec
integer
• Evaluates the value of the functions contained in obj as far as possible.
• `deval` returns double float. Rational numbers remain unchanged in results from `eval`.
• In `eval` the computation is done by PARI (See section `pari`). In `deval` the computation is done by the C math library.
• `deval` cannot handle complex numbers.
• When prec is specified, computation will be performed with a precision of about prec-digits. If prec is not specified, computation is performed with the precision set currently. (See section `setprec`)
• Currently available numerical functions are listed below. Note they are only a small part of whole PARI functions.
`sin`, `cos`, `tan`, `asin`, `acos`, `atan`, `sinh`, `cosh`, `tanh`, `asinh`, `acosh`, `atanh`, `exp`, `log`, `pow(a,b) (a^b)`
• Symbols for special values are as the followings. Note that `@i` cannot be handled by `deval`.
@i
unit of imaginary number
@pi
the number pi, the ratio of circumference to diameter
@e
Napier's number (exp(1))
``` eval(exp(@pi*@i));
-1.0000000000000000000000000000
 eval(2^(1/2));
1.414213562373095048763788073031
 eval(sin(@pi/3));
0.86602540378443864674620506632
 eval(sin(@pi/3)-3^(1/2)/2,50);
-2.78791084448179148471 E-58
 eval(1/2);
1/2
 deval(sin(1)^2+cos(1)^2);
1
```
References
section `ctrl`, section `setprec`, section `pari`.

Go to the first, previous, next, last section, table of contents.