πŸ“ Week 08 (Part III: Transcendental Calculus & Optimization) β€’ Student Lecture Materials
🐍 Download Notebook (.ipynb) πŸ“‘ Download Blank Slides (PDF) πŸ“Š Download Dataset (.csv)

Week 08 β€” Trigonometric Derivatives & Harmonic Phase Cycles

Engineering Focus: Seismic Accelerometer Kinematics, Harmonic Oscillator Phase Shifts, Lead-Screw Wedge Mechanics (\(\sec^2\theta\)) & Rotational Vibration Jerk Companion Dataset: Week08_Seismic_Mass_Spring_Accelerometer_Data.csv


1. β€œCalculus Made Easy” Intuition: Rotating Around the Unit Circle by a Tiny Nudge \(d\theta\)

Why is the derivative of \(\sin\theta\) equal to \(\cos\theta\), and why does \(\cos\theta\) pick up a minus sign (\(-\sin\theta\))? You do not have to memorize anything blindlyβ€”just picture walking around a circular track of radius \(1\)!

Stand at angle \(\theta\) on the unit circle, at horizontal coordinate \(x = \cos\theta\) and height \(y = \sin\theta\).

  1. Now step forward counterclockwise by one tiny arc bit \(d\theta\) along the circle rim.
  2. Zoom into that tiny step with a magnifying glass! Because \(d\theta\) is tiny, the circular arc looks like a tiny straight arrow of length \(d\theta\) pointing tangent to the circle (perpendicular to the radius!).
  3. Check which way that arrow points in Quadrant I:
    • Your height \(y = \sin\theta\) goes UP (\(d(\sin\theta) > 0\)), while your horizontal position \(x = \cos\theta\) moves LEFT (\(d(\cos\theta) < 0\))! Look! That immediately explains the minus sign on \(\frac{d}{d\theta}(\cos\theta)\)!
  4. Now draw the tiny right triangle formed by the hypotenuse \(d\theta\), vertical leg \(d(\sin\theta)\), and horizontal leg \(-d(\cos\theta)\). By similar right triangles rotated by \(90^\circ\): \[d(\sin\theta) = \cos\theta\,d\theta \implies \mathbf{\frac{d}{d\theta}(\sin\theta) = +\cos\theta}\] \[d(\cos\theta) = -\sin\theta\,d\theta \implies \mathbf{\frac{d}{d\theta}(\cos\theta) = -\sin\theta}\]

The Endless 4-Step Dance of Spring Oscillations

Differentiate a sine wave four times and watch what happens: \[\sin\theta \xrightarrow{d/d\theta} +\cos\theta \xrightarrow{d/d\theta} -\sin\theta \xrightarrow{d/d\theta} -\cos\theta \xrightarrow{d/d\theta} +\sin\theta\] Every derivative simply shifts the wave forward by \(90^\circ\) (\(\pi/2\text{ rad}\))! That is why on a vibrating mass-spring shaker table, acceleration \(a(t) = -\omega^2 y(t)\) is always exactly opposite (\(180^\circ\) out of phase) to displacement \(y(t)\)!

2. Complete Mathematical Derivations & Reference Guide

2.1 Deriving \(\tan\theta\), \(\cot\theta\), \(\sec\theta\), and \(\csc\theta\) Using the Quotient Rule

Once you know \((\sin\theta)' = \cos\theta\) and \((\cos\theta)' = -\sin\theta\), the remaining four trig derivatives fall out automatically in two lines!

2.2 Remembering the Chain Rule Factor (\(\omega\)!) in Physical Oscillations

In real vibrations, angles vary with time \(\theta = \omega t\), where \(\omega = 2\pi f\ [\text{rad/s}]\). Every differentiation pulls another factor of \(\omega\) outside!

Function Exact Derivative (rad) Chain-Rule Form (\(u = g(x)\)) Engineering Significance
\(\sin u\) \(\cos u\) \(\cos(u)\,u'\) Velocity of cosine displacement
\(\cos u\) \(-\sin u\) \(-\sin(u)\,u'\) Acceleration proportional to \(-\text{disp}\)
\(\tan u\) \(\sec^2 u\) \(\sec^2(u)\,u'\) Optical tangent tracking & slope sensitivity
\(\sec u\) \(\sec u\tan u\) \(\sec(u)\tan(u)\,u'\) Structural truss member load sensitivity
\(\cot u,\ \csc u\) \(-\csc^2 u,\ -\csc u\cot u\) Times \(u'\) Co-function minus pattern
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import sympy as sp
from pathlib import Path

plt.rcParams.update({
    "figure.dpi": 150,
    "font.size": 10,
    "axes.grid": True,
    "grid.alpha": 0.30,
    "axes.spines.top": False,
    "axes.spines.right": False,
})

def load_week_csv(filename):
    for p in [Path("datasets") / filename, Path("../datasets") / filename]:
        if p.exists():
            return pd.read_csv(p)
    raise FileNotFoundError(f"Dataset not found: {filename}")

3. Seismic Accelerometer Harmonic Shake-Table Analysis

We load Week08_Seismic_Mass_Spring_Accelerometer_Data.csv, recording displacement \(y(t)\), velocity \(v(t)\), and acceleration \(a(t)\) on a \(4\text{ Hz}\) structural shake table (\(A = 12.0\text{ mm}\), \(\omega = 8\pi\text{ rad/s}\)). Watch how velocity peaks exactly as displacement crosses zero (\(90^\circ\) phase lead), while acceleration mirrors displacement upside down!

df = load_week_csv("Week08_Seismic_Mass_Spring_Accelerometer_Data.csv")
print("Week 08 Seismic Shake-Table Data (first 6 rows):")
print(df.head(6).to_string(index=False))

t_s = df["Time_s"].values
y_m = df["Disp_mm"].values / 1000.0
a_m_s2 = df["Accel_m_s2"].values
# Verify harmonic oscillator identity a(t) / y(t) = -omega^2
omega_sq_est = -np.mean(a_m_s2[np.abs(y_m) > 0.002] / y_m[np.abs(y_m) > 0.002])
f_est_hz = np.sqrt(omega_sq_est) / (2.0 * np.pi)
print(f"\n[Harmonic Identity Check] Estimated natural frequency from a/y ratio = {f_est_hz:.3f} Hz (Design = 4.000 Hz)")
print(f"[Peak G-Load] max |a(t)| = {np.max(np.abs(a_m_s2)):.2f} m/s^2 ({np.max(np.abs(a_m_s2))/9.81:.2f} g)")

fig, (ax1, ax2) = plt.subplots(1, 2, figsize=(11.8, 4.3))
ax1.plot(t_s * 1e3, df["Disp_mm"] / 12.0, "o-", color="#0284c7", lw=2.0, label="Norm Displacement $y/A$")
ax1.plot(t_s * 1e3, df["Vel_mm_s"] / (12.0 * 8*np.pi), "s--", color="#059669", lw=1.8, label=r"Norm Velocity $v/(A\omega)$")
ax1.plot(t_s * 1e3, df["Accel_m_s2"] / (0.012 * (8*np.pi)**2), "^:", color="#dc2626", lw=1.8, label=r"Norm Accel $a/(A\omega^2)$")
ax1.axhline(0, color="#64748b", lw=1.0)
ax1.set_title("90-deg Phase Ladder of Sine & Cosine Derivatives")
ax1.set_xlabel("Time $t$ [ms]")
ax1.set_ylabel("Normalized Waveform [-]")
ax1.legend(fontsize=8.0)

ax2.plot(df["Disp_mm"], df["Accel_m_s2"], "o-", color="#7c3aed", lw=2.0)
ax2.set_title("Phase-Space Signature: $a = -\\omega^2 y$ (Exact Straight Line!)")
ax2.set_xlabel("Displacement $y(t)$ [mm]")
ax2.set_ylabel("Acceleration $a(t)$ [m/s$^2$]")

plt.tight_layout()
plt.show()
# Verified Output:
Week 08 Seismic Shake-Table Data (first 6 rows):
 Time_s  Disp_mm  Vel_mm_s  Accel_m_s2
  0.000    0.000    301.59      -0.000
  0.025    7.053    243.99      -4.455
  0.050   11.413     93.20      -7.209
  0.075   11.413    -93.20      -7.209
  0.100    7.053   -243.99      -4.455
  0.125    0.000   -301.59      -0.000

[Harmonic Identity Check] Estimated natural frequency from a/y ratio = 4.000 Hz (Design = 4.000 Hz)
[Peak G-Load] max |a(t)| = 7.21 m/s^2 (0.73 g)
Week 08 Engineering Plot

4. Three Unabridged Worked Engineering Problems

Worked Example 1 β€” Product + Trig Chain Rule on a Damped Harmonic Signal

Problem: Differentiate \(y(t) = t^2\sin(5t)\) and \(z(\theta) = \frac{\tan(2\theta)}{\theta}\), simplifying clearly.

Unabridged Hand Solution:

  1. For \(y(t) = t^2\sin(5t)\): Use Product Rule with Chain Rule factor \(5\) inside \(\sin(5t)\): \[y'(t) = t^2\cdot\frac{d}{dt}[\sin(5t)] + \sin(5t)\cdot\frac{d}{dt}[t^2] = t^2\left(5\cos(5t)\right) + 2t\sin(5t) = \mathbf{5t^2\cos(5t) + 2t\sin(5t)}\]

  2. For \(z(\theta) = \frac{\tan(2\theta)}{\theta}\): Use Quotient Rule remembering \(\frac{d}{d\theta}[\tan(2\theta)] = 2\sec^2(2\theta)\): \[z'(\theta) = \mathbf{\frac{2\theta\sec^2(2\theta) - \tan(2\theta)}{\theta^2}}\]


Worked Example 2 β€” Optical Radar Gimbal Angular Tracking Speed

Problem: A straight test road lies \(L = 120\text{ m}\) perpendicular to a stationary camera. A vehicle drives along the road at distance \(x = L\tan\theta\), where \(\theta\) is the camera pan angle. Using \(\frac{dx}{d\theta} = L\sec^2\theta\), compute the required camera pan rate \(\dot{\theta}\) (\(\text{rad/s}\) and \(\text{deg/s}\)) when a racecar blasts past at \(v = 72\text{ m/s}\) and pan angle \(\theta = 45^\circ\).

Unabridged Hand Solution:

  1. Differentiate \(x = L\tan\theta\) with respect to time \(t\): \[v = \frac{dx}{dt} = L\sec^2\theta\cdot\frac{d\theta}{dt} \implies \frac{d\theta}{dt} = \frac{v\cos^2\theta}{L}\]

  2. At \(\theta = 45^\circ = \pi/4\): \(\cos(\pi/4) = \frac{\sqrt{2}}{2} \implies \cos^2(\pi/4) = \frac{1}{2}\)!

  3. Substitute \(v = 72\text{ m/s}\) and \(L = 120\text{ m}\): \[\dot{\theta} = \frac{72 \times (1/2)}{120} = \frac{36}{120} = \mathbf{0.300\text{ rad/s} \approx 17.19^\circ/\text{s}}\]


Worked Example 3 β€” Cam-Driven Suspension Acceleration & Jerk Limit Check

Problem: An active suspension hydraulic actuator sweeps \(y(t) = 0.025\cos(12t)\ [\text{m}]\) (\(\omega = 12\text{ rad/s}\)). Compute peak velocity \(|v|_{\max}\), peak acceleration \(|a|_{\max}\), and peak jerk \(|j|_{\max}\).

Unabridged Hand Solution:

t_s, th_s = sp.symbols("t theta", real=True)
print("[Example 1] d/dt(t^2 sin(5t)) =", sp.diff(t_s**2 * sp.sin(5*t_s), t_s))
print("[Example 1] d/dth(tan(2th)/th) =", sp.simplify(sp.diff(sp.tan(2*th_s)/th_s, th_s)))
theta_dot = (72.0 * np.cos(np.radians(45.0))**2) / 120.0
print(f"[Example 2] Camera gimbal pan rate = {theta_dot:.4f} rad/s ({np.degrees(theta_dot):.2f} deg/s)")
print(f"[Example 3] Suspension peaks: v_max = {0.025*12:.2f} m/s, a_max = {0.025*144:.2f} m/s^2, j_max = {0.025*1728:.1f} m/s^3")
# Verified Output:
[Example 1] d/dt(t^2 sin(5t)) = 5*t**2*cos(5*t) + 2*t*sin(5*t)
[Example 1] d/dth(tan(2th)/th) = (2*theta/cos(2*theta)**2 - tan(2*theta))/theta**2
[Example 2] Camera gimbal pan rate = 0.3000 rad/s (17.19 deg/s)
[Example 3] Suspension peaks: v_max = 0.30 m/s, a_max = 3.60 m/s^2, j_max = 43.2 m/s^3

5. Engineering Practice Problems (Self-Study Exercises)

Practice Problem 1 β€” Double Chain Rule with Trig Powers (\(\sin^4(3x)\))

Differentiate \(f(x) = \sin^4(3x)\) cleanly by rewriting \((\sin(3x))^4\) first.

πŸ” Click to View Complete Step-by-Step Solution
  1. Outer power \((\text{stuff})^4 \to 4(\sin(3x))^3\).
  2. Multiply by inner trig \((\sin(3x))' = \cos(3x)\cdot 3\): \[f'(x) = 4\sin^3(3x)\cdot 3\cos(3x) = \mathbf{12\sin^3(3x)\cos(3x)}\]

Practice Problem 2 β€” Maximum Shear Strain Rate in Harmonic Torsion

A drive shaft twists with angle \(\phi(t) = 0.04\sin(30\pi t)\ [\text{rad}]\). Compute angular twist velocity \(\dot{\phi}(t)\) and peak twist acceleration \(|\ddot{\phi}|_{\max}\).

πŸ” Click to View Complete Step-by-Step Solution
  1. \(\dot{\phi}(t) = 0.04(30\pi)\cos(30\pi t) = \mathbf{1.2\pi\cos(30\pi t) \approx 3.77\cos(30\pi t)\text{ rad/s}}\).
  2. \(|\ddot{\phi}|_{\max} = 0.04(30\pi)^2 = 36\pi^2 \approx \mathbf{355.3\text{ rad/s}^2}\).

Practice Problem 3 β€” Checking \(\sec\theta\) Quotient Identity

Differentiate \(h(\theta) = \frac{1}{\cos\theta}\) directly using the Quotient Rule to confirm \(\frac{d}{d\theta}(\sec\theta) = \sec\theta\tan\theta\).

πŸ” Click to View Complete Step-by-Step Solution
  1. Numerator \(1\) has derivative \(0\); denominator \(\cos\theta\) has derivative \(-\sin\theta\): \[h'(\theta) = \frac{\cos\theta(0) - 1(-\sin\theta)}{\cos^2\theta} = \frac{\sin\theta}{\cos^2\theta} = \frac{1}{\cos\theta}\cdot\frac{\sin\theta}{\cos\theta} = \mathbf{\sec\theta\tan\theta}\]

Practice Problem 4 β€” Zero-Velocity Phase in Two-Harmonic Vibration

An unbalanced pump vibrates vertically via \(y(t) = 3\sin(2t) + 4\cos(2t)\ [\text{mm}]\). Differentiate to find velocity \(v(t)\), and compute the smallest positive time \(t^* > 0\) where velocity momentarily equals zero (turning point!).

πŸ” Click to View Complete Step-by-Step Solution
  1. \(v(t) = 6\cos(2t) - 8\sin(2t)\).
  2. Set \(v(t^*) = 0 \implies 8\sin(2t^*) = 6\cos(2t^*) \implies \tan(2t^*) = \frac{6}{8} = \frac{3}{4}\).
  3. Solve: \(2t^* = \arctan(0.75) = 0.6435\text{ rad} \implies \mathbf{t^* = 0.3218\text{ s}}\).

References

🎬 Visual Intuition Animation β€” Unit Circle Differential Triangle