i need help with a formula in my program and i feel stupid. if 50 = 1000 and 250 = 0 what is the formula to take any number between 50 and 250 and give it a value from 1000 to 0?
y = a*x + b, where a = (y2 - y1) / (x2 - x1) and b = y2 - a*x2 so based on what u typed (I think): a = (0 - 1000) / (250 - 50) = -5 b = 0 - (-5 * 250) = 1250
So with Y = -5*X + 1250 when X=50, Y=-5*50 + 1250 = 1000 Check when X=250, Y=-5*250 + 1250 = 0 Check Good equation
im lazy so i just went with Score = (1000 / X) * 50. Its measured in milliseconds, seems to work just fine. Behold! sicc's garage punching machine. bring on the sprained wrists!
I have a masters in engineering and my brain so fried today that made it hurt. I cannot do basic math today.
tell me about it.... we had a department/company dinner last night, my head hurts so bad that even reading this is making me dizzy.
That might be fun to watch though. Note the OP only defined a range of x for the linear relationship to hold, so the the proper form of the equation is For x = 50 to 250, then y= 1250 -5x. Did that put Metalhead in the ditch?
What if you do not want a linear relationship? You know so you can look more manly depending on your needs....
For all we know its a Sinusoidal function with an amplitude of 1000 and just so happens to cross 0 at 250.