Esempio n. 1
0
 public nleqreport(nleq.nleqreport obj)
 {
     _innerobj = obj;
 }
        /*************************************************************************
        Shifted Himmelblau's function

            F = (x^2+y-11)^2 + (x+y^2-7)^2 + 1

        posed as system of M functions:

            f0 = x^2+y-11
            f1 = x+y^2-7
            f2 = 1

        This function is used to test algorithm on problem which has no solution.
        *************************************************************************/
        private static void testfuncshbm(nleq.nleqstate state)
        {
            double x = 0;
            double y = 0;

            ap.assert(state.needf | state.needfij, "TestNLEQUnit: internal error!");
            x = state.x[0];
            y = state.x[1];
            if( state.needf )
            {
                state.f = math.sqr(x*x+y-11)+math.sqr(x+y*y-7)+1;
                return;
            }
            if( state.needfij )
            {
                state.fi[0] = x*x+y-11;
                state.fi[1] = x+y*y-7;
                state.fi[2] = 1;
                state.j[0,0] = 2*x;
                state.j[0,1] = 1;
                state.j[1,0] = 1;
                state.j[1,1] = 2*y;
                state.j[2,0] = 0;
                state.j[2,1] = 0;
                return;
            }
        }
Esempio n. 3
0
 public nleqstate(nleq.nleqstate obj)
 {
     _innerobj = obj;
 }
        /*************************************************************************
        Himmelblau's function

            F = (x^2+y-11)^2 + (x+y^2-7)^2

        posed as system of 1 function
        *************************************************************************/
        private static void testfunchb1(nleq.nleqstate state)
        {
            double x = 0;
            double y = 0;

            ap.assert(state.needf | state.needfij, "TestNLEQUnit: internal error!");
            x = state.x[0];
            y = state.x[1];
            if( state.needf )
            {
                state.f = math.sqr(math.sqr(x*x+y-11)+math.sqr(x+y*y-7));
                return;
            }
            if( state.needfij )
            {
                state.fi[0] = math.sqr(x*x+y-11)+math.sqr(x+y*y-7);
                state.j[0,0] = 2*(x*x+y-11)*2*x+2*(x+y*y-7);
                state.j[0,1] = 2*(x*x+y-11)+2*(x+y*y-7)*2*y;
                return;
            }
        }