Function newton_raphson_solve
pub fn newton_raphson_solve<F>(
a: f64,
rp: f64,
v: f64,
max_iter: usize,
tolerance: f64,
v_clamp: Option<(f64, f64)>,
step_limit: Option<f64>,
device_iv: F,
) -> f64Expand description
Unified Newton-Raphson solver for all WDF nonlinear root elements.
Every nonlinear element in the WDF tree solves the same constraint equation:
f(v) = a - 2v - 2·Rp·i(v) = 0
where a is the incident wave, Rp is the port resistance, v is the
voltage across the element, and i(v) is the device-specific current.
The device I-V characteristic is provided as a closure returning
(current, d_current/d_voltage) at a given voltage.
Returns the reflected wave b = 2v - a.
§Parameters
a: Incident wave from the WDF treerp: Port resistance (Ω)v: Initial guess for the voltage (mutable, used as starting point)max_iter: Maximum iterations (bounded for real-time safety)tolerance: Convergence threshold for |dv|v_clamp: Optional (min, max) voltage clamping boundsstep_limit: If the raw Newton step exceeds this, the step is halved to prevent overshoot. PassNonefor standard (undamped) Newton.device_iv: Closure returning(i, di_dv)for a given voltage