# How to solve a system of ordinary differential equations contain a interpolating function?

I'm wondering how I can solve a system of ODE that has a interpolating function? For example, z and y are InterpolatingFunctions generated by prior NDSolve commands. Now I need to solve a second ODE system:

{x2'[t] == -k1*x2[t]*y[t]/h2[t] + k2*z[t],
h2'[t] == -3*(-k1*x2[t]*y[t]/h2[t] + k2*z[t]),
x2[0] == 0, h2[0] == 1}


where k1 and k2 are constants.

-
I recommend that you post two separate questions. Having said that, I think that both questions have issues. In your first question, you've got a condition on x, namely x[0]==.001, yet there's no x[t] in your system. Also, concrete explanations as to where y, z, k1, and k2 arise would be nice. As for the second question - is that well formed mathematically? For example, $f(t)=c e^{-t}$ solves $f'=-f$ and $\lim_{t\rightarrow\infty}f(t)=0$ for all $c$. – Mark McClure Nov 7 '12 at 22:01
Thanks Mark. I'll post another question regarding to the 2nd part of my question! – DumbleKo Nov 7 '12 at 23:55

Using an interpolating function in a call to NDSolve is a simple matter. Here's a totally made up example.

Clear[x, y];
y[t_] = y[t] /. First[NDSolve[{
y'[t] == Sin[t] y[t] Sin[y[t]],
y[0] == 1
}, y[t], {t, 0, 10}]];
x[t_] = x[t] /. First[NDSolve[{
x'[t] == y[t]*Sin[x[t]] + 1, x[0] == 1},
x[t], {t, 0, 10}]];
Plot[{x[t], y[t]}, {t, 0, 10}]


-
+1 Cute. I think it might be worth remarking that a single NDSolve call for coupled system would be as efficient. – Sasha Nov 7 '12 at 23:13