rescaleRescale values from one range to another |
![]() |
This information is part of the Business Simulation Library (BSL). Please support this work and ► donate.
The function will rescale the input to run from range y_min
to y_max
over the range min
to max
.
Function.rescale(x, {x_min, x_max}); // {y_min, y_max} by default assumed to be {0,1}
Function.rescale(x, {min, max}, {y_min, y_max});
Function.rescale(5, {0, 10}); // 0.5
Function.rescale(5, {0, 10}, {10, 20}); // 15.
This function is closely modeled to Rescale
in the Wolfram Language.
x |
Type: Real Description: Value to be transformed |
---|---|
x_range |
Type: Real[2] Description: Original range [min,max] given as a list |
y_range |
Default Value: {0, 1} Type: Real[2] Description: Rescaled range [y_min, y_max] given as a list (default = {0,1}) |
y |
Type: Real Description: Rescaled value to run from y_min to y_max over the range min to max |
---|
Inline = true
in v2.1.0.