On 12/7/2013 9:49 AM, Barton Willis wrote:
> By the way--the user documentation says that numerval allows for
> non-floats:
>
> (%i1) numerval(%z, (1+sqrt(7))/2);
> (%o1) [%z]
>
> (%i2) 5*%z + 2013,numer;
> (%o2) 2022.114378277661
>
> (%i3) ?? numerval;
> -- Function: numerval (<x_1>, <expr_1>, ..., <var_n>, <expr_n>)
> Declares the variables `x_1', ..., <x_n> to have numeric values
> equal to `expr_1', ..., `expr_n'. The numeric value is evaluated
> and substituted for the variable in any expressions in which the
> variable occurs if the `numer' flag is `true'. See also `ev'.
> The expressions `expr_1', ..., `expr_n' can be any expressions,
> not necessarily numeric.
> (%o3) true
>
>
>
> --Barton
>
>
> ------------------------------------------------------------------------
The generalization allowed by Mathematica is that the
ev(expression,numer) equivalent is
N[expression], but there is also
N[expression, precision]
and
N[expression, precision, accuracy].
also it is possible to change the meaning of N[ ...]
by pattern-match "assignment".
e.g.
N[piby2]:= N[Pi/2]
or to even attach a program, e.g.
N[piby2]:= ... check current global setting of precision flag, and see
if there is a cached value that is good enough, else recompute....