Langevin Function: Accurate Evaluation
The Langevin function arises frequently in the mathematical physics of electromagnetism. It is an entire function, defined by a simple formula:
L(x) = coth(x) - 1/x ,
with a limiting value of 0 at x=0.
The function is mathematically well conditioned, but the defining formula is not well suited for numerical evaluation for 'x' close to 0. A rapidly converging, and numerically stable, continued-fraction approximation is utlized instead for 0<|x|<1.
Numerical benchmarking suggests that the double-precision relative accuracy is roughly 15 decimal digits over all of -inf<x<inf.
Cite As
Chuck Gartland (2025). Langevin Function: Accurate Evaluation (https://se.mathworks.com/matlabcentral/fileexchange/38405-langevin-function-accurate-evaluation), MATLAB Central File Exchange. Retrieved .
MATLAB Release Compatibility
Platform Compatibility
Windows macOS LinuxCategories
Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!Discover Live Editor
Create scripts with code, output, and formatted text in a single executable document.
| Version | Published | Release Notes | |
|---|---|---|---|
| 1.0.0.0 | 
