Added: 11 months ago
From: oscarsveliz
Views: 2,157
Sort by time | Sort by thread (beta)

Link to this comment:

Share to:

All Comments (7)

Sign In or Sign Up now to post a comment!
  • thanks alot .

  • @Van1tyC4se As you pointed out Bisection does have trouble with flat functions. There are too many points close to the actual root it has a hard time discerning it. Using the interval tolerance approach you described is a common way to avoid this scenario. Adding the additional condition is not a big deal in the long run because Bisection takes linear time. I would check both.

    c=(b-a)/2

    while abs(f(c))>e and (b-a)>tol

    {

    if (f(c)*f(a))<=0 //dif signs b=c

    else a=c

    c=(b-a)/2

    }

    root=c

  • Hello. I see that you (like most people) check with tolerance with something like:

    if f(c)<error

    and this creates a problem with flat functions.

    What I did was check like this:

    if (b-a)<tolerance then

    root = (a+b)/2

    which means that once I have bracketed the root into a sufficiently small interval I just pick the midpoint to be my answer. This usually takes more steps but seems to work fine with flat functions. I even checked with (x-5)^11 :). Any thoughts?

  • very clear Thanks

Loading...
Alert icon
0 / 00Unsaved Playlist Return to active list
    1. Your queue is empty. Add videos to your queue using this button:
      or sign in to load a different list.
    Loading...Loading...Saving...
    • Clear all videos from this list
    • Learn more