
        format none;

        function xdot = f (x, t)
            # Zmena hodnoty x za jednotku casu
            xdot = zeros (66,1);
            xdot(1) = 0; # fixed, k1_a 
xdot(2) = 0; # fixed, k1_bc 
xdot(3) = 0; # fixed, lambda 
xdot(4) = 0; # fixed, k2_a 
xdot(5) = 0; # fixed, k2_bc 
xdot(6) = 0; # fixed, k3_a 
xdot(7) = 0; # fixed, k3_bc 
xdot(8) = 0; # fixed, k4_a 
xdot(9) = 0; # fixed, k4_c 
xdot(10) = 0; # fixed, ktuN 
xdot(11) = 0; # fixed, kdtN 
xdot(12) = 0; # fixed, kdsN 
xdot(13) = 0; # fixed, ksuN 
xdot(14) = 0; # fixed, kutN 
xdot(15) = 0; # fixed, ktdN 
xdot(16) = 0; # fixed, ksdN 
xdot(17) = 0; # fixed, kusN 
xdot(18) = 0; # fixed, ktuA 
xdot(19) = 0; # fixed, kdtA 
xdot(20) = 0; # fixed, kdsA 
xdot(21) = 0; # fixed, ksuA 
xdot(22) = 0; # fixed, kutA 
xdot(23) = 0; # fixed, ktdA 
xdot(24) = 0; # fixed, ksdA 
xdot(25) = 0; # fixed, kusA 
xdot(26) = 0; # fixed, KMj 
xdot(27) = 0; # fixed, KDAC 
xdot(28) = 0; # fixed, KDAS 
xdot(29) = 0; # fixed, gammam 
xdot(30) = 0; # fixed, gammap 
xdot(31) = 0; # fixed, cu 
xdot(32) = 0; # fixed, cs 
xdot(33) = 0; # fixed, cd 
xdot(49) = 0; # fixed, CT 
xdot(50) = 0; # fixed, AT 
xdot(51) = 0; # fixed, cytosol 
xdot(34) = x(34) = x(55) + x(56) + x(57) + x(58); # assignment, C_H  FROM INIT EXPRESSION!!! 
xdot(35) = x(35) = x(59) + x(60) + x(61) + x(62); # assignment, C_B  FROM INIT EXPRESSION!!! 
xdot(36) = x(36) = x(63) + x(64) + x(65) + x(66); # assignment, C_P  FROM INIT EXPRESSION!!! 
xdot(37) = x(37) = x(56)+ x(58); # assignment, Zz  FROM INIT EXPRESSION!!! 
xdot(38) = x(38) = x(36) + x(34) + x(35); # assignment, C_total  FROM INIT EXPRESSION!!! 
xdot(39) = x(39) = (x(54) + x(38)/6 + x(27))/2 - sqrt((x(54) + x(38)/6 + x(27))^2/4 - x(54)*x(38)/6); # assignment, A2C6  FROM INIT EXPRESSION!!! 
xdot(40) = x(40) = (x(54)-x(39))/(1 + x(34)/x(26) + 1/x(28)*(x(61)/6) * (x(61)/x(35))^5); # assignment, Af  FROM INIT EXPRESSION!!! 
xdot(41) = x(41) = x(14) + x(22) * x(40); # assignment, kut  FROM INIT EXPRESSION!!! 
xdot(42) = x(42) = x(17) + x(25) * x(40); # assignment, kus  FROM INIT EXPRESSION!!! 
xdot(43) = x(43) = x(13) + x(21) * x(40); # assignment, ksu  FROM INIT EXPRESSION!!! 
xdot(44) = x(44) = x(10) + x(18) * x(40); # assignment, ktu  FROM INIT EXPRESSION!!! 
xdot(45) = x(45) = x(15) + x(23) * x(40); # assignment, ktd  FROM INIT EXPRESSION!!! 
xdot(46) = x(46) = x(11) + x(19) * x(40); # assignment, kdt  FROM INIT EXPRESSION!!! 
xdot(47) = x(47) = x(16) + x(24) * x(40); # assignment, ksd  FROM INIT EXPRESSION!!! 
xdot(48) = x(48) = x(12) + x(20) * x(40); # assignment, kds  FROM INIT EXPRESSION!!! 
xdot(52) =  + 0 * (x(4)*x(52))  - (x(6)*x(52))  + (x(1)) ; # reaction, kaiA_mRNA 
xdot(53) =  - (x(7)*x(53))  + (x(2)*((1+x(3)*x(37))/(1+x(37)) * 1/(1+x(55))))  + 0 * (x(5)*x(53)) ; # reaction, kaiBC_mRNA 
xdot(54) =  - (x(8)*x(54))  + (x(4)*x(52)) ; # reaction, KaiA 
xdot(55) =  + 0 * (x(2)*((1+x(3)*x(37))/(1+x(37)) * 1/(1+x(55))))  + (x(31) * x(59) * (x(59)/x(35))^5)  + (x(42)*x(57))  + (x(41)*x(56))  + (x(30)*x(63)*(x(36)^5))  - (x(9)*x(55))  - (x(29)*x(55))  - (x(43)*x(55))  - (x(44)*x(55)) ; # reaction, KaiC6_U 
xdot(56) =  + (x(45)*x(58))  + (x(30)*x(64)*(x(36)^5))  - (x(9)*x(56))  - (x(41)*x(56))  - (x(29)*x(56))  - (x(46)*x(56))  + (x(44)*x(55)) ; # reaction, KaiC6_T 
xdot(57) =  + (x(47)*x(58))  + (x(30)*x(65)*(x(36)^5))  - (x(9)*x(57))  - (x(42)*x(57))  - (x(29)*x(57))  - (x(48)*x(57))  - (x(32) * x(57) * (x(57)/x(34))^5)  + (x(43)*x(55)) ; # reaction, KaiC6_S 
xdot(58) =  + (x(30)*x(66)*(x(36)^5))  - (x(9)*x(58))  - (x(29)*x(58))  - (x(45)*x(58))  - (x(47)*x(58))  - (x(33) * x(58) * (x(58)/x(34))^5)  + (x(48)*x(57))  + (x(46)*x(56)) ; # reaction, KaiC6_D 
xdot(59) =  + (x(17)*x(61))  + (x(14)*x(60))  - (x(9)*x(59))  - (x(29)*x(59))  - (x(13)*x(59))  - (x(10)*x(59))  - (x(31) * x(59) * (x(59)/x(35))^5) ; # reaction, KaiBC_U 
xdot(60) =  + (x(15)*x(62))  - (x(9)*x(60))  - (x(14)*x(60))  - (x(29)*x(60))  - (x(11)*x(60))  + (x(10)*x(59)) ; # reaction, KaiBC_T 
xdot(61) =  + (x(16)*x(62))  - (x(9)*x(61))  - (x(17)*x(61))  - (x(29)*x(61))  - (x(12)*x(61))  + (x(13)*x(59))  + (x(32) * x(57) * (x(57)/x(34))^5) ; # reaction, KaiBC_S 
xdot(62) =  - (x(9)*x(62))  - (x(29)*x(62))  - (x(16)*x(62))  - (x(15)*x(62))  + (x(12)*x(61))  + (x(11)*x(60))  + (x(33) * x(58) * (x(58)/x(34))^5) ; # reaction, KaiBC_D 
xdot(63) =  + (x(29)*x(59))  + (x(5)*x(53))  - (x(30)*x(63)*(x(36)^5))  + (x(29)*x(55))  - (x(9)*x(63)) ; # reaction, KaiC_U 
xdot(64) =  + (x(29)*x(60))  - (x(30)*x(64)*(x(36)^5))  + (x(29)*x(56))  - (x(9)*x(64)) ; # reaction, KaiC_T 
xdot(65) =  + (x(29)*x(61))  - (x(30)*x(65)*(x(36)^5))  + (x(29)*x(57))  - (x(9)*x(65)) ; # reaction, KaiC_S 
xdot(66) =  + (x(29)*x(62))  - (x(30)*x(66)*(x(36)^5))  + (x(29)*x(58))  - (x(9)*x(66)) ; # reaction, KaiC_D 
xdot(34) = 0; # end
xdot(35) = 0; # end
xdot(36) = 0; # end
xdot(37) = 0; # end
xdot(38) = 0; # end
xdot(39) = 0; # end
xdot(40) = 0; # end
xdot(41) = 0; # end
xdot(42) = 0; # end
xdot(43) = 0; # end
xdot(44) = 0; # end
xdot(45) = 0; # end
xdot(46) = 0; # end
xdot(47) = 0; # end
xdot(48) = 0; # end

        endfunction

        # time scale
        t = linspace(0, 250, 200);

        # default values
        x0 = zeros (66,1);
        x0(1) = 0.0117; # fixed parameter, k1_a
x0(2) = 0.4139; # fixed parameter, k1_bc
x0(3) = 3.0378; # fixed parameter, lambda
x0(4) = 0.3497; # fixed parameter, k2_a
x0(5) = 0.0457; # fixed parameter, k2_bc
x0(6) = 0.0195; # fixed parameter, k3_a
x0(7) = 0.2996; # fixed parameter, k3_bc
x0(8) = 0.3278; # fixed parameter, k4_a
x0(9) = 0.0162; # fixed parameter, k4_c
x0(10) = 0.01; # fixed parameter, ktuN
x0(11) = 0.13; # fixed parameter, kdtN
x0(12) = 0; # fixed parameter, kdsN
x0(13) = 0; # fixed parameter, ksuN
x0(14) = 0.22; # fixed parameter, kutN
x0(15) = 0; # fixed parameter, ktdN
x0(16) = 0.34; # fixed parameter, ksdN
x0(17) = 0.12; # fixed parameter, kusN
x0(18) = 3.9; # fixed parameter, ktuA
x0(19) = 0; # fixed parameter, kdtA
x0(20) = 10.9; # fixed parameter, kdsA
x0(21) = 0.6; # fixed parameter, ksuA
x0(22) = 0; # fixed parameter, kutA
x0(23) = 0.5; # fixed parameter, ktdA
x0(24) = 0; # fixed parameter, ksdA
x0(25) = 0.6; # fixed parameter, kusA
x0(26) = 3; # fixed parameter, KMj
x0(27) = 0.1; # fixed parameter, KDAC
x0(28) = 8e-6; # fixed parameter, KDAS
x0(29) = 0.4; # fixed parameter, gammam
x0(30) = 5e+4; # fixed parameter, gammap
x0(31) = 0; # fixed parameter, cu
x0(32) = 1380; # fixed parameter, cs
x0(33) = 2420; # fixed parameter, cd
x0(49) = 3.5; # fixed parameter, CT
x0(50) = 0.6; # fixed parameter, AT
x0(51) = 1; # fixed compartment, cytosol
x0(52) = 0; # fixed specie, kaiA_mRNA
x0(53) = 0; # fixed specie, kaiBC_mRNA
x0(57) = 0; # fixed specie, KaiC6_S
x0(58) = 0; # fixed specie, KaiC6_D
x0(60) = 0; # fixed specie, KaiBC_T
x0(61) = 0; # fixed specie, KaiBC_S
x0(62) = 0; # fixed specie, KaiBC_D
x0(63) = 0; # fixed specie, KaiC_U
x0(64) = 0; # fixed specie, KaiC_T
x0(65) = 0; # fixed specie, KaiC_S
x0(66) = 0; # fixed specie, KaiC_D
x0(55) = 0.998*x0(49); # assignment specie, KaiC6_U
x0(56) = 0.001*x0(49); # assignment specie, KaiC6_T
x0(34) = x0(55) + x0(56) + x0(57) + x0(58); # assignment parameter, C_H
x0(59) = 0.001*x0(49); # assignment specie, KaiBC_U
x0(35) = x0(59) + x0(60) + x0(61) + x0(62); # assignment parameter, C_B
x0(36) = x0(63) + x0(64) + x0(65) + x0(66); # assignment parameter, C_P
x0(37) = x0(56)+ x0(58); # assignment parameter, Zz
x0(38) = x0(36) + x0(34) + x0(35); # assignment parameter, C_total
x0(54) = 2*x0(50); # assignment specie, KaiA
x0(39) = (x0(54) + x0(38)/6 + x0(27))/2 - sqrt((x0(54) + x0(38)/6 + x0(27))^2/4 - x0(54)*x0(38)/6); # assignment parameter, A2C6
x0(40) = (x0(54)-x0(39))/(1 + x0(34)/x0(26) + 1/x0(28)*(x0(61)/6) * (x0(61)/x0(35))^5); # assignment parameter, Af
x0(41) = x0(14) + x0(22) * x0(40); # assignment parameter, kut
x0(42) = x0(17) + x0(25) * x0(40); # assignment parameter, kus
x0(43) = x0(13) + x0(21) * x0(40); # assignment parameter, ksu
x0(44) = x0(10) + x0(18) * x0(40); # assignment parameter, ktu
x0(45) = x0(15) + x0(23) * x0(40); # assignment parameter, ktd
x0(46) = x0(11) + x0(19) * x0(40); # assignment parameter, kdt
x0(47) = x0(16) + x0(24) * x0(40); # assignment parameter, ksd
x0(48) = x0(12) + x0(20) * x0(40); # assignment parameter, kds


        #lsode_options ( 'absolute tolerance', max (50*eps, 0.5e-28) );
        lsode_options ( 'relative tolerance', max (50*eps, 0.5e-28) ); 

        y = lsode ("f", x0, t);
        
        for i = 1:length(t)
            y(i, 34) = y(i, 55) + y(i, 56) + y(i, 57) + y(i, 58); # assignment, C_H  FROM INIT EXPRESSION!!! 
y(i, 35) = y(i, 59) + y(i, 60) + y(i, 61) + y(i, 62); # assignment, C_B  FROM INIT EXPRESSION!!! 
y(i, 36) = y(i, 63) + y(i, 64) + y(i, 65) + y(i, 66); # assignment, C_P  FROM INIT EXPRESSION!!! 
y(i, 37) = y(i, 56)+ y(i, 58); # assignment, Zz  FROM INIT EXPRESSION!!! 
y(i, 38) = y(i, 36) + y(i, 34) + y(i, 35); # assignment, C_total  FROM INIT EXPRESSION!!! 
y(i, 39) = (y(i, 54) + y(i, 38)/6 + y(i, 27))/2 - sqrt((y(i, 54) + y(i, 38)/6 + y(i, 27))^2/4 - y(i, 54)*y(i, 38)/6); # assignment, A2C6  FROM INIT EXPRESSION!!! 
y(i, 40) = (y(i, 54)-y(i, 39))/(1 + y(i, 34)/y(i, 26) + 1/y(i, 28)*(y(i, 61)/6) * (y(i, 61)/y(i, 35))^5); # assignment, Af  FROM INIT EXPRESSION!!! 
y(i, 41) = y(i, 14) + y(i, 22) * y(i, 40); # assignment, kut  FROM INIT EXPRESSION!!! 
y(i, 42) = y(i, 17) + y(i, 25) * y(i, 40); # assignment, kus  FROM INIT EXPRESSION!!! 
y(i, 43) = y(i, 13) + y(i, 21) * y(i, 40); # assignment, ksu  FROM INIT EXPRESSION!!! 
y(i, 44) = y(i, 10) + y(i, 18) * y(i, 40); # assignment, ktu  FROM INIT EXPRESSION!!! 
y(i, 45) = y(i, 15) + y(i, 23) * y(i, 40); # assignment, ktd  FROM INIT EXPRESSION!!! 
y(i, 46) = y(i, 11) + y(i, 19) * y(i, 40); # assignment, kdt  FROM INIT EXPRESSION!!! 
y(i, 47) = y(i, 16) + y(i, 24) * y(i, 40); # assignment, ksd  FROM INIT EXPRESSION!!! 
y(i, 48) = y(i, 12) + y(i, 20) * y(i, 40); # assignment, kds  FROM INIT EXPRESSION!!! 

        endfor
        
        [t',y]
        