daily pastebin goal
58%
SHARE
TWEET

Untitled

a guest Jan 19th, 2019 78 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import matplotlib as mlp
  2. import matplotlib.pyplot as plt
  3. import numpy as np
  4. import math
  5. #
  6. #def f(x):
  7. #    return 0.5*x**3 - 0.2*x**2 - 2.9*x + 3
  8.  
  9.  
  10.  
  11. b = 1
  12. a = 5
  13. m = ((a + b)/2)
  14.  
  15. def f(x):
  16.     return ((x**2/4) - 3*x + 5)
  17.  
  18.  
  19. for i in range(10):
  20.     m = ((a + b)/2)
  21.     if f(a) * f(m) < 0.21:
  22.         b = m
  23.     else:
  24.         a = m
  25.     print(f(m))
  26.  
  27.    
  28.  
  29. #if f(a) < 0 < f(b)
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top