PDA

View Full Version : Using Mathematica to solve 2nd order system of nonlinear ODE's


Mugged
May24-11, 08:20 PM
Hello, Ive started learning how to numerically integrate ODE's and I've run aground when i posed a 2nd order system for mathematica.

Here is my initial code:

NDSolve = [{x'[t] == -y[t] - x[t]^2, y'[t]==x[t], x[0]==1, y[0]==0.5},{x,y},{t,0,30}]

and i get an error message saying the equation becomes stiff at a certain time t. Now I have played around with different integrating methods, switching from stiff integrators to nonstiff ones...but i cant get this to work.

The code above you can probably just cut and paste into your mathematica and see for yourself.

If you know how to fix the problem, can you post the code of how you did it?

Thank you so much

JJacquelin
May26-11, 04:06 PM
The two ODE system can be analytically solved. The solution is obtained on a parametric form.

Mugged
May26-11, 05:00 PM
wow jjacquelin, i attempted to do this recently but couldn't figure it out. you're really good thanks. im wasnt familiar with the method you used; what class have you taken to learn this?

Also, what do you think if the system has a forcing term? for example:

x'[t] == -y[t] - x[t]^2 + sin[w*t]
y'[t]==x[t]

where sin[w*t] is the forcing term.

Im not asking you to solve this system, but do you think this can be solved analytically?
Thanks

JJacquelin
May27-11, 03:05 AM
what class have you taken to learn this?
Not all is learned in classes... :rofl:

x'[t] == -y[t] - x[t]^2 + sin[w*t]
y'[t]==x[t]
where sin[w*t] is the forcing term.
Im not asking you to solve this system, but do you think this can be solved analytically?
It is very doubtfull that it could be.
May be we could find approximative analytical solution in case of
x'[t] == -y[t] - x[t]^2 + a*sin[w*t]
with small coefficient a.