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

Week 09 β€” Exponential & Logarithmic Master Derivative Rules

Engineering Focus: Underdamped Vehicle Suspension Ring-Down, Polymer Stress Relaxation & Simplifying Monster Products via Logarithmic Differentiation Companion Dataset: Week09_Underdamped_Suspension_and_Polymer_Relaxation_Data.csv


1. β€œCalculus Made Easy” Intuition: Why Does \(e^x\) Refrain from Changing?

Ask yourself: what single machine on Earth outputs its exact own slope at every value of \(x\)? As we saw in Week 03, Euler’s number \(e \approx 2.718281828\dots\) was literally defined so that at \(x = 0\), the tangent slope of \(e^x\) is \(1\): \[\lim_{h\to 0}\frac{e^h - 1}{h} = 1\] Now compute \(\frac{d}{dx}(e^x)\) using that single limit: \[\frac{e^{x+h} - e^x}{h} = e^x\left(\frac{e^h - 1}{h}\right) \xrightarrow{h\to 0} e^x \cdot 1 = \mathbf{e^x}\] Wait: what happens to its inverse, \(y = \ln x\)? Write \(e^y = x\) and differentiate both sides with respect to \(x\) (Chain Rule!): \[e^y\frac{dy}{dx} = 1 \implies \frac{dy}{dx} = \frac{1}{e^y} = \mathbf{\frac{1}{x}}\] Let that sink in! Every exponential power becomes a derivative itself, while the logarithm \(\ln x\) turns immediately into an ordinary algebra fraction \(\frac{1}{x}\)!

β€œOne Rule to Ring Them All”: Never Memorize 6 Separate Formulas!

With the Chain Rule and Base-Switching (\(b^u = e^{(\ln b)u}\)), only two master 3-factor recipes handle every exponential and logarithm on Earth (\(u = f(x)\)):

  1. Exponential Master Rule: (Copy \(\times\) Derivative of Exponent \(\times\) \(\ln(\text{Base})\)) \[\mathbf{\frac{d}{dx}\left[b^{f(x)}\right] = b^{f(x)} \cdot f'(x) \cdot \ln(b)}\] (When \(b = e\), \(\ln(e) = 1\) automatically drops out: \(\frac{d}{dx}[e^{f(x)}] = f'(x) e^{f(x)}\)!)

  2. Logarithm Master Rule: (Derivative of Inside \(\div\) Inside \(\div\) \(\ln(\text{Base})\)) \[\mathbf{\frac{d}{dx}\left[\log_b f(x)\right] = \frac{f'(x)}{\ln(b) \cdot f(x)}}\] (When \(b = e\), \(\ln(e) = 1\) automatically drops out: \(\frac{d}{dx}[\ln f(x)] = \frac{f'(x)}{f(x)}\) β€” the relative rate of change of \(f\)!)

2. Complete Mathematical Derivations & Reference Guide

2.1 Logarithmic Differentiation β€” Taming Monster Products & Variable Exponents (\(x^x\))

What if you must differentiate \(y = x^x\), or a messy 4-term fraction like \(y = \frac{(x+1)^5\sqrt{x^2+3}}{(2x-7)^4}\)? Taking \(\ln(\cdot)\) first turns multiplication into addition, division into subtraction, and exponents into coefficients: \[\ln y = x\ln x \implies \frac{y'}{y} = 1\cdot\ln x + x\cdot\frac{1}{x} = \ln x + 1 \implies \mathbf{y' = x^x(\ln x + 1)}\]

2.2 Master Exponential & Logarithm Derivatives Table

Function Exact Derivative Special Case / Engineering Note
\(e^{f(x)}\) \(f'(x)\,e^{f(x)}\) \(b=e \implies \ln e = 1\); e.g., \(d/dt(e^{-t/\tau}) = -\frac{1}{\tau}e^{-t/\tau}\)
\(b^{f(x)}\) \(f'(x)\,\ln(b)\,b^{f(x)}\) Arbitrary base (\(2^t, 10^t\)) adds factor \(\ln b\)
\(\ln|f(x)|\) \(\frac{f'(x)}{f(x)}\) Notice constants multiply inside vanish: \(\ln(5x) \implies \frac{5}{5x} = \frac{1}{x}\)!
\(\log_b f(x)\) \(\frac{f'(x)}{\ln(b)\,f(x)}\) Decibels & pH scale slopes carry \(1/\ln(10)\)
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. Underdamped Vehicle Suspension Ring-Down & Polymer Relaxation

We read Week09_Underdamped_Suspension_and_Polymer_Relaxation_Data.csv, tracking an automotive strut hitting a curb bump (\(y(t) = A e^{-\zeta\omega_n t}\cos(\omega_d t)\)) alongside polymer stress-relaxation modulus \(E(t)\) decay. Notice how differentiating \(e^{-\zeta\omega_n t}\cos(\omega_d t)\) via Product + Exponential + Trig rules captures velocity reversals accurately!

df = load_week_csv("Week09_Underdamped_Suspension_and_Polymer_Relaxation_Data.csv")
print("Week 09 Underdamped Suspension Data (first 6 rows):")
print(df.head(6).to_string(index=False))

t_d = df["Time_s"].values
y_mm = df["Suspension_Disp_mm"].values
v_num = np.gradient(y_mm, t_d)
# Exact Product-Rule velocity from parameters sigma=1.8 s^-1, wd=12.0 rad/s, A=40 mm
sig_d, wd, A_d = 1.8, 12.0, 40.0
v_exact = -A_d * np.exp(-sig_d * t_d) * (sig_d * np.cos(wd * t_d) + wd * np.sin(wd * t_d))
print(f"\n[Max Velocity Comparison] Analytical Peak |v| = {np.max(np.abs(v_exact)):.1f} mm/s")
print(f"[Polymer Relaxation Rate] Initial stress decay dE/dt(0) = {df['Polymer_Modulus_MPa'].iloc[1]-df['Polymer_Modulus_MPa'].iloc[0]:.2f} MPa per time step")

fig, (ax1, ax2) = plt.subplots(1, 2, figsize=(11.8, 4.3))
tf = np.linspace(0, t_d.max(), 400)
env = A_d * np.exp(-sig_d * tf)
ax1.plot(tf, A_d * np.exp(-sig_d * tf) * np.cos(wd * tf), "-", color="#0284c7", lw=2.0, label="Damped Response $y(t)$")
ax1.plot(tf, env, "--", color="#dc2626", lw=1.4, label=r"Decay Envelope $\pm A e^{-\sigma t}$")
ax1.plot(tf, -env, "--", color="#dc2626", lw=1.4)
ax1.plot(t_d, y_mm, "ko", ms=3.5, label="Measured Telemetry")
ax1.set_title("Quarter-Car Strut Curb Ring-Down $y(t)$")
ax1.set_xlabel("Time $t$ [s]")
ax1.set_ylabel("Displacement [mm]")
ax1.legend(fontsize=8.2)

ax2.plot(df["Time_s"], df["Polymer_Modulus_MPa"], "s-", color="#059669", lw=2.0, label="Measured Modulus $E(t)$")
ax2.set_title("Viscoelastic Polymer Stress Relaxation Modulus")
ax2.set_xlabel("Time $t$ [s]")
ax2.set_ylabel("Relaxation Modulus $E(t)$ [MPa]")
ax2.legend(fontsize=8.6)

plt.tight_layout()
plt.show()
# Verified Output:
Week 09 Underdamped Suspension Data (first 6 rows):
 Time_s  Suspension_Disp_mm  Polymer_Modulus_MPa
  0.000              40.000                90.00
  0.075              21.724                81.33
  0.150              -6.938                73.77
  0.225             -24.120                67.17
  0.300             -20.903                61.41
  0.375              -4.293                56.39

[Max Velocity Comparison] Analytical Peak |v| = 367.6 mm/s
[Polymer Relaxation Rate] Initial stress decay dE/dt(0) = -8.67 MPa per time step
Week 09 Engineering Plot

4. Three Unabridged Worked Engineering Problems

Worked Example 1 β€” Applying Both 3-Factor Master Rules (\(b^{f(x)}\) and \(\log_b f(x)\))

Problem: Differentiate \(y(x) = 3^{\sin(2x)}\) and \(g(x) = \log_{10}(x^2 + 5x + 1)\) cleanly.

Unabridged Hand Solution:

  1. Exponential (\(3^{\sin(2x)}\)): Three factors: copy (\(3^{\sin 2x}\)) \(\times\) derivative of exponent (\(2\cos 2x\)) \(\times\) \(\ln(\text{base})\) (\(\ln 3\)): \[y'(x) = \mathbf{2\ln(3)\cos(2x)\,3^{\sin(2x)}}\]

  2. Base-10 Logarithm (\(\log_{10}(x^2+5x+1)\)): \(\frac{f'(x)}{\ln(b) f(x)}\): \[g'(x) = \mathbf{\frac{2x + 5}{\ln(10)\,(x^2 + 5x + 1)}}\]


Worked Example 2 β€” Product + Chain Velocity & First Peak Time of Damped Shock Absorber

Problem: A motorcycle shock oscillates as \(y(t) = 0.040\,e^{-2.0t}\cos(10t)\ [\text{m}]\). Find velocity \(v(t) = dy/dt\) and the exact first rebound time \(t_1 > 0\) where velocity momentarily vanishes (\(v(t_1) = 0\)).

Unabridged Hand Solution:

  1. Product Rule (\(f = 0.040\,e^{-2t}\), \(g = \cos(10t)\)): \[v(t) = 0.040\left[-2e^{-2t}\cos(10t) + e^{-2t}(-10\sin(10t))\right] = \mathbf{-0.040\,e^{-2t}\left(2\cos(10t) + 10\sin(10t)\right)}\]

  2. Set \(v(t_1) = 0\): since \(e^{-2t}\) is never zero, only the bracket vanishes: \[10\sin(10t_1) = -2\cos(10t_1) \implies \tan(10t_1) = -0.2\] The smallest positive solution adds \(\pi\) to \(\arctan(-0.2) = -0.1974\text{ rad}\): \[10t_1 = \pi - 0.19740 = 2.9442\text{ rad} \implies \mathbf{t_1 = 0.2944\text{ s}}\]


Worked Example 3 β€” Logarithmic Differentiation on a Complex Fluid Coefficient

Problem: Find \(f'(x)\) for \(f(x) = \frac{x^3\sqrt{2x+1}}{e^{4x}(x+2)^5}\) using logarithmic differentiation instead of triple Product + Quotient gymnastics.

Unabridged Hand Solution:

  1. Take \(\ln\) of both sides to split products/powers into sums: \[\ln f(x) = 3\ln x + \frac{1}{2}\ln(2x+1) - 4x - 5\ln(x+2)\]

  2. Differentiate each simple piece cleanly: \[\frac{f'(x)}{f(x)} = \frac{3}{x} + \frac{1}{2}\cdot\frac{2}{2x+1} - 4 - \frac{5}{x+2} = \frac{3}{x} + \frac{1}{2x+1} - 4 - \frac{5}{x+2}\]

  3. Multiply back by original \(f(x)\): \[f'(x) = \mathbf{\frac{x^3\sqrt{2x+1}}{e^{4x}(x+2)^5}\left(\frac{3}{x} + \frac{1}{2x+1} - 4 - \frac{5}{x+2}\right)}\]

x_s, t_s = sp.symbols("x t", real=True, positive=True)
y1_sym = 3**sp.sin(2*x_s)
g1_sym = sp.log(x_s**2 + 5*x_s + 1, 10)
print("[Example 1] d/dx(3^sin(2x)) =", sp.diff(y1_sym, x_s))
print("[Example 1] d/dx(log10(...)) =", sp.diff(g1_sym, x_s))
t1_rebound = (np.pi + np.arctan(-0.2)) / 10.0
print(f"[Example 2] First damped shock rebound turning time = {t1_rebound:.4f} s")
f3 = (x_s**3 * sp.sqrt(2*x_s + 1)) / (sp.exp(4*x_s) * (x_s + 2)**5)
rel_rate = sp.simplify(sp.diff(f3, x_s) / f3)
print("[Example 3] Relative rate f'(x)/f(x) check at x=1:", float(rel_rate.subs(x_s, 1.0)), "vs direct:", 3 + 1/3 - 4 - 5/3)
# Verified Output:
[Example 1] d/dx(3^sin(2x)) = 2*3**sin(2*x)*log(3)*cos(2*x)
[Example 1] d/dx(log10(...)) = (2*x + 5)/((x**2 + 5*x + 1)*log(10))
[Example 2] First damped shock rebound turning time = 0.2944 s
[Example 3] Relative rate f'(x)/f(x) check at x=1: -2.333333333333333 vs direct: -2.333333333333333

5. Engineering Practice Problems (Self-Study Exercises)

Practice Problem 1 β€” The Classic Constant-Scaling Trap in \(\ln(kx)\)

Why do \(\ln(x)\) and \(\ln(500x)\) have the exact same derivative? Verify using both the Chain Rule and the logarithm product property!

πŸ” Click to View Complete Step-by-Step Solution
  1. Chain Rule: \(\frac{d}{dx}[\ln(500x)] = \frac{1}{500x}\cdot 500 = \mathbf{\frac{1}{x}}\).
  2. Logarithm Law: \(\ln(500x) = \ln(500) + \ln(x)\). Since \(\ln(500)\) is a pure constant, its derivative is \(0\), leaving \(\mathbf{\frac{1}{x}}\)!

Practice Problem 2 β€” Differentiating \(y = x^{\sqrt{x}}\)

Using logarithmic differentiation, compute \(y'(x)\) for \(y = x^{\sqrt{x}}\) (\(x > 0\)).

πŸ” Click to View Complete Step-by-Step Solution
  1. \(\ln y = \sqrt{x}\ln x\).
  2. Product Rule: \(\frac{y'}{y} = \frac{1}{2\sqrt{x}}\ln x + \sqrt{x}\cdot\frac{1}{x} = \frac{\ln x + 2}{2\sqrt{x}}\).
  3. Multiply by \(y\): \(\mathbf{y'(x) = x^{\sqrt{x}}\left(\frac{\ln x + 2}{2\sqrt{x}}\right)}\).

Practice Problem 3 β€” Surge Transient Current Peak (\(i(t) = C t e^{-at}\))

Current in an inductor surge test follows \(i(t) = 12\,t\,e^{-5t}\ [\text{A}]\) (\(t \geq 0\)). Find \(i'(t)\) and compute the exact time \(t_{\text{peak}}\) and peak current \(i_{\max}\).

πŸ” Click to View Complete Step-by-Step Solution
  1. Product Rule: \(i'(t) = 12\left(1\cdot e^{-5t} + t(-5 e^{-5t})\right) = \mathbf{12\,e^{-5t}(1 - 5t)}\).
  2. Set \(i'(t) = 0\): since \(e^{-5t} > 0\), \(1 - 5t = 0 \implies \mathbf{t_{\text{peak}} = 0.20\text{ s}}\).
  3. Peak current: \(i(0.20) = 12(0.20)e^{-1} = \frac{2.4}{e} = \mathbf{0.8829\text{ A}}\).

Practice Problem 4 β€” Battery Decibel Roll-Off Derivative

An amplifier voltage gain (in dB) is \(G(\omega) = 20\log_{10}\!\left(\frac{1}{\sqrt{1+\omega^2}}\right) = -10\log_{10}(1 + \omega^2)\). Compute the roll-off sensitivity \(\frac{dG}{d\omega}\) at \(\omega = 1.0\text{ rad/s}\)!

πŸ” Click to View Complete Step-by-Step Solution
  1. Logarithm Master Rule: \(G'(\omega) = -10\,\frac{2\omega}{\ln(10)\,(1+\omega^2)} = -\frac{20\omega}{\ln(10)(1+\omega^2)}\).
  2. At \(\omega = 1.0\): \(G'(1) = -\frac{20}{2\ln(10)} = -\frac{10}{2.302585} = \mathbf{-4.343\text{ dB/(rad/s)}}\).

References

🎬 Visual Intuition Animation β€” Davis Master Exponential Grid