functionrescale
Rescale values from one range to another
Extends from BusinessSimulation.Icons.Function (Icon for functions).
Information
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.
Syntax
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});
Examples
Function.rescale(5, {0, 10}); // 0.5
Function.rescale(5, {0, 10}, {10, 20}); // 15.
Notes
This function is closely modeled to Rescale in the Wolfram Language.
See also
Inputs
| Type | Name | Default | Description |
|---|---|---|---|
| Real | x | Value to be transformed | |
| Real[2] | x_range | Original range [min,max] given as a list | |
| Real[2] | y_range | {0, 1} | Rescaled range [y_min, y_max] given as a list (default = {0,1}) |
Outputs
| Type | Name | Default | Description |
|---|---|---|---|
| Real | y | Rescaled value to run from y_min to y_max over the range min to max |
Revisions
- Added
Inline = truein v2.1.0.