In [1]:
%pylab inline
In [2]:
from sympy import init_session
init_session()
In [25]:
phi = (cos(pi*x) + cos(pi*y) + cos(pi*z))*(1-x)*(1-y)*(1-z)
phi
Out[25]:
In [16]:
f = diff(phi, x, 2) + diff(phi, y, 2) + diff(phi, z, 2)
f
Out[16]:
In [24]:
print(f)
In [27]:
xl = phi.subs(x, 0)
xl
Out[27]:
In [28]:
print(xl)
In [19]:
phi.subs(x, 1)
Out[19]:
In [29]:
yl = phi.subs(y, 0)
yl
Out[29]:
In [30]:
print(yl)
In [21]:
phi.subs(y, 1)
Out[21]:
In [31]:
zl = phi.subs(z, 0)
zl
Out[31]:
In [32]:
print(zl)
In [23]:
phi.subs(z, 1)
Out[23]:
In [ ]: