Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import matplotlib as mlp
- import matplotlib.pyplot as plt
- import numpy as np
- import math
- #
- #def f(x):
- # return 0.5*x**3 - 0.2*x**2 - 2.9*x + 3
- b = 1
- a = 5
- m = ((a + b)/2)
- def f(x):
- return ((x**2/4) - 3*x + 5)
- for i in range(10):
- m = ((a + b)/2)
- if f(a) * f(m) < 0.21:
- b = m
- else:
- a = m
- print(f(m))
- #if f(a) < 0 < f(b)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement