OCW
6: Bisection Methods, Newton/Raphson, Introduction to Lists def squareRootBi(x, epsilon): “””Assumes x >= 0 and epsilon > 0 Return y s.t. y * y is within epsilon of x””” assert x >= 0, ‘x must be non-negative, not’ + str(x) assert epsilon > 0, ‘epsilon must be positive, not’ + str(epsilon) […]
Continue reading about Lec 6 | MIT 6.00 Introduction to Computer Science and Programming, Fall 2008
5: Floating Point Numbers, Successive Refinement, Finding Roots def squareRootBi(x, epsilon): “””Return y s.t. y*y is within epsilon of x””” assert epsilon > 0, ‘epsilon must be positive, no ‘ + str(epsilon) low = 0 high = max(x, 1) guess = (low + high) / 2.0 ctr = 1 […]
Continue reading about Lec 5 | MIT 6.00 Introduction to Computer Science and Programming, Fall 2008
Recent Comments