Author |
Message |
lapo3399
|
Posted: 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
Description: |
|
Download |
Filename: |
findrootquad.t |
Filesize: |
564 Bytes |
Downloaded: |
424 Time(s) |
|
|
|
|
|
|
Sponsor Sponsor
|
|
|
Tony
|
Posted: Sun Nov 21, 2004 3:33 pm Post subject: (No subject) |
|
|
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)
|
Tony's programming blog. DWITE - a programming contest. |
|
|
|
|
Andy
|
Posted: Sun Nov 21, 2004 8:09 pm Post subject: (No subject) |
|
|
heh i wrote one on my ti83 that can do the unreal roots.. too bad i lost it :'(
|
|
|
|
|
|
Tony
|
Posted: Sun Nov 21, 2004 8:42 pm Post subject: (No 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
|
Tony's programming blog. DWITE - a programming contest. |
|
|
|
|
Andy
|
Posted: Mon Nov 22, 2004 4:21 pm Post subject: (No subject) |
|
|
heh yea.. same here
|
|
|
|
|
|
|