0

I have these two sets of number, group A : numbers from 49 to 225
and group B : from 84 to 16.

how can i conclude an equation to get the value of any number from set B (lets say 50) according to value of group A ? hope i explain my question enough.

In other way i need to change the value of group A according to value of group B (within the given limits), and actually my math knowledge is limited...

  • Are you looking for a map of the ordered interval [49,225] onto the ordered interval [84,16]? – MPW Jul 26 '19 at 20:11
  • I'm afraid your question isn't too clear... – H Huang Jul 26 '19 at 20:11
  • The sets have different cardinality, hence cannot be in bijection. – Dietrich Burde Jul 26 '19 at 20:12
  • sorry but i'm programming a game and i need to change the value of group A according to value of group B, and actually my math knowledge is limited. – Khalil Tam Jul 26 '19 at 20:14
  • @MPW i don't know what exactly i want in term of math. – Khalil Tam Jul 26 '19 at 20:21
  • $B=84-68×(A-49)/176$ – Empy2 Jul 26 '19 at 20:29
  • Programming questions are better suited for: https://stackoverflow.com/ Also, you could be more specific providing pseudocode of what you want. And on stackoverflow you should specify what programming language you are using. –  Jul 26 '19 at 21:35
  • If you want a value from table $B$ (array) using table $A$ (array) as indices, you could do something like: $B[A[someVal]]$; using C syntax atleast. In math you could do the same with functions like: $x = B(A(n))$. where $x$ is the output and $n$ is an integer input (initialized) with some value. –  Jul 26 '19 at 21:40

1 Answers1

0

If you're looking to map the interval from $49$ to $225$ linearly onto the interval from $84$ to $16$, in that order, then you can use the function

$$b(a) = 84 + (16-84)\cdot\left(\frac{a-49}{225-49}\right)$$

As $a$ ranges from $49$ to $225$, the value of $b(a)$ above ranges from $84$ to $16$, and does so linearly. That means, for example, that when you choose $a$ to be $\tfrac13$ of the way between $49$ and $225$, the value of $b(a)$ will also be $\tfrac13$ of the way between $84$ and $16$ (try it!).

Examples:

  • if $a=49$, then $b(49) = 84+(-68)\cdot 0 = 84$, left end
  • if $a=225$, then $b(225) = 84 + (-68)\cdot 1 = 16$, right end
  • if $a=137$, then $b(137) = 84 + (-68)\cdot(\tfrac{88}{176}) =50$, midpoint

And if you need the map to go the other way, just swap the numbers in the formula for the endpoints of the intervals (that's why I left the formula unsimplified, so you could see how the interval endpoints "feed into" the formula):

$$a(b) = 49 + (225-49)\cdot\left(\frac{b-84}{16-84}\right)$$

MPW
  • 43,638
  • Thanks man that's what i was looking for. and also i found this other solution by : y = 2.59 x + 266.44 . (x is between 84 - 16 )and i got the same value too. – Khalil Tam Jul 26 '19 at 23:46