Lets say I have generated a 2D interpolating function using the code:
da = Flatten[Table[{t, tau, N@Sin[2 (t + 3 tau)] Exp[-2 t - tau]}, {t, 0, 2, 2/100}, {tau, 0, 5, 5/100}], 1]
f = Interpolation@da
and I want to integrate over one of the variables (I realise that in this case the integral can be done analytically, but I want to integrate an interpolating function from NDSolve which is too complicated to post here...). I can do this using something like:
tend = 2;
tauend = 5;
dtau = tauend/100;
taurange = Range[0, tauend,dtau];
int = Table[NIntegrate[f[t,tau],{t,0,tend}],{tau,taurange}];
intfunc = Interpolation@int;
but this seems somewhat inelegant, and also is pretty slow. Is there a better way to approach such a problem?
Integrate[f[x, y], x] /. x -> 1
? $\endgroup$