fnormal in maple (version 7, anyway)



On 1 Sep 2008, Stavros Macrakis wrote:

>Given the definition below, a simplified version of Maple's fnormal would
>be:
>
>fnormal(ex):=
>   if numberp(ex) and abs(ex) < 1.0e-14 then 0
>   elseif mapatom(ex) then ex
>   else map(fnormal,ex);
>
This behaves like Chop(expr) in Mathematica, a feature very useful
when combining symbolic with floating point calculations.

I like  the word chop  better than fnormal.

(%i7) a+1.0e-15;
(%o7)                     a + 1.0000000000000001E-15
(%i8) fnormal(%);
(%o8)                                  a
(%i9) a+%i*1.0e-15;
(%o9)                    a + 1.0000000000000001E-15 %i
(%i10) fnormal(%);
(%o10)                                 a
(%i11) exp( float(%i*2*%pi));
(%o11)                  1.0 - 2.4492127076447545E-16 %i
(%i12) fnormal(%);
(%o12)                                1.0

Ted Woollett