Sign in to follow this  
Raab314159

Math Cosmetics!

Recommended Posts

Raab314159    122
These questions may seem a bit unusual, but let's give it a try: 1) Why is the default slope formula "m = (y2-y1)/(x2-x1)" and not "m = (y1-y2)/(x1-x2)" 2) Say you have to label two arbitrary points on a line, with the labels P1 and P2, would you put P1 to the left and P2 to the right, just because it looks nice? Or are there any official rules involved? Tnx

Share this post


Link to post
Share on other sites
Neosmyle    144
Ack, try to stay away from the homework questions.

But while I'm here, I guess the reasoning behind the (y2-y1)/(x2-x1) is that if the line has a positive slope, you will be left with a positive numerator and denominator. (EDIT: and if the line has a negative slope, either numerator or denominator will be negative. So P2-P1 lets you work with negatives less. Everyone hates negatives hahaha =)

Official rules about it would be stupid, as the two are perfectly equivalent

(y2-y1) / (x2-x1)
-(y2-y1) / -(x2-x1)
(y1-y2) / (x1-x2)

Share this post


Link to post
Share on other sites
Raab314159    122
Quote:
Original post by Neosmyle
But while I'm here, I guess the reasoning behind the (y2-y1)/(x2-x1) is that if the line has a positive slope, you will be left with a positive numerator and denominator. (EDIT: and if the line has a negative slope, either numerator or denominator will be negative. So P2-P1 lets you work with negatives less. Everyone hates negatives hahaha =)


Thank you, that's pretty clear. From what you are saying here I can also deduce the points (x1,y2) and (x2,y2) are put on the line from left to right by default :)

[Edited by - Raab314159 on August 3, 2004 4:25:05 PM]

Share this post


Link to post
Share on other sites
Timkin    864
No, they are not put on the line from left to right by default... nor is the ordering determined by the direction the line runs... well, at least, not directly.... the direction the line runs is a consequence of something else... and that is trigonometry.

The gradient of a line, m, (which you must remember is a gradient relative to something else) is equal to the tan of the angle between the line and the positive x axis. So, we know that the gradient is measured relative to the positive x axis. tan increases from zero with positive angle from 0 radians up to pi/2 radians, so therefore gradient must also increase in that direction. If the gradient of the line is defined by the change in the vertical direction divided by the change in the horizontal direction, then the this implies an ordering on the points on the line and in the equation for gradient.

As to what happens when the line is vertical, you have an infinite vertical change divided by a zero horizontal change, which gives an infinite gradient (which can be confirmed by checking that the tan(pi) = infinity.

Cheers,

Timkin

Share this post


Link to post
Share on other sites
alvaro    21266
1) The vector that goes from (x1,y1) to (x2,y2) is (x2-x1,y2-y1). You can then get the slope by dividing (y2-y1)/(x2-x1). I find that choice more elegant.

2) Ask a mathematician to draw an arbitrary line, and you will get a horizontal line. Ask him to put two points P1 and P2 on it, and you will get P1 on the left and P2 on the right. We mathematicians have limited imaginations. :)

Share this post


Link to post
Share on other sites
Squirm    481
Ask me to do an arbitrary line and you get a 45 degree positive slope, but maybe that's because I'm a physicist?

Any other disciplines want to add to this little psychological experiment?

Share this post


Link to post
Share on other sites
Scheermesje    169
I will go for the .25 * PI radians line.. but that's because I'm a programmer ;)

About the labeling.. If I draw a 45 degrees line I would label the left point (x1,y1) and the right point (x2,y2) just because I read from left to right and the numbers go from low to high..

But I would calculate m then with (y2 - y1) / (x2 - x1) to make sure I get a positive slope.

Share this post


Link to post
Share on other sites
Timkin    864
If asked to draw an arbitrary line, I'd draw a circle... it's one of the hardest shapes for a human to draw, yet one of the simplest and most elegant! ;)

...and I doubt this choice has anything to do with my educational training (maths/physics/philosophy/computing).

Timkin

Share this post


Link to post
Share on other sites
liquiddark    350
Quote:
Original post by Timkin
As to what happens when the line is vertical, you have an infinite vertical change divided by a zero horizontal change, which gives an infinite gradient (which can be confirmed by checking that the tan(pi) = infinity.

Or, more accurately, tan(theta approaches pi) approaches plus or minus infinity, since it goes to different places depending on which way you're coming from.

Share this post


Link to post
Share on other sites
Dredge-Master    175
1) There is no "default" slope formula. Thinking that there is a "default" formula just means that you don't understand your maths.
The reason why they teach you "m=(y2-y1)/(x2-x1)" is to avoid dividing a negative by a negative. It confuses people when they are first learning about gradients. The whole point is that you define gradient as "Rise over Run", so we leave it as a positive over a postive when using cartesian co-ordinates.


as for 2)
with labels there are no official rules involved, but if the labels are in a directly related numerical order, you should follow the co-oridinate system. In the case of cartesian, you should stick p1 on the left and p2 on the right.
On the other hand, if your plotting something that is in order like the names of cash registers, but you are plotting them on a line that only shows revenue earned, they aren't correlated so just wack p1 and p2 wherever it is appropriate.
It comes down to how it is relevent to the data.

I find a naming convetion such as "Fred" on the left and "Rubber Ducky" on the right is usually sufficient enough to confuse any reader into ignoring your labeling convention.

Share this post


Link to post
Share on other sites
alvaro    21266
Quote:
Original post by liquiddark
Quote:
Original post by Timkin
As to what happens when the line is vertical, you have an infinite vertical change divided by a zero horizontal change, which gives an infinite gradient (which can be confirmed by checking that the tan(pi) = infinity.

Or, more accurately, tan(theta approaches pi) approaches plus or minus infinity, since it goes to different places depending on which way you're coming from.

Not really. There are several types of infinity. For real numbers, there are two options: you can add two points "-infinity" and "+infinity", or you can add a single point "infinity" which is reachable from both ends. The first construction is common in Analysis (a.k.a. Calculus) when talking about limits. The second construction is the one used in Projective Geometry, which is the appropriate framework to describe the slope of a line.

The slope of a line should be an element of the 1-D real projective space, instead of a real number. The difference is only that the 1-D real projective space has a valid representation for vertical lines.

Saying that "tan(pi) = infinity" makes perfect sense to me, because we can see tan as a function that takes a real number and returns an element of the 1-D real projective space.

In case it is not clear by now, I like Geometry better than I like analysis. :)

Share this post


Link to post
Share on other sites
Timkin    864
Krumble, you are perfectly correct... someone else picked up on my typo as well... I just hadn't had time to correct it... sorry...

Of course tan(pi/2) = infinity and not tan(pi), which infact equals zero.

Sorry for the really bad typo and the confusion it may have caused.

Cheers,

Timkin

Share this post


Link to post
Share on other sites
uutee    142
Well, assuming x2 > x1, then x2-x1 is always positive, the intuitive physical interpretation of "difference" between x1 and x2. That's very convenient.

Share this post


Link to post
Share on other sites
Doc    586
Quote:
Original post by Squirm
Ask me to do an arbitrary line and you get a 45 degree positive slope, but maybe that's because I'm a physicist?


OMFG I was thinking the exact same thing. And I'm also a physicist...

Share this post


Link to post
Share on other sites
Raab314159    122
Thanks for all your input!

To summarize:

We label points from left to right, just because we read from left to right.Then:

(y2-y1)/(x2-x1) Is better than (y1-y2)/(x1-x2) because in the first case the the denoninator is *always* positive
(only if we put P1 to the left and P2 to the right)





Share this post


Link to post
Share on other sites
Dmytry    1151
i think it's because x2-x1 and y2-y1 is a vector from x1,y1 to x2,y2 ....
also dX/dY thing,too.
and of course not working with negative too.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this