MathGroup Archive 2009

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

Search the Archive

specifying the integration interval using a function

  • To: mathgroup at smc.vnet.net
  • Subject: [mg95794] specifying the integration interval using a function
  • From: pfb <pf.buonsante at gmail.com>
  • Date: Tue, 27 Jan 2009 07:00:39 -0500 (EST)

Hi everybody,

 is it possible to specify the integration interval using a function?
My problem is as follows:

I have some function f[x] I want to integrate. Actually I want to
obtain a sort of running average, i.e. a
function F[x,D] given by the integral of f[x] over the interval [x-D, x
+D].
So far, it's easy. I can do that with the following function

F[x_,D_]:= NIntegrate[f[y],{y,x-D,x+D}]

However, the function f may have some (integrable) singularities in
the integration interval.
I know that NIntegrate finds it helpful if one tells it the locations
of the singularities.
So I thought: easy! I just need a function s[x,D] whose output is  {x-
D, s1,s2,s3, x+D}.,
where s1, s2, .. are the singularities of f in the interval.

I have such a function, but I'm not able to feed it into NIntegrate.
I have tried

F[x_,D_]:= NIntegrate[f[y],Flatten[{y,s[x,D]}]]

but mathematica complains that Flatten[{y,s[x,D]}] is not a correct
integration range specification, despite
its evaluation (in a separate cell) gives what I'd expect, i.e. {y,x-
D,s1,s2,s3,x+D}.

I also tried something like

r[y_,x_,D_]:=Flatten[{y,s[x,D]}]

which again gives {y,x-D,s1,s2,s3,x+D}, and then tried


F[x_,D_]:= NIntegrate[f[y],r[y,x,D]]

Mathematica complains also in this case: r[y,x,D] is not a correct
integration range specification.

In both case it seems that the function providing the integration
range is not evaluated.
Has this anything to do with delayed set (:=)?

Is there another way of dealing with the intermediate points in an
integration interval?

Thanks a lot

F



  • Prev by Date: Re: Permutations...
  • Next by Date: Re: Multiple Shooting Method
  • Previous by thread: Re: Has anyone tried to use MathLink to receive real-time market
  • Next by thread: Re: specifying the integration interval using a function