showing decimals of irrational numbers and irregular fractions



On Jan 21, 2008 11:46 PM, Justin Harford <blindstein at gmail.com> wrote:

> When I type something like
> sqrt(2)
> or
> 3/2
> maxima shows it exactly as I wrote it.  Is there a way I can make it
> show the results in decimal form?
>

Yes, use float(...) or ev(...,numer).

Maxima doesn't do this by default because Maxima keeps everything in *exact*
form until you tell it you want an approximate numeric computation.  This
permits its results to be more accurate:

(float(sqrt(2)))^2-2        =>      4.4408920985006262E-16     approximate
answer
sqrt(2)^2-2                     =>
0                                              exact answer

sin(10^100*%pi)             =>
0                                             exact answer
sin(float(10^100*%pi))   =>      -0.2538
approximate answer

Most computer programs use the floating-point approximation, which makes
them faster than Maxima for numerical computations, but less accurate.

                -s