polynomial.py

#
# Les erreurs d'arrondi ou le caractère discret de la matière ?
#
# Vincent Legat - 2020
# Ecole Polytechnique de Louvain
#

from numpy import *
from matplotlib import pyplot as plt

plt.figure("Plot de x^7-7x^6.... et de (x-1)^7"); 
plt.subplot(221)
p = [1,-7,21,-35,35,-21,7,-1]
x = linspace(0.9,1.1,1000)
plt.plot(x,polyval(p,x),'-b')

plt.subplot(222)
x = linspace(1-2e-4,1+2e-4,1000)
plt.plot(x,polyval(p,x),'-b')
plt.gca().set_xticks(arange(1-2e-4,1+2e-4,2e-4))


plt.subplot(223)
x = linspace(0.9,1.1,1000)
plt.plot(x,power((x-1.0),7),'-b')

plt.subplot(224)
x = linspace(1-2e-4,1+2e-4,1000)
plt.plot(x,power((x-1.0),7),'-b')
plt.gca().set_xticks(arange(1-2e-4,1+2e-4,2e-4))


plt.show()