pub fn total_variation(u: &[f64]) -> f64
Computes the total variation TV(u) = Σ |u[i+1] - u[i]|.
TV(u) = Σ |u[i+1] - u[i]|