# How do I solve coupled ordinary differential equations?

I have four coupled ODE's. I am not sure how to plot and solve them using Mathematica.

I won't give the exact problem, but the following is something analogous:

The equations

a= x'[t]
a'=-c1*x[t]/c2+c1*(y[t]-x[t])/c2
b=y'[t]
b'=-c1*(y[t]-x[t])/c2


Can be written as

x'[t]= -c1*x[t]/c2 + c1*(y[t]-x[t])/c2
y'[t]= -c1*(y[t]-x[t])/c2


The question is, now how do I use these in NDSolve to give solution and later a plot as well? I have initial conditions to plug in, but I am hung up on how to solve these coupled equations...

Edit I do not know how to input this into NDSolve.

• I think if $a=x'[t]$ then $a'=x''[t]$… and does c1x[t] lack a blank after c1? Your equation seems to be pretty normal, what difficulty do you have in solving them with NDSolve? I suggest you to give a more specific sample. Nov 5, 2012 at 5:27
• If $a=x'[t]$ then $a'=x''[t]$… have you checked the document for the syntax of NDSolve? : reference.wolfram.com/mathematica/ref/… Nov 5, 2012 at 6:01
• No need to use NDSolve. This is a linear system analytically solvable in closed form with DSolve Please make an effort, look through examples there. There are some almost identical to your case. Nov 5, 2012 at 7:12
• Welcome to Mathematica.SE! I suggest the following: 1) As you receive help, try to give it too, by answering questions in your area of expertise. 2)Read the FAQs! 3) When you see good Q&A, vote them up by clicking the gray triangles, because the credibility of the system is based on the reputation gained by users sharing their knowledge. ALSO, remember to accept the answer, if any, that solves your problem, by clicking the checkmark sign Nov 5, 2012 at 8:04

I liked the shaped of the solutions and couldn't stay away from posting this. No need to use NDSolve. This is a linear system analytically solvable in closed form with DSolve. DSolve can get you easily large formulas for general solution. But if you specify initial conditions you can get a bit more compact forms of closed solutions.

{X, Y} = {x, y} /. DSolve[{
x'[t] == -c1*x[t]/c2 + c1*(y[t] - x[t])/c2,
y'[t] == -c1*(y[t] - x[t])/c2, x[0] == 0, y[0] == 1},
{x, y}, t] // FullSimplify // First


Manipulate[Plot[Evaluate[{X[t], Y[t]} /. {c1 -> a, c2 -> b}], {t, 0, 10},
PlotRange -> {0, 1}, PlotStyle -> Thick, Filling -> {1 -> {2}}],
{{a, 1.3, "c1"}, 1, 3, Appearance -> "Labeled"},
{{b, 2.5, "c2"}, 1, 3, Appearance -> "Labeled"}]
`

You may learn how to do that by looking into Help/Documentation Center/NDSolve/Basic examples and there example Nr. 3 gives the answer to your question.