# Setting up two ordinary differential equations [closed]

Just having a total blank at the moment, I realise that maybe this question would best be suited for a math forum but i assume Mathematica is needed in order to solve these equations. So the question explains that as time passes the two equations "decay", just no idea by how much. So basically there are two ordinary, differential equations both decaying at different rates (I've attached them). I need to solve them for $t = 0$ to $120$ minutes.

Assume the initial conditions at $t = 0$ are

$\quad \quad A=B=0$

and that the parameters are

$\quad \quad K_1=0.5,\, K_2=2,\, n=10$

The ODEs are

$$\frac{dA}{dt}=\frac{0.5}{1+\left(\frac{B}{K_1}\right)^n}-0.2\,A$$ $$\frac{dB}{dt}=\frac{1}{1+\left(\frac{A}{K_2}\right)^n}-2\,B$$

I really have no idea mathematically nor Mathematica-wise on how to do this :(

• – Sektor May 25 '15 at 15:47
• Thanks, might sound stupid but I am still unsure of the relationship between t and both equations, is it that each value of A or B is affected by the amount calculated in the equation per 1 minute interval of t? – Steve May 25 '15 at 15:55

You could try something like this (but this question is likely to be closed because it has been asked 10 000 times)

eqn1 = D[A[t], t] == 1/2/(1 + (B[t]/k1)^n) - 2/10 A[t]
eqn2 = D[B[t], t] == 1/(1 + (A[t]/k2)^n) - 2 B[t]


You can then solve for A[t],B[t]

sol=NDSolveValue[{eqn1, eqn2, A[0] == 0, B[0] == 0} /. {n -> 10, k1 -> 1/2,
k2 -> 2}, {A[t], B[t]}, {t, 0, 1}]


Then you can plot the result:

Plot[sol, {t, 0, 1}]


• "... I have assumed arbitrarily that n=1,k1=k2=1 and A[0]=0, B[0]=0." doesn't seem to be the case. It appears that you substituted the OP values for the parameters. And the OP specified A[0]=0, B[0]=0. You should reconsider that remark. – m_goldberg May 25 '15 at 16:54
• No intent of telling you off. Just suggesting that you edit your answer to reflect the current state of the question. – m_goldberg May 25 '15 at 17:06

Without understanding what is happening conceptually, I'm afraid that Mathematica probably won't help you much. You have a 2-by-2 system of differential equations, which I would recommend researching in general.

However, I like using Mathematica to visualize what is happening in a system, so here's some code!

k1 = 0.5; k2 = 2; n = 10;
StreamPlot[{.5/(1 + (y/k1)^n) - 0.2*x, 1/(1 + ((x/k2)^n) ) - 2*y},
{x, -7, 7}, {y, -7, 7}]


I changed the notation to $x$ and $y$ instead of $A$ and $B$, but it's the same equations. This is a plot of the system's evolution over time for various initial conditions. I don't know where these equations came from, but this type of visualization helped me when I took Diff EQ's.

For some background info, try this
{"found_math": true, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 1, "mathjax_display_tex": 1, "mathjax_asciimath": 1, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0}