kill(all);

y12 : g12-%i*b12;
y13 : g13-%i*b13;
y23 : g23-%i*b23;
y34 : g34-%i*b34;
y35 : g35-%i*b35;
y45 : g45-%i*b45;
y56 : g56-%i*b56;

Y   : matrix([ y12+y13, -y12    , -y13            ,  0      ,  0          ,  0  ],
             [-y12    ,  y12+y23, -y23            ,  0      ,  0          ,  0  ],
             [-y13    , -y23    ,  y12+y23+y34+y35, -y34    , -y35        ,  0  ],
             [ 0      ,  0      , -y34            ,  y34+y45, -y45        ,  0  ],
             [ 0      ,  0      , -y35            , -y45    ,  y35+y45+y56, -y56],
             [ 0      ,  0      ,  0              ,  0      , -y56        ,  y56]);

V1  : V1*(cos(d1)+%i*sin(d1));
V2  : V2*(cos(d2)+%i*sin(d2));
V3  : V3*(cos(d3)+%i*sin(d3));
V4  : V4*(cos(d4)+%i*sin(d4));
V5  : V5*(cos(d5)+%i*sin(d5));
V6  : V6;

V   : transpose(matrix([V1,V2,V3,V4,V5,V6]));

I   : Y.V;
S   : V*conjugate(I);

P   : trigsimp(realpart(S));
Q   : trigsimp(imagpart(S));




