[Maxima] strange behaviour with simple decimals

Stavros Macrakis macrakis at alum.mit.edu
Wed Apr 18 09:59:57 CDT 2007


On 4/17/07, Andrey G. Grozin <A.G.Grozin at inp.nsk.su> wrote:
>
> I'd like to stress one general point about maxima (or any other CAS).
> maxima *always* transforms its input to its internal representation.


Absolutely!

One detail: "part" actually reformulates the internal form for human use.
Here's a little function to see what the internal form looks like a bit more
accurately:

showin(ex) :=
     block([inflag : true],
         if atom(ex) then ex
         else funmake(concat(" ", part(ex, 0)), map(showin, args(ex))))$

showin(1/x) => ^(x, - 1)      = x^(-1)
showin(x-y) => +(x,  *(- 1, y))     NOT +(x, -(y))
showin(1/3) => //(1, 3)      special form for rational numbers, not 3^(-1)
showin(x/(3*y)) => *( //(1, 3), x,  ^(y, - 1))    = 1/3 * x * y^(-1)  NOT x
* (3*y)^-1
showin(sqrt(1-x^2)) =>  ^( +(1,  *(- 1,  ^(x, 2))),  //(1, 2))  NOT
sqrt(...)
showin([a,b]) => [(a,b)     ... "[" is the list-forming operator

showin doesn't cover all cases (subscripting, bigfloats, CREs (created by
rat), complex applications), but it's good enough to show the idea.

To see the full unvarnished internal representation, you can use the Lisp
function ?print:

?print(1.5b0/x-1)$
((MPLUS SIMP) -1
 ((MTIMES SIMP) ((BIGFLOAT SIMP 56) 54043195528445952 1)
  ((MEXPT SIMP) $X -1)))

          -s
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.math.utexas.edu/pipermail/maxima/attachments/20070418/cef30b5e/attachment-0001.htm 


More information about the Maxima mailing list