Mathematica 9 is now available
Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2000
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*November
*December
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2000

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

Search the Archive

Strange behaviour

  • To: mathgroup at smc.vnet.net
  • Subject: [mg21671] Strange behaviour
  • From: "Simons, F.H." <F.H.Simons at tue.nl>
  • Date: Sat, 22 Jan 2000 02:52:24 -0500 (EST)
  • Sender: owner-wri-mathgroup at wolfram.com

I like working with Mathematica very much. But occasionally strange things
happen that I do not understand. The questions that I will raise have
nothing do do with the somewhat complicated function I define below. The
arguments of that function have to be positive. I am working with
Mathematica 4.0 under Windows98.

t[x_, y_, c_] := u[Round[10^10 x]/10^10, Round[10^10 y]/10^10, c]

u[x_, y_, c_] := 
  NIntegrate[ 
    Cos[Pi x Min[Abs[c], 1] - u]/(Pi x Min[Abs[c], 1] - 
            u)*(-CosIntegral[Pi*y - (\[Pi] x Min[Abs[c], 1] - u)*y/(c*x)] + 
          CosIntegral[Pi*y + (\[Pi] x Min[Abs[c], 1] - u)*y/(c*x)]), {u, 0, 
      1/2 Pi x Min[Abs[c], 1]}]

The function evaluates without any problem in a point close to the origin:

t[ 1.*10^-8, 1.*10^-8, 1/2]

Now we plot the graph. The extra command Print[{x,y}] in the argument of
Plot3D shows the points where the function is evaluated.

Off[General::stop];
Plot3D[ Print[{x, y}]; t[ x, y, 1/2], {x, 1. 10^-8, 1}, {y, 1. 10^-8, 1},
PlotPoints -> 2]

Question 1. We have seen that the function evaluates without any problem
near the origin. Then why all these complaints in evaluating under Plot3D?

I thought that Plot3D takes some values for x and y, substitutes these
values in the unevaluated first argument, evaluates the result and then goes
to the next point.

Question 2. Why does Plot3D evaluate the function four times in the lower
left point?

Now we take exactly the same function, but in the function body the variable
c replaced with 1/2.

t[x_, y_] := u[Round[10^10 x]/10^10, Round[10^10 y]/10^10]

u[x_, y_] := 
  NIntegrate[ 
    Cos[\[Pi] x 1/2 - u]/(\[Pi] x 1/2 - 
            u)*(-CosIntegral[Pi*y - (\[Pi] x 1/2 - u)*y/(1/2*x)] + 
          CosIntegral[Pi*y + (\[Pi] x 1/2 - u)*y/(1/2*x)]), {u, 0, 
      1/2 \[Pi] x 1/2}]

Plot3D[ Print[{x, y}]; t[ x, y], {x, 10^-8, 1}, {y, 10^-8, 1},   PlotPoints
-> 2]

Question 3. Why do the problems not exist any more?


  • Prev by Date: Re: a question about complex variable
  • Next by Date: Re: Problem with evaluation of delayed rules
  • Previous by thread: Strange behaviour
  • Next by thread: Corrupted notebook