# What type of differential equation system is this ? And how to solve them?

I need to solve an equation system that is defining flows and pressures in cardiovascular system. As you can see 10 of them are algebraic and 14 of them are differential equations. I am planing to use scipy.odeint for numerical solution. I tried 2 different ways:

Firstly I differentiated the algebraic ones which are \begin{align} x_2,x_4,x_6,x_8,x_9,x_{10},x_{11},x_{12},x_{18} \end{align} \begin{align}x_{24}\end{align}. But didn't pursue that way because \begin{align} x'_9,x'_{10},x'_{11},x'_{12} \end{align} were piecewise functions and couldn't find out how to implement all those coupled equations.

Secondly some guy from stackoverflow told that those equations form a differential algebraic equation system. As far as I learned from internet, in a dae system you must have algebraic constraint equations for all unknown variables. From \begin{align} x_2 \end{align} I can get a constraint equation for \begin{align} x_1 \end{align} such that \begin{align} x_1 &= V_{lv0} + ((x_2-P_{lv0})/(e_{lv}t))\end{align} But again I am not sure I would be succesfull if I follow that way. Because there are not constraints for all unknowns.

So , could someone suggest me a way to solve these equations? Or at least what kind of equations are those ? Or are there some explanatory sources for such problems ? Thanks in advance.

\begin{align} x'_1 &= x'_2-x'_9 \\ x_2 &= P_{lv0}+e_{lv}(t)(x_1 -V_{lv0})\\ x'_3 &= x'_{11}-x'_{10} \\ x_4 &= P_{rv0}+e_{rv}(t)(x_3 -V_{rv0})\\ x'_5 &= x_{24}-x_{12}\\ x_6 &= P_{la0}+e_{la}(t)(x_5 -V_{la0})\\ x'_7 &= x_{18}-x_{11}\\ x_8 &= P_{ra0}+e_{ra}(t)(x_7 -V_{ra0})\\ x_9 &= \left\{ \begin{array}{ll} cqao(x_2-x_{13})^{(0.5)} & x_2\ge x_{13}\\ 0, & x_2\lt x_{13} \end{array} \right.\\ x_{10} &= \left\{ \begin{array}{ll} cqpo(x_2-x_{13})^{(0.5)} & x_4\ge x_{19}\\ 0, & x_4\lt x_{19} \end{array} \right.\\ x_{11} &= \left\{ \begin{array}{ll} cqti(x_8-x_4)^{(0.5)} & x_8\ge x_{4}\\ 0, & x_8\lt x_{4} \end{array} \right.\\ x_{12} &= \left\{ \begin{array}{ll} cqmi(x_6-x_{2})^{(0.5)} & x_6\ge x_{2}\\ 0, & x_6\lt x_{2} \end{array} \right.\\ x'_{13} &=csas^{-1}(x_9-x_{20})\\ x'_{14} &=lsas^{-1}(x_{13}-x_{15}-rsas(x_{14}))\\ x'_{15} &=csat^{-1}(x_{14}-x_{16})\\ x'_{16} &=lsat^{-1}(x_{15}-x_{17}-(rsat+rsar+rscp)(x_{16}))\\ x'_{17} &=csvn^{-1}(x_{16}-x_{18})\\ x_{18} &=rsvn^{-1}(x_{17}-x_{8})\\ x'_{19} &=cpas^{-1}(x_{10}-x_{22})\\ x'_{20} &=lpas^{-1}(x_{19}-x_{21}-rpas(x_{20}))\\ x'_{21} &=cpat^{-1}(x_{20}-x_{22})\\ x'_{22} &=lpat^{-1}(x_{21}-x_{23}-(rpat+rpar+rpcp)(x_{22}))\\ x'_{23} &=cpvn^{-1}(x_{22}-x_{24})\\ x_{24} &=rpvn^{-1}(x_{23}-x_{6})\\ \end{align}

(\begin{align} e_{lv}(t),e_{rv}(t),e_{la}(t),e_{ra}(t) \end{align} are all well defined piecewise sinusoidal functions, four letters and variables with suffix 0 are all constants which are coefficients or values of model components)

The schematic of simplified model The model is comprised of 3 main modules: Heart, Systemic Circulation and Pulmonary Circulation. Each submodel has its own pressure and flow variables. In order to simplify them I changed all the unknown variable names with x. For example \begin{align} x'_1 \end{align} is actually the differentiation of left ventricle volume according to time: \begin{align} dV_{lv}(t)/dt \end{align}

• The first line should perhaps read "I need to solve a system of equations that define flows and pressures in a simplified model of the cardiovascular system." Then it would be very helpful to draw a schematic picture of your simplified model with an explanation of how the variables used relate to this picture. Also what do the groups of four letters refer to: are they undeclared functions or various combinations of undeclared variables? – James Arathoon Apr 25 '18 at 11:59
• Thanks for including the schematic. I would have thought that blood can be assumed incompressible at the pressures the heart can generate. With the assumption that a healthy system of circulation is a closed loop pumped system, is not the volume rate of blood flow a constant around the complete system. – James Arathoon Apr 25 '18 at 16:48
• I should of said cannot the short term average volume rate of blood flow be considered a constant to a first approximation (the average taken over two or more heartbeat cycles). As with an a.c. signal passing through a series of filters (using discrete time signal processing analysis) the original heartbeat pulse generated as blood passes through the heart will be modified as the blood passes from the arteries through to the veins, with presumably the higher frequency components of the original pulse being gradually removed in the process. – James Arathoon Apr 25 '18 at 18:08
• Thanks for commenting @JamesArathoon. If I did not misunderstand you are suggesting to make some approximation. But as this is already a simplified model I should find a solution without a reduction. It seems an easy way to differentiate algebraic eqns. In that case problem transforms to translate -an ode system with "parameters" which are functions of the dependent variables- into python code. – kemal kaya Apr 26 '18 at 16:51
• I tried to find the paper that the diagram comes from but it is behind a paywall. Two important types of model are the time domain model and the frequency domain model. The frequency domain model tends to be a linearized black box type model. Doesn't a time domain model using a set of linked differential equations need at the very least to account for the elastic response of the artery wall and such like, section by section, as this will affect the speed at which a pressure pulse from the heart moves along a given length of artery piping and how it is modified on this journey. – James Arathoon Apr 26 '18 at 19:04