Generated Code

The following is c_ida code generated by the CellML API from this CellML file. (Back to language selection)

The raw code is available.

/*
   There are a total of 123 entries in the algebraic variable array.
   There are a total of 44 entries in each of the rate and state variable arrays.
   There are a total of 126 entries in the constant variable array.
 */
/*
 * CONSTANTS[0] is Bmax_CaM in component buffca (mM).
 * CONSTANTS[118] is Bmax_SLhighjn in component buffca (mM).
 * CONSTANTS[122] is Bmax_SLhighsl in component buffca (mM).
 * CONSTANTS[119] is Bmax_SLlowjn in component buffca (mM).
 * CONSTANTS[123] is Bmax_SLlowsl in component buffca (mM).
 * CONSTANTS[87] is Bmax_SR in component buffca (mM).
 * CONSTANTS[1] is Bmax_TnChigh in component buffca (mM).
 * CONSTANTS[2] is Bmax_TnClow in component buffca (mM).
 * CONSTANTS[3] is Bmax_myosin in component buffca (mM).
 * STATES[0] is CaM in component buffca (mM).
 * STATES[1] is Ca_i in component calcium (mM).
 * STATES[2] is Ca_jn in component calcium (mM).
 * STATES[3] is Ca_sl in component calcium (mM).
 * STATES[41] is J_CaB_cytosol in component buffca (mM_per_ms).
 * STATES[42] is J_CaB_jn in component buffca (mM_per_ms).
 * STATES[43] is J_CaB_sl in component buffca (mM_per_ms).
 * CONSTANTS[4] is Mg_i in component ion (mM).
 * STATES[4] is Myoc in component buffca (mM).
 * STATES[5] is Myom in component buffca (mM).
 * STATES[6] is SLH_jn in component buffca (mM).
 * STATES[7] is SLH_sl in component buffca (mM).
 * STATES[8] is SLL_jn in component buffca (mM).
 * STATES[9] is SLL_sl in component buffca (mM).
 * STATES[10] is SRB in component buffca (mM).
 * STATES[11] is TnCHc in component buffca (mM).
 * STATES[12] is TnCHm in component buffca (mM).
 * STATES[13] is TnCL in component buffca (mM).
 * CONSTANTS[113] is Vjn in component geom (litre).
 * CONSTANTS[116] is Vmyo in component geom (litre).
 * CONSTANTS[120] is Vsl in component geom (litre).
 * CONSTANTS[5] is koff_cam in component buffca (mS_per_uF).
 * CONSTANTS[6] is koff_myoca in component buffca (mS_per_uF).
 * CONSTANTS[7] is koff_myomg in component buffca (mS_per_uF).
 * CONSTANTS[8] is koff_slh in component buffca (mS_per_uF).
 * CONSTANTS[9] is koff_sll in component buffca (mS_per_uF).
 * CONSTANTS[10] is koff_sr in component buffca (mS_per_uF).
 * CONSTANTS[11] is koff_tnchca in component buffca (mS_per_uF).
 * CONSTANTS[12] is koff_tnchmg in component buffca (mS_per_uF).
 * CONSTANTS[13] is koff_tncl in component buffca (mS_per_uF).
 * CONSTANTS[14] is kon_cam in component buffca (per_mM_per_ms).
 * CONSTANTS[15] is kon_myoca in component buffca (per_mM_per_ms).
 * CONSTANTS[16] is kon_myomg in component buffca (per_mM_per_ms).
 * CONSTANTS[17] is kon_slh in component buffca (per_mM_per_ms).
 * CONSTANTS[18] is kon_sll in component buffca (per_mM_per_ms).
 * CONSTANTS[19] is kon_sr in component buffca (per_mM_per_ms).
 * CONSTANTS[20] is kon_tnchca in component buffca (per_mM_per_ms).
 * CONSTANTS[21] is kon_tnchmg in component buffca (per_mM_per_ms).
 * CONSTANTS[22] is kon_tncl in component buffca (per_mM_per_ms).
 * VOI is time in component engine (ms).
 * CONSTANTS[23] is Bmax_Na_jn in component buffna (mM).
 * CONSTANTS[24] is Bmax_Na_sl in component buffna (mM).
 * STATES[14] is NaB_jn in component buffna (mM).
 * STATES[15] is NaB_sl in component buffna (mM).
 * STATES[16] is Na_jn in component sodium (mM).
 * STATES[17] is Na_sl in component sodium (mM).
 * CONSTANTS[25] is koff_na in component buffna (mS_per_uF).
 * CONSTANTS[26] is kon_na in component buffna (per_mM_per_ms).
 * CONSTANTS[124] is Bmax_Csqn in component calcium (mM).
 * CONSTANTS[27] is C in component cell (farad).
 * STATES[18] is Ca_sr in component calcium (mM).
 * STATES[19] is Csqn in component calcium (mM).
 * CONSTANTS[28] is F in component phys (C_per_mol).
 * ALGEBRAIC[71] is ICaB_jn in component icab (A_per_F).
 * ALGEBRAIC[72] is ICaB_sl in component icab (A_per_F).
 * ALGEBRAIC[73] is ICaL_Ca_jn in component ical (A_per_F).
 * ALGEBRAIC[74] is ICaL_Ca_sl in component ical (A_per_F).
 * ALGEBRAIC[104] is ICa_tot_jn in component calcium (A_per_F).
 * ALGEBRAIC[105] is ICa_tot_sl in component calcium (A_per_F).
 * ALGEBRAIC[92] is INaCa_jn in component inaca (A_per_F).
 * ALGEBRAIC[93] is INaCa_sl in component inaca (A_per_F).
 * ALGEBRAIC[98] is IpCa_jn in component ipca (A_per_F).
 * ALGEBRAIC[99] is IpCa_sl in component ipca (A_per_F).
 * CONSTANTS[90] is JCa_jnsl in component calcium (m3_per_s).
 * CONSTANTS[91] is JCa_slmyo in component calcium (m3_per_s).
 * ALGEBRAIC[63] is J_SRCarel in component ryr (mM_per_ms).
 * ALGEBRAIC[64] is J_SRleak in component ryr (mM_per_ms).
 * ALGEBRAIC[65] is J_serca in component ryr (mM_per_ms).
 * CONSTANTS[121] is Vsr in component geom (litre).
 * CONSTANTS[29] is koff_csqn in component calcium (mS_per_uF).
 * CONSTANTS[30] is kon_csqn in component calcium (per_mM_per_ms).
 * CONSTANTS[31] is AF in component cell (dimensionless).
 * CONSTANTS[88] is Vcell in component geom (litre).
 * CONSTANTS[32] is cell_length in component geom (um).
 * CONSTANTS[33] is cell_radius in component geom (um).
 * CONSTANTS[34] is pi in component geom (dimensionless).
 * ALGEBRAIC[58] is ECa_jn in component nernst (mV).
 * ALGEBRAIC[59] is ECa_sl in component nernst (mV).
 * CONSTANTS[35] is Fjn in component junc (dimensionless).
 * CONSTANTS[114] is Fsl in component junc (dimensionless).
 * ALGEBRAIC[106] is ICaB in component icab (A_per_F).
 * STATES[20] is V in component membrane (mV).
 * CONSTANTS[36] is gCaB in component icab (mS_per_uF).
 * CONSTANTS[37] is Ca_o in component ion (mM).
 * CONSTANTS[92] is FRT in component phys (per_mV).
 * CONSTANTS[38] is Fjn_CaL in component junc (dimensionless).
 * CONSTANTS[93] is Fsl_CaL in component junc (dimensionless).
 * ALGEBRAIC[121] is ICaL in component ical (A_per_F).
 * ALGEBRAIC[107] is ICaL_Ca in component ical (A_per_F).
 * ALGEBRAIC[75] is ICaL_K in component ical (A_per_F).
 * ALGEBRAIC[108] is ICaL_Na in component ical (A_per_F).
 * ALGEBRAIC[76] is ICaL_Na_jn in component ical (A_per_F).
 * ALGEBRAIC[77] is ICaL_Na_sl in component ical (A_per_F).
 * STATES[21] is K_i in component potassium (mM).
 * CONSTANTS[39] is K_o in component ion (mM).
 * CONSTANTS[40] is Na_o in component ion (mM).
 * CONSTANTS[117] is Q in component phys (dimensionless).
 * CONSTANTS[41] is Q10CaL in component ical (dimensionless).
 * STATES[22] is d in component ical (mS_per_uF).
 * STATES[23] is f in component ical (mS_per_uF).
 * STATES[24] is fCaB_jn in component ical (mS_per_uF).
 * STATES[25] is fCaB_sl in component ical (mS_per_uF).
 * CONSTANTS[42] is fcaCaMSL in component ical (dimensionless).
 * CONSTANTS[43] is fcaCaj in component ical (dimensionless).
 * ALGEBRAIC[0] is ibarca_jn in component ical (uA_per_cm2).
 * ALGEBRAIC[1] is ibarca_sl in component ical (uA_per_cm2).
 * ALGEBRAIC[2] is ibark in component ical (uA_per_cm2).
 * ALGEBRAIC[3] is ibarna_jn in component ical (uA_per_cm2).
 * ALGEBRAIC[4] is ibarna_sl in component ical (uA_per_cm2).
 * ALGEBRAIC[5] is ical_d_inf in component ical (dimensionless).
 * ALGEBRAIC[6] is ical_d_tau in component ical (ms).
 * ALGEBRAIC[7] is ical_f_inf in component ical (dimensionless).
 * ALGEBRAIC[8] is ical_f_tau in component ical (ms).
 * CONSTANTS[94] is pCa in component ical (cm_per_s).
 * CONSTANTS[95] is pK in component ical (cm_per_s).
 * CONSTANTS[96] is pNa in component ical (cm_per_s).
 * CONSTANTS[115] is ECl in component nernst (mV).
 * ALGEBRAIC[9] is IClB in component iclb (A_per_F).
 * CONSTANTS[44] is gClB in component iclb (mS_per_uF).
 * ALGEBRAIC[78] is IClCa in component iclca (A_per_F).
 * ALGEBRAIC[10] is IClCa_jn in component iclca (A_per_F).
 * ALGEBRAIC[11] is IClCa_sl in component iclca (A_per_F).
 * CONSTANTS[45] is KdClCa in component iclca (mM).
 * CONSTANTS[46] is gClCa in component iclca (mS_per_uF).
 * ALGEBRAIC[60] is EK in component nernst (mV).
 * ALGEBRAIC[109] is IK1 in component ik1 (A_per_F).
 * CONSTANTS[47] is IK1_Fact in component ik1 (dimensionless).
 * ALGEBRAIC[12] is Na_observed in component ik1 (mM).
 * ALGEBRAIC[13] is a_fact in component ik1 (dimensionless).
 * CONSTANTS[97] is gK1 in component ik1 (mS_per_uF).
 * ALGEBRAIC[79] is ik1_inf_a in component ik1 (mS_per_uF).
 * ALGEBRAIC[80] is ik1_inf_b in component ik1 (mS_per_uF).
 * ALGEBRAIC[81] is inf in component ik1 (dimensionless).
 * CONSTANTS[98] is Act in component ikach (dimensionless).
 * CONSTANTS[48] is CCh in component ikach (dimensionless).
 * CONSTANTS[49] is Constitutive_Frac in component ikach (dimensionless).
 * ALGEBRAIC[110] is IKACh in component ikach (A_per_F).
 * ALGEBRAIC[82] is Na_dep in component ikach (dimensionless).
 * ALGEBRAIC[14] is Na_observed in component ikach (mM).
 * CONSTANTS[99] is gKACh in component ikach (mS_per_uF).
 * ALGEBRAIC[111] is IKp in component ikp (A_per_F).
 * ALGEBRAIC[83] is IKp_jn in component ikp (A_per_F).
 * ALGEBRAIC[84] is IKp_sl in component ikp (A_per_F).
 * CONSTANTS[50] is gKp in component ikp (mS_per_uF).
 * ALGEBRAIC[15] is kp in component ikp (dimensionless).
 * ALGEBRAIC[85] is IKr in component ikr (A_per_F).
 * CONSTANTS[100] is gKr in component ikr (mS_per_uF).
 * ALGEBRAIC[16] is ikr_x_inf in component ikr (dimensionless).
 * ALGEBRAIC[17] is ikr_x_tau in component ikr (ms).
 * ALGEBRAIC[18] is r in component ikr (dimensionless).
 * STATES[26] is x in component ikr (mS_per_uF).
 * ALGEBRAIC[19] is EKs in component iks (mV).
 * ALGEBRAIC[86] is IKs in component iks (A_per_F).
 * ALGEBRAIC[20] is IKs_jn in component iks (A_per_F).
 * ALGEBRAIC[21] is IKs_sl in component iks (A_per_F).
 * STATES[27] is Na_i in component sodium (mM).
 * CONSTANTS[101] is gKs_jn in component iks (mS_per_uF).
 * CONSTANTS[102] is gKs_sl in component iks (mS_per_uF).
 * ALGEBRAIC[22] is iks_x_inf in component iks (dimensionless).
 * ALGEBRAIC[23] is iks_x_tau in component iks (ms).
 * CONSTANTS[51] is pNaK in component iks (dimensionless).
 * STATES[28] is x in component iks (mS_per_uF).
 * ALGEBRAIC[87] is IKur in component ikur (A_per_F).
 * CONSTANTS[103] is gKur in component ikur (mS_per_uF).
 * ALGEBRAIC[24] is ikur_r_inf in component ikur (dimensionless).
 * ALGEBRAIC[25] is ikur_r_tau in component ikur (ms).
 * ALGEBRAIC[26] is ikur_s_inf in component ikur (dimensionless).
 * ALGEBRAIC[27] is ikur_s_tau in component ikur (ms).
 * STATES[29] is r in component ikur (mS_per_uF).
 * STATES[30] is s in component ikur (mS_per_uF).
 * ALGEBRAIC[61] is ENa_jn in component nernst (mV).
 * ALGEBRAIC[62] is ENa_sl in component nernst (mV).
 * ALGEBRAIC[112] is INa in component ina (A_per_F).
 * ALGEBRAIC[88] is INa_jn in component ina (A_per_F).
 * ALGEBRAIC[89] is INa_sl in component ina (A_per_F).
 * CONSTANTS[52] is gNa in component ina (mS_per_uF).
 * STATES[31] is h in component ina (mS_per_uF).
 * ALGEBRAIC[28] is ina_h_alpha in component ina (mS_per_uF).
 * ALGEBRAIC[29] is ina_h_beta in component ina (mS_per_uF).
 * ALGEBRAIC[30] is ina_h_inf in component ina (dimensionless).
 * ALGEBRAIC[31] is ina_h_tau in component ina (ms).
 * ALGEBRAIC[32] is ina_j_alpha in component ina (mS_per_uF).
 * ALGEBRAIC[33] is ina_j_beta in component ina (mS_per_uF).
 * ALGEBRAIC[34] is ina_j_inf in component ina (dimensionless).
 * ALGEBRAIC[35] is ina_j_tau in component ina (ms).
 * ALGEBRAIC[36] is ina_m_alpha in component ina (mS_per_uF).
 * ALGEBRAIC[37] is ina_m_beta in component ina (mS_per_uF).
 * ALGEBRAIC[38] is ina_m_inf in component ina (dimensionless).
 * ALGEBRAIC[39] is ina_m_tau in component ina (ms).
 * STATES[32] is j in component ina (mS_per_uF).
 * STATES[33] is m in component ina (mS_per_uF).
 * ALGEBRAIC[113] is INaB in component inab (A_per_F).
 * ALGEBRAIC[90] is INaB_jn in component inab (A_per_F).
 * ALGEBRAIC[91] is INaB_sl in component inab (A_per_F).
 * CONSTANTS[53] is gNaB in component inab (mS_per_uF).
 * ALGEBRAIC[114] is INaCa in component inaca (A_per_F).
 * CONSTANTS[104] is IbarNCX in component inaca (A_per_F).
 * ALGEBRAIC[40] is Ka_jn in component inaca (dimensionless).
 * ALGEBRAIC[41] is Ka_sl in component inaca (dimensionless).
 * CONSTANTS[54] is Kdact in component inaca (mM).
 * CONSTANTS[55] is KmCai in component inaca (mM).
 * CONSTANTS[56] is KmCao in component inaca (mM).
 * CONSTANTS[57] is KmNai in component inaca (mM).
 * CONSTANTS[58] is KmNao in component inaca (mM).
 * CONSTANTS[59] is Q10NCX in component inaca (dimensionless).
 * ALGEBRAIC[42] is inaca_INaCa_jn_s1 in component inaca (mol4_per_m12).
 * ALGEBRAIC[43] is inaca_INaCa_jn_s2 in component inaca (mol4_per_m12).
 * ALGEBRAIC[44] is inaca_INaCa_jn_s3 in component inaca (mol4_per_m12).
 * ALGEBRAIC[45] is inaca_INaCa_sl_s1 in component inaca (mol4_per_m12).
 * ALGEBRAIC[46] is inaca_INaCa_sl_s2 in component inaca (mol4_per_m12).
 * ALGEBRAIC[47] is inaca_INaCa_sl_s3 in component inaca (mol4_per_m12).
 * CONSTANTS[60] is ksat in component inaca (dimensionless).
 * CONSTANTS[61] is nu in component inaca (dimensionless).
 * ALGEBRAIC[115] is INaK in component inak (A_per_F).
 * ALGEBRAIC[94] is INaK_jn in component inak (A_per_F).
 * ALGEBRAIC[95] is INaK_sl in component inak (A_per_F).
 * CONSTANTS[62] is IbarNaK in component inak (A_per_F).
 * CONSTANTS[63] is KmKo in component inak (mM).
 * CONSTANTS[64] is KmNaip in component inak (mM).
 * ALGEBRAIC[48] is fnak in component inak (dimensionless).
 * CONSTANTS[105] is sigma in component inak (dimensionless).
 * ALGEBRAIC[116] is INaL in component inal (A_per_F).
 * ALGEBRAIC[96] is INaL_jn in component inal (A_per_F).
 * ALGEBRAIC[97] is INaL_sl in component inal (A_per_F).
 * CONSTANTS[106] is gNaL in component inal (mS_per_uF).
 * STATES[34] is hl in component inal (mS_per_uF).
 * ALGEBRAIC[49] is inal_hl_inf in component inal (dimensionless).
 * CONSTANTS[65] is inal_hl_tau in component inal (ms).
 * ALGEBRAIC[50] is inal_ml_a in component inal (mS_per_uF).
 * ALGEBRAIC[51] is inal_ml_b in component inal (mS_per_uF).
 * STATES[35] is ml in component inal (mS_per_uF).
 * CONSTANTS[66] is Cl_i in component ion (mM).
 * CONSTANTS[67] is Cl_o in component ion (mM).
 * CONSTANTS[68] is IbarSLCaP in component ipca (A_per_F).
 * ALGEBRAIC[117] is IpCa in component ipca (A_per_F).
 * CONSTANTS[69] is KmPCa in component ipca (mM).
 * CONSTANTS[70] is Q10SLCaP in component ipca (dimensionless).
 * CONSTANTS[89] is b in component ipca (dimensionless).
 * ALGEBRAIC[52] is ipca_IpCa_jn_a in component ipca (dimensionless).
 * ALGEBRAIC[53] is ipca_IpCa_sl_a in component ipca (dimensionless).
 * ALGEBRAIC[100] is Ito in component ito (A_per_F).
 * CONSTANTS[107] is gto in component ito (mS_per_uF).
 * ALGEBRAIC[54] is ito_x_inf in component ito (dimensionless).
 * ALGEBRAIC[55] is ito_x_tau in component ito (ms).
 * ALGEBRAIC[56] is ito_y_inf in component ito (dimensionless).
 * ALGEBRAIC[57] is ito_y_tau in component ito (ms).
 * STATES[36] is x in component ito (mS_per_uF).
 * STATES[37] is y in component ito (mS_per_uF).
 * ALGEBRAIC[118] is ICa_tot in component membrane (A_per_F).
 * ALGEBRAIC[101] is ICl_tot in component membrane (A_per_F).
 * ALGEBRAIC[120] is IK_tot in component potassium (A_per_F).
 * ALGEBRAIC[119] is INa_tot in component membrane (A_per_F).
 * ALGEBRAIC[102] is INa_tot_jn in component sodium (A_per_F).
 * ALGEBRAIC[103] is INa_tot_sl in component sodium (A_per_F).
 * ALGEBRAIC[70] is I_stim in component stimulus (A_per_F).
 * ALGEBRAIC[122] is I_tot in component membrane (A_per_F).
 * CONSTANTS[71] is R in component phys (mJ_per_mol_per_K).
 * CONSTANTS[72] is T in component phys (kelvin).
 * CONSTANTS[108] is Kmf in component ryr (mM).
 * CONSTANTS[73] is Kmr in component ryr (mM).
 * CONSTANTS[74] is MaxSR in component ryr (dimensionless).
 * CONSTANTS[75] is MinSR in component ryr (dimensionless).
 * CONSTANTS[76] is Q10SRCaP in component ryr (dimensionless).
 * ALGEBRAIC[66] is RI in component ryr (dimensionless).
 * CONSTANTS[77] is Vmax_SRCaP in component ryr (mM_per_ms).
 * CONSTANTS[78] is ec50SR in component ryr (mM).
 * CONSTANTS[79] is hillSRCaP in component ryr (dimensionless).
 * STATES[38] is i in component ryr (mS_per_uF).
 * ALGEBRAIC[67] is kCaSR in component ryr (dimensionless).
 * CONSTANTS[80] is kiCa in component ryr (per_mM_per_ms).
 * ALGEBRAIC[68] is kiSRCa in component ryr (per_mM_per_ms).
 * CONSTANTS[81] is kim in component ryr (mS_per_uF).
 * CONSTANTS[109] is koCa in component ryr (per_mM2_per_ms).
 * ALGEBRAIC[69] is koSRCa in component ryr (per_mM2_per_ms).
 * CONSTANTS[82] is kom in component ryr (mS_per_uF).
 * CONSTANTS[83] is ks in component ryr (mS_per_uF).
 * STATES[39] is o in component ryr (mS_per_uF).
 * STATES[40] is r in component ryr (mS_per_uF).
 * CONSTANTS[110] is JNa_jnsl in component sodium (m3_per_s).
 * CONSTANTS[111] is JNa_slmyo in component sodium (m3_per_s).
 * CONSTANTS[112] is amplitude in component stimulus (A_per_F).
 * CONSTANTS[84] is duration in component stimulus (ms).
 * CONSTANTS[85] is offset in component stimulus (ms).
 * CONSTANTS[86] is period in component stimulus (ms).
 * RATES[0] is d/dt CaM in component buffca (mM).
 * RATES[13] is d/dt TnCL in component buffca (mM).
 * RATES[11] is d/dt TnCHc in component buffca (mM).
 * RATES[12] is d/dt TnCHm in component buffca (mM).
 * RATES[4] is d/dt Myoc in component buffca (mM).
 * RATES[5] is d/dt Myom in component buffca (mM).
 * RATES[10] is d/dt SRB in component buffca (mM).
 * RATES[8] is d/dt SLL_jn in component buffca (mM).
 * RATES[6] is d/dt SLH_jn in component buffca (mM).
 * RATES[9] is d/dt SLL_sl in component buffca (mM).
 * RATES[7] is d/dt SLH_sl in component buffca (mM).
 * RATES[14] is d/dt NaB_jn in component buffna (mM).
 * RATES[15] is d/dt NaB_sl in component buffna (mM).
 * RATES[1] is d/dt Ca_i in component calcium (mM).
 * RATES[2] is d/dt Ca_jn in component calcium (mM).
 * RATES[3] is d/dt Ca_sl in component calcium (mM).
 * RATES[18] is d/dt Ca_sr in component calcium (mM).
 * RATES[19] is d/dt Csqn in component calcium (mM).
 * RATES[22] is d/dt d in component ical (mS_per_uF).
 * RATES[23] is d/dt f in component ical (mS_per_uF).
 * RATES[24] is d/dt fCaB_jn in component ical (mS_per_uF).
 * RATES[25] is d/dt fCaB_sl in component ical (mS_per_uF).
 * RATES[26] is d/dt x in component ikr (mS_per_uF).
 * RATES[28] is d/dt x in component iks (mS_per_uF).
 * RATES[29] is d/dt r in component ikur (mS_per_uF).
 * RATES[30] is d/dt s in component ikur (mS_per_uF).
 * RATES[31] is d/dt h in component ina (mS_per_uF).
 * RATES[32] is d/dt j in component ina (mS_per_uF).
 * RATES[33] is d/dt m in component ina (mS_per_uF).
 * RATES[34] is d/dt hl in component inal (mS_per_uF).
 * RATES[35] is d/dt ml in component inal (mS_per_uF).
 * RATES[36] is d/dt x in component ito (mS_per_uF).
 * RATES[37] is d/dt y in component ito (mS_per_uF).
 * RATES[20] is d/dt V in component membrane (mV).
 * RATES[21] is d/dt K_i in component potassium (mM).
 * RATES[38] is d/dt i in component ryr (mS_per_uF).
 * RATES[39] is d/dt o in component ryr (mS_per_uF).
 * RATES[40] is d/dt r in component ryr (mS_per_uF).
 * RATES[27] is d/dt Na_i in component sodium (mM).
 * RATES[16] is d/dt Na_jn in component sodium (mM).
 * RATES[17] is d/dt Na_sl in component sodium (mM).
 * There are a total of 6 condition variables.
 */
void
initConsts(double* CONSTANTS, double* RATES, double *STATES)
{
CONSTANTS[0] = 0.024;
CONSTANTS[1] = 0.14;
CONSTANTS[2] = 0.07;
CONSTANTS[3] = 0.14;
STATES[0] = 6.73710089221736985e-04;
STATES[1] = 2.02054825252250719e-04;
STATES[2] = 3.07333085373605341e-04;
STATES[3] = 2.23134214147860355e-04;
CONSTANTS[4] = 1.0;
STATES[4] = 3.79608844523014136e-03;
STATES[5] = 1.35691489581683838e-01;
STATES[6] = 1.00754933940878755e-01;
STATES[7] = 1.86055242143676608e-01;
STATES[8] = 1.28122161143722785e-02;
STATES[9] = 2.05131045874987414e-02;
STATES[10] = 4.31383413366585346e-03;
STATES[11] = 1.27405935029765827e-01;
STATES[12] = 5.91106798633337510e-03;
STATES[13] = 1.77305527980331397e-02;
CONSTANTS[5] = 0.238;
CONSTANTS[6] = 0.00046;
CONSTANTS[7] = 5.7e-05;
CONSTANTS[8] = 0.03;
CONSTANTS[9] = 1.3;
CONSTANTS[10] = 0.06;
CONSTANTS[11] = 3.2e-05;
CONSTANTS[12] = 0.00333;
CONSTANTS[13] = 0.0196;
CONSTANTS[14] = 34.0;
CONSTANTS[15] = 13.8;
CONSTANTS[16] = 0.0157;
CONSTANTS[17] = 100.0;
CONSTANTS[18] = 100.0;
CONSTANTS[19] = 100.0;
CONSTANTS[20] = 2.37;
CONSTANTS[21] = 0.003;
CONSTANTS[22] = 32.7;
CONSTANTS[23] = 7.561;
CONSTANTS[24] = 1.65;
STATES[14] = 3.62527560419928152e+00;
STATES[15] = 7.91087217252140484e-01;
STATES[16] = 9.20484970072274145e+00;
STATES[17] = 9.20559631626608166e+00;
CONSTANTS[25] = 0.001;
CONSTANTS[26] = 0.0001;
CONSTANTS[27] = 1.381e-10;
STATES[18] = 4.85784491491899340e-01;
STATES[19] = 1.11204132576763315e+00;
CONSTANTS[28] = 96485.0;
CONSTANTS[29] = 65.0;
CONSTANTS[30] = 100.0;
CONSTANTS[31] = 0.0;
CONSTANTS[32] = 100.0;
CONSTANTS[33] = 10.25;
CONSTANTS[34] = 3.14159265358979312e+00;
CONSTANTS[35] = 0.11;
STATES[20] = -7.49738877185916408e+01;
CONSTANTS[36] = 6.06430000000000033e-04;
CONSTANTS[37] = 1.8;
CONSTANTS[38] = 0.9;
STATES[21] = 120.0;
CONSTANTS[39] = 5.4;
CONSTANTS[40] = 140.0;
CONSTANTS[41] = 1.8;
STATES[22] = 1.67750282273476489e-05;
STATES[23] = 9.98760022198537767e-01;
STATES[24] = 4.24066845471226944e-02;
STATES[25] = 3.13717989771996886e-02;
CONSTANTS[42] = 0.0;
CONSTANTS[43] = 0.0;
CONSTANTS[44] = 0.009;
CONSTANTS[45] = 0.1;
CONSTANTS[46] = 0.0548;
CONSTANTS[47] = 2.1;
CONSTANTS[48] = 0.0;
CONSTANTS[49] = 0.0;
CONSTANTS[50] = 0.002;
STATES[26] = 4.42405976310802831e-03;
STATES[27] = 9.20582356442186978e+00;
CONSTANTS[51] = 0.01833;
STATES[28] = 6.73017121702351208e-03;
STATES[29] = 3.28872423495696863e-04;
STATES[30] = 9.62950458643225149e-01;
CONSTANTS[52] = 23.0;
STATES[31] = 8.70955463748630310e-01;
STATES[32] = 8.92501441492474679e-01;
STATES[33] = 7.97426794491632243e-03;
CONSTANTS[53] = 0.000597;
CONSTANTS[54] = 0.000384;
CONSTANTS[55] = 0.00359;
CONSTANTS[56] = 1.3;
CONSTANTS[57] = 12.29;
CONSTANTS[58] = 87.5;
CONSTANTS[59] = 1.57;
CONSTANTS[60] = 0.27;
CONSTANTS[61] = 0.35;
CONSTANTS[62] = 1.26;
CONSTANTS[63] = 1.5;
CONSTANTS[64] = 11.0;
STATES[34] = 5.18117114324953484e-02;
CONSTANTS[65] = 600.0;
STATES[35] = 7.97426794490581868e-03;
CONSTANTS[66] = 15.0;
CONSTANTS[67] = 150.0;
CONSTANTS[68] = 0.0471;
CONSTANTS[69] = 0.0005;
CONSTANTS[70] = 2.35;
STATES[36] = 1.19930453889315167e-03;
STATES[37] = 9.52396284498915668e-01;
CONSTANTS[71] = 8314.0;
CONSTANTS[72] = 310.0;
CONSTANTS[73] = 1.7;
CONSTANTS[74] = 15.0;
CONSTANTS[75] = 1.0;
CONSTANTS[76] = 2.6;
CONSTANTS[77] = 0.0053114;
CONSTANTS[78] = 0.45;
CONSTANTS[79] = 1.787;
STATES[38] = 4.16351235655844508e-07;
CONSTANTS[80] = 0.5;
CONSTANTS[81] = 0.005;
CONSTANTS[82] = 0.06;
CONSTANTS[83] = 25.0;
STATES[39] = 1.73377710603823675e-06;
STATES[40] = 8.06359263514647706e-01;
CONSTANTS[84] = 0.5;
CONSTANTS[85] = 50.0;
CONSTANTS[86] = 1000.0;
CONSTANTS[87] =  19.0000*0.000900000;
CONSTANTS[88] =  ( ( CONSTANTS[34]*pow(CONSTANTS[33], 2.00000))*CONSTANTS[32])*1.00000e-15;
CONSTANTS[89] = pow( CONSTANTS[69]*1.00000, 1.60000);
CONSTANTS[90] = 1.00000/1.21340e+12;
CONSTANTS[91] = 1.00000/2.68510e+11;
CONSTANTS[92] = (CONSTANTS[28]/CONSTANTS[71])/CONSTANTS[72];
CONSTANTS[93] = 1.00000 - CONSTANTS[38];
CONSTANTS[94] =  (1.00000 -  0.500000*CONSTANTS[31])*0.000270000;
CONSTANTS[95] =  (1.00000 -  0.500000*CONSTANTS[31])*1.35000e-07;
CONSTANTS[96] =  (1.00000 -  0.500000*CONSTANTS[31])*7.50000e-09;
CONSTANTS[97] =  ( (1.00000+CONSTANTS[31])* pow((CONSTANTS[39]/5.40000), 1.0 / 2))*0.0525000;
CONSTANTS[98] = CONSTANTS[49]+( (1.00000 - CONSTANTS[49])*CONSTANTS[48])/(CONSTANTS[48]+0.125000);
CONSTANTS[99] = 0.100000 -  0.0500000*CONSTANTS[31];
CONSTANTS[100] =  0.0350000* pow((CONSTANTS[39]/5.40000), 1.0 / 2);
CONSTANTS[101] =  (1.00000+CONSTANTS[31])*0.00350000;
CONSTANTS[102] =  (1.00000+CONSTANTS[31])*0.00350000;
CONSTANTS[103] =  (1.00000 -  0.500000*CONSTANTS[31])*0.0450000;
CONSTANTS[104] =  (1.00000+ 0.400000*CONSTANTS[31])*3.15000;
CONSTANTS[105] = (exp(CONSTANTS[40]/67.3000) - 1.00000)/7.00000;
CONSTANTS[106] =  0.00250000*CONSTANTS[31];
CONSTANTS[107] =  (1.00000 -  0.700000*CONSTANTS[31])*0.165000;
CONSTANTS[108] =  2.50000*0.000246000;
CONSTANTS[109] =  (10.0000+ 20.0000*CONSTANTS[31])*1.00000;
CONSTANTS[110] = 1.00000/( (1.63820e+12/3.00000)*100.000);
CONSTANTS[111] = 1.00000/( (1.83080e+10/3.00000)*100.000);
CONSTANTS[112] = - 90.0000;
CONSTANTS[125] = 0.00000;
CONSTANTS[113] =  ( 0.0539000*0.0100000)*CONSTANTS[88];
CONSTANTS[114] = 1.00000 - CONSTANTS[35];
CONSTANTS[115] =  (1.00000/CONSTANTS[92])*log(CONSTANTS[66]/CONSTANTS[67]);
CONSTANTS[116] =  0.650000*CONSTANTS[88];
CONSTANTS[117] = (CONSTANTS[72] - 310.000)/10.0000;
CONSTANTS[118] =  (( 0.00165000*CONSTANTS[116])/CONSTANTS[113])*0.100000;
CONSTANTS[119] =  (( 0.00460000*CONSTANTS[116])/CONSTANTS[113])*0.100000;
CONSTANTS[120] =  0.0200000*CONSTANTS[88];
CONSTANTS[121] =  0.0350000*CONSTANTS[88];
CONSTANTS[122] =  (CONSTANTS[116]/CONSTANTS[120])*0.0134000;
CONSTANTS[123] =  (CONSTANTS[116]/CONSTANTS[120])*0.0374000;
CONSTANTS[124] =  (CONSTANTS[116]/CONSTANTS[121])*0.140000;
STATES[41] = 0.1001;
STATES[42] = 0.1001;
STATES[43] = 0.1001;
RATES[0] = 0.1001;
RATES[13] = 0.1001;
RATES[11] = 0.1001;
RATES[12] = 0.1001;
RATES[4] = 0.1001;
RATES[5] = 0.1001;
RATES[10] = 0.1001;
RATES[8] = 0.1001;
RATES[6] = 0.1001;
RATES[9] = 0.1001;
RATES[7] = 0.1001;
RATES[14] = 0.1001;
RATES[15] = 0.1001;
RATES[1] = 0.1001;
RATES[2] = 0.1001;
RATES[3] = 0.1001;
RATES[18] = 0.1001;
RATES[19] = 0.1001;
RATES[22] = 0.1001;
RATES[23] = 0.1001;
RATES[24] = 0.1001;
RATES[25] = 0.1001;
RATES[26] = 0.1001;
RATES[28] = 0.1001;
RATES[29] = 0.1001;
RATES[30] = 0.1001;
RATES[31] = 0.1001;
RATES[32] = 0.1001;
RATES[33] = 0.1001;
RATES[34] = 0.1001;
RATES[35] = 0.1001;
RATES[36] = 0.1001;
RATES[37] = 0.1001;
RATES[20] = 0.1001;
RATES[38] = 0.1001;
RATES[39] = 0.1001;
RATES[40] = 0.1001;
RATES[27] = 0.1001;
RATES[16] = 0.1001;
RATES[17] = 0.1001;
}
void
computeResiduals(double VOI, double* CONSTANTS, double* RATES, double* OLDRATES, double* STATES,
                 double* OLDSTATES, double* ALGEBRAIC, double* CONDVARS)
{
resid[0] = RATES[0] -  ( CONSTANTS[14]*STATES[1])*(CONSTANTS[0] - STATES[0]) -  CONSTANTS[5]*STATES[0];
resid[1] = STATES[41] - (((((RATES[13]+RATES[11])+RATES[12])+RATES[0])+RATES[4])+RATES[5])+RATES[10];
resid[2] = STATES[42] - RATES[8]+RATES[6];
resid[3] = STATES[43] - RATES[9]+RATES[7];
resid[4] = RATES[4] -  ( CONSTANTS[15]*STATES[1])*((CONSTANTS[3] - STATES[4]) - STATES[5]) -  CONSTANTS[6]*STATES[4];
resid[5] = RATES[5] -  ( CONSTANTS[16]*CONSTANTS[4])*((CONSTANTS[3] - STATES[4]) - STATES[5]) -  CONSTANTS[7]*STATES[5];
resid[6] = RATES[6] -  ( CONSTANTS[17]*STATES[2])*(CONSTANTS[118] - STATES[6]) -  CONSTANTS[8]*STATES[6];
resid[7] = RATES[7] -  ( CONSTANTS[17]*STATES[3])*(CONSTANTS[122] - STATES[7]) -  CONSTANTS[8]*STATES[7];
resid[8] = RATES[8] -  ( CONSTANTS[18]*STATES[2])*(CONSTANTS[119] - STATES[8]) -  CONSTANTS[9]*STATES[8];
resid[9] = RATES[9] -  ( CONSTANTS[18]*STATES[3])*(CONSTANTS[123] - STATES[9]) -  CONSTANTS[9]*STATES[9];
resid[10] = RATES[10] -  ( CONSTANTS[19]*STATES[1])*(CONSTANTS[87] - STATES[10]) -  CONSTANTS[10]*STATES[10];
resid[11] = RATES[11] -  ( CONSTANTS[20]*STATES[1])*((CONSTANTS[1] - STATES[11]) - STATES[12]) -  CONSTANTS[11]*STATES[11];
resid[12] = RATES[12] -  ( CONSTANTS[21]*CONSTANTS[4])*((CONSTANTS[1] - STATES[11]) - STATES[12]) -  CONSTANTS[12]*STATES[12];
resid[13] = RATES[13] -  ( CONSTANTS[22]*STATES[1])*(CONSTANTS[2] - STATES[13]) -  CONSTANTS[13]*STATES[13];
resid[14] = RATES[14] -  ( CONSTANTS[26]*STATES[16])*(CONSTANTS[23] - STATES[14]) -  CONSTANTS[25]*STATES[14];
resid[15] = RATES[15] -  ( CONSTANTS[26]*STATES[17])*(CONSTANTS[24] - STATES[15]) -  CONSTANTS[25]*STATES[15];
resid[16] = RATES[1] - (( - ALGEBRAIC[65]*CONSTANTS[121])/CONSTANTS[116] - STATES[41])+ (CONSTANTS[91]/CONSTANTS[116])*(STATES[3] - STATES[1]);
resid[17] = RATES[2] - (((( - ALGEBRAIC[104]*CONSTANTS[27])/( ( CONSTANTS[113]*2.00000)*CONSTANTS[28])+ (CONSTANTS[90]/CONSTANTS[113])*(STATES[3] - STATES[2])) - STATES[42])+( ALGEBRAIC[63]*CONSTANTS[121])/CONSTANTS[113])+( ALGEBRAIC[64]*CONSTANTS[116])/CONSTANTS[113];
resid[18] = RATES[3] - ((( - ALGEBRAIC[105]*CONSTANTS[27])/( ( CONSTANTS[120]*2.00000)*CONSTANTS[28])+ (CONSTANTS[90]/CONSTANTS[120])*(STATES[2] - STATES[3]))+ (CONSTANTS[91]/CONSTANTS[120])*(STATES[1] - STATES[3])) - STATES[43];
resid[19] = RATES[18] - (ALGEBRAIC[65] - (( ALGEBRAIC[64]*CONSTANTS[116])/CONSTANTS[121]+ALGEBRAIC[63])) - RATES[19];
resid[20] = RATES[19] -  ( CONSTANTS[30]*STATES[18])*(CONSTANTS[124] - STATES[19]) -  CONSTANTS[29]*STATES[19];
resid[21] = RATES[22] - (ALGEBRAIC[5] - STATES[22])/ALGEBRAIC[6];
resid[22] = RATES[23] - (ALGEBRAIC[7] - STATES[23])/ALGEBRAIC[8];
resid[23] = RATES[24] -  ( ( 1.70000*STATES[2])*(1.00000 - STATES[24]) -  0.0119000*STATES[24])*1.00000;
resid[24] = RATES[25] -  ( ( 1.70000*STATES[3])*(1.00000 - STATES[25]) -  0.0119000*STATES[25])*1.00000;
resid[25] = RATES[26] - (ALGEBRAIC[16] - STATES[26])/ALGEBRAIC[17];
resid[26] = RATES[28] - (ALGEBRAIC[22] - STATES[28])/ALGEBRAIC[23];
resid[27] = RATES[29] - (ALGEBRAIC[24] - STATES[29])/ALGEBRAIC[25];
resid[28] = RATES[30] - (ALGEBRAIC[26] - STATES[30])/ALGEBRAIC[27];
resid[29] = RATES[31] - (ALGEBRAIC[30] - STATES[31])/ALGEBRAIC[31];
resid[30] = RATES[32] - (ALGEBRAIC[34] - STATES[32])/ALGEBRAIC[35];
resid[31] = RATES[33] - (ALGEBRAIC[38] - STATES[33])/ALGEBRAIC[39];
resid[32] = RATES[34] - (ALGEBRAIC[49] - STATES[34])/CONSTANTS[65];
resid[33] = RATES[35] -  ALGEBRAIC[50]*(1.00000 - STATES[35]) -  ALGEBRAIC[51]*STATES[35];
resid[34] = RATES[36] - (ALGEBRAIC[54] - STATES[36])/ALGEBRAIC[55];
resid[35] = RATES[37] - (ALGEBRAIC[56] - STATES[37])/ALGEBRAIC[57];
resid[36] = RATES[20] - - (ALGEBRAIC[122]+ALGEBRAIC[70]);
resid[37] = RATES[38] - ( ( ALGEBRAIC[68]*STATES[2])*STATES[39] -  CONSTANTS[81]*STATES[38]) - ( CONSTANTS[82]*STATES[38] -  ( ALGEBRAIC[69]*pow(STATES[2], 2.00000))*ALGEBRAIC[66]);
resid[38] = RATES[39] - ( ( ALGEBRAIC[69]*pow(STATES[2], 2.00000))*STATES[40] -  CONSTANTS[82]*STATES[39]) - ( ( ALGEBRAIC[68]*STATES[2])*STATES[39] -  CONSTANTS[81]*STATES[38]);
resid[39] = RATES[40] - ( CONSTANTS[81]*ALGEBRAIC[66] -  ( ALGEBRAIC[68]*STATES[2])*STATES[40]) - ( ( ALGEBRAIC[69]*pow(STATES[2], 2.00000))*STATES[40] -  CONSTANTS[82]*STATES[39]);
resid[40] = RATES[27] -  (CONSTANTS[111]/CONSTANTS[116])*(STATES[17] - STATES[27]);
resid[41] = RATES[16] - (( - ALGEBRAIC[102]*CONSTANTS[27])/( CONSTANTS[113]*CONSTANTS[28])+ (CONSTANTS[110]/CONSTANTS[113])*(STATES[17] - STATES[16])) - RATES[14];
resid[42] = RATES[17] - ((( - ALGEBRAIC[103]*CONSTANTS[27])/( CONSTANTS[120]*CONSTANTS[28])+ (CONSTANTS[110]/CONSTANTS[120])*(STATES[16] - STATES[17]))+ (CONSTANTS[111]/CONSTANTS[120])*(STATES[27] - STATES[17])) - RATES[15];
resid[43] = RATES[21] - CONSTANTS[125];
}
void
computeVariables(double VOI, double* CONSTANTS, double* RATES, double* STATES, double* ALGEBRAIC)
{
ALGEBRAIC[106] = ALGEBRAIC[71]+ALGEBRAIC[72];
ALGEBRAIC[107] = ALGEBRAIC[73]+ALGEBRAIC[74];
ALGEBRAIC[108] = ALGEBRAIC[76]+ALGEBRAIC[77];
ALGEBRAIC[112] = ALGEBRAIC[88]+ALGEBRAIC[89];
ALGEBRAIC[113] = ALGEBRAIC[90]+ALGEBRAIC[91];
ALGEBRAIC[114] = ALGEBRAIC[92]+ALGEBRAIC[93];
ALGEBRAIC[116] = ALGEBRAIC[96]+ALGEBRAIC[97];
ALGEBRAIC[117] = ALGEBRAIC[98]+ALGEBRAIC[99];
ALGEBRAIC[121] = (ALGEBRAIC[107]+ALGEBRAIC[108])+ALGEBRAIC[75];
}
void
computeEssentialVariables(double VOI, double* CONSTANTS, double* RATES, double* STATES, double* ALGEBRAIC)
{
ALGEBRAIC[5] = 1.00000/(1.00000+exp(- (STATES[20]+9.00000)/6.00000));
ALGEBRAIC[6] = ( ALGEBRAIC[5]*(1.00000 - exp(- (STATES[20]+9.00000)/6.00000)))/( 0.0350000*(STATES[20]+9.00000));
ALGEBRAIC[7] = 1.00000/(1.00000+exp((STATES[20]+30.0000)/7.00000))+0.200000/(1.00000+exp((50.0000 - STATES[20])/20.0000));
ALGEBRAIC[8] = 1.00000/( 0.0197000*exp(- pow( 0.0337000*(STATES[20]+25.0000), 2.00000))+0.0200000);
ALGEBRAIC[16] = 1.00000/(1.00000+exp(- (STATES[20]+10.0000)/5.00000));
ALGEBRAIC[17] = ( ((550.000)/(1.00000+exp((- 22.0000 - STATES[20])/9.00000)))*6.00000)/(1.00000+exp((STATES[20]+11.0000)/9.00000))+230.000/(1.00000+exp((STATES[20]+40.0000)/20.0000));
ALGEBRAIC[22] = 1.00000/(1.00000+exp(- (STATES[20]+3.80000)/14.2500));
ALGEBRAIC[23] = 990.100/(1.00000+exp(- (STATES[20]+2.43600)/14.1200));
ALGEBRAIC[24] = 1.00000/(1.00000+exp((STATES[20]+6.00000)/- 8.60000));
ALGEBRAIC[25] = 9.00000/(1.00000+exp((STATES[20]+5.00000)/12.0000))+0.500000;
ALGEBRAIC[26] = 1.00000/(1.00000+exp((STATES[20]+7.50000)/10.0000));
ALGEBRAIC[27] = 590.000/(1.00000+exp((STATES[20]+60.0000)/10.0000))+3050.00;
ALGEBRAIC[28] = (CONDVAR[1]<0.00000 ?  0.135000*exp((STATES[20]+80.0000)/- 6.80000) : 0.00000);
ALGEBRAIC[29] = (CONDVAR[2]<0.00000 ?  3.56000*exp( 0.0790000*STATES[20])+ 310000.*exp( 0.350000*STATES[20]) : 1.00000/( 0.130000*(1.00000+exp((STATES[20]+10.6600)/- 11.1000))));
ALGEBRAIC[30] = ALGEBRAIC[28]/(ALGEBRAIC[28]+ALGEBRAIC[29]);
ALGEBRAIC[31] = 1.00000/(ALGEBRAIC[28]+ALGEBRAIC[29]);
ALGEBRAIC[32] = (CONDVAR[3]<0.00000 ? ( ( - 127140.*exp( 0.244400*STATES[20]) -  3.47400e-05*exp( - 0.0439100*STATES[20]))*(STATES[20]+37.7800))/(1.00000+exp( 0.311000*(STATES[20]+79.2300))) : 0.00000);
ALGEBRAIC[33] = (CONDVAR[4]<0.00000 ? ( 0.121200*exp( - 0.0105200*STATES[20]))/(1.00000+exp( - 0.137800*(STATES[20]+40.1400))) : ( 0.300000*exp( - 2.53500e-07*STATES[20]))/(1.00000+exp( - 0.100000*(STATES[20]+32.0000))));
ALGEBRAIC[34] = ALGEBRAIC[32]/(ALGEBRAIC[32]+ALGEBRAIC[33]);
ALGEBRAIC[35] = 1.00000/(ALGEBRAIC[32]+ALGEBRAIC[33]);
ALGEBRAIC[36] = (STATES[20]==- 47.1300 ? 3.20000 : ( 0.320000*(STATES[20]+47.1300))/(1.00000 - exp( - 0.100000*(STATES[20]+47.1300))));
ALGEBRAIC[37] =  0.0800000*exp(- STATES[20]/11.0000);
ALGEBRAIC[38] = ALGEBRAIC[36]/(ALGEBRAIC[36]+ALGEBRAIC[37]);
ALGEBRAIC[39] = 1.00000/(ALGEBRAIC[36]+ALGEBRAIC[37]);
ALGEBRAIC[49] = 1.00000/(1.00000+exp((STATES[20]+91.0000)/6.10000));
ALGEBRAIC[50] = ( 0.320000*(STATES[20]+47.1300))/(1.00000 - exp( - 0.100000*(STATES[20]+47.1300)));
ALGEBRAIC[51] =  0.0800000*exp(- STATES[20]/11.0000);
ALGEBRAIC[54] = 1.00000/(1.00000+exp(- (STATES[20]+1.00000)/11.0000));
ALGEBRAIC[55] =  3.50000*exp(- pow(STATES[20]/30.0000, 2.00000))+1.50000;
ALGEBRAIC[56] = 1.00000/(1.00000+exp((STATES[20]+40.5000)/11.5000));
ALGEBRAIC[57] =  25.6350*exp(- pow((STATES[20]+52.4500)/15.8827, 2.00000))+24.1400;
ALGEBRAIC[63] =  ( CONSTANTS[83]*STATES[39])*(STATES[18] - STATES[2]);
ALGEBRAIC[64] =  ( (1.00000+ 0.250000*CONSTANTS[31])*(STATES[18] - STATES[2]))*5.34800e-06;
ALGEBRAIC[65] = ( ( pow(CONSTANTS[76], CONSTANTS[117])*CONSTANTS[77])*(pow(STATES[1]/CONSTANTS[108], CONSTANTS[79]) - pow(STATES[18]/CONSTANTS[73], CONSTANTS[79])))/((1.00000+pow(STATES[1]/CONSTANTS[108], CONSTANTS[79]))+pow(STATES[18]/CONSTANTS[73], CONSTANTS[79]));
ALGEBRAIC[66] = ((1.00000 - STATES[40]) - STATES[39]) - STATES[38];
ALGEBRAIC[67] = CONSTANTS[74] - (CONSTANTS[74] - CONSTANTS[75])/(1.00000+pow(CONSTANTS[78]/STATES[18], 2.50000));
ALGEBRAIC[68] =  CONSTANTS[80]*ALGEBRAIC[67];
ALGEBRAIC[69] = CONSTANTS[109]/ALGEBRAIC[67];
ALGEBRAIC[70] =  (CONDVAR[5]<0.00000 ? 1.00000 : 0.00000)*CONSTANTS[112];
ALGEBRAIC[40] = 1.00000/(1.00000+pow(CONSTANTS[54]/STATES[2], 2.00000));
ALGEBRAIC[42] =  ( exp( ( CONSTANTS[61]*STATES[20])*CONSTANTS[92])*pow(STATES[16], 3.00000))*CONSTANTS[37];
ALGEBRAIC[43] =  ( exp( ( (CONSTANTS[61] - 1.00000)*STATES[20])*CONSTANTS[92])*pow(CONSTANTS[40], 3.00000))*STATES[2];
ALGEBRAIC[44] = ((( ( CONSTANTS[55]*pow(CONSTANTS[40], 3.00000))*(1.00000+pow(STATES[16]/CONSTANTS[57], 3.00000))+ ( pow(CONSTANTS[58], 3.00000)*STATES[2])*(1.00000+STATES[2]/CONSTANTS[55]))+ CONSTANTS[56]*pow(STATES[16], 3.00000))+ pow(STATES[16], 3.00000)*CONSTANTS[37])+ pow(CONSTANTS[40], 3.00000)*STATES[2];
ALGEBRAIC[92] = (( ( ( ( CONSTANTS[35]*CONSTANTS[104])*pow(CONSTANTS[59], CONSTANTS[117]))*ALGEBRAIC[40])*(ALGEBRAIC[42] - ALGEBRAIC[43]))/ALGEBRAIC[44])/(1.00000+ CONSTANTS[60]*exp( ( (CONSTANTS[61] - 1.00000)*STATES[20])*CONSTANTS[92]));
ALGEBRAIC[3] = ( ( ( ( CONSTANTS[96]*STATES[20])*CONSTANTS[28])*CONSTANTS[92])*( ( 0.750000*STATES[16])*exp( STATES[20]*CONSTANTS[92]) -  0.750000*CONSTANTS[40]))/(exp( STATES[20]*CONSTANTS[92]) - 1.00000);
ALGEBRAIC[76] =  ( ( ( ( ( CONSTANTS[38]*ALGEBRAIC[3])*STATES[22])*STATES[23])*((1.00000 - STATES[24])+CONSTANTS[43]))*pow(CONSTANTS[41], CONSTANTS[117]))*0.450000;
ALGEBRAIC[61] =  (1.00000/CONSTANTS[92])*log(CONSTANTS[40]/STATES[16]);
ALGEBRAIC[88] =  ( ( ( ( CONSTANTS[35]*CONSTANTS[52])*pow(STATES[33], 3.00000))*STATES[31])*STATES[32])*(STATES[20] - ALGEBRAIC[61]);
ALGEBRAIC[90] =  ( CONSTANTS[35]*CONSTANTS[53])*(STATES[20] - ALGEBRAIC[61]);
ALGEBRAIC[48] = 1.00000/((1.00000+ 0.124500*exp( ( - 0.100000*STATES[20])*CONSTANTS[92]))+ ( 0.0365000*CONSTANTS[105])*exp( - STATES[20]*CONSTANTS[92]));
ALGEBRAIC[94] = (( ( ( CONSTANTS[35]*CONSTANTS[62])*ALGEBRAIC[48])*CONSTANTS[39])/(1.00000+pow(CONSTANTS[64]/STATES[16], 4.00000)))/(CONSTANTS[39]+CONSTANTS[63]);
ALGEBRAIC[96] =  ( ( ( CONSTANTS[35]*CONSTANTS[106])*pow(STATES[35], 3.00000))*STATES[34])*(STATES[20] - ALGEBRAIC[61]);
ALGEBRAIC[102] = ((((ALGEBRAIC[88]+ALGEBRAIC[90])+ 3.00000*ALGEBRAIC[92])+ 3.00000*ALGEBRAIC[94])+ALGEBRAIC[76])+ALGEBRAIC[96];
ALGEBRAIC[41] = 1.00000/(1.00000+pow(CONSTANTS[54]/STATES[3], 2.00000));
ALGEBRAIC[45] =  ( exp( ( CONSTANTS[61]*STATES[20])*CONSTANTS[92])*pow(STATES[17], 3.00000))*CONSTANTS[37];
ALGEBRAIC[46] =  ( exp( ( (CONSTANTS[61] - 1.00000)*STATES[20])*CONSTANTS[92])*pow(CONSTANTS[40], 3.00000))*STATES[3];
ALGEBRAIC[47] = ((( ( CONSTANTS[55]*pow(CONSTANTS[40], 3.00000))*(1.00000+pow(STATES[17]/CONSTANTS[57], 3.00000))+ ( pow(CONSTANTS[58], 3.00000)*STATES[3])*(1.00000+STATES[3]/CONSTANTS[55]))+ CONSTANTS[56]*pow(STATES[17], 3.00000))+ pow(STATES[17], 3.00000)*CONSTANTS[37])+ pow(CONSTANTS[40], 3.00000)*STATES[3];
ALGEBRAIC[93] = (( ( ( ( CONSTANTS[114]*CONSTANTS[104])*pow(CONSTANTS[59], CONSTANTS[117]))*ALGEBRAIC[41])*(ALGEBRAIC[45] - ALGEBRAIC[46]))/ALGEBRAIC[47])/(1.00000+ CONSTANTS[60]*exp( ( (CONSTANTS[61] - 1.00000)*STATES[20])*CONSTANTS[92]));
ALGEBRAIC[4] = ( ( ( ( CONSTANTS[96]*STATES[20])*CONSTANTS[28])*CONSTANTS[92])*( ( 0.750000*STATES[17])*exp( STATES[20]*CONSTANTS[92]) -  0.750000*CONSTANTS[40]))/(exp( STATES[20]*CONSTANTS[92]) - 1.00000);
ALGEBRAIC[77] =  ( ( ( ( ( CONSTANTS[93]*ALGEBRAIC[4])*STATES[22])*STATES[23])*((1.00000 - STATES[25])+CONSTANTS[42]))*pow(CONSTANTS[41], CONSTANTS[117]))*0.450000;
ALGEBRAIC[62] =  (1.00000/CONSTANTS[92])*log(CONSTANTS[40]/STATES[17]);
ALGEBRAIC[89] =  ( ( ( ( CONSTANTS[114]*CONSTANTS[52])*pow(STATES[33], 3.00000))*STATES[31])*STATES[32])*(STATES[20] - ALGEBRAIC[62]);
ALGEBRAIC[91] =  ( CONSTANTS[114]*CONSTANTS[53])*(STATES[20] - ALGEBRAIC[62]);
ALGEBRAIC[95] = (( ( ( CONSTANTS[114]*CONSTANTS[62])*ALGEBRAIC[48])*CONSTANTS[39])/(1.00000+pow(CONSTANTS[64]/STATES[17], 4.00000)))/(CONSTANTS[39]+CONSTANTS[63]);
ALGEBRAIC[97] =  ( ( ( CONSTANTS[114]*CONSTANTS[106])*pow(STATES[35], 3.00000))*STATES[34])*(STATES[20] - ALGEBRAIC[62]);
ALGEBRAIC[103] = ((((ALGEBRAIC[89]+ALGEBRAIC[91])+ 3.00000*ALGEBRAIC[93])+ 3.00000*ALGEBRAIC[95])+ALGEBRAIC[77])+ALGEBRAIC[97];
ALGEBRAIC[58] =  ((1.00000/CONSTANTS[92])/2.00000)*log(CONSTANTS[37]/STATES[2]);
ALGEBRAIC[71] =  ( CONSTANTS[35]*CONSTANTS[36])*(STATES[20] - ALGEBRAIC[58]);
ALGEBRAIC[0] = ( ( ( ( ( CONSTANTS[94]*4.00000)*STATES[20])*CONSTANTS[28])*CONSTANTS[92])*( ( 0.341000*STATES[2])*exp( ( 2.00000*STATES[20])*CONSTANTS[92]) -  0.341000*CONSTANTS[37]))/(exp( ( 2.00000*STATES[20])*CONSTANTS[92]) - 1.00000);
ALGEBRAIC[73] =  ( ( ( ( ( CONSTANTS[38]*ALGEBRAIC[0])*STATES[22])*STATES[23])*((1.00000 - STATES[24])+CONSTANTS[43]))*pow(CONSTANTS[41], CONSTANTS[117]))*0.450000;
ALGEBRAIC[52] = pow( STATES[2]*1.00000, 1.60000);
ALGEBRAIC[98] = ( ( ( CONSTANTS[35]*pow(CONSTANTS[70], CONSTANTS[117]))*CONSTANTS[68])*ALGEBRAIC[52])/(ALGEBRAIC[52]+CONSTANTS[89]);
ALGEBRAIC[104] = ((ALGEBRAIC[73]+ALGEBRAIC[71])+ALGEBRAIC[98]) -  2.00000*ALGEBRAIC[92];
ALGEBRAIC[59] =  ((1.00000/CONSTANTS[92])/2.00000)*log(CONSTANTS[37]/STATES[3]);
ALGEBRAIC[72] =  ( CONSTANTS[114]*CONSTANTS[36])*(STATES[20] - ALGEBRAIC[59]);
ALGEBRAIC[1] = ( ( ( ( ( CONSTANTS[94]*4.00000)*STATES[20])*CONSTANTS[28])*CONSTANTS[92])*( ( 0.341000*STATES[3])*exp( ( 2.00000*STATES[20])*CONSTANTS[92]) -  0.341000*CONSTANTS[37]))/(exp( ( 2.00000*STATES[20])*CONSTANTS[92]) - 1.00000);
ALGEBRAIC[74] =  ( ( ( ( ( CONSTANTS[93]*ALGEBRAIC[1])*STATES[22])*STATES[23])*((1.00000 - STATES[25])+CONSTANTS[42]))*pow(CONSTANTS[41], CONSTANTS[117]))*0.450000;
ALGEBRAIC[53] = pow( STATES[3]*1.00000, 1.60000);
ALGEBRAIC[99] = ( ( ( CONSTANTS[114]*pow(CONSTANTS[70], CONSTANTS[117]))*CONSTANTS[68])*ALGEBRAIC[53])/(ALGEBRAIC[53]+CONSTANTS[89]);
ALGEBRAIC[105] = ((ALGEBRAIC[74]+ALGEBRAIC[72])+ALGEBRAIC[99]) -  2.00000*ALGEBRAIC[93];
ALGEBRAIC[118] = ALGEBRAIC[104]+ALGEBRAIC[105];
ALGEBRAIC[9] =  CONSTANTS[44]*(STATES[20] - CONSTANTS[115]);
ALGEBRAIC[10] =  (( CONSTANTS[35]*CONSTANTS[46])/(1.00000+CONSTANTS[45]/STATES[2]))*(STATES[20] - CONSTANTS[115]);
ALGEBRAIC[11] =  (( CONSTANTS[114]*CONSTANTS[46])/(1.00000+CONSTANTS[45]/STATES[3]))*(STATES[20] - CONSTANTS[115]);
ALGEBRAIC[78] = ALGEBRAIC[10]+ALGEBRAIC[11];
ALGEBRAIC[101] = ALGEBRAIC[78]+ALGEBRAIC[9];
ALGEBRAIC[2] = ( ( ( ( CONSTANTS[95]*STATES[20])*CONSTANTS[28])*CONSTANTS[92])*( ( 0.750000*STATES[21])*exp( STATES[20]*CONSTANTS[92]) -  0.750000*CONSTANTS[39]))/(exp( STATES[20]*CONSTANTS[92]) - 1.00000);
ALGEBRAIC[75] =  ( ( ( ( ALGEBRAIC[2]*STATES[22])*STATES[23])*( CONSTANTS[38]*(CONSTANTS[43]+(1.00000 - STATES[24]))+ CONSTANTS[93]*(CONSTANTS[42]+(1.00000 - STATES[25]))))*pow(CONSTANTS[41], CONSTANTS[117]))*0.450000;
ALGEBRAIC[60] =  (1.00000/CONSTANTS[92])*log(CONSTANTS[39]/STATES[21]);
ALGEBRAIC[12] = STATES[17];
ALGEBRAIC[13] = 0.100000+0.900000/(1.00000+pow(ALGEBRAIC[12]/7.00000, 2.00000));
ALGEBRAIC[79] = ( ALGEBRAIC[13]*1.00000)/(1.00000+exp( 0.238500*((STATES[20] - ALGEBRAIC[60]) - 59.2150)));
ALGEBRAIC[80] =  1.00000*(( 0.491240*exp( 0.0803200*((STATES[20] - ALGEBRAIC[60])+5.47600))+exp( 0.0617500*((STATES[20] - ALGEBRAIC[60]) - 594.310)))/(1.00000+exp( - 0.514300*((STATES[20] - ALGEBRAIC[60])+4.75300))));
ALGEBRAIC[81] = ALGEBRAIC[79]/(ALGEBRAIC[79]+ALGEBRAIC[80]);
ALGEBRAIC[109] =  ( ( CONSTANTS[47]*CONSTANTS[97])*ALGEBRAIC[81])*(STATES[20] - ALGEBRAIC[60]);
ALGEBRAIC[14] = STATES[17];
ALGEBRAIC[82] = (CONDVAR[0]<0.00000 ? 1.00000+1.50000/(1.00000+pow(9.00000/ALGEBRAIC[14], 4.00000)) : 1.00000);
ALGEBRAIC[110] =  ( ( ( ( CONSTANTS[99]*ALGEBRAIC[82])*CONSTANTS[98])*(0.0550000+0.400000/(1.00000+exp(((STATES[20] - ALGEBRAIC[60])+9.53000)/17.1800))))*(STATES[20] - ALGEBRAIC[60]))* pow((CONSTANTS[39]/5.40000), 1.0 / 2);
ALGEBRAIC[15] = 1.00000/(1.00000+exp(7.48800 - STATES[20]/5.98000));
ALGEBRAIC[83] =  ( ( CONSTANTS[35]*CONSTANTS[50])*ALGEBRAIC[15])*(STATES[20] - ALGEBRAIC[60]);
ALGEBRAIC[84] =  ( ( CONSTANTS[114]*CONSTANTS[50])*ALGEBRAIC[15])*(STATES[20] - ALGEBRAIC[60]);
ALGEBRAIC[111] = ALGEBRAIC[83]+ALGEBRAIC[84];
ALGEBRAIC[18] = 1.00000/(1.00000+exp((STATES[20]+74.0000)/24.0000));
ALGEBRAIC[85] =  ( ( CONSTANTS[100]*STATES[26])*ALGEBRAIC[18])*(STATES[20] - ALGEBRAIC[60]);
ALGEBRAIC[19] =  (1.00000/CONSTANTS[92])*log((CONSTANTS[39]+ CONSTANTS[51]*CONSTANTS[40])/(STATES[21]+ CONSTANTS[51]*STATES[27]));
ALGEBRAIC[20] =  ( ( CONSTANTS[35]*CONSTANTS[101])*pow(STATES[28], 2.00000))*(STATES[20] - ALGEBRAIC[19]);
ALGEBRAIC[21] =  ( ( CONSTANTS[114]*CONSTANTS[102])*pow(STATES[28], 2.00000))*(STATES[20] - ALGEBRAIC[19]);
ALGEBRAIC[86] = ALGEBRAIC[20]+ALGEBRAIC[21];
ALGEBRAIC[87] =  ( ( CONSTANTS[103]*STATES[29])*STATES[30])*(STATES[20] - ALGEBRAIC[60]);
ALGEBRAIC[115] = ALGEBRAIC[94]+ALGEBRAIC[95];
ALGEBRAIC[100] =  ( ( CONSTANTS[107]*STATES[36])*STATES[37])*(STATES[20] - ALGEBRAIC[60]);
ALGEBRAIC[120] = (((((((ALGEBRAIC[100]+ALGEBRAIC[85])+ALGEBRAIC[86])+ALGEBRAIC[109]) -  2.00000*ALGEBRAIC[115])+ALGEBRAIC[75])+ALGEBRAIC[111])+ALGEBRAIC[87])+ALGEBRAIC[110];
ALGEBRAIC[119] = ALGEBRAIC[102]+ALGEBRAIC[103];
ALGEBRAIC[122] = ((ALGEBRAIC[119]+ALGEBRAIC[101])+ALGEBRAIC[118])+ALGEBRAIC[120];
}
void
getStateInformation(double* SI)
{
SI[0] = 1.0;
SI[1] = 1.0;
SI[2] = 1.0;
SI[3] = 1.0;
SI[41] = 0.0;
SI[42] = 0.0;
SI[43] = 0.0;
SI[4] = 1.0;
SI[5] = 1.0;
SI[6] = 1.0;
SI[7] = 1.0;
SI[8] = 1.0;
SI[9] = 1.0;
SI[10] = 1.0;
SI[11] = 1.0;
SI[12] = 1.0;
SI[13] = 1.0;
SI[14] = 1.0;
SI[15] = 1.0;
SI[16] = 1.0;
SI[17] = 1.0;
SI[18] = 1.0;
SI[19] = 1.0;
SI[20] = 1.0;
SI[21] = 1.0;
SI[22] = 1.0;
SI[23] = 1.0;
SI[24] = 1.0;
SI[25] = 1.0;
SI[26] = 1.0;
SI[27] = 1.0;
SI[28] = 1.0;
SI[29] = 1.0;
SI[30] = 1.0;
SI[31] = 1.0;
SI[32] = 1.0;
SI[33] = 1.0;
SI[34] = 1.0;
SI[35] = 1.0;
SI[36] = 1.0;
SI[37] = 1.0;
SI[38] = 1.0;
SI[39] = 1.0;
SI[40] = 1.0;
}
void
computeRoots(double VOI, double* CONSTANTS, double* RATES, double* OLDRATES, double* STATES,
             double* OLDSTATES, double* ALGEBRAIC, double* CONDVARS)
{
CONDVAR[0] = CONSTANTS[31] - 1.00000;
CONDVAR[1] = STATES[20] - - 40.0000;
CONDVAR[2] = STATES[20] - - 40.0000;
CONDVAR[3] = STATES[20] - - 40.0000;
CONDVAR[4] = STATES[20] - - 40.0000;
CONDVAR[5] = ((VOI - CONSTANTS[85]) -  CONSTANTS[86]*floor((VOI - CONSTANTS[85])/CONSTANTS[86])) - CONSTANTS[84];
}