MathGroup Archive 2003

[Date Index] [Thread Index] [Author Index]

Search the Archive

RE: SetPrecision & Plot bug?

  • To: mathgroup at smc.vnet.net
  • Subject: [mg39931] RE: [mg39909] SetPrecision & Plot bug?
  • From: "David Park" <djmp at earthlink.net>
  • Date: Wed, 12 Mar 2003 02:28:58 -0500 (EST)
  • Sender: owner-wri-mathgroup at wolfram.com

Enrique,

Ted Ersek has a package, PrecisionPlot, that is available from MathSource.
When that package is loaded then..

hw[rom_][ro_] = (1/7245)*
    (2*(Sqrt[(-ro^2)*(ro^2 + 4830*(Sqrt[5832225 - ro^2] - 2415))] -
      Sqrt[((rom^2*(112678587000*Sqrt[5832225 - rom^2] -
             (17496675 - 4*rom^2)^2) - 164291718016518750*
            (Sqrt[5832225 - rom^2] - 2415))*ro^4 +
         2415*(56339293500*Sqrt[5832225 - ro^2]*Sqrt[5832225 - rom^2]*
            (4*rom^2 - 5832225) - 34993350*Sqrt[5832225 - rom^2]*
            (4*rom^4 - 1944075*rom^2 + 11338282816875) +
           2415*(4*rom^2 + 5832225)*(8*rom^4 - 64154475*rom^2 +
             68029696901250) - 2*Sqrt[5832225 - ro^2]*
            (rom^2*(17496675 - 4*rom^2)^2 - 396764499009892781250))*
          ro^2 + 14084823375*(4*(4*Sqrt[5832225 - ro^2] - 12075)*
            rom^6 - 7245*(8*Sqrt[5832225 - rom^2]*Sqrt[5832225 -
                ro^2] + 9660*Sqrt[5832225 - ro^2] -
             9660*Sqrt[5832225 - rom^2] - 64154475)*rom^4 +
           140848233750*(Sqrt[5832225 - ro^2] + 2415)*
            (Sqrt[5832225 - rom^2] - 2898)*rom^2 - 328583436033037500*
            (Sqrt[5832225 - ro^2] + 2415)*(Sqrt[5832225 - rom^2] -
             2415)))/(rom^2*(17496675 - 4*rom^2)^2)]));

PrecisionPlot[hw[1][ro], {ro, 0, 1}];

PrecisionPlot[hw[50][ro], {ro, 0, 1}];

produce nice plots. They are of such a different scale that it makes no
sense to display them on the same plot.

Ted has also allowed me to make PrecisionPlot available within the
DrawGraphics package at my web site.

David Park
djmp at earthlink.net
http://home.earthlink.net/~djmp/

From: Enrique Zeleny [mailto:ezeleny at fismat1.fcfm.buap.mx]
To: mathgroup at smc.vnet.net


Consider this expression

In[1]:= HW =
 (1/7245)*(2*(Sqrt[(-ro^2)*(ro^2 + 4830*(Sqrt[5832225 - ro^2] - 2415))] -
     Sqrt[(1/(rom^2*(17496675 - 4*rom^2)^2))*
       ((rom^2*(112678587000*Sqrt[5832225 - rom^2] - (17496675 - 4*rom^2)^
             2) - 164291718016518750*(Sqrt[5832225 - rom^2] - 2415))*ro^4
+
        2415*(56339293500*Sqrt[5832225 - ro^2]*Sqrt[5832225 - rom^2]*
           (4*rom^2 - 5832225) - 34993350*Sqrt[5832225 - rom^2]*
           (4*rom^4 - 1944075*rom^2 + 11338282816875) +
          2415*(4*rom^2 + 5832225)*(8*rom^4 - 64154475*rom^2 +
            68029696901250) - 2*Sqrt[5832225 - ro^2]*
           (rom^2*(17496675 - 4*rom^2)^2 - 396764499009892781250))*ro^2 +
        14084823375*(4*(4*Sqrt[5832225 - ro^2] - 12075)*rom^6 -
          7245*(8*Sqrt[5832225 - rom^2]*Sqrt[5832225 - ro^2] +
            9660*Sqrt[5832225 - ro^2] - 9660*Sqrt[5832225 - rom^2] -
            64154475)*rom^4 + 140848233750*(Sqrt[5832225 - ro^2] + 2415)*
           (Sqrt[5832225 - rom^2] - 2898)*rom^2 - 328583436033037500*
           (Sqrt[5832225 - ro^2] + 2415)*(Sqrt[5832225 - rom^2] -
2415)))]));


This should work

In[2]:= Plot[Evaluate[SetPrecision[HW /. rom -> 1, 50]], {ro, 0, 1},
PlotPoints -> 5, Compiled -> False]


but is awful, how Plot chooses the points? see this

In[3]:= %[[1]]

(Output is not shown because it's big)

this is the problem

In[4]:= FullForm[SetPrecision[HW /. rom -> 1, 50]]

(Output is not shown)

SetPrecision converts Power[expr,1/2] to Power[expr,0.5'50], but power is
an algebraic operation!, documentation say :

SetPrecision[expr, n] yields a version of expr in which all numbers have
been set to have a precision of n digits.

SetPrecision[expr, n] does not modify expr itself.

(???)

this works well

In[5]:= ListPlot[Table[Evaluate[SetPrecision[HW /. rom -> 1, 24],
{ro, 0, 1, 0.01`24}]], PlotJoined -> True];

This should work?

In[6]:= Plot[Evaluate[N[HW /. rom -> 1, 50]], {ro, 0, 1}, Compiled ->
False]


Enrique Zeleny
UAP, Mexico





  • Prev by Date: Re: Re: presentation layout
  • Next by Date: Re: Handling expressions. Could any one find a more direct way?
  • Previous by thread: SetPrecision & Plot bug?
  • Next by thread: This should evaluate to zero