How to prevent the immediaetly evaluation after substitute a variable
Subject: How to prevent the immediaetly evaluation after substitute a variable
From: Aleksas Domarkas
Date: Tue, 24 Jan 2012 09:39:29 +0200
from http://www.math.utexas.edu/pipermail/maxima/2012/027547.html
Ralf,
Let me just add to Barton's suggestion that the issue here isn't (in Maxima
terminology) "evaluation" (i.e. the substitution of variable values and
functions) but "simplification". The expression (2+3) is *simplified* to
5, just as (2*x+3*x) is *simplified* to 5*x.
-s
On Mon, Jan 23, 2012 at 15:27, Barton Willis <willisb at unk.edu
<http://www.math.utexas.edu/mailman/listinfo/maxima>> wrote:
>* Try using box:*>**>* (%i67) 2 * sqrt(box(h));*>* (%o67) 2*sqrt(h)*>**>* (%i68) subst(h=0.3,%);*>* (%o68) 2*sqrt(0.3)*>**>* (%i69) rembox(%);*>* (%o69) 1.095445115010332*>**>* To read the documentation for box, input ? box. There might be limitations*>* on*>* this method that I have not thought about.It might be possible to extend*>* rembox*>* to remove boxes bottom up one layer at a time.*>**>* --Barton*>**>* maxima-bounces at math.utexas.edu <http://www.math.utexas.edu/mailman/listinfo/maxima> wrote on 01/23/2012 01:27:03 PM:*>**>* > From: %i1 x : 2*sqrt(h)*>* >*>* > (%o1) 2sqrt(h)*>* >*>* > (%i2) subst([h=0.3], x)*>* >*>* > (%o2) 1.095445115010332*>* >*>* > But I want this outcome*>* >*>* > (%o2) 2sqrt(0.3)*>* >*>* > is it possible to stop the immediaetly evaluation after subst, so I*>* > can see first my expression with all the variables changed?*>* >*>* > ralf*>* > ____________________*
***************************************************************
(%i1) "2*sqrt(0.3)";
(%o1) "2*sqrt(0.3)"
(%i2) eval_string(%);
(%o2) 1.095445115010332
Other method:
(%i3) simp:false$
(%i4) 2*sqrt(0.3);
(%o4) 2*sqrt(0.3)
(%i5) %,simp=true;
(%o5) 1.095445115010332
(%i6) 3+2;
(%o6) 3+2
(%i7) simp:true$
(%i8) 3+2;
(%o8) 5
yet another method:
(%i9) define(Sqrt(x),sqrt(x))$
(%i10) define(f(x),2*'Sqrt(x))$
(%i11) f(0.3);
(%o11) 2*Sqrt(0.3)
(%i12) ev(%,nouns);
(%o12) 1.095445115010332
Aleksas D