Ask your own question, for FREE!
MIT 6.00 Intro Computer Science (OCW) 14 Online
OpenStudy (anonymous):

What code would I use to get the positive root of a quadratic equation?

OpenStudy (across):

There are several numerical methods that accomplish this task; try looking into Newton's method.

OpenStudy (anonymous):

why not use an if ans to the quadratic eq is positive use it otherwise ignore it?

OpenStudy (harsimran_hs4):

try it this way 1) function that computes the roots 2) filter out the positive one`s for the 1st part i remember that`s there a problem set that covers this part using newton`s method check that out...

OpenStudy (anonymous):

Do you remember the old quadratic equation from grade school?\[x =\frac{ \pm \sqrt{b ^{2}-4ac}\ }{2a }\] Because of the plus or minus, two roots will be given. However, it is very important to note that zero, one, or both of the roots could be positive. If I were to write a program given your specifications, I would create a function that plugs an x into the quadratic formula for a given a, b, and c, and then return the positive roots (if any). Let me know if you have any more questions!

Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!
Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!