Skip to content

Latest commit

 

History

History
118 lines (88 loc) · 5.13 KB

homework3.md

File metadata and controls

118 lines (88 loc) · 5.13 KB

Homework 3

Instructions

Obtain the GitHub repository you will use to complete the homework assignment, which contains the starter Jupyter notebook file homework3.ipynb. The notebook template provides space for you to answer each question. Your notebook should run without error when you select Restart Kernel and Run All Cells:

When you’re done, save your file, then stage, commit, and push (upload) it to GitHub, and then follow the instructions in the How to submit section.

Questions

Use the leapfrog integration method when implementing the models in both questions.

  1. Revise the model of the motion of a damped spring to account for air friction using Stoke’s friction instead of Newtonian friction. The formula for Stoke’s friction is

    F=bv

    where b is a constant and v is the velocity of the object. Implement your revised model in a function named simulation and save it in a file named stokes.py.

    After implementing the revised model, import it and choose parameters that fulfill the following relationship:

    b^{2}>4k^{2}

    where k is the spring constant. Plot the length and velocity of the system as a function of time to confirm that the system is overdamped, meaning that oscillation is damped out.

    Then, choose parameters that fulfill the opposite condition:

    b^{2}<4k^{2}

    Again, plot the length and velocity of the system as a function of time and confirm that the system is underdamped, meaning that the system does show oscillatory behavior.

  2. The restoring force for a nonlinear hard spring is:

    k(x-x_{0})\left[1+a^{2}(x-x_{0})^{2}\right]

    where k is the spring constant, x is the spring length, x_{0} is the equilibrium spring length, and a is a small constant. Similarly, the restoring force for a nonlinear soft spring is:

    k(x-x_{0})\left[1-a^{2}(x-x_{0})^{2}\right]

    Extend the undamped model of the motion of a spring by implementing both types of nonlinear springs. Place your revised model in a function named simulation and save it in a file named nonlinear.py. It should be possible using the function inputs for simulation to specify whether the model will use the standard linear spring based on Hooke’s Law, or one of the two nonlinear springs.

    After implementing the revised model, import it and choose three different values of a (remember, a is supposed to be small, meaning a\ll{}1). For the rest of the model parameters, use the default values shown in class for the undamped oscillator. Then, for each of those values of a, simulate the linear spring, the nonlinear hard spring, and the nonlinear soft spring and create plots of the length and velocity of the system as a function of time. Ensure that the plots allow the reader to easily compare and contrast the model behavior and better understand how adding a nonlinear term affects the idealized behavior of the linear spring.

How to submit

To lock in your submission time, export your notebook to PDF and upload the PDF file to the assignment posting on Blackboard.

In addition, be sure to save, commit, and push your final result so that everything is synchronized to GitHub. I may want to inspect your source files directly and run your notebook, so it’s very important that the files in your homework repository match what I see in the PDF export uploaded to Blackboard.