fposition.py

Created by jlevon

Created on November 27, 2018

157 Bytes


from math import *
def f(x):
 return x**2-x+3

def fp(p):
a = 3
x = a
y = f(a)
while abs(y-x)>p:
  x=y
  y=a-(y-a)/(f(y)-f(a))*f(a)
return y