 |
|
List Archives > 
Maple User Group List Archive > 
Archive by date > 
This Month By Date > 
This Month By Topic
[MUG] Re: rootof and allvalues
| [MUG] Re: rootof and allvalues |
|
Author: Maple Group
Posted: 01/11/2000 15:07:58 GMT
|
>> From: Maple Group
-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-
Date: Fri, 27 Oct 2000 00:27:24 +0200
From: Theodore Kolokolnikov
To:
Subject: rootof and allvalues
| >> From: Don Hartig
| eqn1 := x^3-sin(x-1)=0;
| eqn2 := x^3-sin(x)=0;
| ...
| finds a numerical solution for the first
| but not second example.
I'm am not exactly sure why, but the first example has only one real
solution whereas the second example has at least 2 real solutions...
and the non-zero one cannot be expressed in terms of elementary
functions.
fsolve works in both cases. Use it instead if you need numerical
solutions.
Regards,
Theodore.
-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-
Date: Thu, 26 Oct 2000 15:49:39 -0700 (PDT)
From: Robert Israel
To:
Subject: rootof and allvalues
On Wed, 25 Oct 2000, Don Hartig wrote:
> # What is going on with "allvalues" in Maple 6?
> > soln := solve(eqn);
> > allvalues(soln);
> 3 2
> 1 + RootOf(sin(_Z) - _Z - 1 - 3 _Z - 3 _Z , -1.972700767)
> # OK, the documentation says that allvalues no longer returns numerical
> # values.
Well, it does sometimes. In this case, the relevant paragraph from the
help page ?allvalues is
--------------------------------
If solve cannot find symbolic representations of the roots, then fsolve is
used to search for numerical approximations. If numerical approximations
are found, RootOfs with a numerical selector are returned. If it cannot be
determined that fsolve has found all the roots then the global variable
_ValuesMayBeLost will be set to true.
------------------------------
In this case, _ValuesMayBeLost has indeed been set to true. So what
allvalues is saying is that one solution is 1+R, where R is the solution
of sin(_Z)-_Z^3-3*_Z^2-3*_Z-1=0 which is approximately -1.972700767
(corresponding to -.972700767 as a solution for your equation). In this
case it turns out that Maple is unnecessarily pessimistic, as this is
in fact the only real solution.
> # That means evalf will, right?
> #
> > evalf(soln);
> -.972700767
> # Right.
OK, so what's the problem?
> # The next example is an easier equation to solve. Maple 5 (and my teen
> # age son) can find the exact solution immediately.
Well, your teenage son might take a while to find the solutions
.9286263087 and -.9286263087.
> > eqn := x^3-sin(x)=0;
> > soln := solve(eqn);
> 3
> soln := RootOf(_Z - sin(_Z), label = _L1)
I don't know why solve puts in the "label" on this one but not the
previous one. The purpose of the label option is supposed to be "to
distinguish several unspecified roots of the same equation". Does Maple
know there are several real roots in this case but not in the previous
case? Probably not.
> > allvalues(soln);
> 3
> RootOf(_Z - sin(_Z), label = _L1)
I suspect that allvalues leaves alone any labelled RootOf.
> > evalf(soln);
> 3
> RootOf(_Z - sin(_Z), label = _L1)
Without the "label= _L1", evalf would return a solution, namely 0.
> # What's with this? I guess I do not understand the label business. The
> # help page is not very helpful.
I agree.
You might find my "allsolve" procedure useful. This computes numerically
all solutions of an equation in one variable in a real interval. It is
part of my Maple Advisor Database, http://www.math.ubc.ca/~advisor. For
example:
> allsolve(eqn, x=-infinity .. infinity);
[-.9286263090, -.8056634e-11, .9286263087]
Robert Israel
Department of Mathematics http://www.math.ubc.ca/~israel
University of British Columbia
Vancouver, BC, Canada V6T 1Z2
|
[View Complete Thread]
Previous by date: [MUG] Re: programming a table, Maple Group
Next by date: [MUG] Re: How to suppress warning?, Maple Group
Previous thread: [MUG] textplot(3d) busted - workaround?, Luis Goddyn
Next thread: [MUG] How to suppress warning?, Erik Leunissen
|
|
|