# Thread: roota of an equation

1. ## roota of an equation

Good morning sir,
Iam new to the c i need a help from u. I dont know the roots of an equation in c program language so i kindly requested u to give the solution.

Thank you sir 2. 3. How would you do it in math? If you know how to find the roots, mathematically, it's easy to convert that into functions. If not then no knowlege of C will help you.

Though I guess you could always use the brute force aproach. 4. > so i kindly requested u to give the solution.
http://cboard.cprogramming.com/annou...t.php?f=4&a=39
http://cboard.cprogramming.com/annou...t.php?f=4&a=51 5. You could use the Newton-Raphson method.
double solve (double (*) (double), double low, double high); 6. 1) If the problem states that there is just one root in a given interval, like [a,b], than the solution is straightforward: you just have to use the bisection method.
2) You should take great care when using Newton-Raphson method (a badly designed algorithm implementing Newton-Raphson method will go, for certain roots, to infinity) 7. 1) If the problem states that there is just one root in a given interval, like [a,b], than the solution is straightforward: you just have to use the bisection method.
2) You should take great care when using Newton-Raphson method (a badly designed algorithm implementing Newton-Raphson method will go, for certain roots, to infinity)
Actually, bisection will only work if there are at least two points in your interval for which their y-value is of opposite sign. An interval can have one root in it, but if the signs never change in that interval, your bisection method will do much worse than Newton-Raphson (namely, it will crash or have undefined behaviour.)

Also, to avoid all these infinity deals, usually what's best is to see if you reach a fix point after a certain number of iterations.

If I was you, doing a homework assignment, I'd simply do bisection, unless order of convergence and efficiency are THAT important to you. Popular pages Recent additions 