syntax - Python: The code I typed isn't doing anything -
i'm trying bisection method using python , when try run it, nothing happens. here's code used:
import math a=0 b=1 def f(x): return math.sqrt(x)-math.cos(x) while b-a>0.0001: c=(a+b)/2 if f(a)*f(c)>0: a=c else: b=c print(c)
- the else belongs while.
- c defined inside while
- it seems push c value down?
Comments
Post a Comment