I have a question regarding definining boundaries in fenics.

I want to define boundaries using the length of the interval (one-dimensional) so that I can impose different boundary conditions on both ends. But, if I use a variable in defining boundaries, I get an error.

TypeError: bad operand type for abs(): ‘Form’

If I do not use a variable and use a number, no errors. Could you help me out?

```
from dolfin import *
import matplotlib.pyplot as plt
import numpy as np
mesh = UnitIntervalMesh(32)
V = FunctionSpace(mesh, 'Lagrange', 2)
u0 = Constant('0.0')
u_true = Expression('0.5*x[0]*(1.0-x[0])', degree=2)
plot(mesh)
L = 1.0
u_right = Constant(0)
u_left = Constant(0)
def boundary_right(x, on_boundary):
tol = 1E-14
return abs(x[0] - L) < tol
def boundary_left(x, on_boundary):
tol = 1E-14
return abs(x[0]) < tol
bc_right = DirichletBC(V, u_right, boundary_right)
bc_left = DirichletBC(V, u_left, boundary_left)
bcs = [bc_right, bc_left]
u = TrialFunction(V)
v = TestFunction(V)
f = Constant(1.0)
a = inner(nabla_grad(u), nabla_grad(v))*dx
L = f*v*dx
u = Function(V)
solve(a == L, u, bcs)
```