Classical mechanics & runge-kutta

Click For Summary
SUMMARY

The discussion focuses on solving a system of nonlinear differential equations related to a pendulum in a car using the Runge-Kutta method in C. The equations provided are: (M+m)x'' + mLθ''cos(θ) - mL(θ')²sin(θ) - F = 0 and mL²θ'' + mLx''cos(θ) + mgLsin(θ) = 0. The recommended approach is to convert these second-order equations into a system of first-order equations and apply the fourth-order Runge-Kutta (RK4) method to compute θ' and x', followed by integrating to find x(t) and θ(t). Numerical Recipes in C serves as a key resource for implementing this solution.

PREREQUISITES
  • Understanding of nonlinear differential equations
  • Familiarity with the Runge-Kutta method, specifically RK4
  • Proficiency in C programming
  • Knowledge of numerical integration techniques
NEXT STEPS
  • Study the conversion of second-order differential equations to first-order systems
  • Implement the Runge-Kutta method in C for solving differential equations
  • Explore the Numerical Recipes in C, particularly Chapter 16 on differential equations
  • Research numerical integration techniques for time-dependent systems
USEFUL FOR

Physics students, engineers, and programmers interested in numerical methods for solving differential equations, particularly those working with dynamic systems like pendulums and springs.

gulsen
Messages
215
Reaction score
0
We have a pendullum in a car, that is being pulled with:
a) constant F force
b) connectec to a spring, with force F = -kx

The physics part is done, and we have 2 differential equations (non-lineer), and we're supposed to write a C program to calculate theta(t) and x(t) from them. We should solve them with Rugne-Kutta. Here they are:

[tex](M+m)x'' + mL\theta''cos(\theta) - mL(\theta')^2 sin(\theta) - F = 0[/tex]
[tex]mL^2\theta'' + mLx''cos(\theta) + mgLsin(\theta) = 0[/tex]

The problem is, we've learned how to solve
[tex]f'' + p(t)f' + q(t)f + r(t) = 0[/tex]

but these equations have two independent variables. Now, what's the path to follow?

(note: yes, these two equations are confirmed to be enough to get values for x(t) and theta(t))
 
Physics news on Phys.org
Numerical recipies in C is online now:

http://www.library.cornell.edu/nr/bookcpdf.html

The general approach is to convert your system of second order differential equations into a system of linear first order differential equations.

See for example

http://www.library.cornell.edu/nr/bookcpdf/c16-0.pdf

and later chapters.
 
Last edited by a moderator:
I actually solved the simple pendulum this way in high school. What you need to do is use an RK4 to get [tex]\theta '[/tex] and [tex]x'[/tex] from the second order equations, and then use the same RK4 to do a simple time integral of that velocity ([tex]dx = vdt[/tex]). At least, that's how I would do it.
 

Similar threads

  • · Replies 9 ·
Replies
9
Views
4K
  • · Replies 11 ·
Replies
11
Views
2K
  • · Replies 1 ·
Replies
1
Views
3K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 3 ·
Replies
3
Views
1K
  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 9 ·
Replies
9
Views
2K
  • · Replies 3 ·
Replies
3
Views
2K
  • · Replies 33 ·
2
Replies
33
Views
5K
  • · Replies 4 ·
Replies
4
Views
1K