math-wave
Analytical solutions for wave and Helmholtz equations.
Installation
Add to your Cargo.toml:
[]
= { = "../math-wave" }
Features
- 1D solutions: Plane waves, standing waves, damped waves
- 2D solutions: Cylinder scattering (Bessel/Hankel series)
- 3D solutions: Sphere scattering (Mie theory)
- Special functions: Spherical Bessel/Hankel, Legendre polynomials
- Green's functions: Helmholtz kernel and derivatives
Usage
1D Plane Wave
use plane_wave_1d;
use PI;
let wave = plane_wave_1d;
assert_eq!;
3D Sphere Scattering
use sphere_scattering_3d;
use PI;
let scatter = sphere_scattering_3d;
assert!;
Green's Functions
The Helmholtz Green's function for 3D:
G(x, y) = exp(ik|x-y|) / (4π|x-y|)
For 2D (cylindrical):
G(x, y) = (i/4) H₀⁽¹⁾(k|x-y|)
Modules
analytical- Exact solutions for validation (1D, 2D, 3D)greens- Green's function implementationsspecial- Spherical Bessel, Hankel, and Legendre functions
Key Types
Point
Represents a point in 1D, 2D, or 3D space with coordinate conversions:
use Point;
let p = new_3d;
let r = p.radius;
let theta = p.theta_3d;
AnalyticalSolution
Contains solution data with error computation:
use AnalyticalSolution;
let l2_err = solution.l2_error;
let linf_err = solution.linf_error;
let rel_err = solution.relative_l2_error;
Use Cases
- Validating BEM (Boundary Element Method) solvers
- Validating FEM (Finite Element Method) solvers
- Reference solutions for convergence studies
- Test data generation for numerical methods