@linearize(nim, tol:numeric)


build a new nim that approximates the argument. The new nim uses only linear interpolation and homogeneous breakpoints. An adaptive sampling step achieves an approximation within tol (i.e. for any point in the domain, the images of the nim argument and the image of the resulting nim are withing tol) .

The result is a linear homogeneous nim.

The application of the @linearize function can be time consuming and care must be taken to not perturb the real-time computations, e.g., by precomputing the linearization: see [eval_when_load] clause and function @loadvalue.

• the effect of @sample is pictured at top right,
• the effect of @align_breakpoints is sketched at bottom left,
• and the effect of @linearize is illustrated at bottom right.