Super simple math problem

Pyro Pilots Lounge. For all topics *not* covered in other DBB forums.

Moderators: fliptw, roid

Post Reply
User avatar
Thenior
DBB Captain
DBB Captain
Posts: 667
Joined: Wed Oct 06, 2004 9:40 am

Super simple math problem

Post by Thenior »

This is bugging me - I am working on a coding project, and can't figure it out. I know this is simple math, but it is escaping me. Maybe it's cuz I have a headache right now.

Anyways

I have two X & Y coordinates: (30, 60) and (50, 30).

If you know X, how do you solve for Y? For instance, if X = 40, Y = ?

I know my slope is -3/2 - but I dunno, I am just drawing a major blank here.
User avatar
sdfgeoff
DBB Ace
DBB Ace
Posts: 498
Joined: Wed Jan 12, 2011 1:07 am
Location: Low Earth Orbit
Contact:

Re: Super simple math problem

Post by sdfgeoff »

Find the formulae for the slope. It will be Y=Gradient X + Constant

The gradient is -3 over 2 (you said it)
the constant will be the point at which the line intersects the Y axis.

Then insert X into the completed formulae, and it will give you Y
Eh?
User avatar
dissent
DBB Fleet Admiral
DBB Fleet Admiral
Posts: 2162
Joined: Thu Oct 28, 2004 12:17 pm
Location: Illinois

Re: Super simple math problem

Post by dissent »

your function is a line, I take it ... :wink:

like geoff said, y = m * x + b, where m = (y2 - y1)/(x2 - x1)


you still need to find "b", so substitute in one of your points for x and y, determining b = 105

then for your line y = [(60 - 30)/(30 - 50)] * x + 105

y = -3/2 * x + 105
"I've long called these people Religious Maniacs because, of course, they are. I always point out that you don't need a god to be religious maniac; you just need a dogma and a Devil." - Ace @ Ace of SpadesHQ, 13 May 2015, 1900 hr
Post Reply