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

    zKc = 1-0.5*((y(4)/y(2))^(2-y(1)))*(1+1/(y(1)^2))*(3-y(1)-y(3)-y(5));
    zvc = 1+0.5*((y(4)/y(2))^(2-y(1)))*(1-1/(y(1)^2))*(3-y(1)-y(3)-y(5));
    zKs = 1-0.5*((y(4)/y(2))^(-y(1)))*((1+1/(y(3)^2))*(3-y(1)-y(3)-y(5))-4*y(5));
    zvs = 1+0.5*((y(4)/y(2))^(-y(1)))*(1-1/(y(3)^2))*(3-y(1)-y(3)-y(5));
    zy  = 1-((y(4)/y(2))^(-y(1)))*(1+(y(5)/4)*(y(3)-(1/y(3)))*(3-y(1)-y(3)-y(5))+(y(5)/2)*(y(3)^2+1)-(y(1)-y(3)+y(5)));

    dKc = -0.5*(y(2)/y(4))*(y(1)^2)*y(6)*zKc;
    dvc = -0.5*(y(1)/y(4))*(y(2)^2)*y(6)*zvc;
    dKs = -0.5*(y(3)^2)*((y(5)^2) + y(6)*zvs);
    dvs = -0.5*y(4)*y(3)*y(6)*zvs;
    dy  = 2*(1-y(3))*y(5) - y(6)*zy;
    dDb = (3 - y(1) - y(3) - y(5))*y(6);
    dDf = y(7);

yprime = [dKc; dvc; dKs; dvs; dy; dDb; dDf];

  

