# Python skript for Taylor-rekke eksempel, # funksjonen f(x,y) = (1-y^2)*cos(x) Taylor-utvikles til andre ordens ledd # 1 - 1/2*x^2 - y^2 from pylab import * from mpl_toolkits.mplot3d import axes3d # rutenett med -5 <= x <= 5 og -4 <= y <= 4 og med henholdsvis 26 og 21 punkt x,y = meshgrid (linspace (-5, 5, 26), linspace (-4, 4, 21), indexing="ij") fig = figure() ax = fig.add_subplot(111, projection="3d") h = (1 - y**2)*cos(x) ax.plot_surface(x, y, h, rstride=1, cstride=1, cmap=cm.jet, linewidth=0, antialiased=False) xlabel ('x') ylabel ('y') ax.plot_surface (x, y, 1 - 1./2*x**2 - y**2, rstride=1, cstride=1, cmap=cm.bone, linewidth=0, antialiased=False) show()