dm_spe_suites.py

Created by alex-juge84

Created on November 21, 2021

235 Bytes


from math import *

def f(n) :
    return (n+1)*exp(n)+0.5*n

a = -1
b = 0
x = -2
epsilon = float(input("epsilon="))

while (a-x) > epsilon:
    acc = (a-b) / (f(a)-f(b))
    x = a
    a = a - acc * f(a)
print(a)