1import numpy as np
2
3class Model():
4 def __call__(self, x):
5 return 2 * (2 * x ** 2 - 10) * 4 * x
6alpha = 0.005
7x = 5.0
8norme_epsilon= 100
9seuil_epsilon = 0.001
10ma_fonction = Model()
11while norme_epsilon > seuil_epsilon:
12 dfx_dx = ma_fonction(x)
13 norme_epsilon = np.abs(dfx_dx)
14 x = x - alpha * dfx_dx
15 print(x)
16