Drexel dragonThe Math ForumDonate to the Math Forum



Search All of the Math Forum:

Views expressed in these public forums are not endorsed by Drexel University or The Math Forum.


Math Forum » Discussions » Software » comp.soft-sys.math.mathematica

Topic: NDSolve with NIntegrate where Integral is a function of x
Replies: 2   Last Post: Jul 20, 2012 3:59 AM

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View   Messages: [ Previous | Next ]
psycho_dad

Posts: 64
Registered: 4/28/07
Re: NDSolve with NIntegrate where Integral is a function of x
Posted: Jul 20, 2012 3:56 AM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

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




Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© Drexel University 1994-2014. All Rights Reserved.
The Math Forum is a research and educational enterprise of the Drexel University School of Education.