Mathematica creating an ellipse

Panel[Column[{Button["Generuj Elipse",

    While[True,(*Randomly choose coefficients until acceptable*){a, b,

        c, d, f, g} = RandomReal[{-10, 10}, 6];

     \[CapitalDelta] = -c d^2 + 2 b d f - a f^2 - b^2 g + a c g;

     j = -b^2 + a c; i = a + c;

     If[\[CapitalDelta] != 0 && j > 0 && \[CapitalDelta]/i < 0,

      Break[]]];

    ellipse = a*x^2 + 2*b*x*y + c*y^2 + 2*d*x + 2*f*y + g;

    (*Center of an ellipse in general form is{(c d-b f)/(b^2-

    a c),(a f-b d)/(b^2-a c)}*)

    points = Table[theta = RandomReal[{0, 2 Pi}];

      ksol =

       FindRoot[(ellipse /. {x ->

             k*Cos[theta] + (c d - b f)/(b^2 - a c),

            y -> k*Sin[theta] + (a f - b d)/(b^2 - a c)}) == 0, {k,

         1.}];

      Point[{x, y}] /. {x -> k*Cos[theta] + (c d - b f)/(b^2 - a c),

         y -> k*Sin[theta] + (a f - b d)/(b^2 - a c)} /. ksol, {5}];

    nearpoints =

     points /.

      Point[{x_, y_}] :>

       Point[{x + RandomReal[{-.1, .1}], y + RandomReal[{-.1, .1}]}];

    (*ellipse x and y min and max values*)

    yplotrange =

     Flatten[{y,

       Sort[{(2*b*d - 2*a*f +

            Sqrt[(2*b*d - 2*a*f)^2 -

              4*(b^2 - a*c)*(d^2 - a*g)])/(2*(-b^2 + a*c)), (-2*b*d +

            2*a*f +

            Sqrt[(2*b*d - 2*a*f)^2 -

              4*(b^2 - a*c)*(d^2 - a*g)])/(2*(b^2 - a*c))}]}];

    xplotrange =

     Flatten[{x,

       Sort[{(2*c*d - 2*b*f +

            Sqrt[(-2*c*d + 2*b*f)^2 -

              4*(b^2 - a*c)*(f^2 - c*g)])/(2*(b^2 - a*c)), (-2*c*d +

            2*b*f +

            Sqrt[(-2*c*d + 2*b*f)^2 -

              4*(b^2 - a*c)*(f^2 - c*g)])/(2*(-b^2 + a*c))}]}];

    final =

     Show[ContourPlot[ellipse == 0, Evaluate[xplotrange],

       Evaluate[yplotrange]], Graphics[points],

      Graphics[{Red, nearpoints}], ImageSize -> {500, Automatic}]],

   Dynamic[final],

   Dynamic@Grid[

     Join[{{"points", "nearby points"}},

      Transpose[{points, nearpoints}][[All, All, 1]]], Frame -> All,

     Alignment -> Left]}]]




http://community.wolfram.com/groups/-/m/t/193644

Is anyone able to explain how they operate KKT conditions for my application?
I generally generated elipse of 5 random points on it and added noise generating points lying close to those on the ellipse. I have a show if I can carried out elipse through these points with noise or not. I need also calculate the cost function.