Mathematics / Crank-Nicolson Heat PDE
FREE TO EXPLORE
LABORATORY 36 · MATHEMATICS

Crank-Nicolson Heat PDE lab report

A worked crank-nicolson heat pde lab report with iteration data tables, logarithmic graphs, calculations, uncertainty and conclusions.

WORKED EXAMPLE · BENCHMARK OBSERVATIONS

A complete example laboratory report.

Simulated demonstration data.

This report illustrates formal numerical analysis, iteration tracking, and convergence rate extraction. Replace its observations with your own computational telemetry when preparing a practical submission.

Student: __________________Student ID: __________________Course: __________________Date: __________________Partner: __________________Instructor: __________________

1. Title and aim

Heat Equation Parabolic PDE: Crank-Nicolson Unconditional Stability. Implement the implicit Crank-Nicolson scheme for the one-dimensional unsteady heat conduction PDE ∂u/∂t = α ∂²u/∂x², demonstrate unconditional numerical stability, and verify second-order temporal and spatial convergence O(Δt² + Δx²).

2. Abstract

Six computational trials were executed across standardized inputs Step = 1.0 to Step = 6.0 for Heat Equation Parabolic PDE: Crank-Nicolson Unconditional Stability. An ordinary least-squares regression yielded an empirical Crank-Nicolson Convergence Order (α) of 2.000 order (difference from theoretical reference = 0.0000%). The empirical telemetry conclusively validates the theoretical model and complexity scaling with R² = 1.000000.

3. Apparatus and fixed settings

4. Theory and graph choice

The mathematical modeling of diffusive transport—from transient thermal conduction in aerospace heat shields to chemical solute dispersion and financial option pricing via the Black-Scholes PDE—is governed by parabolic partial differential equations. Discretizing the heat equation ∂u/∂t = α ∂²u/∂x² with explicit forward differences leads to severe numerical instability: the time step must satisfy the crippling Courant-type condition r = α Δt / Δx² ≤ 1/2, forcing billions of tiny time steps on fine meshes. In 1947, British mathematicians John Crank and Phyllis Nicolson devised an elegant implicit formulation that averages spatial derivatives at time levels n and n + 1. By centering the stencil at t_{n+1/2}, Crank-Nicolson achieves unconditional von Neumann stability (|G| ≤ 1 for all r) and second-order accuracy O(Δt² + Δx²). In this laboratory, we implement the Crank-Nicolson scheme, invert the tridiagonal system via the Thomas algorithm, and verify the second-order O(h²) error convergence.

ln(E_max) = α · ln(h) + ln(C)

The mathematical regression linearizes the relationship into the form y = mx + b. Here, the independent variable x represents Logarithmic Mesh Spacing ln(h), and the dependent variable y represents Logarithmic Global Error ln(E_max). The slope m directly extracts Crank-Nicolson Convergence Order (α), while the intercept b accounts for residual baseline offsets.

5. Method

  1. Set up ∂u/∂t = ∂²u/∂x² on [0, π] with initial condition u(x, 0) = sin(x) and exact solution u(x, t) = e^{-t} sin(x).
  2. For test levels k = 1 to 6, set spatial grid spacing h = Δx = 0.20 / 2^{k-1} and time step Δt proportional to h.
  3. Construct tridiagonal matrices with diagonal 1 + r and off-diagonals -r/2 on the left, and diagonal 1 - r and off-diagonals r/2 on the right.
  4. At each time step t_n → t_{n+1}, multiply current state by right matrix and solve tridiagonal system via the Thomas algorithm.
  5. At final time t = 0.5, compute absolute errors |u(x_i, 0.5) - u_i^N| across all nodes and extract supremum error E_max.
  6. Plot ln(E_max) versus ln(h) and compute the linear regression gradient to verify α = 2.000 with R² = 1.000000.

6. Observations and calculation table

All iterative observations use strictly controlled 64-bit IEEE 754 precision buffers. Residuals are computed relative to the ordinary least-squares regression line.

Table 1. Six simulated observations; x and y represent transformed mathematical metrics.
No.Grid Spacing Level (k) (step)Global PDE Solution Error ||u - u_exact||_∞ (error norm)Logarithmic Mesh Spacing ln(h)Logarithmic Global Error ln(E_max)Fitted yResidual
11.00.008926-1.6094-4.7188-4.71880.0000
22.00.002231-2.3026-6.1052-6.10520.0000
33.00.000558-2.9957-7.4914-7.49140.0000
44.00.000139-3.6889-8.8778-8.87780.0000
55.03.5e-05-4.3820-10.2640-10.26400.0000
66.09e-06-5.0752-11.6504-11.65040.0000

Download the sample observations (CSV) ↓

7. Worked calculation for one observation

For step k = 1.0: Logarithmic mesh coordinate x = ln(h) = -1.6094. Logarithmic error y = ln(E) = α · ln(h) + ln(C) = -4.7188. Empirical error: 0.008926.

8. Graph, gradient and final calculation

-12.69-5.49-10.44-4.42-8.18-3.34-5.93-2.27-3.68-1.19Logarithmic Mesh Spacing ln(h)Logarithmic Global Error ln(E_max)

Circular markers represent empirical computational observations. The solid line represents the ordinary least-squares linear fit.

x̄ = -3.34230; ȳ = -8.18460
Σ(x − x̄)² = 8.40810
Σ(x − x̄)(y − ȳ) = 16.81620
m = Σ(x − x̄)(y − ȳ) / Σ(x − x̄)² = 2.00000000
b = ȳ − mx̄ = -1.50000000
ln(E) = 2.0000 · ln(h) + -1.5000 ⟹ α = 2.000 (theoretical α = 2.0)

9. Uncertainty and comparison

Percentage difference = |estimate − theoretical value| / |theoretical value| × 100 = 0.0000%.

For n = 6 observations, Σresidual² = 0.00000; s² = Σresidual²/(n − 2). Gradient standard error = √[s²/Σ(x − x̄)²] = 0.00000. Intercept standard error = √[s²(1/n + x̄²/Σ(x − x̄)²)] = 0.00000.

Propagating the fit parameters yields a fit standard error of 1.0000e-04 order, with an ideal coefficient of determination R² = 1.000000.

In computational mathematics and numerical analysis, errors arise from algorithmic discretization, finite precision IEEE 754 floating-point arithmetic (machine epsilon ε_mach ≈ 2.22 × 10⁻¹⁶ for 64-bit double precision), and condition number propagation. The ordinary least-squares fit across n = 6 standardized observations provides standard errors for the gradient and intercept. Because the mathematical recurrence is evaluated with high numerical precision, the residual sum of squares is vanishingly small, yielding a coefficient of determination R² ≥ 0.999999 and confirming the theoretical mathematical model.

10. Result and discussion

Crank-Nicolson Convergence Order (α) = 2.000 order
Theoretical reference value: 2.000 order

The empirical benchmark observations provide rigorous quantitative verification of Heat Equation Parabolic PDE: Crank-Nicolson Unconditional Stability. In numerical analysis, scientific computing, and computational mathematics, algorithms are characterized by their asymptotic operational scaling, stability, and convergence rates. Across all six observations, the empirical slope m = 2.0000 confirms the theoretical model with near-zero residual variance. Furthermore, comparison with alternative algorithmic paradigms underscores critical trade-offs between memory footprint, condition number sensitivity, and operational throughput. The algorithm's behavior confirms the mathematical predictions established by numerical analysis literature.

11. Precautions and limitations

While Crank-Nicolson is A-stable, it is not L-stable: it does not damp stiff high-frequency error components as rapidly as backward Euler or BDF2. The simulation executes the implicit Crank-Nicolson scheme across coupled mesh spacings h = 0.20 / 2^{k-1} on the thermal diffusion PDE ∂u/∂t = ∂²u/∂x². The maximum error is measured against the exact fundamental Fourier mode u(x, t) = e^{-t} sin(x). The logarithmic regression ln(E) = α·ln(h) + ln(C) extracts the asymptotic order α = 2.000 with R² = 1.000000.

12. Conclusion

This computational laboratory investigation quantitatively verified the mathematical formulation and asymptotic scaling of Heat Equation Parabolic PDE: Crank-Nicolson Unconditional Stability. Through rigorous tracking across six observation points, we confirmed an empirical Crank-Nicolson Convergence Order (α) of 2.000 order matching the theoretical reference 2.000 order within 0.0000% error. The investigation demonstrates why this method serves as an indispensable tool in modern computational science.