Here's the question you clicked on:

55 members online
  • 0 replying
  • 0 viewing

tinab

  • 3 years ago

I'm trying to complete the third problem on Problem set one however I don't understand bisection search. Does it always need to have a epsilon? Also I finally looked at the solution after a few hours of trying and it does not work either, is it impossible?

  • This Question is Closed
  1. bwCA
    • 3 years ago
    Best Response
    You've already chosen the best response.
    Medals 1

    2011 class?? typically the problemsets have you use 'epsilon' when working with floating point numbers - when comparing numbers that are the result of floating point calcs there are inherent errors that need to be accounted for - those calcs might not produce a value that you expect and so may not compare the way you want them to. you need to set a tolerance. bisection is an algorithim that reduces the problem (or search space) by 1/2 on each iteration. did you watch the lecture and read the readings and try out the examples from the lectures? what exactly don't you 'get'?

  2. tinab
    • 3 years ago
    Best Response
    You've already chosen the best response.
    Medals 0

    Thanks, I did read the readings and watch the lectures. I apparently was not understanding the need for an epsilon, the moment I added one in the code works fine. I guess I hit a silly level of frustration and didn't think about inherent errors.

  3. bwCA
    • 3 years ago
    Best Response
    You've already chosen the best response.
    Medals 1

    using the Decimal clss from the decimal module you can see the actual values http://dpaste.com/810175/ http://docs.python.org/library/decimal.html#decimal-objects

  4. Not the answer you are looking for?
    Search for more explanations.

    • Attachments:

Ask your own question

Sign Up
Find more explanations on OpenStudy
Privacy Policy