Thread: Help needed! Finding Root of an Equation?

  1. #1
    Registered User
    Join Date
    Jun 2008

    Help needed! Finding Root of an Equation?

    Hello guys. I have a homework and cannot solve this. Please help me and send the codes.

    In this homework, you will write a C program that will find A ROOT of an equation of the form
    using the modified version of bisection method explained as below, given an interval of x, and an epsilon value :
    1. Calculates the F(x) for the endpoint of the interval (F(xlow) and F(xhigh), as in the example graph below).
    2. If |F(xlow) |   then output xlow
    as the root,
    else if |F(xhigh) |   then output xhigh
    as the root,
    else if the signs of F(xhigh) and F(xlow) are the same, output “No roots in that interval”
    else find the middle of the interval as xmid=(xhigh+xlow)/2. Then, calculate F(xmid). If |F(xmid)|  then output xmid
    the root and stop, otherwise if |F(xmid)| >  , assign xmid to xlow
    or xhigh such that the signs of F(xlow) and F(xhigh)
    will be different (i.e. xmid
    will be one of the new ends of this new half interval for the next iteration, [xmid,xhigh]
    or [xlow,xmid]), and goto step 1.

    Your program, firstly, inputs the coefficients of the equation. Then, repeatedly:
    -asks an interval of x (xlow
    and xhigh), and an epsilon value to find out a root of the equation in
    this interval as explained above.
    -If the user inputs 0.0 and 0.0 as the interval, then the program stops.
    Initial interval
    next interval
    ot: This is a simplified version of bisection method of finding the roots of an equation. You may refer to chapter 7 of the text book (Hanly Koffman’s) to check the explanation of the
    neral form of this method. But do not use that solution as it uses function that we have not covered yet.

  2. #2
    Deathray Engineer MacGyver's Avatar
    Join Date
    Mar 2007
    If you want actual help, where you're doing the work and we're providing some guidance, that is one thing. If you're going to beg for answers, you can just fail your course.

    Homework policy.

  3. #3
    Technical Lead QuantumPete's Avatar
    Join Date
    Aug 2007
    London, UK
    Quote Originally Posted by reader View Post
    Hello guys. I have a homework and cannot solve this. Please help me and send the codes. - might set you back a couple hundred bucks though.

    "No-one else has reported this problem, you're either crazy or a liar" - Dogbert Technical Support
    "Have you tried turning it off and on again?" - The IT Crowd

  4. #4
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    The edge of the known universe
    I wonder how many more we've got to look forward to?

    Read all of this to figure out how to post.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  5. #5
    Registered User guesst's Avatar
    Join Date
    Feb 2008
    Lehi, UT
    I'm curios what class these folks are taking and where? College or High School? What state? What nation? Are they being referred by their teachers or are they googling?
    Type-ins are back! Visit Cymon's Games at for a new game every week!

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Pointer confusion
    By Blackroot in forum C++ Programming
    Replies: 11
    Last Post: 09-12-2007, 12:44 AM
  2. Bisection Method function value at root incorrect
    By mr_glass in forum C Programming
    Replies: 3
    Last Post: 11-10-2005, 09:10 AM
  3. Binary Search Trees Part III
    By Prelude in forum A Brief History of
    Replies: 16
    Last Post: 10-02-2004, 03:00 PM
  4. Finding the square root! Not Working!
    By Lah in forum C Programming
    Replies: 5
    Last Post: 09-14-2003, 07:28 PM
  5. Templated Binary Tree... dear god...
    By Nakeerb in forum C++ Programming
    Replies: 15
    Last Post: 01-17-2003, 02:24 AM

Tags for this Thread