Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
21
Task/Map-range/00-TASK.txt
Normal file
21
Task/Map-range/00-TASK.txt
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
Given two [[wp:Interval (mathematics)|ranges]]:
|
||||
:::* <big><math>[a_1,a_2]</math></big> and
|
||||
:::* <big><math>[b_1,b_2]</math></big>;
|
||||
:::* then a value <big><math>s</math></big> in range <big><math>[a_1,a_2]</math></big>
|
||||
:::* is linearly mapped to a value <big><math>t</math></big> in range <big><math>[b_1,b_2]</math>
|
||||
</big> where:
|
||||
<br>
|
||||
|
||||
:::* <big><big><math>t = b_1 + {(s - a_1)(b_2 - b_1) \over (a_2 - a_1)}</math></big></big>
|
||||
|
||||
|
||||
;Task:
|
||||
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 <big><code> [0, 10] </code></big> to the range <big><code> [-1, 0]. </code></big>
|
||||
|
||||
|
||||
;Extra credit:
|
||||
Show additional idiomatic ways of performing the mapping, using tools available to the language.
|
||||
<br><br>
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue