clipClip values so they do not extend beyond a given interval |
|
This information is part of the Business Simulation Library (BSL). Please support this work and ► donate.
The function will clip a list of input values x so that any component x_i of x will be x_i for min ≤ x_i ≤ max, min for x_i < min, and max for x_i > max.
Function.clip(x); // {min, max} = {-1,1}
Function.clip(x, {min, max});
Function.clip({-3,-2,-1,0,1,2,3}); // {-1,-1,-1,0,1,1,1}
Function.clip({-3,-2,-1,0,1,2,3},{-2,2}); // {-2,-2,-1,0,1,2,2}
This function is closely modeled to Clip in the Wolfram Language.
| x |
Type: Real[:] Description: List of values to be clipped |
|---|---|
| interval |
Default Value: {-1, 1} Type: Real[2] Description: Interval [min,max] given as a list (default = {-1,1}) |
| y |
Type: Real[size(x, 1)] Description: Clipped values |
|---|
Inline = true in v2.1.0.