Maple User Group List Archive
Archive by date
This Month By Date
This Month By Topic
[MUG] Re: Curiosity
|[MUG] Re: Curiosity
Author: Maple Group
Posted: 26/10/2000 19:19:25 GDT
Problem is in the rounding that occurs in the top line due to x^2+25 term,
which converts the top line to a step function as seen (Maple Vr5.1) in:
The divisor then converts this to a saw tooth.
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.
Date: Mon, 23 Oct 2000 16:25:23 -0700 (PDT)
From: Robert Israel
A closer inspection reveals that the "sines" are actually sawtooths. The
explanation is this. To simplify matters slightly, let's look at
the slightly simpler (sqrt(x^2+1)-1)/x^2.
Suppose x is positive but small. Maple is computing sqrt(x^2 + 1) (using
evalhf) to a certain accuracy. Since the derivative of this function is
very close to 0 when x is small, the result will be constant over
substantial intervals: if epsilon is the smallest positive number such
that 1+epsilon has a representation different from 1, it appears that
sqrt(x^2+1) will be computed as 1 for x < sqrt(3 epsilon/2), then
1+j*epsilon for sqrt((2 j - 1/2) epsilon) < x < sqrt((2 j + 3/2) epsilon)
for each small positive integer j. Thus (sqrt(x^2+1)-1)/x^2 will be
computed as j*epsilon/x^2 in this interval. The first "tooth" in the plot
of (sqrt(x^2+1)-1)/x^2, corresponding to j=1, will go from
[sqrt(3/2 epsilon), 2/3] to [sqrt(7/2 epsilon), 2/7], the second from
[sqrt(7/2 epsilon), 4/7] to [sqrt(11/2 epsilon), 4/11], etc.
You can get epsilon from
On my machine it is .222044604925031308e-15.
If the use of evalhf is prevented, e.g. by using (sqrt(Re(x^2)+1)-1)/x^2,
the pattern is a bit more complicated. I think this is because there
are two separate rounding steps in this case (while under evalhf the
numeric processor may store intermediate results at higher precision than
what it uses to report the output).
Department of Mathematics http://www.math.ubc.ca/~israel
University of British Columbia
Vancouver, BC, Canada V6T 1Z2
Date: Tue, 24 Oct 2000 09:34:54 +0200
From: Heike Koch-Beuttenmueller
> Treating TRUE as 1 and FALSE as 0, was unexpected.
Why true is plotted as 1 and false as 0 I don't know, but I would be
interested to know it.
You have written an inequality. Multiplying it, is possible in Maple.
Both sides are multiplied with 3. But adding 2 to both sides is not
2 (x - 2) (x + 1) < 2
Error, (in simpl/relopsum) invalid terms in sum
The normal accuracy Digits:=10 is not enough for plotting in this
domain. So you get a lot of numerical errors .
Try Digits:=30; and set the region for y=0..0.2 for example, then the
numerical calculations are more stable. Have a look at the numerical
behaviour when you calculate x^2 +25 for small x ...
Mit freundlichen Gruessen
[View Complete Thread]
Previous by date: [MUG] Re: Bug in contourplot in Maple6, Maple Group
Next by date: [MUG] Re: table -> plot3d in Maple V R 4, Maple Group
Previous thread: [MUG] rootof and allvalues, Don Hartig
Next thread: [MUG] table -> plot3d in Maple V R 4, Franck Courchamp