Inconsistency when using previously defined variables as arguments to functions
Subject: Inconsistency when using previously defined variables as arguments to functions
From: thomas
Date: Tue, 01 Feb 2011 11:21:07 +0100
Thanks :)
On 02/01/2011 01:15 AM, Stavros Macrakis wrote:
> ev really is that evil -- take a look at my old note in
> http://www.math.utexas.edu/pipermail/maxima/2007/006737.html for some
> examples (certainly not exhaustive!).
>
> It is easy enough to create a pseudo-function that will quote its
> argument and 'protect' it from simplification:
>
> :lisp (defprop $nosimp (lambda(x) (list '(mlabox simp) (cadr x)
> '$nosimp)) mfexpr*)
>
> ex: nosimp(2+3);
>
> nosimp"
> "2 + 3"
> """""""
>
> rembox(ex,'nosimp);
>
> 5
>
> block([simp:false],print(rembox(%o44,'nosimp)));
>
> 2 + 3 <<< printed result from within the block
>
> 5 <<< gets simplified when returned from block
>
>
> On Mon, Jan 31, 2011 at 18:45, thomas <thomas at geogebra.org
> <mailto:thomas at geogebra.org>> wrote:
>
> On 02/01/2011 12:30 AM, Stavros Macrakis wrote:
>
> I don't know what a "Hold" statement is.
>
> To simplify an expression that was created with simp:false,
> you can use simply
>
> block([simp:true], expr )
>
> This avoids all the perverse semantics of 'ev'.
>
> If the expression has been simplified (or partially
> simplified) under different conditions than the current
> conditions (e.g. different assumptions, different global
> flags, etc.), you can do:
>
> block([simp:true], expand(expr,0,0) )
>
> which forces Maxima to rescan the whole expression, including
> parts that are already tagged as simplified.
>
> -s
>
>
> Hi!
> Sorry for not explaining what I meant with "hold": I meant a
> command available in other CAS that is basically a way to enter an
> expression without evaluating or simplifying it. Since to my
> knowledge maxima doesn't have any such thing, so we emulate it by
> using simp:false as default and use ev(....., simp) every time we
> really do want to have somethign evaluated/simplified.
>
> Is "ev" (and using simp:false) really that evil? (Like I said,
> I've yet to encounter any "perverse" semantics of it, so far it
> worked pretty well)?
> (In any case, thank you for your suggestions and the tip with
> 'block' :) )
>
> Cheers
>
> Thomas
>
>