[Maxima] Making maxima not expand powers
van.nek at arcor.de
Sun Jun 4 12:24:36 CDT 2006
Am 3 Jun 2006 um 16:36 hat Henry Lenzi geschrieben:
> Hi --
> Here's my problem: I want to make a list made of huge numbers. Then,
> I want to sort it. I don't want maxima to expand powers (I want it too
> keep exponential notation, for readability.) Is ther a way?
The answer depends on what you want to do with your list after sorting. Just two
(%o3) [2^8, 10^5, 2^32]
In this case the answer is a list of strings. An evaluation is now possible with mapping
function 'parse_string' from /share/contrib/eval_string.lisp onto every element, but this
would expand the powers.
Another posssibility is quoting the exponentiation operator. As far as I know, quoting
operators is not available at the moment. I would like to see this. But here is a workaround.
I define a quoted exponentiation.
(%i4) :lisp (defun $exptq (x y) `((mexpt simp) ,x ,y))
8 5 32
(%o6) [2 , 10 , 2 ]
Here the answer is a list of unevaluated powers.
You can simply evaluate them with a double single quote (two typed single quotes) ...
(%o7) [256, 100000, 4294967296]
... or with ev(%);
More information about the Maxima