display expression exactly as entered



You're missing the newline/Enter/Return between the Lisp and the Maxima
statements.
On Oct 24, 2011 6:51 PM, "Ether Jones" <maxima at etherjones.us> wrote:

>
> (%i1) :lisp (defmacro $dd (x) `(progn (displa '((mlable) Raw ,x)) (terpri)
> ',x))
>       dd(x/x);
>
> Maxima encountered a Lisp error:
>   Error in PROGN [or a callee]: The variable DD is unbound.
> Automatically continuing.
> To enable the Lisp debugger set *debugger-hook* to nil.
>
>
> See attached screenshot
>
> ------------------------------
> *From:* Stavros Macrakis <macrakis at alum.mit.edu>
> *To:* Ether Jones <maxima at etherjones.us>
> *Cc:* maxima <maxima at math.utexas.edu>
> *Sent:* Monday, October 24, 2011 3:56 PM
> *Subject:* Re: [Maxima] display expression exactly as entered
>
> Well, if that's your use case, then you might want to redefine the
> read-eval-print loop (if you *always* want to see the unsimplified form) or
> use the following macro
>
> (%i13) :lisp (defmacro $dd (x) `(progn (displa '((mlable) Raw ,x)) (terpri)
> ',x))
> (%i14) dd(x/x);
>                                        x
> (raw)                                  -
>                                        x
>
> (%o14)                                 1
>
> It prints the unsimplified form, and returns the value, whereupon it is
> simplified in the normal way.
>
> You will always get better replies to your queries if you explain **why**
> you want to do what you're asking for....
>
>            -s
>
> On Mon, Oct 24, 2011 at 14:42, Ether Jones <maxima at etherjones.us> wrote:
>
>
> Yes, but as soon as you 'touch' it again, it will be simplified.
>
> Understood, and acceptable.
>
> Why exactly do you want this?
>
> I want the expression I manually enter to appear exactly the way I typed it
> for three reasons, all of which you have anticipated:
>
> 1) to confirm that I entered it correctly, and
>
> 2) for me to see it in 2D the way I entered it so that I can examine it for
> insight as to how I want to proceed, and
>
> 3) most importantly, because I entered it the way I did for a reason, and I
> want it to display that way (when I first enter it).  That reason is, it
> corresponds more clearly with the flow of the derivation argument I am
> making (for example, it more closely corresponds with any figures or
> diagrams I have prepared).
>
> Thanks for your help.
>
>
> ------------------------------
> *From:* Stavros Macrakis <macrakis at alum.mit.edu>
> *To:* Ether Jones <maxima at etherjones.us>
> *Cc:* maxima <maxima at math.utexas.edu>
> *Sent:* Monday, October 24, 2011 2:20 PM
>
> *Subject:* Re: [Maxima] display expression exactly as entered
>
> Yes, but as soon as you 'touch' it again, it will be simplified.
>
> Why exactly do you want this?  Is it to confirm that you entered the
> expression correctly?  Then maybe something like the following would be
> useful?
>
> (%i2) inputprint(n):= block([simp:false], apply('display,[concat('%i,n)]))$
> (%i3) x/x;
> (%o3) 1
> (%i4) x/4*1/(x+1);
> (%o4) x/(4*(x+1))
> (%i5) inputprint(3)$
> %i3 = x/x
> (%i6) inputprint(4);
> %i4 = x/4*1/(x+1)
>
> It looks as though the playback function could have an option to print the
> input (not just output) expressions in 2d.  Would that solve your problem?
>
>            -s
>
> On Mon, Oct 24, 2011 at 14:09, Ether Jones <maxima at etherjones.us> wrote:
>
>
> Thanks for the suggestion Stavros. Bracketing the expression with
> simp:false and simp:true seems to give what I want:
>
> simp:false$
> ex1: (W/4)*(1/());
> simp:true$
> ex1;
>
> See attached PNG screenshot for output.
>
>
> ------------------------------
> *From:* Stavros Macrakis <macrakis at alum.mit.edu>
> *To:* Ether Jones <maxima at etherjones.us>
> *Cc:* maxima <maxima at math.utexas.edu>
> *Sent:* Monday, October 24, 2011 10:49 AM
> *Subject:* Re: [Maxima] display expression exactly as entered
>
> You can disable Maxima's default transformations a.k.a. general
> simplification, by setting simp:false.
>
> However, this breaks most of Maxima's functionality.  For example:
>
>  (%i4) simp:false;
> (%o4) false
> (%i5) (W/4)*(1/(1+x));
> (%o5) W/4*(1/(1+x))
> (%i6) diff(%,x);
> (%o6) 'diff(1/(1+x),x,1)*(W/4)+0*(1/(1+x))
>
> In this case, 0*(1/(1+x)) is not simplified to 0, diff(1/(1+x),x,1) is not
> performed.  This second case may seem mysterious until you understand that
> Maxima normally does not use a division operator internally, but transforms
> it to multiplication and exponentiation -- (a/b) internally is actually a *
> b^-1, as you can see in the Lisp representation:
>
> (%i7) ?print(a/b)$
> ((MQUOTIENT) $A $B)
> (%i8) simp:true$
> (%i9) ?print(a/b)$
> ((MTIMES SIMP) $A ((MEXPT SIMP) $B -1))
>
> You can also block default simplifications by using the "box" function (and
> set boxchar:" " if you want the boxes to be invisible).
>
> But this doesn't guarantee to preserve order:
>
> (%i3) box(W/4)*box(1/(1+x));
> (%o3) box(1/(x+1))*box(W/4)
>
> And Maxima functions treat boxes as unknown functions:
>
> (%i4) diff(%,x);
> (%o4) 'diff(box(1/(x+1)),x,1)*box(W/4)
>
> Why exactly do you want to preserve your input form?  Is it because you
> find it more intuitive when you're manipulating the expression?  Because you
> want to present this form as part of your output?  Because you want to do
> transformations which depend on the form of the expression?
>
> In the last case, you might want to look at ratsubst rather than subst:
>
> (%i5) expr: (W/4)*(1/(1+x));
> (%o5) W/(4*(x+1))
> (%i6) subst(q,W/4,%);
> (%o6) W/(4*(x+1))                         <<< W/4 is not syntactically
> present in expr
> (%i7) ratsubst(q,W/4,%);
> (%o7) q/(x+1)                               <<< but ratsubst recognizes it
>
> Does that help?
>
>             -s
>
>
> On Mon, Oct 24, 2011 at 10:01, Ether Jones <maxima at etherjones.us> wrote:
>
> Hello,
>
> Is there a way to force maxima to display an expression exactly as I have
> entered it, rather than "simplifying" it for me?
>
> For example, when I enter (W/4)*(1/(1+x)) it displays as   W/(4*(x+1))
>
> Please see attached WXM file or the PNG screenshot.
>
> Thank you.
>
>
>
> _______________________________________________
> Maxima mailing list
> Maxima at math.utexas.edu
> http://www.math.utexas.edu/mailman/listinfo/maxima
>
>
>
>
>
>
>
>
>
>
>