32 KiB
32 KiB
In [1]:
import numpy as np
import matplotlib.pyplot as plt
In [7]:
def f(x):
return (x**2 * np.e**x + 1)/(x * np.e**x + np.e**x)
In [8]:
def pointfixe(x,f,k=50):
for _ in range(0,k):
x = f(x)
return x
In [16]:
xfs = np.arange(0,1.5,0.01)
yfs = np.array(f(xfs))
xs = np.arange(0,1.5,0.01)
x = pointfixe(1,f,1000)
plt.plot(xfs,yfs,'r')
plt.plot(xs,xs,'g')
plt.plot(x,x,'.b')
Out[16]:
In [ ]: