Lesson 10 of 18
Laplacian
The Laplacian
The Laplacian of is the sum of its second-order partial derivatives:
It measures how much differs from its average in the neighborhood of a point.
Computing Second Derivatives Numerically
Using central differences twice:
Applications
The Laplacian appears throughout physics and engineering:
- Heat equation: (how temperature diffuses)
- Wave equation:
- Electrostatics: in free space (Laplace's equation)
- Image processing: edge detection (Laplacian filter)
Interpretation
- at a point: is below its local average (like a bowl)
- at a point: is above its local average (like a hill)
- : harmonic function — a steady-state distribution
Example
For :
- everywhere
For :
- (harmonic!)
Your Task
Implement double laplacian_2d(double (*f)(double, double), double x, double y, double h) using the central difference formulas for second derivatives.
TCC compiler loading...
Loading...
Click "Run" to execute your code.