 |
|
List Archives > 
Maple User Group List Archive > 
Archive by date > 
This Month By Date > 
This Month By Topic
[MUG] Evaluation problem
| [MUG] Evaluation problem |
|
Author: Colin Campbell - IST
Posted: Wed, 11 Dec 2002 15:59:37 -0500
|
>> From: Colin Campbell - IST "campbell"
Dear MUG and Maple Support:
This problem actually arose recently in a Calculus assignment on
exploring limits with the help of Maple.
1. Here is the function:
f := (x) -> ( x - 8 ) /
( x^(1/3) - 2 );
2. We evaluate the function at x=8, (Maple 8, Win XP)
f(8);
but instead of getting: "Error, numeric exception: division by zero"
we get: "0" as the result.
3. Some insight may perhaps be found by evaluating:
1 / ( 8^(1/3) - 2 );
which comes back unchanged. It has to be "simplify"ed to get the error.
4. Question: Should Maple be more aggressive in evaluating denominators
before returning a zero result based on the numerator?
It seems uncharacteristic of Maple to take short-cuts.
5. Comment: Naturally this sort of behaviour is confusing to students
until this feature of Maple is explained to them. Is it
documented in the manuals or help so that students may be
directed to an explanation whenever this arises?
Colin Campbell - IST - University of Waterloo - ON - Canada
-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-
From: Colin Campbell - IST "campbell"
To: "maple-list"
cc: "Support (WM Support)" "Support"
Dear Support:
Thank you for your reply. Correct me if I'm wrong but
it seems the most reasonable way Maple "could" evaluate:
f := (x) -> ( x - 8 ) /
( x^(1/3) - 2 );
f(8);
would be as:
0
-----------
8^(1/3) - 2
so it doesn't make assumptions about the denominator being non-zero.
And then the user could decide to:
simplify(%); # <- accepting the assumptions simplify makes
and get the error they possibly seek: "division by zero".
Colin
On Tue, 10 Dec 2002, Support (WM Support) wrote:
> Dear Colin Campbell,
>
> Perhaps the following two FAQs on our Support website may be of interest to you:
>
> http://www.maplesoft.com/support/Faqs/MapleV/Math/7.shtml
> http://www.maplesoft.com/support/Faqs/Maple7/Math/1.shtml
>
> When simplifying (8)^(1/3), Maple is looking for a complex number, z, such that
> z^3=8. Basically, Maple is doing the following calculation:
>
> > solve(z^3=8,z);
>
> 1/2 1/2
> 2, -1 + 3 I, -1 - 3 I
>
> Notice that 8^(1/3) has three possible solutions (one real, two complex).
> Therefore, Maple cannot make the generalization that 8^(1/3) - 2 is equivalent
> to 0.
>
> Usually in situations where one defines a function with fractional powers, we
> would suggest:
>
> 1. using surd(x,n) (Non-principal root function) instead of x^(1/n):
>
> > f := (x) -> ( x - 8 ) / ( surd(x,3) - 2 );
>
> x - 8
> f := x -> --------------
> surd(x, 3) - 2
>
> > f(8);
> Error, (in f) numeric exception: division by zero
>
> 2. using RealDomain:
>
> > with(RealDomain):
> > f := (x) -> ( x - 8 ) / ( x^(1/3) - 2 );
>
> x - 8
> f := x -> ---------------------------
> RealDomain:-`^`(x, 1/3) - 2
>
> > f(8);
> Error, (in f) numeric exception: division by zero
>
> We hope this information helps.
>
> Sincerely,
> Technical Support Department
> Waterloo Maple Inc.
>
> Maple's new Distance Education Solution
> Introducing MapleNet
> http://www.maplesoft.com/maplenet
>
|
| [MUG] Re: Evaluation problem |
|
Author: Maple User Group
Posted: Fri, 13 Dec 2002 16:54:24 -0500
|
>> From: Maple User Group "maple_gr"
-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-
Date: Thu, 12 Dec 2002 15:54:35 -0500
From: Bill Bauldry "BauldryWC"
Subject: Evaluation problem
To: "maple-list"
>>> From: Colin Campbell - IST "campbell"
> This problem actually arose recently in a Calculus assignment on
> exploring limits with the help of Maple.
>
> 1. Here is the function:
>
> f := (x) -> ( x - 8 ) /
> ( x^(1/3) - 2 );
>
> 2. We evaluate the function at x=8, (Maple 8, Win XP)
>
> f(8);
>
> but instead of getting: "Error, numeric exception: division by zero"
> we get: "0" as the result.
[snip]
Colin,
The problem is that Maple works in the Complex domain while your students
are working in the Real domain. In C, the "first" cube root of 8 isn't
necessarily 2 (branch choice matters), so the 0 can be correct.
If you have your students enter:
> with(RealDomain):
at the beginning of a session, they'll get what they expect.
Happy Holidays,
Bill
______________________________________
Wm C Bauldry, PhD
Professor and Chairperson
Department of Mathematical Sciences
Appalachian State University
121 Bodenheimer Dr
Boone, NC 28608-2092
_____________________
phone: (828) 262-3050
fax: (828) 265-8617
"mailto:BauldryWC"
http://www.mathsci.appstate.edu/~wmcb/
______________________________________
-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-
Date: Fri, 13 Dec 2002 08:38:50 +1000
To: "maple-list"
From: "W.Whiten" (Bill Whiten)
Subject: Evaluation problem
Note this expression can be simplified to x^(2/3)+2*x^(1/3)+4 which gives
the value 12 at x=8 in real arithmetic, and 0 for the complex roots of 8 :
> eq1:=( x - 8 ) /( x^(1/3) - 2 );
x - 8
eq1 := ----------
(1/3)
x - 2
> factor(y^3-8);
2
(y - 2) (y + 2 y + 4)
> eq2:=x^(2/3)+2*x^(1/3)+4;
(2/3) (1/3)
eq2 := x + 2 x + 4
> testeq(eq1,eq2);
true
> s1:=solve(y^3=8);
s1 := 2, -1 + I sqrt(3), -1 - I sqrt(3)
> eq3:=y^2+2*y+4;
2
eq3 := y + 2 y + 4
> subs(y=s1[1],eq3);
12
> simplify(subs(y=s1[2],eq3));
0
> simplify(subs(y=s1[3],eq3));
0
Regards,
-----------
Bill Whiten, "W.Whiten"
Julius Kruttschnitt Mineral Research Centre,
The University Of Queensland, Tel: int +61 7 3365 5888
Isles Rd, Indooroopilly, Fax: int +61 7 3365 5999
Brisbane Qld 4068, AUSTRALIA.
-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-
From: "Dr Francis J. Wright" "F.J.Wright"
To: "campbell"
Subject: Evaluation problem
Date: Fri, 13 Dec 2002 16:00:13 -0000
I think the question is really this: "Should Maple simplify 0/X to 0?"
There is probably no right answer to this. Currently, Maple does simplify
0/X to 0, which I guess is what users want in the majority of cases.
However, when further information shows that X is, in fact, zero, one
realizes that the simplification was not justified, by which time it is too
late to go back and fix things because the X has gone.
Here is another way to avoid the problem, which should make sense to
students who are studying limits:
> F := X -> simplify(limit(( x - 8 ) / ( x^(1/3) - 2 ), x=X));
> F(8);
12
Francis
-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-
Date: Thu, 12 Dec 2002 14:37:06 -0400
From: C W "sylvester7"
To: "maple-list"
Subject: Evaluation problem
No evaluation problem :
plot(`@`(proc (x3) options operator, arrow; x3^2+2*x3+4 end,proc (x) options
operator, arrow; surd(x,3) end),-10..10);
Chris
|
Previous by date: [MUG] Two bugs in evalapply(), Helmut Kahovec
Next by date: [MUG] Re: Import RTF files into maple., Carl Devore
Previous thread: [MUG] Forcing Maple Output with Simplifying, Fraser Murray
Next thread: [MUG] Import RTF files into maple., Aldrovando Azeredo Araujo
|
|
|