# Help integrating an interpolating function inside NDSolve

I am trying to solve an ODE having a term of integration of an interpolating function multiplied by the variable, as shown below. However, I get the following error:

Integrate::ilim: Invalid integration variable or limit(s) in {0.,0,4}.

Code:

data = Table[{x, x + Sin[2 Pi x]}, {x, 0, 4.82, 0.1}];
f = Interpolation[data];

NDSolve[{Integrate[f[x]*ϕ[x], {x, 0, 4}] + ϕ'[x] == 1, ϕ[0] == 0}, ϕ, {x, 0, 4}]


Thanks for your help in anticipation.

• My equation is more complicated, however, the basic question is how to deal with a term inside NDSOLVE in which exist terms containing an integration of an interpolating function multiplied by the variable. Jan 29 '17 at 17:37
• Use a different symbol for the "dummy" variable of integration Jan 29 '17 at 17:44

The issue is with the integral part Integrate[f[x]*ϕ[x], {x, 0, 4}]. To solve it as a stand alone definite integral, the output should be some constant, but in fact, x is the independent variable of the ode and f itself is a set of data. Which you want to integrate over the domain of the ode. This can be done like this,
data = Table[{y, y + Sin[2 Pi y]}, {y, 0, 4.82, 0.1}];

• @qahtah So the modified integral Integrate[f[y]*ϕ[x], {y, 0, x}] is what you want? Jan 30 '17 at 3:48