def test_single_comp_paraboloid_pbo_hanging_param(self):

        class ParaboloidPBO(Component):
            """ Evaluates the equation f(x,y) = (x-3)^2 + xy + (y+4)^2 - 3 """

            def __init__(self):
                super(ParaboloidPBO, self).__init__()

                self.add_param('x', val=0.0)
                self.add_param('y', val=0.0, pass_by_obj=True)

                self.add_output('f_xy', val=0.0)

            def solve_nonlinear(self, params, unknowns, resids):
                """f(x,y) = (x-3)^2 + xy + (y+4)^2 - 3
                Optimal solution (minimum): x = 6.6667; y = -7.3333
                """

                x = params['x']
                y = params['y']

                unknowns['f_xy'] = (x-3.0)**2 + x*y + (y+4.0)**2 - 3.0

        prob = Problem()
        root = prob.root = Group()
        root.add('p1', IndepVarComp('x', 0.0), promotes=['*'])
        root.add('p2', IndepVarComp('y', 0.0, pass_by_obj=True), promotes=['*'])
        root.add('comp', ParaboloidPBO(), promotes=['x', 'y', 'f_xy'])

        root.fd_options['force_fd'] = True
        root.fd_options['form'] = 'complex_step'

        prob.setup(check=False)
        prob.run()

        jac = prob.calc_gradient(['x'], ['f_xy'])

        # Note, FD can not reach this accuracy, but CS can.
        assert_rel_error(self, jac[0][0], -6.0, 1e-7)
dataset/ETHPy150Open OpenMDAO/OpenMDAO/openmdao/core/test/test_complex_step.py/ComplexStepVectorUnitTestsBasicImpl.test_single_comp_paraboloid_pbo_hanging_param/original