From The FEniCS project

The following program solves Poissons's equation in just two lines of code, maybe the worlds smallest Poisson solver?

V = FunctionSpace(UnitSquare(32, 32), "CG", 1)
plot(VariationalProblem(dot(grad(TestFunction(V)), grad(TrialFunction(V)))*dx + TestFunction(V)*TrialFunction(V)*ds, TestFunction(V)*Function(V, "500.0 * exp(-(pow(x[0] - 0.5, 2) + pow(x[1] - 0.5, 2)) / 0.02)")*dx).solve(), interactive=True)

This program requires DOLFIN 0.9.0.

Contributed by Anders Logg.