Using Mathematica to solve 2nd order system of nonlinear ODE's

Click For Summary
The discussion centers on using Mathematica to numerically integrate a second-order system of nonlinear ordinary differential equations (ODEs). The initial code provided encounters stiffness issues, prompting the user to experiment with different integration methods without success. Participants mention that the system can be solved analytically in a parametric form, and there is curiosity about the potential for analytical solutions when a forcing term, such as sin[w*t], is introduced. It is suggested that while an exact analytical solution may be unlikely with the forcing term, an approximate solution could be possible if the coefficient is small. The conversation highlights the challenges of solving nonlinear ODEs and the nuances of numerical methods in Mathematica.
Mugged
Messages
103
Reaction score
0
Hello, I've 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 can't 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
 
Physics news on Phys.org
The two ODE system can be analytically solved. The solution is obtained on a parametric form.
 

Attachments

  • Analytic solution.JPG
    Analytic solution.JPG
    30.5 KB · Views: 635
wow jjacquelin, i attempted to do this recently but couldn't figure it out. you're really good thanks. I am 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
 
what class have you taken to learn this?
Not all is learned in classes... :smile:

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.
 

Similar threads

  • · Replies 2 ·
Replies
2
Views
4K
  • · Replies 2 ·
Replies
2
Views
3K
  • · Replies 3 ·
Replies
3
Views
3K
  • · Replies 12 ·
Replies
12
Views
5K
  • · Replies 9 ·
Replies
9
Views
3K
  • · Replies 8 ·
Replies
8
Views
2K
  • · Replies 6 ·
Replies
6
Views
2K
  • · Replies 14 ·
Replies
14
Views
3K
  • · Replies 2 ·
Replies
2
Views
5K
  • · Replies 1 ·
Replies
1
Views
2K