def METHOD_NAME():
    mesh = IntervalMesh(10, 0, 1)
    V = FunctionSpace(mesh, "CG", 1)
    x = SpatialCoordinate(mesh)
    f = interpolate(x[0], V)
    g = interpolate(sin(x[0]), V)
    control = Control(g)
    test = TestFunction(V)
    trial = TrialFunction(V)
    a = inner(grad(trial), grad(test))*dx
    L = inner(g, test)*dx
    bc = DirichletBC(V, g, "on_boundary")
    sol = Function(V)
    solve(a == L, sol, bc)
    u = Function(V)
    u.project(f*sol*g)
    J = assemble(u ** 2 * dx)
    rf = ReducedFunctional(J, control)
    g = Function(V)
    g.vector()[:] = rand(V.dim())
    h = Function(V)
    h.vector()[:] = rand(V.dim())
    assert taylor_test(rf, g, h) > 1.9