Homework 8¶
Total points: 120
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')Exercise 1 (10pt) Paths along a curved surface¶
We have shown by minimizing the path length on a 2D flat surface that we have generated a linear equation, which illustrates the shortest distance between two points is a straight line. On a curved surface, the shortest distance will be a curve of some kind. In this exercise you will construct the path-length functional for a sphere and a cylinder, both with fixed radii, and identify the shortest path by minimizing it.
A step in spherical coordinates is given by:
A step in cylindrical coordinates is given by:
(5 pt) Demonstrate that the length functional for a path between two points on a sphere of radius is:
where is the polar angle and is the azimuthal angle. Travel from to at fixed , assuming can be used as a path parameter. Explain that minimizing this functional gives the shortest path.
(5 pt) Construct the length functional for a path on a cylinder of radius and height . The endpoints are and in cylindrical coordinates, where is the radial coordinate, is the azimuthal angle, and is the height. State the allowed range of and explain how minimizing the functional identifies the shortest path.
Exercise 2 (15pt) Snell’s Law¶
We can develop Snell’s law by minimizing the time it takes for light to travel between two points in different media. The speed of light in a medium is , where is the speed of light in vacuum and is the medium’s refractive index. The time to traverse a segment of length is .
Let a light ray travel from a fixed point in medium 1, across a planar interface, to a fixed point in medium 2. The refractive indices are and .
(5 pt) Sketch the problem and indicate the relevant angles and distances in your figure. Recall that the angle of incidence is and the angle of refraction is . It is ok to use a 2D sketch.
(5 pt) Set up the total travel time for the two line segments. Use and express each segment length in terms of the geometry of your sketch. Your answer should include the angles of incidence and refraction, and , and the refractive indices and .
(5 pt) Minimize the time it takes for light to travel between two points in different media to derive Snell’s Law.
Exercise 3 (15pt) Lagrangian Examples¶
Constructing the Lagrangian for a system can be a bit tricky. In this exercise you will be asked to construct the Lagrangian for a few systems and quickly find equations of motion to illustrate the process.
(2 pt) Construct the Lagrangian in 3D for a projectile subject to no air resistance in a uniform gravitational field, taking upward and . The coordinates are in the Cartesian coordinate system. Find the 3 equations of motion.
(2 pt) Construct the Lagrangian for a one-dimensional simple harmonic oscillator (). The coordinate is in the Cartesian coordinate system. Find the equation of motion.
(3 pt) A mass moves in a potential well . Construct the Lagrangian in 2D. The coordinates are in the Cartesian coordinate system. Find the 2 equations of motion.
It’s common to use coordinates that are convenient for the problem. In these cases, you will need to write down the kinetic and potential energy in terms of the coordinates you choose. The single particle kinetic energy in these coordinates are commonly used.
(4 pt) Write or derive the velocity vector in spherical coordinates. The coordinates are in the spherical coordinate system. Show the kinetic energy is given by .
(4 pt) Write or derive the velocity vector in cylindrical coordinates. The coordinates are in the cylindrical coordinate system. Show the kinetic energy is given by .
Exercise 4 (25pt) Changing Coordinates¶
Consider two particles with masses connected by a spring with spring constant . They sit on a frictionless surface but are constrained to the -axis. The location of the first particle is and the location of the second particle is . The spring is at equilibrium when the particles are a distance apart. Assume the spring is massless and that the left mass never changes position with the right mass (i.e., the spring is always horizontal).
(3 pt) Write down the kinetic and potential energy for this system in terms of and and their associated velocities.
(4 pt) Write down the Lagrangian for this system in terms of and and their associated velocities . Find the 2 equations of motion.
(5 pt) Now consider a new coordinate system where the center of mass is at and the relative coordinate is , the spring extension from equilibrium. Write down the kinetic and potential energy in terms of and and their associated velocities.
(8 pt) Write down the Lagrangian for this system in terms of the center of mass coordinate () and the spring extension () and the associated velocities . Find the 2 equations of motion.
(5 pt) Find and for the system for some generic initial conditions of your choosing. Describe the motion of the system.
In this problem we are changing the coordinates to explore a different aspect of the problem (and to make the math easier). This is a common technique that will not always be obvious. But practice will help us identify when it is useful.
Exercise 5 (35 pt) Motion inside a paraboloid¶
Let’s figure out the motion of a particle constrained to the inside of a paraboloid. The potential energy of the bead is given by , where is the mass of the bead and is the acceleration due to gravity. The coordinates are in the Cartesian coordinate system, with upward.
The constraint surface itself (for an arbitrary choice of ) looks like this:
import numpy as np
import matplotlib.pyplot as plt
plt.style.use('seaborn-v0_8-colorblind')
alpha = 1.0
rho = np.linspace(0, 1.5, 40)
phi = np.linspace(0, 2*np.pi, 60)
Rho, Phi = np.meshgrid(rho, phi)
X, Y = Rho*np.cos(Phi), Rho*np.sin(Phi)
Z = 0.5*alpha*(X**2 + Y**2)
fig = plt.figure(figsize=(6, 5))
ax = fig.add_subplot(projection='3d')
ax.plot_surface(X, Y, Z, cmap='viridis', alpha=0.85, linewidth=0)
ax.set_xlabel('x')
ax.set_ylabel('y')
ax.set_zlabel('z')
ax.set_title(r'Constraint Surface: $z=\frac{1}{2}\alpha(x^2+y^2)$')
plt.tight_layout()
plt.show()
(5 pt) Write down the Lagrangian for the system in terms of , , and and their associated velocities . Find the 3 equations of motion.
(15 pt) The bead is constrained by the paraboloid , where has units of inverse length. Find the constraint equation and use it to eliminate one coordinate from the Lagrangian. Find the 2 equations of motion. Here it can be useful to change to cylindrical coordinates . Hint: the reduced Lagrangian should be a function of , , and their associated velocities.
(15 pt) Choose an initial condition in which the bead is moving relative to the paraboloid at some height above its bottom. Numerically solve the equations of motion for and and plot the motion of the bead. Verify numerically that the trajectory remains on the paraboloid.
Exercise 6 (20pt), Project Check-in 3¶
This is the last of three check-ins for your final project. At this point, you should be preparing to finish your computational essay. Following the posted rubric for the computational essay, you should reflect on your progress and update your project. This is a chance to evaluate where you are in the process of completing your computational essay.
6a (5 pts). Review your project in the context of the rubric. 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. What do you have left to do? (at least 250 words)
6b (5 pts). What problems did you encounter in doing your work? What questions came up and how did you resolve them? Are there any unresolved questions? (at least 250 words)
6c (5 pts). Provide an 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. (100–200 words)
6d (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? How will you meet the expectations from the rubric? (100–200 words)