How to avoid ^- in maxima output? (Leo Butler) [Martin Kraska]
Subject: How to avoid ^- in maxima output? (Leo Butler) [Martin Kraska]
From: Leo Butler
Date: Thu, 7 Nov 2013 15:44:50 GMT
> From: Martin Kraska <kraska at fh-brandenburg.de>
> CC: <maxima at math.utexas.edu>, <graubman at fh-brandenburg.de>
> Date: Fri, 1 Nov 2013 16:45:17 +0100
>
> Leo, thanks for the agreement. Yes, it is sensible to include the code
> changes. For the future, I guess, just adding rules to sm_rules in our
> session init would be sufficient, wouldn't it? Then we do not need to bother
> with updates.
>
> The only direct change was made to the match pattern in order to resolve
> different interpretation of a^b^c in Maxima and SMath:
>
> matchdeclare([sm_x],true,sm_y,lambda([e],if is(numberp(e) and e<0 and e#-1)
> or is(not(atom(e)) and (op(e)="-" or op(e)="^")) then true else false));
>
> Thanks again for your help.
>
> Martin
Martin, I pushed the patched plugin to the Maxima repository. Give it
a test run, please.
Note that I changed the rule slightly, to make it put braces around
almost all non-atomic exponents.
(%i1) load(smath);
(%o1) "/home/work/maxima/sandbox/git/maxima-sf/share/contrib/smath/smath.mac"
(%i2) to_sm_display();
(%s2) %s
(%i3) e^a^b^c^d;
(%s3) e^{a^{b^{c^d}}}
(%i4) e^(1+cos(e^a));
(%s4) e^{cos(e^a)+1}
(%i5) e^(1+cos(e^a^-w));
(%s5) e^{cos(e^{a^{-w}})+1}
Leo