update meta data
This commit is contained in:
parent
f3a896c724
commit
90e15ed6ce
3307 changed files with 1674 additions and 7 deletions
6
Task/Map-range/00DESCRIPTION
Normal file
6
Task/Map-range/00DESCRIPTION
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
Given two [[wp:Interval (mathematics)|ranges]], <math>[a_1,a_2]</math> and <math>[b_1,b_2]</math>; then a value <math>s</math> in range <math>[a_1,a_2]</math> is linearly mapped to a value <math>t</math> in range <math>[b_1,b_2]</math> when:
|
||||
:<math>t = b_1 + {(s - a_1)(b_2 - b_1) \over (a_2 - a_1)}</math>
|
||||
|
||||
The task is to write a function/subroutine/... that takes two ranges and a real number, and returns the mapping of the real number from the first to the second range. Use this function to map values from the range <code>[0, 10]</code> to the range <code>[-1, 0]</code>.
|
||||
|
||||
'''Extra credit:''' Show additional idiomatic ways of performing the mapping, using tools available to the language.
|
||||
Loading…
Add table
Add a link
Reference in a new issue