Monday, July 27, 2009

How can i solve a differential equation using computer programming or using c++/python?

differential equations like solving for simple harmonic oscillators with damped forces using c++/python or any other computer programming language

How can i solve a differential equation using computer programming or using c++/python?
When you are interested in one specific differential equation and you know the general solution of it, then you can write a computer program to substitute actual values for the parameters of the differential equation to obtain a numerical answer. Or you can investigate the dependence of the solution on the parameters.





For example: dx(t)/dt = a


You know that the general solution is x(t) = at.


Then a = -3 =%26gt; computer program =%26gt; x(t) = -3t





When you don't know the solution of a differential equation, you should use a mathematical program like Mathematica or MATLAB. Such programs can give you general solutions to differential equations.





For example: dx(t)/dt = a =%26gt; Mathematica =%26gt; x(t) = at





You can write such a program yourself for a class of differential equations, but not for all differential equations. At least, I wouldn't like to.
Reply:There is no commercial software for your problem: however, if you know C++ programing, you can study numerical methods as; Runge-Kutta, Eulers method, etc and make a program for your specific problem, But the output is not an equation but the trajectory of the dependent variable.


No comments:

Post a Comment