Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def sekanten(x,y):
- if round(y,3) == round(x,3):
- print(y - x)
- return func(y)
- else:
- print("x_k: ", y, ", x_k-1: ", x)
- yt = x - ((y-x)/(func(y)-func(x)))*func(y)
- print("y: ", y, ", yt: ", yt)
- return sekanten(y,yt)
- def func(x):
- return x**2 - 2
- print("sqrt(2) ist ca.: ", sekanten(1.0,2.0))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement