extracting the first N digits of a number



-----maxima-admin@math.utexas.edu wrote: -----

>(1) is there a function in Maxima to extract
>the first N digits in the decimal representation
>of a number?

I don't think so.

>(2) how can I convert a polynomial in CRE form
>back into the non-CRE form?

Use ratdisrep or totaldisrep:

(%i22) describe(ratdisrep);
 - Function: RATDISREP (exp)
     changes its argument from CRE form to general form.  This is
     sometimes convenient if one wishes to stop the "contagion", or use
     rational functions in non-rational contexts.  Most CRE functions
     will work on either CRE or non-CRE expressions, but the answers may
     take different forms.  If RATDISREP is given a non-CRE for an
     argument, it returns its argument unchanged.  See also TOTALDISREP.

(%i27) describe("total");

 - Function: TOTALDISREP (exp)
     converts every subexpression of exp from CRE to general form.  If
     exp is itself in CRE form then this is identical to RATDISREP but
     if not then RATDISREP would return exp unchanged while TOTALDISREP
     would "totally disrep" it.  This is useful for ratdisrepping
     expressions e.g., equations, lists, matrices, etc. which have some
     subexpressions in CRE form.

Barton