Week 13 โ Definite Integrals & The Fundamental Theorem of Calculus
Engineering Focus: Nonlinear Spring & Gas
Expansion Work (\(W = \int P\,dV\)),
Daily Solar Energy Yield (\(\int
G\,dt\)), Signed Displacement vs.ย Total Odometer Distance &
Running-Total Derivatives (\(\frac{d}{dx}\int_a^x f(t)dt = f(x)\))
Companion Dataset:
Week13_Gas_Turbine_PV_Indicator_and_Solar_Irradiance_Data.csv
1. โCalculus Made Easyโ Intuition: Adding Up Thin Strips = Subtraction of Endpoints!
Suppose you want the exact area under a bumpy pressure-volume curve \(P(V)\) between volume \(V_1 = a\) and volume \(V_2 = b\)โor the total solar watt-hours landing on a roof from sunrise to sunset!
- Slice the floor \([a, b]\) into thousands of razor-thin vertical strips, each of width \(dx\) and height \(f(x)\).
- Each single strip has tiny area \(dA = f(x)\,dx\). (In physics, pressure \(\times\) tiny volume nudge \(P\,dV = dW\) is one tiny piston stroke of mechanical work!).
- Adding every tiny strip from \(a\) to \(b\) (a Riemann Sum as \(dx \to 0\)) defines the Definite Integral \(\int_a^b f(x)\,dx\).
The Greatest Miracle in Mathematics (The Fundamental Theorem of Calculus)
Adding up a million razor-thin rectangles by hand sounds exhausting. Here is why Newton and Leibniz changed the world: you do NOT need to add a single rectangle!
Imagine a running-total counter \(F(x)\) recording how much energy (or distance) has accumulated so far up to position \(x\). Whenever \(x\) ticks forward by tiny \(dx\), the counter gains one new strip \(f(x)\,dx\), which means \(\frac{dF}{dx} = f(x)\) โ \(F(x)\) is literally an anti-derivative of \(f(x)\)! Therefore, the total gain from start \(a\) to finish \(b\) is simply: \[\mathbf{\int_a^b f(x)\,dx = F(b) - F(a)}\] Look! The annoying \(+C\) from last week cancels out completely (\([F(b)+C] - [F(a)+C] = F(b)-F(a)\))!
2. Complete Mathematical Derivations & Reference Guide
2.1 Critical Trap: Signed Net Change vs.ย Total Positive Area / Distance
Because a definite integral adds heights \(f(x)\) with their plus/minus signs:
- Area above the axis counts positive; area below the axis counts negative!
- Net Displacement: \(\Delta s = \int_{t_1}^{t_2} v(t)\,dt\) (moving \(10\text{ m}\) forward then \(10\text{ m}\) backward gives net \(\Delta s = 0\)!).
- Total Odometer Distance / Fuel Burned: Always integrate the magnitude \(|v(t)|\) by splitting at zero-crossings where \(v(t) = 0\): \[\text{Total Distance} = \int_{t_1}^{t_2} |v(t)|\,dt\]
2.2 Master Definite Integral Properties
| Property / Theorem | Exact Equation | Engineering Use |
|---|---|---|
| FTC Evaluation | \(\int_a^b f(x)\,dx = F(b) - F(a)\) | Exact work \(W\), impulse \(J\), heat \(\Delta H\) |
| FTC Derivative (Part I) | \(\frac{d}{dx}\int_a^x f(t)\,dt = f(x)\) | Rate of energy accumulation equals instant flux |
| Average Value Theorem | \(f_{\text{avg}} = \frac{1}{b-a}\int_a^b f(x)\,dx\) | Mean power, RMS signal baseline, mean temp |
| Reversing Limits | \(\int_b^a f(x)\,dx = -\int_a^b f(x)\,dx\) | Compression (\(V_2 < V_1 \implies W < 0\)) vs.ย Expansion |
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. Piston Indicator PโV Work & Daily Solar Irradiance Integration
We load
Week13_Gas_Turbine_PV_Indicator_and_Solar_Irradiance_Data.csv,
integrating real gas-expansion \(P(V)\)
data to compute mechanical piston work (\(W =
\int P\,dV\ [\text{kJ}]\)) alongside clear-sky solar flux \(G(t)\) to obtain daily solar insolation
(\(\text{MJ/m}^2\) and \(\text{kWh/m}^2\)).
df = load_week_csv("Week13_Gas_Turbine_PV_Indicator_and_Solar_Irradiance_Data.csv")
print("Week 13 P-V Work & Solar Irradiance Data (first 6 rows):")
print(df.head(6).to_string(index=False))
V_m3 = df["Volume_V_m3"].values
P_kpa = df["Pressure_P_kPa"].values
W_trapz_kJ = np.trapz(P_kpa, V_m3)
# Polytropic analytical check: P*V^1.3 = const = P0*V0^1.3
n_poly = 1.3
C_poly = P_kpa[0] * (V_m3[0]**n_poly)
W_exact_kJ = C_poly * (V_m3[-1]**(1 - n_poly) - V_m3[0]**(1 - n_poly)) / (1 - n_poly)
t_hr = df["Solar_Hour_h"].values
G_Wm2 = df["Solar_Flux_G_W_m2"].values
E_kWh_m2 = np.trapz(G_Wm2, t_hr) / 1000.0
E_MJ_m2 = E_kWh_m2 * 3.6
print(f"\n[PV Work Integral] Trapezoidal = {W_trapz_kJ:.2f} kJ vs Exact FTC Polytropic = {W_exact_kJ:.2f} kJ")
print(f"[Daily Solar Yield] Integral G(t) dt = {E_kWh_m2:.3f} kWh/m^2 ({E_MJ_m2:.2f} MJ/m^2)")
fig, (ax1, ax2) = plt.subplots(1, 2, figsize=(11.8, 4.3))
ax1.plot(V_m3 * 1e3, P_kpa, "o-", color="#dc2626", lw=2.0, label="Measured Indicator $P(V)$")
ax1.fill_between(V_m3 * 1e3, 0, P_kpa, color="#dc2626", alpha=0.20, label=f"Work $W = {W_trapz_kJ:.1f}$ kJ")
ax1.set_title("Polytropic Gas Expansion Work $W = \\int P\\,dV$")
ax1.set_xlabel("Cylinder Volume $V$ [Liters]")
ax1.set_ylabel("Gas Pressure $P$ [kPa]")
ax1.legend(fontsize=8.4)
ax2.plot(t_hr, G_Wm2, "s-", color="#d97706", lw=2.0, label="Measured Irradiance $G(t)$")
ax2.fill_between(t_hr, 0, G_Wm2, color="#d97706", alpha=0.22, label=f"Daily Yield = {E_kWh_m2:.2f} kWh/m$^2$")
ax2.set_title("Cumulative Daily Solar Energy $\\int G(t)\\,dt$")
ax2.set_xlabel("Solar Time [hr]")
ax2.set_ylabel("Irradiance [W/m$^2$]")
ax2.legend(fontsize=8.4)
plt.tight_layout()
plt.show()# Verified Output:
Week 13 P-V Work & Solar Irradiance Data (first 6 rows):
Volume_V_m3 Pressure_P_kPa Solar_Hour_h Solar_Flux_G_W_m2
0.0500 850.00 6.00 0.0
0.0625 635.97 6.75 135.1
0.0750 501.76 7.50 303.2
0.0875 410.65 8.25 474.2
0.1000 345.21 9.00 633.4
0.1125 296.20 9.75 769.3
[PV Work Integral] Trapezoidal = 54.53 kJ vs Exact FTC Polytropic = 54.25 kJ
[Daily Solar Yield] Integral G(t) dt = 6.909 kWh/m^2 (24.87 MJ/m^2)
4. Three Unabridged Worked Engineering Problems
Worked Example 1 โ Nonlinear Bumper Spring Work (\(W = \int_a^b F(x)\,dx\))
Problem: A heavy railcar elastomeric bumper resists compression \(x\) (m) with nonlinear stiffening force \(F(x) = 40{,}000\,x + 600{,}000\,x^3\ [\text{N}]\). Apply the FTC to compute total mechanical work absorbed compressing from \(x_1 = 0\text{ m}\) to \(x_2 = 0.20\text{ m}\).
Unabridged Hand Solution:
Set up the work definite integral: \[W = \int_0^{0.20}\left(40{,}000\,x + 600{,}000\,x^3\right)dx\]
Antiderivative: \(F(x) = 20{,}000\,x^2 + 150{,}000\,x^4\).
Evaluate \(F(0.20) - F(0)\): \[W = \left[20{,}000(0.04) + 150{,}000(0.0016)\right] - 0 = 800 + 240 = \mathbf{1{,}040\text{ J} = 1.04\text{ kJ}}\]
Worked Example 2 โ Signed Net Displacement vs.ย Total Travelled Distance
Problem: A linear shuttle actuator follows velocity \(v(t) = t^2 - 4t + 3\ [\text{m/s}]\) over \(t \in [0, 4]\text{ s}\). Compute (a) net displacement \(\int_0^4 v(t)\,dt\) and (b) total distance \(\int_0^4 |v(t)|\,dt\).
Unabridged Hand Solution:
Net Displacement: Antiderivative \(s(t) = \frac{t^3}{3} - 2t^2 + 3t\): \[\Delta s = s(4) - s(0) = \left(\frac{64}{3} - 32 + 12\right) - 0 = \frac{4}{3} = \mathbf{1.333\text{ m}}\]
Find where shuttle reverses direction (\(v(t) = 0\)): \[t^2 - 4t + 3 = (t - 1)(t - 3) = 0 \implies t = 1\text{ s},\ t = 3\text{ s}\] Notice \(v > 0\) on \([0,1]\) and \([3,4]\), while \(v < 0\) (moving backward!) on \([1,3]\)!
Evaluate cumulative pieces cleanly:
- On \([0, 1]\): \(s(1) - s(0) = (\frac{1}{3} - 2 + 3) - 0 = +\frac{4}{3}\text{ m}\)
- On \([1, 3]\): \(s(3) - s(1) = (9 - 18 + 9) - \frac{4}{3} = -\frac{4}{3}\text{ m}\)
- On \([3, 4]\): \(s(4) - s(3) = \frac{4}{3} - 0 = +\frac{4}{3}\text{ m}\)
Total Odometer Distance \(= \left|+\frac{4}{3}\right| + \left|-\frac{4}{3}\right| + \left|+\frac{4}{3}\right| = \mathbf{4.000\text{ m}}\)! (\(3\times\) bigger than net displacement!).
Worked Example 3 โ FTC Part I: Instantaneous Growth of a Running Energy Integral
Problem: Total thermal energy stored up to time \(x\) is \(E(x) = \int_2^{x^2} \frac{\sin(t)}{t}\,dt\) (impossible to integrate in elementary formulas!). Find \(\frac{dE}{dx}\) directly without integrating!
Unabridged Hand Solution: By FTC Part I combined with the Chain Rule on the upper limit \(u = x^2\): \[\frac{dE}{dx} = \frac{\sin(x^2)}{x^2}\cdot \frac{d}{dx}(x^2) = \frac{\sin(x^2)}{x^2}\cdot 2x = \mathbf{\frac{2\sin(x^2)}{x}}\]
t_s, x_s = sp.symbols("t x", real=True)
W_ex1 = float(sp.integrate(40000*x_s + 600000*x_s**3, (x_s, 0, 0.20)))
v_ex2 = t_s**2 - 4*t_s + 3
ds_net = float(sp.integrate(v_ex2, (t_s, 0, 4)))
ds_tot = float(sp.integrate(sp.Abs(v_ex2), (t_s, 0, 4)))
print(f"[Example 1] Bumper Spring Work = {W_ex1:.1f} J ({W_ex1/1e3:.2f} kJ)")
print(f"[Example 2] Net displacement = {ds_net:.4f} m | Total odometer distance = {ds_tot:.4f} m")
E_sym = sp.Integral(sp.sin(t_s)/t_s, (t_s, 2, x_s**2))
print("[Example 3] d/dx Integral =", sp.simplify(E_sym.diff(x_s)))# Verified Output:
[Example 1] Bumper Spring Work = 1040.0 J (1.04 kJ)
[Example 2] Net displacement = 1.3333 m | Total odometer distance = 4.0000 m
[Example 3] d/dx Integral = 2*sin(x**2)/x
5. Engineering Practice Problems (Self-Study Exercises)
Practice Problem 1 โ Average Value of a Half-Sine Pulse Current
A half-wave rectifier delivers current \(I(t) = 10\sin(\pi t)\ [\text{A}]\) for \(0 \leq t \leq 1\text{ s}\). Compute the total charge transferred \(Q = \int_0^1 I(t)\,dt\) and average DC current \(I_{\text{avg}}\).
๐ Click to View Complete Step-by-Step Solution
- \(Q = \int_0^1 10\sin(\pi t)\,dt = \left[-\frac{10}{\pi}\cos(\pi t)\right]_0^1 = -\frac{10}{\pi}(-1 - 1) = \mathbf{\frac{20}{\pi} \approx 6.366\text{ Coulombs}}\).
- Average over \(1 - 0 = 1\text{ s}\): \(I_{\text{avg}} = \mathbf{6.366\text{ A}}\) (\(2/\pi\) times peak!).
Practice Problem 2 โ Thermodynamic Polytropic Piston Work
Gas expands from \(V_1 = 0.10\text{ m}^3\) to \(V_2 = 0.40\text{ m}^3\) following \(P(V) = \frac{100}{V^2}\ [\text{kPa}]\). Compute exact work \(W = \int_{V_1}^{V_2} P(V)\,dV\) in \(\text{kJ}\).
๐ Click to View Complete Step-by-Step Solution
- \(W = \int_{0.10}^{0.40} 100\,V^{-2}\,dV = \left[-\frac{100}{V}\right]_{0.10}^{0.40} = (-250) - (-1000) = \mathbf{750\text{ kJ}}\).
Practice Problem 3 โ Variable Flow Tank Fill Volume (\(R(t) = 2 + 3e^{-0.5t}\))
Coolant drains into a sump at rate \(q(t) = 2 + 3e^{-0.5t}\ [\text{L/min}]\) during \(0 \leq t \leq 4\text{ min}\). Compute total liters accumulated.
๐ Click to View Complete Step-by-Step Solution
- \(V = \int_0^4 (2 + 3e^{-0.5t})\,dt = \left[2t - 6e^{-0.5t}\right]_0^4 = (8 - 6e^{-2}) - (0 - 6) = 14 - 6(0.13534) = \mathbf{13.188\text{ Liters}}\).
Practice Problem 4 โ Zero Net Work Symmetry (\([-a, +a]\) Odd Integrals)
Without doing any antiderivative algebra, explain why \(\int_{-\pi}^{\pi} x^3 \cos(5x)\,dx = 0\)!
๐ Click to View Complete Step-by-Step Solution
Notice \(x^3\) is odd (\(f(-x)=-f(x)\)) and \(\cos(5x)\) is even (\(g(-x)=+g(x)\)), so their product \(x^3\cos(5x)\) is strictly odd! Over any symmetric interval \([-a, +a]\), the negative left side cancels the positive right side identically to \(\mathbf{0}\)!
References
- Thompson, S. P. (1914). Calculus Made Easy (Ch. 18โ19: Finding Areas by Integrating). Macmillan.