Pulp 1.88.0
Cross-platform audio plugin framework
Loading...
Searching...
No Matches
pulp::signal::chardelay::Langevin Struct Reference

Langevin function L(x) = coth(x) − 1/x and its first two derivatives. More...

#include <hysteresis.hpp>

Static Public Member Functions

static double value (double x) noexcept
static double derivative (double x) noexcept
static double second_derivative (double x) noexcept
static double coth (double x) noexcept
 coth via the sanctioned rational tanh approximation and a reciprocal.

Static Public Attributes

static constexpr double kSeriesLimit = 1.0

Detailed Description

Langevin function L(x) = coth(x) − 1/x and its first two derivatives.

The closed forms are numerically useless for small arguments and the reason is worth stating, because the failure is silent. L is the DIFFERENCE of two terms that both blow up as x → 0: at x = 0.06, coth(x) and 1/x are both about 16.4 and their difference is 0.02, so three significant digits are destroyed by cancellation before any approximation error is considered. L'(x) = 1/x² − coth²(x) + 1 is worse — 268.7 − 269.3 + 1 — and L' is what the Newton solver's Jacobian is built from. Feeding it a rational tanh approximation good to "well under a percent" leaves the derivative with a double-digit percentage error, and Newton stops converging quadratically: measured as the solver hitting its iteration cap at exactly the coercive point of every cycle, which is the steepest and most audible part of the hysteresis loop.

So the series expansion is used wherever cancellation would bite (|x| < 1, where four terms are exact to better than a part in 10^4) and the closed form only above it, where the two terms are well separated and the cheap rational tanh is genuinely sufficient.

Member Function Documentation

◆ coth()

double pulp::signal::chardelay::Langevin::coth ( double x)
inlinestaticnoexcept

coth via the sanctioned rational tanh approximation and a reciprocal.

Only reached for |x| >= kSeriesLimit, where coth and 1/x differ enough that the approximation's error survives the subtraction intact.

◆ derivative()

double pulp::signal::chardelay::Langevin::derivative ( double x)
inlinestaticnoexcept

◆ second_derivative()

double pulp::signal::chardelay::Langevin::second_derivative ( double x)
inlinestaticnoexcept

◆ value()

double pulp::signal::chardelay::Langevin::value ( double x)
inlinestaticnoexcept

Member Data Documentation

◆ kSeriesLimit

double pulp::signal::chardelay::Langevin::kSeriesLimit = 1.0
staticconstexpr

The documentation for this struct was generated from the following file:
  • /home/runner/work/pulp/pulp/core/signal/include/pulp/signal/character_delay/hysteresis.hpp