Separation of Variables
Topic:
advanced.pde.separation_of_variables
Separation of Variables is the fundamental technique for solving linear second-order partial differential equations (PDEs) with boundary conditions. It transforms the PDE into multiple ordinary differential equations (ODEs) that can be solved independently.
Mathematical Definition
Core Assumption: For PDE with two independent variables and :
For three variables (e.g., Laplace in 2D):
The Separation Process:
- Substitute product form into PDE
- Separate variables (all -terms on one side, all -terms on other)
- Both sides equal same constant (separation constant )
- Solve resulting ODEs
- Apply boundary conditions to find eigenvalues
- Construct general solution as superposition
Separation of Variables
Separation of Variables is the fundamental technique for solving linear second-order partial differential equations (PDEs) with boundary conditions. It transforms the PDE into multiple ordinary differential equations (ODEs) that can be solved independently.
Quick Overview
Applies to: Linear second-order PDEs with separable boundary conditions Equation types: Heat equation, wave equation, Laplace equation Key idea: Assume solution is a product of functions, each depending on only one variable MathHook implementation: Used internally by Heat, Wave, and Laplace solvers
Mathematical Foundation
Core Assumption
For a PDE with two independent variables and , assume:
For three variables (e.g., Laplace in 2D):
Crucial requirement: The PDE must be linear (otherwise product form doesn't work)
The Separation Process
Step 1: Substitute product form into PDE
Step 2: Separate variables (all -terms on one side, all -terms on other)
Step 3: Both sides must equal same constant (the separation constant )
Step 4: Solve resulting ODEs
Step 5: Apply boundary conditions to find eigenvalues
Step 6: Construct general solution as superposition
Complete Examples
Example 1: Heat Equation (1D)
Problem: Solve heat diffusion in a rod of length
PDE:
Boundary conditions: , (fixed temperature at ends)
Initial condition: (initial temperature distribution)
Solution Steps:
1. Assume product solution:
2. Substitute into PDE:
3. Separate variables:
Left side depends only on , right side only on . Both must equal constant :
4. Get two ODEs:
- Spatial ODE:
- Temporal ODE:
5. Apply boundary conditions to spatial ODE:
and give eigenvalues:
Eigenfunctions:
6. Solve temporal ODE:
7. General solution (superposition):
8. Match initial condition:
Fourier coefficients:
Example 2: Wave Equation (1D)
Problem: Vibrating string of length
PDE:
Boundary conditions: , (fixed ends)
Initial conditions: (initial displacement), (initial velocity)
Solution Steps:
1. Assume:
2. Substitute and separate:
3. Spatial ODE (same as heat equation):
Eigenvalues:
Eigenfunctions:
4. Temporal ODE:
Solution (oscillatory):
where
5. General solution:
6. Match initial conditions:
- determines
- determines
Example 3: Laplace Equation (2D Rectangle)
Problem: Steady-state temperature in rectangular plate
PDE:
Domain: ,
Boundary conditions:
- , (left/right edges cold)
- , (bottom cold, top has temperature profile)
Solution Steps:
1. Assume:
2. Substitute and separate:
3. Two ODEs:
4. Apply boundary conditions in :
, give:
5. Solve equation:
(Using )
6. General solution:
7. Match boundary condition at :
Coefficients:
Eigenvalue Problems
Central concept: Separation of variables converts PDEs to eigenvalue problems
Sturm-Liouville form:
with boundary conditions.
Key properties:
- Eigenvalues are real and can be ordered:
- Eigenfunctions are orthogonal (with weight function )
- Eigenfunctions form complete basis (any function can be expanded in them)
Example (Dirichlet BCs on [0,L]):
- Eigenvalues:
- Eigenfunctions:
- Orthogonality: if
Fourier Series Expansion
The general solution is a Fourier series:
where are eigenfunctions.
Coefficients from initial conditions:
where is inner product with weight function.
For on :
⚠️ MathHook Limitation: Currently returns symbolic coefficients (). Numerical evaluation requires symbolic integration (planned for Phase 2).
When Separation of Variables Works
✅ Requirements:
- Linear PDE (otherwise product form invalid)
- Constant coefficients or separable coefficients
- Rectangular domain or simple geometry
- Separable boundary conditions (each BC involves only one variable)
✅ Works for:
- Heat equation
- Wave equation
- Laplace equation
- Schrödinger equation (quantum mechanics)
- Many diffusion/wave problems
❌ Doesn't work for:
- Nonlinear PDEs
- Complex geometries (use finite elements)
- Non-separable boundary conditions
- Time-dependent coefficients
Common Pitfalls
1. Wrong Sign for Separation Constant
Common mistake: Using instead of
Result: Exponential growth instead of sinusoidal eigenfunctions
Fix: Check boundary conditions - usually need sinusoidal solutions
2. Forgetting Homogeneous Boundary Conditions
Separation of variables requires homogeneous BCs ( or at boundaries).
Non-homogeneous BCs: Use change of variables to make homogeneous first.
3. Incomplete Superposition
Mistake: Using only one eigenfunction
Fix: General solution is infinite series (superposition of all eigenfunctions)
Examples
Heat Equation with Separation of Variables
Demonstrates separation of variables for 1D heat diffusion in a rod.
Rust
#![allow(unused)] fn main() { use mathhook::prelude::*; let registry = PDESolverRegistry::new(); let solution = registry.solve(&pde).unwrap(); // Automatically uses separation of variables if applicable // The solver internally: // 1. Assumes u(x,t) = X(x)*T(t) // 2. Separates into spatial and temporal ODEs // 3. Applies BCs to find eigenvalues // 4. Constructs superposition solution }
Python
from mathhook import PDESolverRegistry
registry = PDESolverRegistry()
solution = registry.solve(pde)
# Automatically uses separation of variables if applicable
JavaScript
const { PDESolverRegistry } = require('mathhook');
const registry = new PDESolverRegistry();
const solution = registry.solve(pde);
// Automatically uses separation of variables if applicable
Performance
Time Complexity: O(n) for n eigenvalues/modes
API Reference
- Rust:
mathhook_core::pde::separation_of_variables - Python:
mathhook.pde.separation_of_variables - JavaScript:
mathhook.pde.separationOfVariables