def METHOD_NAME():
    mesh = IntervalMesh(10, 0, 1)
    V = FunctionSpace(mesh, "CG", 1)
    x = SpatialCoordinate(mesh)
    f = interpolate(x[0], V)
    c = Constant(3.0, domain=mesh)
    d = Constant(2.0, domain=mesh)
    u = Function(V)
    u.assign(c*f+d**3)
    J = assemble(u ** 2 * dx)
    rf = ReducedFunctional(J, Control(c))
    dJdc = rf.derivative()
    assert_approx_equal(float(dJdc), 10.)
    rf = ReducedFunctional(J, Control(d))
    dJdd = rf.derivative()
    assert_approx_equal(float(dJdd), 228.)