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

    A = real(A1);
    Kc = A(1); vc = A(2); y = A(3); Db = A(4); s = A(5); lambda = A(6);
    vf =1;
    
    r1 = real((vf/vc)^(2-Kc));
    r2 = real((vf/vc)^(-Kc));
    r3 = 1+(1/Kc^2);
    r4 = 1-(1/Kc^2);
    r5 = 1-exp(-l*7/4);
    zKc = 1-(1/6)*r1*r3*(7-4*Kc-6*y)
    zvc = 1+(1/6)*r1*r4*(7-4*Kc-6*y);
    zy  = 1-(1/3)*r2*(7-4*Kc-2*y);
    zs = 1+(1/4)*(r1*r4*Kc+r2*y)*(1+(4/7)*r5*(1-Kc-(3/2)*y));
    
    dKc = -real(0.5*(vc/vf)*(Kc^2)*Db*zKc);
    dvc = -0.5*real((Kc/vf)*(vc^2)*Db*zvc);
    dy  = real(-y^2 - Db*zy);
    dDb = real(((7/4)-Kc-(3/2)*y)*Db);
    ds  = real(-s-(1/(4*sqrt(pi)))*sqrt(s)*s*Db*zs);
    dlambda = real(-(1/(4*sqrt(pi)))*sqrt(s)*lambda*Db*zs);
    
    %V = [l Kc Db s lambda]
    %dV = [dKc dvc dy dDb dDf ds dlambda]
        
dA = [dKc; dvc; dy; dDb; ds; dlambda];

  

