Zhobra

Untitled

May 31st, 2022 (edited)
168
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.36 KB | None | 0 0
  1. def findmax(a, b, e):
  2.     temp = abs(d1f(a))
  3.     while (a < b):
  4.         temp2 = abs(d1f(a))
  5.         if temp2 > temp:
  6.             temp = temp2
  7.         a = a + e * 2
  8.     return temp
  9.  
  10.  
  11. def iter(a, b, e):
  12.     c = a
  13.     c_old = c + 2*e
  14.     max = findmax(a, b, e)
  15.     k = 0
  16.     while (abs(c_old - c) >= e) and (abs(f(c)) >= e):
  17.         c_old = c
  18.         c = c_old - f(c) / max
  19.         k = k + 1
  20.     return c
Add Comment
Please, Sign In to add comment