MathGroup Archive 2008

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

Search the Archive

Integrating Interpolation functions

  • To: mathgroup at
  • Subject: [mg88983] Integrating Interpolation functions
  • From: Hugh Goyder <h.g.d.goyder at>
  • Date: Fri, 23 May 2008 03:05:18 -0400 (EDT)

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



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: Problem with Legend and ListPlot
  • Next by Date: Is it possible to solve this differential equation?
  • Previous by thread: Problem with Legend and ListPlot
  • Next by thread: Re: Integrating Interpolation functions