|
From: Stavros M. <mac...@al...> - 2022-07-11 16:41:53
|
On Sun, Jul 10, 2022 at 10:33 PM Eduardo Ochs <edu...@gm...> wrote:
> On Sun, 10 Jul 2022 at 12:32, Stavros Macrakis <mac...@al...>
> wrote:
> ...
> ex1 : a*b/c;
> :lisp #$ex1$
>
> I get the internal representation of ex1, which is:
>
> ((MTIMES SIMP) $A $B ((MEXPT SIMP) $C -1))
>
> How do I get a sexp that is closer to the displayed form?
>
Here is an example that shows most of the differences between the form that
Maxima uses for calculating internally and the form it uses for display:
*... Normal display ...*
(%i1) test: a/2-sqrt(b)/c+2.333b0;
sqrt(b) a
(%o1) (- -------) + - + 2.333b0 <<< terms in standardized order
c 2
*... Internal form ...*
(%i2) ?print(test)$
((MPLUS SIMP)
((BIGFLOAT SIMP 56) 42027591722621469 2) <<< == 42027591722621469*2^(2-56)
<<< numbers always come in first
position
((MTIMES SIMP) ((RAT SIMP) 1 2) $A) <<< x/2 == x*(1/2)
((MTIMES SIMP)
-1 <<< a-b == a*(-1)*b
((MEXPT SIMP)
$B <<< sqrt(x) == x^(1/2)
((RAT SIMP) 1 2))
((MEXPT SIMP) $C -1))) <<< but a/b == a*b^-1
(%i3) :lisp $test
*<<same thing>>*
(%i3) to_lisp()$
Type (to-maxima) to restart, ($quit) to quit Maxima.
MAXIMA> $test
*<<same thing>>*
MAXIMA> (to-maxima)
Returning to Maxima
*... 2-dimensional display of internal form ...*
(%i4) print(test),display_format_internal:true$
1 1/2 - 1
2.333b0 + (-) a + (- 1) b c
2
*... Lisp form prepared for printing ...*
(%i5) :lisp (nformat $test)
((MPLUS)
((MMINUS) ((MQUOTIENT) ((%SQRT) $B) $C))
((MQUOTIENT) $A 2)
((BIGFLOAT SIMP 56) 42027591722621469 2))
(%i6) block([simp:false],?print(?nformat(test)))$
*<<same thing>>*
(note that ?print(?nformat(test)),simp:false does not work)
|