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

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?

OpenStudy (anonymous):

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'?

OpenStudy (anonymous):

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.

OpenStudy (anonymous):

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

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!