Computer Science Canada

QUADRATIC SOLVER

Author:  lapo3399 [ Sun Nov 21, 2004 2:35 pm ]
Post subject:  QUADRATIC SOLVER

Heres a program I made (i just learned turing today) for solving quadratic equations in math. Just enter the a, b, and c values and itll give u the roots. (y=ax**2+bx+[b]c[/b
WARNING!!!-THE PROGRAM MAY HAVE AN ERROR IF THERE ARE NO REAL ROOTS

Author:  Tony [ Sun Nov 21, 2004 3:33 pm ]
Post subject: 

Confused
don't you mean
code:

e:=(b**2-4*a*c)
    if e<0 then
    put "There are no real roots"

because otherwise (sqrt(e)) the program will crash.

its a good start, but now you should try to encorporate all of the roots. Its not that hard. Here's a hit

code:

if e<0 then
e *= -1
flagi := true

and here you go - squareroot part becomes possitive, you just got to keep in mind that you have to add in "i" later on (but flagi is marked as true to remind you)

Author:  Andy [ Sun Nov 21, 2004 8:09 pm ]
Post subject: 

heh i wrote one on my ti83 that can do the unreal roots.. too bad i lost it :'(

Author:  Tony [ Sun Nov 21, 2004 8:42 pm ]
Post subject: 

I had lots of stuff on my TI83.. you know how you used to have to do dozens of the same problems over and over with different numbers? yeah - just solve once for the variable values instead, and write down the function in TI Laughing

Author:  Andy [ Mon Nov 22, 2004 4:21 pm ]
Post subject: 

heh yea.. same here


: