📐 Week 06 (Part II: Limits & Derivative Rules) • Student Lecture Materials
🐍 Download Notebook (.ipynb) 📑 Download Blank Slides (PDF) 📊 Download Dataset (.csv)

Week 06 — Product & Quotient Rules (Coupled Engineering Systems)

Engineering Focus: Electric-Vehicle Shaft Power \(P(t) = \tau(t)\omega(t)\), Compressible Nozzle Mass Flow & Engine/Gearbox Efficiency Ratios \(\eta = f/g\) Companion Dataset: Week06_EV_Traction_Motor_Dyno_Sweep_Data.csv


1. “Calculus Made Easy” Intuition: Why \((fg)' \neq f' g'\)!

Here is the single biggest trap beginners walk into: they guess that the derivative of \(f\cdot g\) should simply be \(f'\cdot g'\). Why is that wrong?! Let us check dimensions AND geometry in 10 seconds!

Imagine a steel sheet whose width \(f\) grows by \(df\), while height \(g\) simultaneously grows by \(dg\):

Look at why the units prove \((fg)' = f'g'\) would be garbage: if \(f\) is Torque (\(\text{N}\cdot\text{m}\)) and \(g\) is Speed (\(\text{rad/s}\)), then shaft power is \(P = \tau\omega\) (\(\text{W}\)), and power climb rate \(\frac{dP}{dt}\) has units \(\mathbf{W/s}\)! Both \(\tau\dot{\omega}\) and \(\dot{\tau}\omega\) equal \(\text{W/s}\)—whereas \(\dot{\tau}\dot{\omega}\) gives \(\text{N}\cdot\text{m}/\text{s}^2\), totally wrong units!

And the Quotient Rule? Just Read “Low d-High Minus High d-Low”!

Write \(Q = \frac{f}{g} \implies f = Q\cdot g\). Differentiate using our shiny new Product Rule: \[f' = Q' g + Q g' \implies Q' g = f' - \frac{f}{g} g' = \frac{g f' - f g'}{g}\] Divide by \(g\) and you instantaneously prove the Quotient Rule: \[\mathbf{\frac{d}{dx}\left[\frac{f(x)}{g(x)}\right] = \frac{g(x)f'(x) - f(x)g'(x)}{[g(x)]^2}}\]

2. Complete Mathematical Derivations & Reference Guide

2.1 Triple Product Rule (Compressible Fluid Flow \(\dot{m} = \rho A v\))

In jet engines and wind tunnels, density \(\rho(t)\), nozzle area \(A(t)\), and flow speed \(v(t)\) can all vary simultaneously! Applying the Product Rule twice reveals a beautifully symmetric rule: \[\frac{d}{dt}(\rho A v) = \dot{\rho}Av + \rho\dot{A}v + \rho A\dot{v}\] Even better—divide every term by \(\dot{m} = \rho A v\) to discover relative percentage rates add cleanly: \[\mathbf{\frac{d\dot{m}}{\dot{m}} = \frac{d\rho}{\rho} + \frac{dA}{A} + \frac{dv}{v}}\] (Example: if air density climbs \(+2\%\), throat opens \(+3\%\), and velocity speeds up \(+1\%\), mass flow increases \(+2+3+1 = \mathbf{+6\%}\)!)

2.2 When to Avoid the Quotient Rule!

Before jumping straight into \(\frac{g f' - f g'}{g^2}\), ask: “Is the denominator just a single number (\(c\)), or just \(x^k\)?”

Rule Name Exact Formula Quick Memory / Dimensional Sanity Check
Product Rule \((fg)' = f g' + g f'\) Two edge strips: hold 1st \(\times\) diff 2nd \(+\) hold 2nd \(\times\) diff 1st
Triple Product Rule \((fgh)' = f'gh + fg'h + fgh'\) One derivative per term added together
Relative Rate Form \(\frac{(fg)'}{fg} = \frac{f'}{f} + \frac{g'}{g}\) Percentage growth rates simply add!
Quotient Rule \(\left(\frac{f}{g}\right)' = \frac{g f' - f g'}{g^2}\) “Low d-High minus High d-Low, square the bottom and away we go!”
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. EV Traction Motor Dynamometer Dataset Analysis

We inspect Week06_EV_Traction_Motor_Dyno_Sweep_Data.csv, logging torque \(\tau(t)\) and angular speed \(\omega(t)\) during a vehicle acceleration run. Notice how motor torque starts tapering off (field weakening) even as speed rises—creating a tug-of-war between \(+\tau\dot{\omega}\) (positive spin-up) and \(+\dot{\tau}\omega\) (negative torque droop) in total shaft power \(P(t) = \tau\omega\)!

df = load_week_csv("Week06_EV_Traction_Motor_Dyno_Sweep_Data.csv")
print("Week 06 EV Traction Motor Dyno Sweep (first 6 rows):")
print(df.head(6).to_string(index=False))

t_d = df["Time_s"].values
tau_d = df["Torque_Nm"].values
w_d = df["Angular_Speed_rad_s"].values
P_kw = (tau_d * w_d) / 1000.0
# Numerical central derivative of coupled P(t) vs Product Rule decomposition
dP_dt_direct = np.gradient(P_kw, t_d)
dtau_dt = np.gradient(tau_d, t_d)
dw_dt = np.gradient(w_d, t_d)
dP_dt_prod = (dtau_dt * w_d + tau_d * dw_dt) / 1000.0
max_check = np.max(np.abs(dP_dt_direct - dP_dt_prod))
print(f"\n[Product Rule Check] Max discrepancy between d(tau*w)/dt and tau'*w + tau*w' = {max_check:.3e} kW/s")
print(f"[Peak Shaft Power] P_max = {P_kw.max():.2f} kW")

fig, (ax1, ax2) = plt.subplots(1, 2, figsize=(11.8, 4.3))
ax1.plot(t_d, P_kw, "o-", color="#0284c7", lw=2.0, label=r"Shaft Power $P(t) = \tau\omega$ [kW]")
ax1.set_title("EV Traction Motor Power Curve $P(t) = \\tau(t)\\omega(t)$")
ax1.set_xlabel("Time $t$ [s]")
ax1.set_ylabel("Power $P$ [kW]")
ax1.legend(fontsize=8.6)

ax2.plot(t_d, dtau_dt * w_d / 1000.0, "s--", color="#dc2626", lw=1.8, label=r"Torque-Droop Term $\dot{\tau}\omega$")
ax2.plot(t_d, tau_d * dw_dt / 1000.0, "^--", color="#059669", lw=1.8, label=r"Spin-Up Term $\tau\dot{\omega}$")
ax2.plot(t_d, dP_dt_prod, "k-", lw=2.2, label=r"Total Rate $\dot{P}(t) = \dot{\tau}\omega + \tau\dot{\omega}$")
ax2.axhline(0, color="#64748b", lw=1.0)
ax2.set_title("Product-Rule Decomposition of $\\dot{P}(t)$ [kW/s]")
ax2.set_xlabel("Time $t$ [s]")
ax2.set_ylabel("Power Rate [kW/s]")
ax2.legend(fontsize=8.0)

plt.tight_layout()
plt.show()
# Verified Output:
Week 06 EV Traction Motor Dyno Sweep (first 6 rows):
 Time_s  Torque_Nm  Angular_Speed_rad_s
  0.000     320.00                25.00
  0.625     319.14                54.57
  1.250     316.56                83.28
  1.875     312.27               111.13
  2.500     306.25               138.12
  3.125     298.52               164.26

[Product Rule Check] Max discrepancy between d(tau*w)/dt and tau'*w + tau*w' = 7.110e-01 kW/s
[Peak Shaft Power] P_max = 66.01 kW
Week 06 Engineering Plot

4. Three Unabridged Worked Engineering Problems

Worked Example 1 — Product Rule for Instantaneous Shaft Power Rate

Problem: During launch at \(t = 2.0\text{ s}\), an electric vehicle motor produces torque \(\tau(t) = 180 - 4t^2\ [\text{N}\cdot\text{m}]\) while spinning at \(\omega(t) = 50t + 10\ [\text{rad/s}]\). Apply the Product Rule to compute the exact shaft power growth rate \(\dot{P}(t)\) at \(t = 2.0\text{ s}\), and express the answer in both \(\text{W/s}\) and \(\text{kW/s}\).

Unabridged Hand Solution:

  1. Individual derivatives first: \[\dot{\tau}(t) = -8t, \qquad \dot{\omega}(t) = 50\] At \(t = 2.0\text{ s}\): \(\tau(2) = 180 - 16 = 164\text{ N}\cdot\text{m}\), \(\dot{\tau}(2) = -16\text{ N}\cdot\text{m/s}\), \(\omega(2) = 110\text{ rad/s}\), \(\dot{\omega}(2) = 50\text{ rad/s}^2\).

  2. Product Rule assembly (\(\dot{P} = \dot{\tau}\omega + \tau\dot{\omega}\)): \[\dot{P}(2) = (-16)(110) + (164)(50) = -1{,}760 + 8{,}200 = \mathbf{+6{,}440\text{ W/s} = +6.44\text{ kW/s}}\] Notice how torque is already dipping (\(-1.76\text{ kW/s}\)), yet fast acceleration (\(+8.20\text{ kW/s}\)) keeps total power climbing cleanly!


Worked Example 2 — Quotient Rule for Maximum-Power Circuit Load Efficiency

Problem: A battery of fixed internal resistance \(r = 2.0\ \Omega\) feeds an adjustable load resistance \(R\). The fraction of power delivered to the load versus total power generated is \(\eta(R) = \frac{R}{R + r}\), while actual load power is \(P_L(R) = V_0^2 \frac{R}{(R+r)^2}\). Differentiate \(\eta(R)\) and \(P_L(R)\) using the Quotient Rule and find where \(P_L'(R) = 0\) (Jacobi’s Maximum Power Transfer Theorem!).

Unabridged Hand Solution:

  1. Differentiate Efficiency \(\eta(R) = \frac{R}{R+r}\): \[\eta'(R) = \frac{(R+r)(1) - R(1)}{(R+r)^2} = \mathbf{\frac{r}{(R+r)^2} > 0}\] (Efficiency strictly increases with larger load resistance \(R\)!)

  2. Differentiate Power \(P_L(R) = V_0^2 \frac{R}{(R+r)^2}\): Using Product/Chain for the denominator’s derivative \(\frac{d}{dR}(R+r)^2 = 2(R+r)\): \[P_L'(R) = V_0^2 \frac{(R+r)^2(1) - R\cdot 2(R+r)}{(R+r)^4} = V_0^2 \frac{(R+r) - 2R}{(R+r)^3} = \mathbf{V_0^2 \frac{r - R}{(R+r)^3}}\]

  3. Set \(P_L'(R) = 0\): Numerator vanishes at \(\mathbf{R = r = 2.0\ \Omega}\) (matched impedance gives peak power, at exactly \(50\%\) efficiency!).


Worked Example 3 — Triple Product Rule for Supersonic Wind-Tunnel Mass Flow

Problem: At an instant when a wind tunnel’s density \(\rho = 1.20\text{ kg/m}^3\) rises at \(\dot{\rho} = +0.06\text{ kg/(m}^3\cdot\text{s)}\), nozzle area \(A = 0.50\text{ m}^2\) widens at \(\dot{A} = -0.01\text{ m}^2/\text{s}\), and flow speed \(v = 100\text{ m/s}\) accelerates at \(\dot{v} = +4.0\text{ m/s}^2\), find \(\dot{m}\) and \(\frac{d\dot{m}}{dt}\).

Unabridged Hand Solution:

  1. Instantaneous mass flow: \(\dot{m} = \rho A v = 1.20 \times 0.50 \times 100 = \mathbf{60.0\text{ kg/s}}\).
  2. Use the relative rate law \(\frac{d\dot{m}/\dot{m}}{dt} = \frac{\dot{\rho}}{\rho} + \frac{\dot{A}}{A} + \frac{\dot{v}}{v}\): \[\frac{\dot{\rho}}{\rho} = \frac{+0.06}{1.20} = +0.05\text{ s}^{-1},\quad \frac{\dot{A}}{A} = \frac{-0.01}{0.50} = -0.02\text{ s}^{-1},\quad \frac{\dot{v}}{v} = \frac{+4.0}{100} = +0.04\text{ s}^{-1}\] Sum \(= 0.05 - 0.02 + 0.04 = +0.07\text{ s}^{-1}\). Multiply by \(\dot{m} = 60.0\text{ kg/s}\): \[\frac{d\dot{m}}{dt} = 60.0 \times (+0.07) = \mathbf{+4.20\text{ kg/s}^2}\]
# SymPy Verification of Worked Examples 1, 2, 3
t_s, R_s, r_s, V0_s = sp.symbols("t R r V0", positive=True)
P_shaft = (180 - 4*t_s**2) * (50*t_s + 10)
dP_at_2 = float(sp.diff(P_shaft, t_s).subs(t_s, 2.0))

P_load = V0_s**2 * R_s / ((R_s + r_s)**2)
dP_dR = sp.factor(sp.diff(P_load, R_s))
m_dot_rate = 0.06*0.5*100 + 1.2*(-0.01)*100 + 1.2*0.5*4.0

print(f"[Example 1] Exact dP/dt(2.0 s) = {dP_at_2:.1f} W/s ({dP_at_2/1e3:.2f} kW/s)")
print(f"[Example 2] Exact dP_L/dR = {dP_dR} (zero at R = r)")
print(f"[Example 3] Triple Product d(rho*A*v)/dt = {m_dot_rate:.2f} kg/s^2")
# Verified Output:
[Example 1] Exact dP/dt(2.0 s) = 6440.0 W/s (6.44 kW/s)
[Example 2] Exact dP_L/dR = V0**2*(-R + r)/(R + r)**3 (zero at R = r)
[Example 3] Triple Product d(rho*A*v)/dt = 4.20 kg/s^2

5. Engineering Practice Problems (Self-Study Exercises)

Practice Problem 1 — Polynomial \(\times\) Power vs. Quotient Shortcut

Differentiate \(y(x) = (x^2 + 3x)(4\sqrt{x} - 5)\) using the Product Rule, and simplify your answer into clean powers of \(x\).

🔍 Click to View Complete Step-by-Step Solution
  1. Let \(f = x^2 + 3x\) (\(f' = 2x + 3\)) and \(g = 4x^{1/2} - 5\) (\(g' = 2x^{-1/2}\)).

  2. Product Rule: \[y'(x) = (x^2 + 3x)(2x^{-1/2}) + (4x^{1/2} - 5)(2x + 3)\]

  3. Distribute and combine like fractional powers: \[= (2x^{3/2} + 6x^{1/2}) + (8x^{3/2} + 12x^{1/2} - 10x - 15) = \mathbf{10x^{3/2} + 18x^{1/2} - 10x - 15}\]


Practice Problem 2 — Rational Compressor Temperature Ratio

The isentropic temperature ratio across a compressor stage behaves near a calibration point as \(y(x) = \frac{2x + 3}{x^2 + 1}\). Apply the Quotient Rule to find \(y'(x)\) and determine at which two \(x\)-values \(y'(x) = 0\).

🔍 Click to View Complete Step-by-Step Solution
  1. Numerator \(f = 2x + 3\) (\(f' = 2\)); Denominator \(g = x^2 + 1\) (\(g' = 2x\)).

  2. Quotient Rule: \[y'(x) = \frac{(x^2+1)(2) - (2x+3)(2x)}{(x^2+1)^2} = \frac{2x^2 + 2 - 4x^2 - 6x}{(x^2+1)^2} = \mathbf{\frac{-2x^2 - 6x + 2}{(x^2+1)^2}}\]

  3. Set numerator to \(0\): \(x^2 + 3x - 1 = 0 \implies \mathbf{x = \frac{-3 \pm \sqrt{13}}{2}} \approx 0.303,\ -3.303\).


Practice Problem 3 — Coupled Battery Discharge Current & Voltage

A drone LiPo battery terminal voltage sags as \(V(t) = 25.2 - 0.15t\ [\text{V}]\) while current demand climbs as \(I(t) = 18 + 0.8t\ [\text{A}]\). Compute the initial power \(P(0)\) and initial rate of power change \(\dot{P}(0)\).

🔍 Click to View Complete Step-by-Step Solution
  1. At \(t = 0\): \(V(0) = 25.2\text{ V}\), \(\dot{V}(0) = -0.15\text{ V/s}\), \(I(0) = 18\text{ A}\), \(\dot{I}(0) = +0.8\text{ A/s}\).
  2. \(P(0) = 25.2 \times 18 = \mathbf{453.6\text{ W}}\).
  3. Product Rule: \[\dot{P}(0) = \dot{V}(0)I(0) + V(0)\dot{I}(0) = (-0.15)(18) + (25.2)(0.8) = -2.70 + 20.16 = \mathbf{+17.46\text{ W/s}}\]

Practice Problem 4 — Ideal-Gas Pressure Sensitivity via Product & Quotient

For \(P(T, V) = \frac{n R T}{V}\), suppose gas in a piston warms at \(\frac{dT}{dt} = +20\text{ K/s}\) while volume expands at \(\frac{dV}{dt} = +0.02\text{ m}^3/\text{s}\) from \(T = 400\text{ K}\), \(V = 0.20\text{ m}^3\), and \(P = 300\text{ kPa}\). Find \(\frac{dP}{dt}\) using the Quotient Rule!

🔍 Click to View Complete Step-by-Step Solution
  1. Treat \(nRT\) as numerator (\(nR\dot{T}\)) and \(V\) as denominator (\(\dot{V}\)): \[\frac{dP}{dt} = \frac{V(nR\dot{T}) - (nRT)\dot{V}}{V^2} = P\left(\frac{\dot{T}}{T} - \frac{\dot{V}}{V}\right)\]

  2. Plug in fractional rates: \(\frac{\dot{T}}{T} = \frac{+20}{400} = +0.05\text{ s}^{-1}\) and \(\frac{\dot{V}}{V} = \frac{+0.02}{0.20} = +0.10\text{ s}^{-1}\).

  3. Subtract: \(\frac{dP}{dt} = 300\text{ kPa}\times(0.05 - 0.10) = \mathbf{-15.0\text{ kPa/s}}\) (expansion wins over heating!).

References

🎬 Visual Intuition Animation — Expanding Product Rule Rectangle