Homework #1: ODE's & Particle Dynamics

Due on Tuesday, Feb. 25, 2025



(10pt) Problem A: Ballistic Motion

Given a location of a gun at (0,0,0), write an 3D artillery simulator that can take in the mass of the projectile, amount of powder, the azimuth and elevation of the gun barrel. Use the amount of powder and the mass of the projectile to determine the muzzle velocity. Account for gravity and air friction. Assume that one kilogram of powder produces 10,000 newtons of force. Assume instantaneous acceleration as a result of the powder going off. Air friction coefficient is constant. Set it to be 50 kg/s initially. The gun and target are both on the X-Z plane.


(15pt) Problem B: Spring-Mass Simulator

A spring hands vertically in its equilibrium or resting position. Given a user-defined mass m attached to the spring with the spring constant k, not stretched at first. Simulate the motion of the spring and mass under the effects of spring and gravitational forces. Assume the mass is 5 kg and k = 15 kg/s^2. Then, set the mass to be 10 kg and k = 20 kg/s^2.


For both problems, you'll need to write at least two functions (Euler's method vs. Mid-point or 4th order Runge-Kutta) for integration and compare their numerical accuracy and stability. Which function is more accurate? Which one is more stable? Which one is more efficient?


Important Information:

  • In problem A, you might also require the barrel length of gun to calculate the initial muzzle velocity. If you do, include it as an input parameter and indicate what value you use for your experiments. Alternatively, you can treat the initial force as an impulse. In any case, mention any assumptions you make in the report.
  • You are free to use any programming language as long as you are able to handle visualization and controls/user interface for your simulation. C++ or Python are suggested because of extensive library support.
  • OpenGL is a good resource for getting started with graphics progamming. If you don't want to focus too much on graphics, you can also use other renderers like Blender, Taichi, Mitsuba, Nvidia Warp, etc. but you may need to adapt your simulation code to work with them (I/O interface, data structures, etc.). Finally, make sure that you write and implement the relevent mathematical equations and numerical algorithms yourself, as you will be graded on that.

  • Submission Guidelines:

  • Put your code, report and results (graphs, images, videos, etc.) in a single directory, compress it and upload it on Canvas.
  • Include the details of your code like dependencies, compilation and execution instructions in the report.
  • The name of your submission file must follow the format: firstname_lastname_hw1.zip.

  • This assignment will be graded based upon:

  • Correctness of the implementations (50%)
  • UI & other SE factors (20%)
  • Other features (analysis, etc.) (30%)