Contact
CoCalc Logo Icon
StoreFeaturesDocsShareSupport News AboutSign UpSign In
| Download
Views: 39
Kernel: SageMath 8.3
var('x,y') f(x,y) = e^(-x^2 * y) show(f) df_dx = f.diff()[0] show(df_dx) df_dy = f.diff()[1] show(df_dy) show(f.diff(2)) show(f.diff(2)[1,0])
z0 = f(0,0) print 'Z0:', z0 x_slope = df_dx(0,0) y_slope = df_dy(0,0) print x_slope, y_slope x0 = 0 y0=0 Z(x,y) = z0 + x_slope*(x - x0) + y_slope*(y-y0) show(Z) f_plot = plot3d(f, (x, -1, 1), (y, -1, 1), color='red') t_plot = plot3d(Z, (x, -1, 1), (y, -1, 1), color='blue') f_plot + t_plot
Z0: 1 0 0
#A -e z0 = f(1,1) print 'Z0:', z0 x_slope = df_dx(1,1) y_slope = df_dy(1,1) print x_slope, y_slope x0 = 1 y0=1 Z(x,y) = z0 + x_slope*(x - x0) + y_slope*(y-y0) show(Z) f_plot = plot3d(f, (x, 0, 2), (y, 0, 2), color='red') t_plot = plot3d(Z, (x, 0, 2), (y, 0, 2)) f_plot + t_plot
Z0: e^(-1) -2*e^(-1) -e^(-1)

Q2

#a var('x,y') f(x, y) = 4 plot3d(f, (x, -2, 2), (y, -2, 2))
f(x,y) = x^2 + y^2 z0 = f(0,0) print 'Z0:', z0 x_slope = f.diff()[0](0,0) y_slope = f.diff()[1](0,0) print x_slope, y_slope x0 = 1 y0=1 Z(x,y) = z0 + x_slope*(x - x0) + y_slope*(y-y0) show(Z) f_plot = plot3d(f, (x, -1, 1), (y, -1, 1), color='red') t_plot = plot3d(Z, (x, -1, 1), (y, -1, 1)) f_plot + t_plot
Z0: 0 0 0
var('y') f(x,y) = x^3 * y - x^2 plot_f = plot3d(f, (x, -1, 1), (y, -1 , 1)) plot_f
var('L, K') Y(L, K) = 2*L^0.75 * K^0.25 show(Y) dY_dL = Y.diff()[0] dY_dK = Y.diff()[1] show(dY_dL) show(dY_dK) print '(1,1) for dY/dL:', dY_dL(1 ,1) print '(1,1) for dY/dK:', dY_dK(1 ,1) print '(1000,1000000) for dY/dL:', dY_dL(1000,1000000) print '(1000,1000000) for dY/dK:', dY_dK(1000,1000000) print '(1000,1) for dY/dL:', dY_dL(1000,1) print '(1000,1) for dY/dK:', dY_dK(1000,1) print '(1,100000) for dY/dL:', dY_dL(1,100000) print '(1,100000) for dY/dK:', dY_dK(1,100000)
(1,1) for dY/dL: 1.50000000000000 (1,1) for dY/dK: 0.500000000000000 (1000,1000000) for dY/dL: 8.43511987785524 (1000,1000000) for dY/dK: 0.00281170662595175 (1000,1) for dY/dL: 0.266741911505838 (1000,1) for dY/dK: 88.9139705019461 (1,100000) for dY/dL: 26.6741911505838 (1,100000) for dY/dK: 0.0000889139705019461