 |
|
List Archives > 
Maple User Group List Archive > 
Archive by date > 
This Month By Date > 
This Month By Topic
[MUG] why the plot is not consistent with evaluated value?
| [MUG] why the plot is not consistent with evaluated value? |
|
Author: Xiaoyan Li
Posted: Fri, 22 Nov 2002 04:21:58 -0500
|
>> From: Xiaoyan Li "xili"
Hello,
I am using maple to plot an expression using the following file. The
strange thing is, some of the plotted value don't comply with the
evaluated value.
In the bottom of the file, I have purposely evaluated expression value at
some particular points, you can see the discreprency directly.
Could some one help me figure out why this is happening?
--------------------------------------------------------------
g := Pi*((2*R-x)^2-R^2);
Fx := exp(-m*g*(1-exp(-n*2)));
fx := diff(Fx,x);
Ex := int(x*fx,x=0..R);
tmpEx := subs(m=1/Pi,n=0.2,Ex);
plot(tmpEx,R=0..40);
v_5_tmp:= eval(tmpEx,R=5);
v_5 := evalf(v_5_tmp,9);
v_20 := eval(tmpEx,R=20);
v_30 := eval(tmpEx,R=30);
v_40 := eval(tmpEx,R=40);
------------------------------------------------------------
Thanks,
Xiaoyan
==============================
|
| [MUG] Re: why the plot is not consistent with evaluated value? |
|
Author: Maple User Group
Posted: Wed, 27 Nov 2002 10:34:48 -0500
|
>> From: Maple User Group "maple_gr"
-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-
Date: Fri, 22 Nov 2002 00:37:28 -0400
From: C W "sylvester7"
To: "maple-list"
Subject: why the plot is not consistent with evaluated value?
You might observe a difference with the following code :
g := Pi*((2*R-x)^2-R^2);
Fx := exp(-m*g*(1-exp(-n*2)));
fx := diff(Fx,x);
Ex := (int)(x*fx,x=0..R);
Ex2:=collect(expand(Ex),exp,factor);
plot((evalf@subs)(m=1/Pi,n=0.2,[Ex,Ex2]),R=0..40,view=[DEFAULT,0..40]);
With my version of Maple, that is Maple V R4, Ex and Ex2 do not evaluate to the
same.
Chris
-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-
Date: Fri, 22 Nov 2002 00:41:22 -0400
From: C W "sylvester7"
To: "maple-list"
Subject: why the plot is not consistent with evaluated value?
Hi !
Also try changing Digits and You will see that Ex evaluates differently. There
is a round off error someplace here...
Chris
-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-
Date: Sat, 23 Nov 2002 10:54:45 -0400
From: Vladimir Bondarenko "vvb"
To: "maple-list"
Subject: why the plot is not consistent with evaluated value?
You have just come across a treacherous loss of accuracy (10 digits
by default). Add Digits := 15: before your plot() and enjoy ;-)
Best wishes,
Vladimir Bondarenko
Mathematical and Production Director
Symbolic Testing Group
Email: "vvb"
Web : http://www.CAS-testing.org/ (under development, 95% ready)
http://maple.bug-list.org/ (under development, 20% ready)
Voice: (380)-652-447325 Mon-Fri 6 a.m. - 3 p.m. GMT
Mail : 76 Zalesskaya Str, Simferopol, Crimea, Ukraine
-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-
From: "Dr Francis J. Wright" "F.J.Wright"
To: "xili"
Subject: why the plot is not consistent with evaluated value?
Date: Tue, 26 Nov 2002 17:10:43 -0000
It appears to be a problem of numerical error caused by the cancellation of
large terms in tmpEx. By default, plot uses hardware floating point (for
speed), which is not quite sufficiently precise to handle the numerical
cancellation in this particular problem. One easy way to avoid this is to
set a high enough value for Digits; on my system Digits := 15 was enough to
give the almost-straight-line plot that you (presumably) expect. Setting
Digits to a value larger than evalhf(Digits) forces plot to use software
floating point, and on my system evalhf(Digits) is 14. But for safety I
suggest setting Digits to 20 for this problem.
Francis
|
Previous by date: [MUG] isqrt command, Adalberto Ayjara Dornelles Filho
Next by date: [MUG] Re: Limit Superior & Limit Inferior, Barsuhn
Previous thread: [MUG] Numerical error, Madham53
Next thread: [MUG] Limit Superior & Limit Inferior, Classen, Manfred
|
|
|