- #1
WraithM
- 32
- 0
I want to write a program in C that's going to solve 3 second order differential equations, and I have little to no experience in solving differential equations in C (however, I know C well enough). I'm having a bit of trouble.
First of all, I don't really know what method I'm going to use to solve these differential equations. I know how to do Euler's method, and Runge-Kutta and those things, but perhaps there's a math library out there for C that works magic with differential equations. I don't really care how these equations get solved. I just care that they get solved, but I'm more than willing to write some code myself to solve them. If anybody has any suggestions, that'd be extremely appreciated.
Also, I don't really know how I'm going to solve 3 equations at once. If I write my own differential equation solver, I'm going to substitute and make them first order, then solve again, but I don't really know how to deal with equations that depend on each other. :/
These are the equations:
[tex]\ddot{t} = \frac{-2M \dot{r} \dot{t}}{r(r-2M)}[/tex]
[tex]\ddot{\phi} = \frac{-2\dot{r}\dot{\phi}}{r}[/tex]
[tex]\ddot{r} = \frac{M\dot{r}^2}{r(r-2M)} - \frac{M(r-2M)}{r^3}\dot{t}^2 + (r - 2M) \dot{\phi}^2[/tex]
Dots mean differentiation with respect to [tex]\tau[/tex].
How do you solve 3 differential equations that all depend upon each other at once (numerically)?
Any help would be greatly appreciated.
First of all, I don't really know what method I'm going to use to solve these differential equations. I know how to do Euler's method, and Runge-Kutta and those things, but perhaps there's a math library out there for C that works magic with differential equations. I don't really care how these equations get solved. I just care that they get solved, but I'm more than willing to write some code myself to solve them. If anybody has any suggestions, that'd be extremely appreciated.
Also, I don't really know how I'm going to solve 3 equations at once. If I write my own differential equation solver, I'm going to substitute and make them first order, then solve again, but I don't really know how to deal with equations that depend on each other. :/
These are the equations:
[tex]\ddot{t} = \frac{-2M \dot{r} \dot{t}}{r(r-2M)}[/tex]
[tex]\ddot{\phi} = \frac{-2\dot{r}\dot{\phi}}{r}[/tex]
[tex]\ddot{r} = \frac{M\dot{r}^2}{r(r-2M)} - \frac{M(r-2M)}{r^3}\dot{t}^2 + (r - 2M) \dot{\phi}^2[/tex]
Dots mean differentiation with respect to [tex]\tau[/tex].
How do you solve 3 differential equations that all depend upon each other at once (numerically)?
Any help would be greatly appreciated.