Showing posts with label geometry. Show all posts
Showing posts with label geometry. Show all posts

Monday, May 20, 2013

Geometry: How to determine if lines are parallel or perpendicular

So let say you have a lines in a graph,

to determine if these are perpendicular, they must have relevant values which the first line's slope must be the reciprocal of the other line intersecting the first line.

Below is an example of determining a parallel lines.

L1 = {-1, -2} and {1, 2}
L2 = {2, 0} and {0, 4}

To solve the slopes,

m1 = 2-(-2)/1- (-1)
      = 2+2/ 1+1
      = 4/2
      = 2

m2 = 4 - 0/ 0 - (-2)
      = 4/2
      = 2


since they are both identical then this lines are both parallel.

For perpendicular lines,


L1 = {0, -4} and {-1, -7}
L2 = {3, 0} and {-3, 2}


m1 = -7 - (-4)/ -1 -0
      = -7 + 4/ -1
      = -3/-1
      = 3

m2  = 2 - 0 /-3 - (3)
       = 2 / -6
       = - 1/3

so m1 and m2 slopes have the reciprocal values. No matter where do we start on measuring, still, perpinduclar lines will result to reciprocal values and perpendicular lines have an "angle of 90 degrees".


This page can be a great reference to look at http://www.purplemath.com/modules/slope2.htm

Geometry: How to get the angle from a slope?


To get the angle from a slope,

First, you must need to identify the slope of a line.

To get the slope of a line, you need to use the formula dy/dx or

∆y/∆x as distance of y and distance of x.

That is,

m = y1-y2/x1-x2


To get the angle, you can use arctangent, the inverse of tan, as

tan -1 x = arctangent or arctan

so

angle = arctangent(m)

m = tangent(angle)

For example, in Python,


>>> math.atan(0.38)* 180/math.pi
20.80679101271123
>>> math.tan(20.80679101271123 * math.pi/180)
0.37999999999999995


math.atan and tan are in radians, so I convert them from radians to degrees or degrees to radians.



Saturday, May 18, 2013

Geometry: Slope of a Straight Line



To get the slope of a line, you can use the equation below



A good and perfect explanation of this can be check on this link http://www.purplemath.com/modules/slope.htm


Other's also use this way of method to explain it's coordinates.


where:
Ax  the x coordinate of point A
Ay  the y coordinate of point A
Bx  the x coordinate of point B
By  the y coordinate of point B

and for this one, you can check on this link http://www.mathopenref.com/coordslope.html


Additionally, if lines with vertical lines, slope is undefined or doesn't exist. And if lines is going horizontal, then slope will always be 0.

Example:

m = (5) - (-3)/ (4) - (4) = 8/0 which is undefined for points (4, 5) and (4, -3) or UNDEFINED SLOPE

and

m = (4) - (4) / (5) - (-3) = 0/8 = 0 for points/coordinates at (-3, 4) and (5, 4) or ZERO BASED SLOPE