function Rtot = U_R_RL_RM_model_numeric(params, constants )
%------------------- LineshapeKin Simulation -----------------------------
% Function for numeric solving of equilibrium thermodynamic equations
%
% 5/12/09
% Evgenii Kovrigin
% Medical College of Wisconsin
%
% U-R-RL-RM model developed in 
% [ek_mac]: /Users/kovrigin/Documents/Workspace/Data/Data.XV/
% EKM16.Analysis_of_multistep_kinetic_mechanisms/Equilibria/U_R_RL_RM_derivation.mn 
% eq3_10


%--- this is what I need for K-matrix
Leq=params(1);


%-- these are constants named as used in the equation below
K_A_1=constants( 1);
K_A_3=constants( 2);
K_B_1=constants( 3);
K_B_2=constants( 4);
K_B_3=constants( 5);
Ltot=constants( 6 );
Mtot=constants( 7 );



%-- equation 3.10
% This equation is 600 characters. Please, show your respect to MuPad used in deriving this equation.

Rtot = - (Leq - Ltot)/(K_A_1*Leq + K_A_1*K_B_2*Leq) - (K_B_1*(Leq - Ltot))/(K_A_1*Leq + K_A_1*K_B_2*Leq) - (K_A_1*Leq*(Leq - Ltot))/(K_A_1*Leq + K_A_1*K_B_2*Leq) - (K_A_1*K_B_2*Leq*(Leq - Ltot))/(K_A_1*Leq + K_A_1*K_B_2*Leq) - (K_A_3*(K_A_1*Leq*Mtot + K_A_1*K_B_2*Leq*Mtot)*(Leq - Ltot))/((K_A_1*Leq + K_A_1*K_B_2*Leq)*(K_A_1*Leq - K_A_3*Leq + K_A_3*Ltot + K_A_1*K_B_2*Leq - K_A_3*K_B_3*Leq + K_A_3*K_B_3*Ltot)) - (K_A_3*K_B_3*(K_A_1*Leq*Mtot + K_A_1*K_B_2*Leq*Mtot)*(Leq - Ltot))/((K_A_1*Leq + K_A_1*K_B_2*Leq)*(K_A_1*Leq - K_A_3*Leq + K_A_3*Ltot + K_A_1*K_B_2*Leq - K_A_3*K_B_3*Leq + K_A_3*K_B_3*Ltot));



