Mathematica code help?
I need to write a few lines of code to solve this problem, but i have no idea where to start. Any input would be nice.
A high speed bullet experiences a quadratic drag force which is a force proportional to the speed squared as in |Fdrag| = -cv2. The direction of this force is opposite the particles velocity. For an object moving in the xy-plane, the drag force expressed as a vector is given as,
Fdrag= -c*Sqrt[x'(t)^2+y'(t)^2]*[x'(t)i+y'(t)j]
Incorporating this force as well as the weight force in to Newton’s 2nd Law give us the ‘equations of motion’ for a particle of mass m,
mx''(t)= -c*Sqrt[x'(t)+y'(t)]*x'(t)
my''(t)= -mg - c*Sqrt[x'(t)+y'(t)]*y'(t)
Question: A bullet with mass 0.05 kg is fired at an angle 30 degrees at speed 100 m/s from an elevation 20 m. Numerically solve Newton’s 2nd Law for the x and y coordinates and on a single graph show the trajectory for a family of curves for c values {0, 0.0005, 0.0010, 0.0015, 0.002} in SI units for 0 < t < 6 s.
Comments
Take a look here
http://reference.wolfram.com/mathematica/ref/NDSol...
and in particular on that page click on Applications and then Lotka-Volterra Equations which demonstrates solving a system of differential equations.
Mathematica is FANATIC about exactly correct capitalization and correct use of () versus [] versus {} and correct use of = versus := versus == and there is even an === and ' versus ` versus " versus '' (that is a double quote versus two apostrophes but it is very difficult to see the difference here with the fonts used here) and those are all completely different. Make any tiny error in any one of those and you will get incorrect results or error messages you may not understand what to do with or even nothing at all. I recommend using Zoom in the menu to magnify all the code in your notebook until it is nice and big and you can recognize any tiny error that you might have made before you run it and get incomprehensible results.