Question: Error, (in Optimization:-NLPSolve) non-numeric result encountered

> restart;
> with(LinearAlgebra);
> with(linalg);
> with(ArrayTools);
> n := 2; p := vector([2, 3, 3]);

> x := vector(n, []);
> x0 := vector(n, []);
> st := vector(n, []);
> for i to n do x0[i] := 0; st[i] := -1 end do;
> f := (x[1]-p[1])^2+p[3]*(x[2]-p[2])^2;
                                   2               2
                         (x[1] - 2)  + 3 (x[2] - 3)
> simplify(f);
                       2                       2          
                   x[1]  - 4 x[1] + 31 + 3 x[2]  - 18 x[2]
> lin := -4*x[1]-18*x[2];
                              -4 x[1] - 18 x[2]
> fin := grad(lin, [x[1], x[2]]);

> f0 := dotprod(x-x0, fin);
                              -4 x[1] - 18 x[2]
> xi := vector(n, []);
> with(Optimization); t := Minimize(f0, {x[1]+2*x[2]                             -38.0000000000292176
                            -0.400000000005842682
                             2.20000000000292138
> qwe := evalf(norm(x0-st, n));
                                 1.414213562
> count := 1;
> if qwe > .1 then while qwe > .1 do count := count+1; k := NLPSolve(f(x0+alpha*(xi-x0)), {alpha >= 0, alpha = 0, alpha Error, (in Optimization:-NLPSolve) non-numeric result encountered
> print(t);
                            -38.0000000000292176

Please Wait...