Computer Science Canada

Equation of a line (y=Mx+b)

Author:  Token [ Thu Dec 16, 2004 8:45 am ]
Post subject:  Equation of a line (y=Mx+b)

y+Mx+b

Isn't this a term that almost every student from gr 9 all the way to 12 hates! how about when you have to find 4 of these equations to identify a shape! yes it can get to be a very long and drawn out process! so0o I created a program that does it for u Very Happy! yes, very helpfull but you know what would be even more helpfull? a program that finds the reciprocal of the equation... its coming, give me time Razz almost done just working on outputing the information to a .txt file. also it will include finding the midpoint of a line and the distance between any two points on the cartesian plane! well hope this helps Wink !

code:

var x, y, x1, x2, y1, y2, m : real

loop

    put "\n\nTo find the formula of the line"

    put "\nEnter the first coordinate."
    put "X: " ..
    get x1
    put "Y: " ..
    get y1

    put "\nEnter the seccond coordinate."
    put "X: " ..
    get x2
    put "Y: " ..
    get y2


    put "\nSlope for XY"
    put "M=Rise/Run"
    put "M= (Y2-Y1) / (X2-X1)"
    put "M= (", y2, "-", y1, ") / (", x2, "-", x1, ")"
    put "M= (", y2 - y1, ") / (", x2 - x1, ")"

    if y2 - y1 = 0 then
        put "This is a horosontal line."
        put "Y= 0X + ", y1
    elsif x2 - x1 = 0 then
        put "This is a vertical line."
        put "Y= 0X "
    else

        put "M= ", (y2 - y1) / (x2 - x1)


        m := (y2 - y1) / (x2 - x1)
        x := x1
        y := y1

        put "\n Formula of the line"
        put "Y=M X + b"
        put y, "=", m, " (", x, ")+b"
        put y, "=", m * x, "+b"
        put y, "+", m * x, "=", m * x, "-", m * x, "+b"
        put y + (m * x), "= b"
        put "b=", y + (m * x)
        put "Therefore Y=", m, "X +", y + (m * x)
    end if

end loop

Author:  Neo [ Thu Dec 16, 2004 4:41 pm ]
Post subject:  Re: Equation of a line (y=Mx+b)

Token wrote:
y+Mx+b

Isn't this a term that almost every student from gr 9 all the way to 12 hates!


Actually, no.

Author:  Andy [ Thu Dec 16, 2004 4:43 pm ]
Post subject: 

err who uses y=mx+b nymore... Ax+By+C=0 is the way to go... get use to it or ur gona flunk algebra

Author:  Tony [ Thu Dec 16, 2004 6:15 pm ]
Post subject: 

5x5 matrix of heavysides Shocked actually my algebra exam was awesome, I think I aced it... though you never now. I had to reinvent the way you check if vectors are colinear or not because damn it, it's hard to sketch out 4D on paper to check visually

anyways, good idea for the program, but it's buggy.

first set: 1/1
second set: 2/2
the equation is most defenatly not y= x + 2 Confused

Author:  Martin [ Thu Dec 16, 2004 7:23 pm ]
Post subject: 

A verticle line should be in the form of x = b

Author:  Token [ Thu Dec 16, 2004 10:09 pm ]
Post subject:  cool

Hey everyone, thanks for the feedback, this was my first post in compsci and its cool to see how fast everyone responds. umm ya it is a little buggy, usually only with the vertical and horosontal lines tho, my math mark is only a 72 tho so it could be my bad. umm ya at my school (in gr 10) were still using t=Mx+b, its an academic class and my teacher said we'll keep using it all through highschool. I'll look over my notes and see if i can fix up the horosontal and vertical lines if anyone has any ideas why its not working feel free to edit the code other than that thanks for your feedback and its nice working with u guys (and girls, although theyre few and far between)

Author:  Pickles [ Sun Dec 19, 2004 12:07 am ]
Post subject:  ..

Quote:
err who uses y=mx+b nymore... Ax+By+C=0 is the way to go... get use to it or ur gona flunk algebra


Hooray for G&D.. I love you Ax+By+Cz+D=0 Heart

Author:  Andy [ Sun Dec 19, 2004 5:19 pm ]
Post subject: 

yes, the scalar eqn owns you and me too but shhhhh

Author:  MihaiG [ Mon Dec 20, 2004 6:35 pm ]
Post subject: 

im in gr. 9 enriched... and we just finished with y = mx + b and started with Ax+By+C=0 he he he

Author:  Andy [ Mon Dec 20, 2004 6:39 pm ]
Post subject: 

enriched? what school?

Author:  MihaiG [ Mon Dec 20, 2004 8:46 pm ]
Post subject: 

why do you ask.......???
i got to Newmarket High

Author:  Pickles [ Tue Dec 21, 2004 1:18 am ]
Post subject:  ...

I dont recall ever using Ax+By+C=0 for the equation of a line until this year in G&D (although i know i learned it somewhere along the lines) hmm. Scalar equations of a plane is fun, that and solving the intersection of three planes.. such boring work

Author:  Token [ Mon Feb 14, 2005 5:06 pm ]
Post subject: 

ya well i'm in grade 10 and we just started learning Ax+By+C=0

Author:  Mr. T [ Mon Feb 14, 2005 7:29 pm ]
Post subject: 

my teacher made a calculator prog called solvesys which does all that dirty work for you Wink

Author:  ssr [ Mon Feb 14, 2005 8:51 pm ]
Post subject: 

Token wrote:
ya well i'm in grade 10 and we just started learning Ax+By+C=0

just started?
umm I thought every school in Canda teaches that in gr. 9
ummm 8)

Author:  Andy [ Mon Feb 14, 2005 10:16 pm ]
Post subject: 

Pwned wrote:
my teacher made a calculator prog called solvesys which does all that dirty work for you Wink


yea well thats built in my calculator

Author:  Drakain Zeil [ Mon Feb 14, 2005 10:40 pm ]
Post subject: 

ssr wrote:
Token wrote:
ya well i'm in grade 10 and we just started learning Ax+By+C=0

just started?
umm I thought every school in Canda teaches that in gr. 9
ummm 8)
Yeah... over here too... Line stuff was wayyy back.

Author:  [Gandalf] [ Wed Feb 16, 2005 5:02 pm ]
Post subject: 

"Ax+By+C=0 is the way to go"
eeaeeae, I hate standard notation - y = mx + b is much easier IMO. In my grade 9 math class we did like grade 10/11 stuff Shocked Smile . I guess that's why I got a 70% even though I sortof consider myself good in math... Wink

Author:  Drakain Zeil [ Wed Feb 16, 2005 8:54 pm ]
Post subject: 

y=mx+b to standard form really isn't that complex...

It's just moving things to one side, and equating to zero.

Then there's some funky rules like... a can't be negative or something.

No decimals either.

Idealy, just mulyiply the entire thing by the "run" of m, then isolate for zero, if a is negative then multiply through a negative, and you're done.

Author:  ssr [ Wed Feb 16, 2005 9:04 pm ]
Post subject: 

Yes I like y-intercept form better too,
and A cant be 0 thats also valid
but what do u mean it cant be a decimal
Quote:
No decimals either.
Question Question 8)


: