I'm fairly new to Mathematica. I'm trying to test my C++ implementation of a fourth order Runge Kutta method for Newton's equations of motion. I want to test my integrator when the applied force is dependant on the position. I tried to implement Newton's equations of motion in Mathematica as below:
iMass = 4
iVel0 = {1.0, 1.0, 1.0}
iTime = 1.0
iMagn = Dot[iPos, iPos]^0.5
iForce = ((12.3/iMagn) - 1.2)*Normalize[iPos]
(* Applied force is 12.3 / distance from 0 0 1.2 minus 1.2 and pointing towards 0,0,0 *)
iAccel = iForce/iMass
iVel = iVel0 + Integrate[iAccel, time]
iPos = {0.0, 10000, 0.0} + Integrate[iVel, time]}]
Mathematica ran for a couple of hours until I aborted the calculation.
How can I get Mathematica to integrate Newton's equations of motion when the applied force is a function of position?