求f(x,y) = x^2 + 3x*y+ y^2 在 (1,2)处的偏导数
from sympy import*
from sympy.abc import x,y,z,f
f = x ** 2 +3 *y +y **2
diff(f,x)
#对x求偏导数
得 2*x + 3 * y
diff(f,y)
3*x + 2 * y
fx = diff(f,x)
fx.evalf(subs = {x:1,y:2})
8.00000000000000
fy = diff(f,y)
fy.evalf(subs = {x:1,y:2})
7.00000000000000