Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a very simple problem but I feel like I am brain-dead.

I cant figure it out how to calculate this in Java:

1321 = 0 
1771 = 640 
1500 = ?


Edit: Sorry for no context. (And english not my first language) I must basically calculate the value that number 1500 represents. If 1321 is min (=0) and 1771 is max (=640) where does 1500 fall in (between 0 and 640) ?

I hope I am more clear now :)

share|cite|improve this question
See…. – joriki Jul 10 '12 at 10:38
Um, what? ${}{}$ – anon Jul 10 '12 at 10:48
Some context would be very helpful. $1321$ is almost never $0$, and when it is, $1721$ isn't usually $640$. Are you working with modular arithmetic? – Cameron Buie Jul 10 '12 at 10:50
I updated my question. I hope I am more clear. – mrkok Jul 10 '12 at 10:58
Looks like the question is about linear interpolation between data points $(1321,0)$ and $(1771,640)$, in particular about how to find $y$ such that $(1500,y)$ would be on the same line. The answer comes from the equation of the line passing through two known points. Have you seen that in school algebra? – Jyrki Lahtonen Jul 10 '12 at 11:04

linear interpolation?

scale x ranges from 1321 to 1771 scale y you want to range from 0 to 640

gradient = (640 - 0) / (1771 -1321)

1500 -1321 = gradient ( x - 0)

x is your answer.

I'm sure you could rearrange this nicely.

(correcting typo)

share|cite|improve this answer
i think it is $385$ – dato datuashvili Jul 10 '12 at 11:22

i dont know exactly if it is way to solve this problem,but i think about one thing,if $1321=0$ and $1771=640$ then for calculating where does fall $1500$,we have to consider what is the difference from min to $1500$ and from $1500$ to max value and make proportion. if we do so we get $450/179=640/x$ from this $x=254$,i think that we could solve this problem like this way

share|cite|improve this answer
thanks very much for commenting on error – dato datuashvili Jul 10 '12 at 12:07

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.