 |
|
List Archives > 
Maple User Group List Archive > 
Archive by date > 
This Month By Date > 
This Month By Topic
[MUG] plot after assume
| [MUG] plot after assume |
|
Author: Matthias Kawski
Posted: Fri, 3 May 2002 12:08:47 -0700 (
|
>> From: Matthias Kawski "kawski"
I believe I should know this -- but continue to repeatedly run into
problems with "assume". The following is a toy example -- in my real
work I often need to "assume" properties in order to simplify big
expressions. But after having done so, I have trouble evaluating,
integrating, plotting etc.
The particularly annoying thing is when recalculating some (but not
all prior sections) I get different results, in the toy example mi-
micked by a second copy of the statements. It seems to be that there
are more than 2 x's here -- and somehow I don't know how to access
the right x in the second slot of e.g. plot(,.,.), or int(.,.).
I am looking for some general advice how to avoid such trouble --
sometimes it is not very obvious that things are wrong the 2nd time.
The constraints are that I rarely know what assumptions I will have
to make later on -- i.e. I cannot just put all assume(...) into the
first paragraph, and I often need to go back a page or two, and re-
execute lengthy calculations (e.g. with slight changes).... apparently
this can work if I take care to not reexecute any of the assume(..);
commands [[generally, there is no need to reset all assumed x:='x';
at the beginning of the pages that I need to reexecute]]. Redoing the
entire worksheet is often completely impractical.
> restart;
> y:=x^2;
> assume(x>0);
> int(y,x);
> plot(y,x);
2
y := x
3
1/3 x~
[[ the plot is OK with x~ along first axis ]]
> y:=x^2;
> assume(x>0);
> int(y,x);
> plot(y,x);
2
y := x~
2
x~ x~
Plotting error, empty plot
Matthias
**********************************************************
Matthias Kawski http://math.asu.edu/~kawski
Dept. of Mathematics and Statistics "kawski"
Arizona State University office: (480) 965 3376
Tempe, Arizona 85287-1804 home: (480) 893 0107
**********************************************************
|
| [MUG] Re: plot after assume |
|
Author: Maple User Group
Posted: Fri, 10 May 2002 16:57:54 -0400
|
>> From: Maple User Group "maple_gr"
-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-
Date: Thu, 09 May 2002 17:22:56 -0500
From: "Robert J. Lopez" "r.lopez"
To: "maple-list"
Subject: plot after assume
Here is what I have found useful in my work with assumptions in Releases
prior to 7.
1) make the assumption
2) execute the required calculations; let's say that expr is the desired
result
3) remove assumptions
4) execute the following line
parse(convert(expr,string));
This is the equivalent of re-typing the expression back into Maple. This
gives you a copy of expr without assumptions and without tildes.
There may have been better ways of working with assumed variables, but I
never found them. This was the only way I could ever manage to continue
using variables with assumptions on them. Of course, in Maple 7 and
beyond, the use of assuming provides a mechanism of "local assumptions"
and the problem has virtually disappeared.
Robert
--
Robert J. Lopez
Department of Mathematics
Rose-Hulman Institute of Technology
Terre Haute, IN 47803
812 877-8396 (office)
812 877-8883 (Department fax)
"r.lopez"
-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-
Date: Thu, 9 May 2002 17:37:41 -0700 (PDT)
From: Robert Israel "israel"
To: "maple-list"
Subject: plot after assume
In Maple 7 and 8, the best thing to do might be to use "assuming" which
makes a temporary assumption on variables for evaluating one expression
without making permanent changes. Otherwise, you can use the rather
clumsy work-around suggested in the "Changing assumptions and names"
page in my Maple Advisor Database (http://www.math.ubc.ca/~israel/advisor):
> oldx:= x:
> assume(x > 0);
> assign(oldx,x):
Robert Israel "israel"
Department of Mathematics http://www.math.ubc.ca/~israel
University of British Columbia
Vancouver, BC, Canada V6T 1Z2
-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-
Date: Thu, 09 May 2002 16:41:03 +0200
From: Preben Alsholm "ifakpa"
To: "maple-list" "kawski"
Subject: plot after assume
Each time you make an assumtion about x a new local variable x~ is
created. In your situation it therefore seems a good to make assignments
that refer to the original global x and not to the local variable created
by assume.
Consider first the following:
> restart;
> y:=x^2: #y is assigned the global x, squared.
> assume(x>0);
> y-x^2; #y evaluates to the global x (^2), which in turn evaluates to the
local x (^2)
0
> type(x,`local`);
true
> z:=x^3: #z is assigned the local x cubed.
> assume(x>0); #A new local x is created
> z-x^3; # Two different locals are involved
3 3
x~ - x~
> y-x^2; #No problem here since y first evaluates to the global x
0
> type(x,`local`);
true
> convert(z-x^3,`global`);
0
> convert('plot'(z,x=0..1),`global`): %;
While the last two lines are interesting they are probably not what you
are looking for.
So here is an idea. We start as before:
> restart;
> y:=x^2:
> assume(x>0);
>
> y-x^2;
0
> z:='x'^3: #This assigns to z the global name x cubed.
> z-x^3;
0
> assume(x>0);
>
> z-x^3;
0
> y-x^2;
0
--
Preben Alsholm
Institut for matematik (Department of Mathematics)
DTU (Technical University of Denmark)
|
Previous by date: [MUG] Reading the Date from a txt File, Juan Navarro
Next by date: [MUG] Re: Hopfu.mws, Douglas B Meade
Previous thread: [MUG] declaration of procedure-type, Stefano Sofia
Next thread: [MUG] Hopfu.mws, C W
|
|
|