from numpy import * import matplotlib.pyplot as plt from sympy import * a=0.5 h = 10**(-arange(0,6,0.1).reshape((-1,1)) ) plt.loglog(h, abs(sin(a)*h/2), \ h, abs(cos(a)*h**2/6), \ h, abs(18*cos(a)*h**4), \ h, abs(sin(a)*h**2/12)) plt.legend(['Newton','Symmetrisk Newton', 'Fire punkter','Andrederiverte']) plt.show() x = arange(0,6,0.05) f = lambda x : (-x**2+10*x-5)/4 plt.plot(x,f(x)) plt.plot(array([1,3]),array([f(1),f(3)])) plt.plot(array([1,5]),array([f(1),f(5)])) plt.plot(array([3,5]),array([f(3),f(5)])) plt.show() A = Matrix([[-2,-1,1,2,1],[4,1,1,4,0],[-8,-1,1,8,0],[16,1,1,16,0]]) C,c=A.rref() print(C)