Re: Plotting with arbitary precision????

• To: mathgroup at smc.vnet.net
• Subject: [mg69616] Re: [mg69611] Plotting with arbitary precision????
• From: Bob Hanlon <hanlonr at cox.net>
• Date: Sun, 17 Sep 2006 22:45:48 -0400 (EDT)

```Needs["Calculus`Pade`"];

ratApp[x_] = Pade[Exp[x], {x, 0, 12, 12}] // Together;

relErr[x_?NumberQ, prec_:50] := Module[
{xp = SetPrecision[x, prec]},
(ratApp[xp] - Exp[xp])/Exp[xp]];

Plot[10^22*relErr[x], {x, -2.5, 2.5}, PlotRange -> All,
Frame -> True, Axes -> False, ImageSize -> 400];

Bob Hanlon

---- lcw1964 <leslie.wright at alumni.uwo.ca> wrote:
> Hi there,
>
> I am a long time user of another system who has been given the chance
> to try out Mathematica 5.2, and I must admit in some regards I like it
> better, though it handles floating point computation (which I am most
> interested in) in a way that takes some getting used to for me.
>
> I am using the MiniMaxApproximation routine in the Numerical Math package,
> and am interested in generating error curves from the results.  I have
> figured out how to invoke arbitrary precision in the MiniMaxApproximation
> routine with the WorkingPrecision option, so I am not confined to
> Machine Precision.
>
> However, the problem comes with the plotting. In a very good rational
> approximation for Exp[x] I have a maximum relative error of, say, about
> 10^-22. Let's call it RatApp. If I try to plot (RatApp-Exp[x])/Exp[x]
> on my interval of approximation, I don't get a nice smooth double
> ripple error curve like I should. I get a noisy mess confined to
> about +/- 10^-17. Which is precisely what I should get since Plot uses
> only machine precision (not the 30 or so digits of arbitary working
> precision specified) when generating plots. Since the numerator of my
> error function will differ only in the 22nd digit or so and beyond,
> the subtlety of the subtraction is lost.
>
> Online help for Plot doesn't seem to provide an arbitrary precision
> "override" to get over this issue. In the other system, one simply had
> to increase the Digits setting since everything is done in software
> floating point anyway--slower, but easier to use. Is there any way in
> Mathematica to plot a function that requires such high precision in
> interim calculations so that the plot is accurate?
>