Midterm 2 (Due 10 Apr)#

Grading Breakdown

  • Individual Exercise (20 points) - Ex 0

  • Pencil and Paper & Numerical Exercises (120 points) - Ex 1-2

  • Extra Credit Opportunity (5% on Midterm Grade)

Spring 2026

Practicalities about Midterms

  1. You can work in up to a group of 3. If you work as a group, you can hand in one answer only if you wish. Remember to write your name(s)!

  2. How do I(we) hand in? You can hand in the paper and pencil exercises as a single scanned PDF document. Your jupyter notebook file should be converted to a PDF file, attached to the same PDF file as for the pencil and paper exercises. All files should be uploaded to Gradescope.

  3. Cite any resources you use for your midterm, and you can, of course, meet with any instructors or ask any questions in class about the midterm. We will not work any of the exercises on the midterm in help sessions as we have with homework exercises.

  4. Midterms are meant to be challenging and might cover topics and areas that we have not covered directly in class. They might also ask you to complete your own research or design your own model; there are plenty of resources available on the course website and you are welcome to ask any instructors for help or guidance.

Instructions for submitting to Gradescope.

Exercise 0 is marked Submit on D2L only, you must do submit this separately to D2L, not Gradescope. The work on Exercise 0 will be graded pass/fail and may be completed with a different group than your homework group.

You are submitting to D2L, so that Danny can give you feedback on your work in a timely manner to help with questions on your project and guide its development.

Reminder of AI Policy for our class

We can use AI for brainstorming, help, and editing.

  • AI cannot be used for direct answers or completion of assignments.

  • We expect documentation of AI use, but it can be informal.

  • Violations are discussed with Danny; the first violation requires a redo of the assignment, and repeated violations result in a failing grade.

What is informal documentation?

A summary of the use of AI and the kinds of questions asked, and what the AI replied with. Detailed prompts and replies are not needed but the extent to which AI was used to create products in the midterm is important to document. Of course, this is a minimal standard. You can include more detailed documentation such as screenshots of your interactions. The benefit of including screenshots, especially for project work, is that instructors can help you use AI tools more effectively.

Midterms in this class are also a learning opportunity. There are different ways to arrive at the solutions and you might have to learn something new to develop that solution. Using your resources and asking for help from instructors is very much encouraged, especially early on for the more open-ended exercises.

import numpy as np
from math import *
import matplotlib.pyplot as plt
import pandas as pd
%matplotlib inline
plt.style.use('seaborn-v0_8-colorblind')

Final Project Exercise (Submit on D2L only)#

Exercise 0, Updates on your project (20 points)#

SUBMIT THIS ON D2L only - One submission per group; you will be asked your group members’ names.

This is the second check-in for your final project. For the first midterm, you submitted your first planning document and you should have received feedback on the idea. Some of you have talked with the teaching team about that feedback. For this midterm, you will submit a report on your progress. This is a chance for you to reflect on your project and to make sure you are on track for the final project.

This report typically has more details than the first because you have made more progress on your project. You should reflect on the work you have done so far, any challenges you have faced, and any changes you need to make to your project plan. This is also a chance for you to ask for feedback.

  • 0a (5 pts). Review your project status. What have you been able to accomplish so far? What were you unable to do in the time you had? Be honest in your evaluation of your progress. You will not be penalized for not reaching your milestones. What does that mean you need to prioritize in the coming weeks? (at least 150 words)

  • 0b (5 pts). What problems have you encountered in doing you research? What questions came up and how did you resolve them? Are there any unresolved questions? (at least 150 words)

  • 0c (5 pts). Provide an updated artifact from your project. This could be a plot, a code snippet, a data set, or a figure. Explain what this artifact is and how it fits into your project. (at least 150 words)

  • 0d (5 pts). Update your project timeline and milestones. How will you adjust your timeline to account for the work you have done and the work you have left to do? (at least 150 words)

Alternatively, you may combine the above questions into a single report that addresses all of the points. If you choose to do this, make sure to clearly address each point in your report and to provide enough detail for each question (~500 words).

Submit your answers on D2L through the assignment titled “Midterm 2 Exercise 0”.

Pencil and Paper Exercises (Submit on Gradescope only)#

Exercise 1, The Duffing Oscillator (80pt)#

Consider the following equation of motion for a damped and driven oscillator that is not necessarily linear. This is the Duffing equation, which describes a damped driven simple harmonic oscillator with a cubic non-linearity. It’s equation of motion is given by:

\[\ddot{x} + \delta \dot{x} + \alpha x + \beta x^3 = \gamma \cos(\omega t).\]

where \(\alpha\), \(\beta\), \(\delta\), \(\gamma\), and \(\omega\) are constants.

Below is a figure showing the strange attractor of the Duffing Oscillator over four periods. It is locally chaotic, but globally it is confined. This is a common feature of some non-linear systems.

Strange attractor

We focus on this one dimensional case, but we will analyze it in parts to put together a full picture of the dynamics of the system. If you are looking for useful parameter choices and initial conditions, we suggest using those listed on the Wikipedia page.

Recall that the potential for this system can give rise to different kinds of behavior depending on the parameters. The figure below shows the potential for different choices of \(\alpha\) and \(\beta\). Make sure you choose your parameters to match the potential you want to study - pick a stable well for solving for trajectories.

Duffing potential

Undamped and undriven case (20 points)#

  • 1a. (5 pt) Consider the undriven and undamped case, \(\delta = \gamma = 0\). What potential would give rise to this kind of equation of motion? Demonstrate that potential gives the expected equation of motion.

  • 1b. (5 pt) Find the equilibrium points of the system for the undriven and undamped case. What are the conditions for stable and unstable equilibrium points? Plot the potential for some choices of \(\alpha\) and \(\beta\) to illustrate your findings.

  • 1c. (5 pt) Plot the phase space for the undriven and undamped case. What are the trajectories of the system? What is the behavior of the system? Does it match your expectations from the potential? The figure above only starts this discussion.

  • 1d. (5 pt) Here you are likely to need a numerical solver. Solve the equation of motion for the undriven and undamped case for a reasonable choice of \(\alpha\) and \(\beta\) and initial conditions. Plot the position as a function of time. What is the behavior of the system? Does it match your expectations from the potential and the phase portrait?

Damped and undriven case (15 points)#

  • 1e. (5 pt) Now consider the damped and undriven case, \(\gamma = 0\). What is the equation of motion in this case? Can you develop this equation of motion fully from a potential (like we did above)? If so, what is the potential? If not, why not?

  • 1f. (5 pt) Plot the phase space for the damped and undriven case. What kinds of trajectories are there?

  • 1g. (5 pt) Here you are likely to need a numerical solver. Solve the equation of motion for the damped and undriven case for a reasonable choice of \(\alpha\), \(\beta\), \(\delta\), and initial conditions. Plot the position as a function of time. What is the behavior of the system? Does it match your expectations from the phase portrait?

Driven and damped case (20 points)#

  • 1h. (5 pt) Now consider the damped and driven case, \(\gamma \neq 0\). What is the equation of motion in this case? Can you develop this equation of motion fully from a potential (like we did above)? If so, what is the potential? If not, why not?

  • 1i. (5 pt) Is it possible to plot the phase space for the driven and damped case? Why or why not? What solutions are available to you to understand the behavior of the system in phase space? Here we are not looking for you to solve the problem, but to conduct research into how people make sense of the behavior of driven and damped systems.

  • 1j. (10 pt) Here you are likely to need a numerical solver. Solve the equation of motion for the driven and damped case for a reasonable choice of \(\alpha\), \(\beta\), \(\delta\), \(\gamma\), \(\omega\), and initial conditions. Plot the position as a function of time. What is the behavior of the system?

Parameter Change (5 points)#

  • 1k. (5 pts) The Duffing oscillator can be either a soft or hard spring by changing the sign of the \(\alpha\) term. What happens to the behavior of the system when you change the sign of \(\alpha\)? Can you explain this behavior in terms of the potential?

Poincaré section (20 pts)#

Poicare map

  • 1l. (20 pts) A critical tool for understanding the behavior of the Duffing oscillator is the Poincaré section.

    • Implement a Poincaré section for the driven and damped case. For choices of different parameters that demonstrate qualitatively different behaviors.

    • What can you claim about the behavior of the system given the Poincaré sections you created?

    • How does a Poincaré section help you understand the behavior of the system? Here we are not looking for you to solve the problem, but to conduct research into how people make sense of the behavior of systems using Poincaré sections.

Exercise 2, Strange Attractor (40pt)#

We learned about Strange Attractors when modeling the Lorenz system in class. In this part of the exam, we will explore the Chen system, which is another example of a system that exhibits chaotic behavior and has a strange attractor. The Chen system is given by the following set of ordinary differential equations:

\[\begin{split}\begin{align} \dot{x} &= \alpha x-yz,\\ \dot{y} &= \beta y + xz,\\ \dot{z} &= \delta z + \frac{1}{3}xy,\\ \end{align}\end{split}\]

where \(\alpha\), \(\beta\), and \(\delta\) are constants that determine the behavior of the system. For this problem, we will use the following values:

Parameter

Value

\(\alpha\)

5.0

\(\beta\)

-10.0

\(\delta\)

-0.38

Visualization of the Chen System

Chen System

Numerical Integrate the Chen System (10 points)#

  • 2a. (5 pts) For this choice of parameters, numerically integrate (using solve_ivp or a similar integrator) the Chen system over a reasonable time interval (e.g., 100 time units). Recall that for solve_ivp, you need to specify the time span and initial conditions. For the initial conditions, you can choose \(x(0) = y(0) = z(0) = 1.0\). Integrate for at least 100 time units. This will give you a starting point to observe the chaotic behavior of the system.

  • 2b. (5 pts) Plot the system in 3D and in 3 subplots showing the projection of the trajectory in the \(x-y\), \(x-z\), and \(y-z\) planes.

Comparing Trajectories (20 points)#

  • 2c. (10 pts) For two nearby points in phase space, numerically integrate the Chen system for 100 time units.

    • Use the same initial conditions as before, but slightly perturb one of the points (e.g., \(x(0) = 1.0\), \(y(0) = 1.0\), \(z(0) = 1.0\) for the first point and \(x(0) = 1.01\), \(y(0) = 1.0\), \(z(0) = 1.0\) for the second point).

    • Plot both trajectories in 3D to observe how they diverge over time. How can you tell that the system is chaotic from this behavior? What features of the trajectories indicate chaotic behavior?

    • Estimate the Lyapunov Exponent, and explain how you did so.

  • 2d. (10 pts) The Chen system has two attractors that we can observe. Which attractor we end up on depends on the initial conditions. To illustrate this, numerically integrate the Chen system for 100 time units with two different sets of initial conditions.

    • For example, you can use \(x(0) = y(0) = z(0) = 1.0\) for the first trajectory and \(x(0) = y(0) = z(0) = -1.0\) for the second trajectory.

    • Plot both trajectories in 3D and in 3 projections (\(x-y\), \(x-z\), and \(y-z\)) to observe the different attractors that the system can exhibit. How can you tell that the system is chaotic from this behavior? What features of the trajectories indicate chaotic behavior?

    • Estimate the Lyapunov Exponent, and explain how you did so. How do these estimates of the Lyapunov Exponents between 2c and 2d compare? Why might that be?

Checking Sensitivity to Initial Conditions (10 points)#

  • 2e. (10 pts) For the Chen system integrate a bundle of trajectories (\(N>100\)) with slightly different initial conditions. Make sure that your conditions are such that you cover both lobes of the attractor. Plot the starting and ending points of the trajectories in 3D and in 3 projections (\(x-y\), \(x-z\), and \(y-z\)). How can you tell that the system is chaotic from this behavior? What features of the trajectories indicate chaotic behavior?

Extra Credit (up to 20 points)#

  • 2f. (20 pts) Through this problem, you should have developed a set of tools and codes that can be applied to any nonlinear system of differential equations. Apply your analysis techniques to a new system of your choosing and demonstrate how the system is or can become chaotic. Make sure to focus on the what we have seen as the hallmarks of chaotic systems. You might use this link for inspiration: https://www.dynamicmath.xyz/strange-attractors/

Extra Credit: Professional Development Planning (5% on Midterm Grade)#

This extra credit opportunity allows you to earn up to 5% additional points on your midterm grade by engaging in structured professional development planning. This is an individual opportunity that requires personal reflection and planning for your career goals.

There are two tracks depending on whether you completed the Midterm 1 extra credit.


Track A: Continuing Students (completed Midterm 1 extra credit)#

“Before” the Midterm Due Date:

  • Schedule and complete a follow-up meeting with Danny to discuss your progress and any adjustments to your plan

    • You may use this link to schedule a meeting
      Use this meeting to reflect on your progress, discuss any challenges or changes in your goals, and brainstorm adjustments to your professional development plan.

By (or shortly after) the Midterm Due Date:

  • Submit a revised professional development plan (approximately 1000 words) via email to Danny caball14@msu.edu

  • Your revised plan should address the following:

  • How your goals and interests have evolved since Midterm 1

  • Honest reflection on your progress — what have you acted on, what has stalled, and why?

  • Updated assessment of your strengths and areas for growth

  • Any adjustments to the specific steps or actions you are taking

  • How your experience in this course continues to connect to your broader career aspirations


Track B: New Participants (did not complete Midterm 1 extra credit)#

“Before” the Midterm Due Date:

  • Schedule and complete a meeting with Danny to discuss your career goals, interests, and potential pathways

  • Use this meeting to present, brainstorm, and/or outline your professional development plan

By (or shortly after) the Midterm Due Date:

  • Submit a written professional development plan (approximately 500 words) via email to Danny caball14@msu.edu

  • Your plan should address the following components:

    • Your current career goals and interests (both short-term and long-term)

    • An honest assessment of your current strengths and skills

    • Areas where you want to grow or develop new competencies

    • Specific steps or actions you plan to take to work toward your goals

    • How this physics course connects to your broader career aspirations


Submission Instructions#

  • Email your written plan directly to Danny (caball14@msu.edu) by the midterm late due date (or shortly thereafter)

  • Use the subject line: “PHY321 Midterm 2 Extra Credit - [Your Name]”

  • This is an individual assignment — each student must complete their own plan and reflection

Grading#

Full extra credit (5%) will be awarded for:

  • Completing the meeting with Danny “before” the deadline

  • Submitting a thoughtful, well-written plan that addresses all required components for your track

  • Demonstrating genuine reflection on your goals and development needs

This extra credit can exceed 100% total on your midterm.

Note: Students who complete Track B for Midterm 2 will be eligible to continue this professional development work for additional extra credit at the end of the semester (applied retroactively to Midterm 1).