%python
"""This demo program solves Poisson's equation
- div grad u(x, y) = f(x, y)
on the unit square with source f given by
f(x, y) = 10*exp(-((x - 0.5)^2 + (y - 0.5)^2) / 0.02)
and boundary conditions given by
u(x, y) = 0 for x = 0 or x = 1
du/dn(x, y) = sin(5*x) for y = 0 or y = 1
"""
from dolfin import *
mesh = UnitSquareMesh(32, 32)
V = FunctionSpace(mesh, "Lagrange", 1)
def boundary(x):
return x[0] < DOLFIN_EPS or x[0] > 1.0 - DOLFIN_EPS
u0 = Constant(0.0)
bc = DirichletBC(V, u0, boundary)
u = TrialFunction(V)
v = TestFunction(V)
f = Expression("10*exp(-(pow(x[0] - 0.5, 2) + pow(x[1] - 0.5, 2)) / 0.02)")
g = Expression("sin(5*x[0])")
a = inner(grad(u), grad(v))*dx
L = f*v*dx + g*v*ds
u = Function(V)
solve(a == L, u, bc)
file = File("poisson.pvd")
file << u

"This demo program solves Poisson's equation\n\n - div grad u(x, y) = f(x, y)\n\non the unit square with source f given by\n\n f(x, y) = 10*exp(-((x - 0.5)^2 + (y - 0.5)^2) / 0.02)\n\nand boundary conditions given by\n\n u(x, y) = 0 for x = 0 or x = 1\ndu/dn(x, y) = sin(5*x) for y = 0 or y = 1\n"

Error in lines 22-23
Traceback (most recent call last):
File "/projects/4a5f0542-5873-4eed-a85c-a18c706e8bcd/.sagemathcloud/sage_server.py", line 873, in execute
exec compile(block+'\n', '', 'single') in namespace, locals
File "", line 1, in <module>
ImportError: No module named dolfin