3 added 36 characters in body
source | link

Here I will illustrate with a simple example to solve two couple systems of odes.

Method I

(*The first system*)
Ode1 = x'[t] == 1/y[t];    
Ode2 = y'[t] == x[t];    
ics := {x[0] == 1, y[0] == 2};
sys = Join[{Ode1, Ode2}, ics];    
soln = First@NDSolve[sys, {x, y}, {t, 0, 10}];    
x1[t_] := Evaluate[x[t] /. soln]; (*assign the interpolating function x[t] to x1[t]*)    
y1[t_] := Evaluate[y[t] /. soln]; (*assign the interpolating function y[t] to y1[t]*)    
(*The second system*) 
Ode3 = x2'[t] == x1[t];
Ode4 = y2'[t] == x2[t] + y1[t] + y2[t];
ics2 := {x2[0] == -1, y2[0] == -2};
sys1 = Join[{Ode3, Ode4}, ics2];
soln1 = First@NDSolve[sys1, {x2, y2}, {t, 0, 10}];
Plot[{x1[t], y1[t], {x2[t], y2[t]} /. soln1}, {t, 0, 10}]

enter image description here

Method II

Solve the two systems as one,

Ode3 = x2'[t] == x[t];    
Ode4 = y2'[t] == x2[t] + y[t] + y2[t];    
combsys12 = Join[{Ode1, Ode2, Ode3, Ode4}, ics, ics2];    
combsoln = First@NDSolve[combsys12, {x, y, x2, y2}, {t, 0, 10}];    
Plot[{x[t], y[t], x2[t], y2[t]} /. combsoln, {t, 0, 10}]

enter image description here

Here I will illustrate with a simple example to solve two couple systems of odes.

Method I

(*The first system*)
Ode1 = x'[t] == 1/y[t];    
Ode2 = y'[t] == x[t];    
ics := {x[0] == 1, y[0] == 2};    
soln = First@NDSolve[sys, {x, y}, {t, 0, 10}];    
x1[t_] := Evaluate[x[t] /. soln]; (*assign the interpolating function x[t] to x1[t]*)    
y1[t_] := Evaluate[y[t] /. soln]; (*assign the interpolating function y[t] to y1[t]*)    
(*The second system*) 
Ode3 = x2'[t] == x1[t];
Ode4 = y2'[t] == x2[t] + y1[t] + y2[t];
ics2 := {x2[0] == -1, y2[0] == -2};
sys1 = Join[{Ode3, Ode4}, ics2];
soln1 = First@NDSolve[sys1, {x2, y2}, {t, 0, 10}];
Plot[{x1[t], y1[t], {x2[t], y2[t]} /. soln1}, {t, 0, 10}]

enter image description here

Method II

Solve the two systems as one,

Ode3 = x2'[t] == x[t];    
Ode4 = y2'[t] == x2[t] + y[t] + y2[t];    
combsys12 = Join[{Ode1, Ode2, Ode3, Ode4}, ics, ics2];    
combsoln = First@NDSolve[combsys12, {x, y, x2, y2}, {t, 0, 10}];    
Plot[{x[t], y[t], x2[t], y2[t]} /. combsoln, {t, 0, 10}]

enter image description here

Here I will illustrate with a simple example to solve two couple systems of odes.

Method I

(*The first system*)
Ode1 = x'[t] == 1/y[t];    
Ode2 = y'[t] == x[t];    
ics := {x[0] == 1, y[0] == 2};
sys = Join[{Ode1, Ode2}, ics];    
soln = First@NDSolve[sys, {x, y}, {t, 0, 10}];    
x1[t_] := Evaluate[x[t] /. soln]; (*assign the interpolating function x[t] to x1[t]*)    
y1[t_] := Evaluate[y[t] /. soln]; (*assign the interpolating function y[t] to y1[t]*)    
(*The second system*) 
Ode3 = x2'[t] == x1[t];
Ode4 = y2'[t] == x2[t] + y1[t] + y2[t];
ics2 := {x2[0] == -1, y2[0] == -2};
sys1 = Join[{Ode3, Ode4}, ics2];
soln1 = First@NDSolve[sys1, {x2, y2}, {t, 0, 10}];
Plot[{x1[t], y1[t], {x2[t], y2[t]} /. soln1}, {t, 0, 10}]

enter image description here

Method II

Solve the two systems as one,

Ode3 = x2'[t] == x[t];    
Ode4 = y2'[t] == x2[t] + y[t] + y2[t];    
combsys12 = Join[{Ode1, Ode2, Ode3, Ode4}, ics, ics2];    
combsoln = First@NDSolve[combsys12, {x, y, x2, y2}, {t, 0, 10}];    
Plot[{x[t], y[t], x2[t], y2[t]} /. combsoln, {t, 0, 10}]

enter image description here

2 added 441 characters in body
source | link

Here I will illustrate with a simple example to solve two couple systems of odes.

Method I

(*The first system*)
Ode1 = x'[t] == 1/y[t];    
Ode2 = y'[t] == x[t];    
ics := {x[0] == 1, y[0] == 2};    
soln = First@NDSolve[sys, {x, y}, {t, 0, 10}];    
x1[t_] := Evaluate[x[t] /. soln]; (*assign the interpolating function x[t] to x1[t]*)    
y1[t_] := Evaluate[y[t] /. soln]; (*assign the interpolating function y[t] to y1[t]*)    
(*The second system*) 
Ode3 = x2'[t] == x1[t];
Ode4 = y2'[t] == x2[t] + y1[t] + y2[t];
ics2 := {x2[0] == -1, y2[0] == -2};
sys1 = Join[{Ode3, Ode4}, ics2];
soln1 = First@NDSolve[sys1, {x2, y2}, {t, 0, 10}];
Plot[{x1[t], y1[t], {x2[t], y2[t]} /. soln1}, {t, 0, 10}]

enter image description here

Method II

Solve the two systems as one,

Ode3 = x2'[t] == x[t];    
Ode4 = y2'[t] == x2[t] + y[t] + y2[t];    
combsys12 = Join[{Ode1, Ode2, Ode3, Ode4}, ics, ics2];    
combsoln = First@NDSolve[combsys12, {x, y, x2, y2}, {t, 0, 10}];    
Plot[{x[t], y[t], x2[t], y2[t]} /. combsoln, {t, 0, 10}]

enter image description here

Here I will illustrate with a simple example to solve two couple systems of odes.

(*The first system*)
Ode1 = x'[t] == 1/y[t];    
Ode2 = y'[t] == x[t];    
ics := {x[0] == 1, y[0] == 2};    
soln = First@NDSolve[sys, {x, y}, {t, 0, 10}];    
x1[t_] := Evaluate[x[t] /. soln]; (*assign the interpolating function x[t] to x1[t]*)    
y1[t_] := Evaluate[y[t] /. soln]; (*assign the interpolating function y[t] to y1[t]*)    
(*The second system*) 
Ode3 = x2'[t] == x1[t];
Ode4 = y2'[t] == x2[t] + y1[t] + y2[t];
ics2 := {x2[0] == -1, y2[0] == -2};
sys1 = Join[{Ode3, Ode4}, ics2];
soln1 = First@NDSolve[sys1, {x2, y2}, {t, 0, 10}];
Plot[{x1[t], y1[t], {x2[t], y2[t]} /. soln1}, {t, 0, 10}]

enter image description here

Here I will illustrate with a simple example to solve two couple systems of odes.

Method I

(*The first system*)
Ode1 = x'[t] == 1/y[t];    
Ode2 = y'[t] == x[t];    
ics := {x[0] == 1, y[0] == 2};    
soln = First@NDSolve[sys, {x, y}, {t, 0, 10}];    
x1[t_] := Evaluate[x[t] /. soln]; (*assign the interpolating function x[t] to x1[t]*)    
y1[t_] := Evaluate[y[t] /. soln]; (*assign the interpolating function y[t] to y1[t]*)    
(*The second system*) 
Ode3 = x2'[t] == x1[t];
Ode4 = y2'[t] == x2[t] + y1[t] + y2[t];
ics2 := {x2[0] == -1, y2[0] == -2};
sys1 = Join[{Ode3, Ode4}, ics2];
soln1 = First@NDSolve[sys1, {x2, y2}, {t, 0, 10}];
Plot[{x1[t], y1[t], {x2[t], y2[t]} /. soln1}, {t, 0, 10}]

enter image description here

Method II

Solve the two systems as one,

Ode3 = x2'[t] == x[t];    
Ode4 = y2'[t] == x2[t] + y[t] + y2[t];    
combsys12 = Join[{Ode1, Ode2, Ode3, Ode4}, ics, ics2];    
combsoln = First@NDSolve[combsys12, {x, y, x2, y2}, {t, 0, 10}];    
Plot[{x[t], y[t], x2[t], y2[t]} /. combsoln, {t, 0, 10}]

enter image description here

1
source | link

Here I will illustrate with a simple example to solve two couple systems of odes.

(*The first system*)
Ode1 = x'[t] == 1/y[t];    
Ode2 = y'[t] == x[t];    
ics := {x[0] == 1, y[0] == 2};    
soln = First@NDSolve[sys, {x, y}, {t, 0, 10}];    
x1[t_] := Evaluate[x[t] /. soln]; (*assign the interpolating function x[t] to x1[t]*)    
y1[t_] := Evaluate[y[t] /. soln]; (*assign the interpolating function y[t] to y1[t]*)    
(*The second system*) 
Ode3 = x2'[t] == x1[t];
Ode4 = y2'[t] == x2[t] + y1[t] + y2[t];
ics2 := {x2[0] == -1, y2[0] == -2};
sys1 = Join[{Ode3, Ode4}, ics2];
soln1 = First@NDSolve[sys1, {x2, y2}, {t, 0, 10}];
Plot[{x1[t], y1[t], {x2[t], y2[t]} /. soln1}, {t, 0, 10}]

enter image description here