Re: specifying the integration interval using a function

• To: mathgroup at smc.vnet.net
• Subject: [mg95833] Re: specifying the integration interval using a function
• From: Jens-Peer Kuska <kuska at informatik.uni-leipzig.de>
• Date: Wed, 28 Jan 2009 06:31:53 -0500 (EST)
• Organization: Uni Leipzig
• References: <glmt0r\$mqd\$1@smc.vnet.net>

```Hi,

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

does not work ?

Regards
Jens

pfb wrote:
> 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: accessing data in a large file
• Next by Date: Re: specifying the integration interval using a function
• Previous by thread: Re: specifying the integration interval using a function
• Next by thread: Re: specifying the integration interval using a function