Layla
Layla

Reputation: 5466

problems with DSolve in Mathematica

I would like to solve this system of differential equations with Mathematica 7, but I found an error that says that the function was specified without dependence on all the independent variables. The equations are: enter image description here

Thanks everybody for your help

Upvotes: 1

Views: 1653

Answers (2)

Simon
Simon

Reputation: 14731

About the error you saw, it's hard to say exactly what you did wrong without seeing your code. But hopefully the code below will help clarify whatever mistake you happened to have made.


Now to solve the system of DEs. You can first solve the x DE:

In[1]:= xSoln = DSolve[{x'[t] == r1 - g1 x[t]}, x, t]

Out[1]= {{x -> Function[{t}, r1/g1 + E^(-g1 t) C[1]]}}

This can be substituted into the y DE to give a 1st order, linear, inhomogeneous differential equation, which can be solved with an integrating factor.

In[2]:= y'[t] == k2 x[t]/(k + x[t]) - g2 y[t] /. xSoln[[1]]

Out[2]= y'[t] == - g2 y[t]  
                 + (k2 (r1/g1 + E^(-g1 t) C[1]))/(k + r1/g1 + E^(-g1 t) C[1])

Call the inhomogeneous mess f[t], so the DE is y'[t] == f[t] - g2 y[t]. Mathematica can solve this

In[3]:= y[t] /. DSolve[y'[t] == f[t] - g2 y[t], y, t][[1]]

Out[3]= C[1] E^(-g2 t) + E^(-g2 t) Integrate[E^(g2 K[1]) f[K[1]], {K[1], 1, t}]

Note that the integration constant C[1] is not the same as that in the x[t] solution. Also that, when you substitute in the explicit form of f[t], Mathematica can not do the integral in closed form.

So the best that we can do is

x[t] == r1/g1 + E^(-g1 t) C[1]
y[t] == C[2] E^(-g2 t) + E^(-g2 t) Integrate[E^(g2 s) f[s], s]

where

f[s] == k2 (r1 E^(g1 s) + g1 C[1])/((g1 k + r1)E^(g1 s) + g1 C[1])

Upvotes: 0

user1054186
user1054186

Reputation:

I do not have V7 handy but does this help?

DSolve[{D[x[t], t] == r1 - g1 x[t], 
  D[y[t], t] == k2 x[t]/(K + x[t]) g2 y[t]}, {x, y}, t]

Upvotes: 2

Related Questions