% The matrix of flow equations for the standard Giamarchi and Schulz case
% the components are [Kc vc Ks vs y Db Df]
function dA = statFullMatrix(l,A)

    Kc = A(1); vc = A(2); Ks = A(3); vs = A(4); y = A(5); Db = A(6);

    r1 = (vs/vc)^(2-Kc);
    r2 = (vs/vc)^(-Kc);
    r3 = 1+(1/Kc^2);
    r4 = 1-(1/Kc^2);
    r3s = 1+(1/Ks^2);
    r4s = 1-(1/Ks^2);
    
    zKc = 1-0.5*r1*r3*(3-Kc-Ks-y);
    zvc = 1+0.5*r1*r4*(3-Kc-Ks-y);
    zKs = 1-0.5*r2*(r3s*(3-Kc-Ks-y)+4*y);
    zvs = 1+0.5*r2*r4s*(3-Kc-Ks-y);
    zy  = 1-r2*(1+0.25*y*Ks*r4s*(3-Kc-Ks)+0.5*y*(Ks^2+1)-(Kc-Ks+y));
        
    dKc = -0.5*(vc/vs)*(Kc^2)*Db*zKc;
    dvc = -0.5*(Kc/vs)*(vc^2)*Db*zvc;
    dKs = -0.5*Ks^2*(y^2+Db*zKs);
    dvs = -0.5*Ks*vs*Db*zvs;
    dy  = (2-2*Ks)*y - Db*zy;
    dDb = (3-Kc-Ks-y)*Db;
    
    [l Kc Db]

dA = [dKc; dvc; dKs; dvs; dy; dDb];

  

