MathGroup Archive 2012

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

Search the Archive

Re: NDSolve with NIntegrate where Integral is a function of x


Hi dude,
Your solution had a few problems I'm afraid. For example, in NDSolve you should always write y'[x]==... and not y'(x)=..  (note the == and the [] instead of = and () ). Also, the same applies for the initial condition y[x]=..

The following seems to work (with a few warnings).

f[x_]:=x^2
g[x_?NumberQ,t_?NumberQ]:=Sin[x*t]
sol=NDSolve[{y'[x]==f[x]*NIntegrate[g[x,t],{t,0,1}],y[0]==0.04},y[x],{x,0,10}][[1]];
Plot[y[x]/.sol,{x,0,10}]

Cheers



  • Prev by Date: Options to know shape of functions
  • Next by Date: Finding a sum
  • Previous by thread: Re: NDSolve with NIntegrate where Integral is a function of x
  • Next by thread: Re: NDSolve with NIntegrate where Integral is a function of x