📐 Week 10 (Part III: Transcendental Calculus & Optimization) • Student Lecture Materials
🐍 Download Notebook (.ipynb) 📑 Download Blank Slides (PDF) 📊 Download Dataset (.csv)

Week 10 — Higher Derivatives, Concavity & Engineering Optimization

Engineering Focus: Minimum-Material Cylindrical Pressure Vessels, Optimal Box Stampings, Centrifugal Pump Best-Efficiency Point (BEP) & Inflection Snap Thresholds Companion Dataset: Week10_Pressure_Vessel_Cost_and_Pump_Efficiency_Data.csv


1. “Calculus Made Easy” Intuition: Hilltops, Valleys & Bending Shape (\(f''\))

In engineering design, we almost never want just any answer—we want the best answer: minimum fuel weight, minimum fabrication cost, or maximum beam strength. How does calculus pinpoint peaks and valleys with 100% precision?

Picture walking across a smooth rolling hillside \(y = f(x)\):

  1. Wherever the path is climbing, slope \(f'(x) > 0\). Wherever it drops, \(f'(x) < 0\).
  2. Right at the very top of a hilltop or very bottom of a valley, your feet must level out flat for an instant: \(\mathbf{f'(x^*) = 0}\) (or occasionally a sharp cusp where \(f'\) doesn’t exist)! Engineers call \(x^*\) a critical point.

How Do We Tell a Peak (Maximum) from a Valley (Minimum) Without Plotting?

Ask what happens to the slope \(f'(x)\) as you walk across the flat point \(x^*\) from left to right! That slope of the slope is the second derivative \(f''(x) = \frac{d^2 y}{dx^2}\):

2. Complete Mathematical Derivations & Reference Guide

2.1 Four-Step Blueprint for Every Engineering Optimization Problem

Never fumble around blindly when given a word problem! Follow these four steps every time:

  1. Draw & Define Variables: Name the dimensions clearly with SI units.
  2. Write Constraint Equation & Isolate Objective Function \(J(x)\): Eliminate extra variables using the fixed requirement (like fixed volume \(V = \pi r^2 h = \text{const}\) or fixed material perimeter) so the cost/power function \(J(x)\) depends on one single variable \(x\)!
  3. Solve Critical Condition \(J'(x^*) = 0\) & Check Domain Endpoints: If \(x\) lives on a closed bounded box \([a, b]\), compare all critical points inside \((a, b)\) and both endpoints \(a, b\)!
  4. Prove Minimum vs. Maximum via \(J''(x^*) \lessgtr 0\): Confirm the physical sign of the second derivative!
Sign Check Curve Geometry Verdict at \(x^*\) (\(f'(x^*)=0\)) Engineering Target
\(f''(x^*) > 0\) Concave Up (\(\cup\) Cup) Strict Local Minimum Minimum metal mass, minimum cost, minimum drag
\(f''(x^*) < 0\) Concave Down (\(\cap\) Cap) Strict Local Maximum Maximum stiffness, maximum power, maximum volume
\(f''\) switches \(\pm\) Curvature changes sign Inflection Point Zero-bending-moment hinge point in a beam
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. Cylindrical Pressure Vessel Cost & Pump BEP Optimization Analysis

We load Week10_Pressure_Vessel_Cost_and_Pump_Efficiency_Data.csv, inspecting total fabrication cost (\(C(r) = c_{\text{ends}}(2\pi r^2) + c_{\text{wall}}(2\pi r h)\) at fixed volume \(V = 2.0\text{ m}^3\)) and a centrifugal pump efficiency curve across flow rate \(Q\). Calculus pinpoints the exact optimum where \(C'(r) = 0\) and \(\eta'(Q) = 0\)!

df = load_week_csv("Week10_Pressure_Vessel_Cost_and_Pump_Efficiency_Data.csv")
print("Week 10 Vessel Cost & Pump Efficiency Data (first 6 rows):")
print(df.head(6).to_string(index=False))

# Find discrete & analytical minimum of Vessel Cost C(r)
idx_min = df["Total_Vessel_Cost_USD"].idxmin()
r_data_min = df.loc[idx_min, "Radius_r_m"]
c_data_min = df.loc[idx_min, "Total_Vessel_Cost_USD"]
idx_bep = df["Pump_Efficiency_Pct"].idxmax()
Q_bep = df.loc[idx_bep, "Pump_Flow_Q_L_min"]
eta_bep = df.loc[idx_bep, "Pump_Efficiency_Pct"]
print(f"\n[Vessel Cost Optimization] Optimal radius ~ {r_data_min:.3f} m -> Min Cost = ${c_data_min:.2f}")
print(f"[Pump Best-Efficiency Point] Max eta = {eta_bep:.1f}% at Q = {Q_bep:.0f} L/min")

fig, (ax1, ax2) = plt.subplots(1, 2, figsize=(11.8, 4.3))
ax1.plot(df["Radius_r_m"], df["Total_Vessel_Cost_USD"], "o-", color="#0284c7", lw=2.0, label="Total Fabrication Cost $C(r)$")
ax1.scatter([r_data_min], [c_data_min], color="#dc2626", s=70, zorder=5, label=f"Min Cost r={r_data_min:.2f} m ($C''>0$)")
ax1.set_title("Cylindrical Pressure Vessel Optimization ($V = 2.0$ m$^3$)")
ax1.set_xlabel("Tank Radius $r$ [m]")
ax1.set_ylabel("Total Cost $C(r)$ [USD]")
ax1.legend(fontsize=8.4)

ax2.plot(df["Pump_Flow_Q_L_min"], df["Pump_Efficiency_Pct"], "s-", color="#059669", lw=2.0, label="Pump Efficiency $\\eta(Q)$")
ax2.scatter([Q_bep], [eta_bep], color="#dc2626", s=70, zorder=5, label=f"BEP Q={Q_bep:.0f} L/min ($\\eta''<0$)")
ax2.set_title("Centrifugal Pump Best-Efficiency Point ($\\eta'(Q) = 0$)")
ax2.set_xlabel("Volumetric Flow Rate $Q$ [L/min]")
ax2.set_ylabel("Efficiency $\\eta$ [%]")
ax2.legend(fontsize=8.4)

plt.tight_layout()
plt.show()
# Verified Output:
Week 10 Vessel Cost & Pump Efficiency Data (first 6 rows):
 Radius_r_m  Total_Vessel_Cost_USD  Pump_Flow_Q_L_min  Pump_Efficiency_Pct
       0.35                2243.27               50.0                -7.12
       0.40                2102.23               75.0                12.00
       0.45                2027.72              100.0                28.88
       0.50                2003.73              125.0                43.50
       0.55                2020.10              150.0                55.88
       0.60                2070.02              175.0                66.00

[Vessel Cost Optimization] Optimal radius ~ 0.500 m -> Min Cost = $2003.73
[Pump Best-Efficiency Point] Max eta = 84.0% at Q = 275 L/min
Week 10 Engineering Plot

4. Three Unabridged Worked Engineering Problems

Worked Example 1 — Classic Minimum-Surface Cylindrical Fuel Tank (\(V = 1000\text{ L} = 1.0\text{ m}^3\))

Problem: You must fabricate a closed cylindrical sheet-metal fuel tank holding fixed volume \(V = 1.0\text{ m}^3\). Find the radius \(r\) and height \(h\) (and prove the universal aspect ratio \(h/D = 1\)) that minimizes total sheet metal area \(S = 2\pi r^2 + 2\pi r h\).

Unabridged Hand Solution:

  1. Constraint: \(V = \pi r^2 h \implies h = \frac{V}{\pi r^2}\).

  2. Single-variable objective \(S(r)\): \[S(r) = 2\pi r^2 + 2\pi r\left(\frac{V}{\pi r^2}\right) = 2\pi r^2 + \frac{2V}{r}\]

  3. Critical point (\(S'(r) = 0\)): \[S'(r) = 4\pi r - \frac{2V}{r^2} = 0 \implies 4\pi r^3 = 2V \implies \mathbf{r^* = \left(\frac{V}{2\pi}\right)^{1/3}}\]

  4. Find optimal \(h^*\) & aspect ratio: Substitute \(V = 2\pi (r^*)^3\) into \(h = V / (\pi r^2)\): \[h^* = \frac{2\pi (r^*)^3}{\pi (r^*)^2} = \mathbf{2r^* = D^*}\] (Every minimum-surface closed soda can or silo has height equal to its diameter \(h = 2r\)!)

  5. Second-derivative proof & \(V = 1.0\text{ m}^3\) numbers: \(S''(r) = 4\pi + \frac{4V}{r^3} > 0\) for all \(r > 0 \implies\) guaranteed strict global minimum! With \(V = 1.0\): \(r^* = (1/(2\pi))^{1/3} = \mathbf{0.5419\text{ m}}\), \(h^* = \mathbf{1.0839\text{ m}}\), \(S_{\min} = \mathbf{5.5358\text{ m}^2}\).


Worked Example 2 — Maximizing Volume of a Stamped Open-Top Electronics Chassis

Problem: A flat rectangular aluminum blank (\(W = 300\text{ mm} \times L = 200\text{ mm}\)) has identical square corners of side \(x\) sheared out and folded up into an open-top cooling box of volume \(V(x) = x(300 - 2x)(200 - 2x)\). Determine the fold height \(x^*\) maximizing box volume and verify \(V''(x^*) < 0\).

Unabridged Hand Solution:

  1. Valid physical domain: all dimensions positive \(\implies 0 < x < 100\text{ mm}\).

  2. Expand \(V(x)\) carefully: \[V(x) = x\left(60{,}000 - 1000x + 4x^2\right) = 4x^3 - 1000x^2 + 60{,}000x\]

  3. Set \(V'(x) = 0\): \[V'(x) = 12x^2 - 2000x + 60{,}000 = 0 \implies 3x^2 - 500x + 15{,}000 = 0\]

  4. Quadratic formula: \[x = \frac{500 \pm \sqrt{250{,}000 - 180{,}000}}{6} = \frac{500 \pm 264.575}{6} \implies x_1 = 127.43\text{ mm (invalid!)},\quad \mathbf{x^* = 39.24\text{ mm}}\]

  5. Confirm maximum via \(V''\): \(V''(x) = 24x - 2000 \implies V''(39.24) = 941.7 - 2000 = -1058.3 < 0\) (strict Maximum!), giving \(V_{\max} = \mathbf{1.0563\times 10^6\text{ mm}^3 = 1.056\text{ L}}\).


Worked Example 3 — Optimal Cylindrical Vessel with Reinforced Thick End Caps

Problem: Suppose the two flat circular end-caps cost \(2.5\times\) more per square meter than the rolled cylindrical sidewall (\(c_{\text{ends}} = 2.5\,c_{\text{wall}}\)) for fixed volume \(V = 2.0\text{ m}^3\). Show how the optimal \(h^*/D^*\) ratio changes!

Unabridged Hand Solution:

  1. Cost objective: \(C(r) = 2.5(2\pi r^2) + 1.0\left(\frac{2V}{r}\right) = 5\pi r^2 + \frac{2V}{r}\).
  2. Differentiate & set zero: \(C'(r) = 10\pi r - \frac{2V}{r^2} = 0 \implies V = 5\pi r^3\).
  3. Optimal height: \(h^* = \frac{V}{\pi r^2} = 5r^* \implies \mathbf{h^*/D^* = 2.5}\) (expensive end-caps favor taller, skinnier tanks!).
r_s, x_s = sp.symbols("r x", real=True, positive=True)
V_ex1 = 1.0
S_expr = 2*sp.pi*r_s**2 + 2*V_ex1/r_s
r_opt = float(sp.solve(sp.diff(S_expr, r_s), r_s)[0].evalf())
print(f"[Example 1] r* = {r_opt:.4f} m, h* = {2*r_opt:.4f} m, S_min = {float(S_expr.subs(r_s, r_opt)):.4f} m^2")

V_box = x_s * (300 - 2*x_s) * (200 - 2*x_s)
roots_box = [float(rt.evalf()) for rt in sp.solve(sp.diff(V_box, x_s), x_s) if 0 < float(rt.evalf()) < 100]
x_opt = roots_box[0]
print(f"[Example 2] Fold x* = {x_opt:.2f} mm -> Max V = {float(V_box.subs(x_s, x_opt))/1e6:.4f} L, V'' = {float(sp.diff(V_box, x_s, 2).subs(x_s, x_opt)):.1f} < 0")

r_ves = (2.0 / (5.0 * np.pi))**(1.0/3.0)
print(f"[Example 3] Reinforced ends V=2 m^3 -> r* = {r_ves:.4f} m, h* = {5*r_ves:.4f} m (h/D = 2.50)")
# Verified Output:
[Example 1] r* = 0.5419 m, h* = 1.0839 m, S_min = 5.5358 m^2
[Example 2] Fold x* = 39.24 mm -> Max V = 1.0563 L, V'' = -1058.3 < 0
[Example 3] Reinforced ends V=2 m^3 -> r* = 0.5031 m, h* = 2.5154 m (h/D = 2.50)

5. Engineering Practice Problems (Self-Study Exercises)

Practice Problem 1 — Optimal Wood-Beam Rectangular Cross-Section for Stiffness

Bending strength (section modulus) of a rectangular timber beam cut from a circular log of diameter \(D = 400\text{ mm}\) scales with \(S = k\,b\,h^2\), where \(b^2 + h^2 = D^2\). Find width \(b\) and depth \(h\) maximizing \(b\,h^2\)!

🔍 Click to View Complete Step-by-Step Solution
  1. Substitute \(h^2 = D^2 - b^2\) directly into \(f(b) = b(D^2 - b^2) = D^2 b - b^3\).
  2. Set \(f'(b) = D^2 - 3b^2 = 0 \implies \mathbf{b = \frac{D}{\sqrt{3}} = 230.9\text{ mm}}\).
  3. Then \(h = \sqrt{D^2 - D^2/3} = D\sqrt{\frac{2}{3}} = \mathbf{326.6\text{ mm}}\) (tall beams with depth \(\sqrt{2}\times\) width maximize bending strength!).

Practice Problem 2 — Snell’s Optical Law via Fermat’s Minimum-Time Optimization

Light travels from water point \((0, a)\) at speed \(v_1\) across \(x\)-interface to air point \((d, -b)\) at speed \(v_2\). Total travel time is \(T(x) = \frac{\sqrt{x^2+a^2}}{v_1} + \frac{\sqrt{(d-x)^2+b^2}}{v_2}\). Differentiate \(T'(x) = 0\) to prove Snell’s Law \(\frac{\sin\theta_1}{v_1} = \frac{\sin\theta_2}{v_2}\)!

🔍 Click to View Complete Step-by-Step Solution
  1. Using \((\sqrt{u})' = u'/(2\sqrt{u})\): \[T'(x) = \frac{x}{v_1\sqrt{x^2+a^2}} - \frac{d-x}{v_2\sqrt{(d-x)^2+b^2}} = 0\]

  2. Recognize geometry: \(\sin\theta_1 = \frac{x}{\sqrt{x^2+a^2}}\) and \(\sin\theta_2 = \frac{d-x}{\sqrt{(d-x)^2+b^2}}\)!

  3. Therefore \(\mathbf{\frac{\sin\theta_1}{v_1} = \frac{\sin\theta_2}{v_2}}\) (Snell’s Law is pure Calculus I optimization!).


Practice Problem 3 — Economic Pipe-Insulation Thickness vs. Heat-Loss Cost

Annual pipe insulation + energy cost is \(C(t) = 18\,t + \frac{72}{t + 1}\ [\text{USD/m}]\), where \(t \geq 0\) is thickness in cm. Compute optimal thickness \(t^*\) minimizing annual cost and check \(C''(t^*) > 0\).

🔍 Click to View Complete Step-by-Step Solution
  1. \(C'(t) = 18 - \frac{72}{(t+1)^2} = 0 \implies (t+1)^2 = \frac{72}{18} = 4\).
  2. Since \(t \geq 0\), take positive root: \(t + 1 = 2 \implies \mathbf{t^* = 1.0\text{ cm}}\).
  3. Check curvature: \(C''(t) = \frac{144}{(t+1)^3} > 0 \implies\) minimum cost \(C(1) = 18 + 36 = \mathbf{\$54\text{ USD/m}}\)!

Practice Problem 4 — Finding Inflection Point of a Sigmoidal Logistic Reliability Curve

System failure fraction follows \(F(t) = \frac{1}{1 + e^{-k(t - t_0)}}\). Show that maximum instantaneous failure rate (\(F''(t) = 0\)) occurs exactly at half-life \(t = t_0\).

🔍 Click to View Complete Step-by-Step Solution
  1. Let \(u = -k(t-t_0)\). First derivative: \(F'(t) = k\,F(t)\,[1 - F(t)]\).
  2. Differentiate again via Product/Chain Rule: \(F''(t) = k\,F'(t)\,[1 - 2F(t)]\).
  3. Since \(k > 0\) and \(F'(t) > 0\), \(F'' = 0\) exclusively when \(F(t) = \frac{1}{2}\), which happens at \(e^{-k(t-t_0)} = 1 \implies \mathbf{t = t_0}\)!

References

🎬 Visual Intuition Animation — Davis Optimization And Concavity