import numpy as np from numpy import pi from numpy.linalg import solve, norm # Solve linear systems and compute norms import matplotlib.pyplot as plt newparams = {'figure.figsize': (6.0, 6.0), 'axes.grid': True, 'lines.markersize': 8, 'lines.linewidth': 2, 'font.size': 14} plt.rcParams.update(newparams) # Exercise 0 f = lambda x: x**3-1 g = lambda y: 3*x**2 x = 3 for i in range(7): x = x - f(x)/g(x) print(np.abs(x-1)) """ Output: 1.0370370370370372 0.4383552698704216 0.12002238333650928 0.012402260381869423 0.00015131136058266215 2.2890509709938556e-08 4.440892098500626e-16 """