Question: How do I solve these equations?

I am trying to use Markowitz theory to optimise a portfolio. At the moment I have got


> f := proc (x) options operator, arrow; piecewise(x = 1, 0.3e-2, x = 2, 0.4e-2, x = 3, 0.6e-2, x = 4, (-1)*0.6e-2, x = 5, 0.4e-2, x = 6, 0.1e-2, x = 7, 0.1e-2, x = 8, 0, x = 9, 0.4e-2, x = 10, 0.8e-2, x = 11, 0.6e-2, x = 12, 0.17e-1, x = 13, 0.2e-2, x = 14, 0.13e-1, x = 15, 0.12e-1, x = 16, 0.6e-2, x = 17, 0.1e-2, x = 18, 0.2e-2, x = 19, 0.1e-2, x = 20, 0.12e-1, x = 21, (-1)*0.1e-2, x = 22, 0.4e-2, x = 23, 0.17e-1, x = 24, 0.4e-2, x = 25, 0.9e-2, x = 26, 0.6e-2, x = 27, 0.1e-1, x = 28, 0.16e-1) end proc;
x -> piecewise(x = 1, 0.003, x = 2, 0.004, x = 3, 0.006, x = 4,

  (-1) 0.006, x = 5, 0.004, x = 6, 0.001, x = 7, 0.001, x = 8, 0,

  x = 9, 0.004, x = 10, 0.008, x = 11, 0.006, x = 12, 0.017,

  x = 13, 0.002, x = 14, 0.013, x = 15, 0.012, x = 16, 0.006,

  x = 17, 0.001, x = 18, 0.002, x = 19, 0.001, x = 20, 0.012,

  x = 21, (-1) 0.001, x = 22, 0.004, x = 23, 0.017, x = 24,

  0.004, x = 25, 0.009, x = 26, 0.006, x = 27, 0.01, x = 28, 0.016

  )
> f(20);
                             0.012
> f(12);
                             0.017
> f(7);
                             0.001
> f(28);
                             0.016
> s := proc (y) options operator, arrow; piecewise(y = 1, 0.524e-1, y = 2, 0.533e-1, y = 3, 0.598e-1, y = 4, 0.535e-1, y = 5, 0.872e-1, y = 6, 0.495e-1, y = 7, 0.529e-1, y = 8, 0.557e-1, y = 9, 0.494e-1, y = 10, 0.458e-1, y = 11, 0.468e-1, y = 12, 0.581e-1, y = 13, 0.557e-1, y = 14, 0.397e-1, y = 15, 0.607e-1, y = 16, 0.378e-1, y = 17, 0.558e-1, y = 18, 0.469e-1, y = 19, 0.438e-1, y = 20, 0.493e-1, y = 21, 0.385e-1, y = 22, 0.363e-1, y = 23, 0.51e-1, y = 24, 0.379e-1, y = 25, 0.455e-1, y = 26, 0.398e-1, y = 27, 0.395e-1, y = 28, 0.458e-1) end proc;
y -> piecewise(y = 1, 0.0524, y = 2, 0.0533, y = 3, 0.0598,

  y = 4, 0.0535, y = 5, 0.0872, y = 6, 0.0495, y = 7, 0.0529,

  y = 8, 0.0557, y = 9, 0.0494, y = 10, 0.0458, y = 11, 0.0468,

  y = 12, 0.0581, y = 13, 0.0557, y = 14, 0.0397, y = 15, 0.0607,

  y = 16, 0.0378, y = 17, 0.0558, y = 18, 0.0469, y = 19, 0.0438,

  y = 20, 0.0493, y = 21, 0.0385, y = 22, 0.0363, y = 23, 0.051,

  y = 24, 0.0379, y = 25, 0.0455, y = 26, 0.0398, y = 27, 0.0395,

  y = 28, 0.0458)
> s(1);
                             0.0524
> s(14);
                             0.0397
> s(21);
                             0.0385
>
> r(p):=0.004;
                             0.004
>
>
>
> q := proc (x, y) options operator, arrow; `if`(9 < x and 9 < y or x < 10 and y < 10, 0.2e-3, (-1)*0.2e-3) end proc;
 (x, y) -> `if`(9 < x and 9 < y or x < 10 and y < 10, 0.0002,

   (-1) 0.0002)
> q(2, 8);
                             0.0002
> q(11, 33);
                             0.0002
> q(8, 22);
                            -0.0002
> q(22, 8);
                            -0.0002
>
> s(1);
                             0.0524
> q(2, 7);
                             0.0002
> p := proc (x, y) options operator, arrow; `if`(x = y, s(y), q(x, y)) end proc;
(x, y) -> `if`(x = y, s(y), q(x, y))
> p(1, 1);
                             0.0524
> p(4, 8);
                             0.0002
> p(5, 5);
                             0.0872
> p(28, 27);
                             0.0002
>
> u := proc (j) options operator, arrow; sum(x(i)*s(i)*s(j)-a-b*f(i), i = 1 .. 28) end proc;
       28                               
     -----                              
      \                                 
       )                                
j ->  /    (x(i) s(i) s(j) - a - b f(i))
     -----                              
     i = 1                              
> v := sum(x(i)-1 = 0, i = 1 .. 28);
-28 + x(1) + x(2) + x(3) + x(4) + x(5) + x(6) + x(7) + x(8)

   + x(9) + x(10) + x(11) + x(12) + x(13) + x(14) + x(15) + x(16)

   + x(17) + x(18) + x(19) + x(20) + x(21) + x(22) + x(23)

   + x(24) + x(25) + x(26) + x(27) + x(28) = 0
> w := sum(x(i)*f(i)-r(p) = 0, i = 1 .. 28);
0.003000000000 x(1) + 0.004000000000 x(2) + 0.006000000000 x(3)

   - 0.006000000000 x(4) + 0.004000000000 x(5)

   + 0.001000000000 x(6) + 0.001000000000 x(7)

   + 0.004000000000 x(9) + 0.008000000000 x(10)

   + 0.006000000000 x(11) + 0.01700000000 x(12)

   + 0.002000000000 x(13) + 0.01300000000 x(14)

   + 0.01200000000 x(15) + 0.006000000000 x(16)

   + 0.001000000000 x(17) + 0.002000000000 x(18)

   + 0.001000000000 x(19) + 0.01200000000 x(20)

   - 0.001000000000 x(21) + 0.004000000000 x(22)

   + 0.01700000000 x(23) + 0.004000000000 x(24)

   + 0.009000000000 x(25) + 0.006000000000 x(26)

   + 0.01000000000 x(27) + 0.01600000000 x(28) - 0.1120000000 = 0.
>

What I would like to know is how do I solve the equations so I can find answers to all the x's?

Please Wait...