Re: Integrating Interpolation functions

• To: mathgroup at smc.vnet.net
• Subject: [mg89021] Re: Integrating Interpolation functions
• From: "David Park" <djmpark at comcast.net>
• Date: Sat, 24 May 2008 03:51:22 -0400 (EDT)
• References: <g15qk7\$p9t\$1@smc.vnet.net>

```Hugh,

data1 = Table[{x, t, Exp[(-x)*t]}, {x, 0, 1, 0.1}, {t, 0, 1, 0.1}];
data2 = Table[{x, t, Sin[x*t]}, {x, 0, 1, 0.1}, {t, 0, 1, 0.1}];

f1 = Interpolation[Flatten[data1, 1]]
f2 = Interpolation[Flatten[data2, 1]]
f3 = FunctionInterpolation[f1[x, t] f2[x, t], {x, 0, 1}, {t, 0, 1}]

g1 = Head@Integrate[f1[x, t], {x, 0, 1}]
Plot[g1[s], {s, 0, 1}]

g3 = Head@Integrate[f3[x, t], {x, 0, 1}]
Plot[g3[s], {s, 0, 1}]

--
David Park
djmpark at comcast.net
http://home.comcast.net/~djmpark/

"Hugh Goyder" <h.g.d.goyder at cranfield.ac.uk> wrote in message
news:g15qk7\$p9t\$1 at smc.vnet.net...
> Below I given an illustrative example where I have a two-dimensional
> interpolation function, f1[x,t], and I integrate over x and obtain a
> one-dimensional expression g1 which is an interpolation function
> depending on t.  The interpolation function g1 has a built-in argument
> of t ie it ends in [t].  I would prefer it to be a pure function so
> that I could use any variable instead of t, like the original
> interpolation function, f1.  I give a work-around which defines a new
> function independent of t. However, I feel that there should be
>
> 1. A better way of getting the interpolation function from Integrate
> without the built in t
>
> 2.A method of using NIntegrate rather than Integrate which should be
> able to use the information that the function is interpolated
>
> 3. A method that would work on a product of interpolating functions
>
> Thanks
>
> Hugh
>
>
> data1 = Table[{x, t, Exp[(-x)*t]}, {x, 0, 1, 0.1}, {t, 0, 1, 0.1}];
>
> data2 = Table[{x, t, Sin[x*t]}, {x, 0, 1, 0.1}, {t, 0, 1, 0.1}];
>
> f1 = Interpolation[Flatten[data1, 1]]
>
> f2 = Interpolation[Flatten[data2, 1]]
>
> g1 = Integrate[f1[x, t], {x, 0, 1}]
>
> g2[tt_] := Evaluate[g1 /. t -> tt]
>
> Plot[g2[t], {t, 0, 1}]
>
> g3 = Integrate[f1[x, t]*f2[x, t], {x, 0, 1}]
>

```

• Prev by Date: Re: LeastSquares using LinearProgramming?
• Next by Date: Re: Re: RenderBadPicture error while running Mathematica 6 on Linux
• Previous by thread: Integrating Interpolation functions
• Next by thread: Re: Integrating Interpolation functions