MathGroup Archive 2001

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

Search the Archive

Re: NIntegrate embedded in a function

  • To: mathgroup at smc.vnet.net
  • Subject: [mg28141] Re: [mg28122] NIntegrate embedded in a function
  • From: BobHanlon at aol.com
  • Date: Sun, 1 Apr 2001 00:08:03 -0500 (EST)
  • Sender: owner-wri-mathgroup at wolfram.com

$Version

"4.1 for Power Macintosh (November 2, 2000)"

Looking at this function resulted in discovery of an unusual, undesirable, 
anomalous behavior of Plot in Mathematica (not to be confused with an 
insect).

foo[x_] := Evaluate[Integrate[Cos[y^2], {y, 0, x}]];

foo[x]

Sqrt[Pi/2]*FresnelC[Sqrt[2/Pi]*x]

Plot[foo[x], {x, 0, 10}];

However, a slight change in the plot range caused the y-axis to be 
mislabeled. 
Incorrect results were obtained with xmax = 11, 12, 13, 14

Plot[foo[x], {x, 0, 11}];

Oddly enough, this did not occur with a yet larger range (xmax = 15) or when 
using the option PlotRange -> All

Plot[foo[x], {x, 0, 15}];

Plot[foo[x], {x, 0, 12}, PlotRange -> All];

Also it may not occur with a different xmin. For example,

Plot[foo[x], {x, 6, 13}];


Bob Hanlon

In a message dated 2001/3/31 3:32:05 AM, may106 at psu.edu writes:

>I want to write a function along the lines of...
>
>foo[x_] := NIntegrate[Cos[y^2],{y,0,x}]
>
>so the function argument is the limit of the integral. Then make a
>surrogate for it...
>
>bar = FunctionInterpolation[foo[z],{z,0,10}]
>
>This works, and I get a bar[ ] function that matches foo[ ] over the
>domain, but first I get a whole bunch of errors along the lines of....
>
>NIntegrate::nlim : "y = z is not a valid limit of integration."
>
>Is there any way to avoid these errors other than turning them off? Some
>sort of evaluation order trickery?
>


  • Prev by Date: Re: Patterns and default arguments
  • Next by Date: RE: Re: Defining a flat, orderless, one-identical function?
  • Previous by thread: NIntegrate embedded in a function
  • Next by thread: Re: NIntegrate embedded in a function