I've given the following first order linear inhomogeneous ordinary differential equation (ODE) equation, unfortunately with nonconstant coefficients:

$$ \frac{A(t)+B(t)}{A(t)}\dot y + \frac{B(t)}{C(t)}y = \frac{1}{C(t)}x_0 $$

where $x_0$ is a constant and $A(t)$, $B(t)$ and $C(t)$ are continuous functions, given by

$$ A(t) = a_1\cdot \exp(a_2\cdot t^{a_3}) \\ B(t) = b_1\cdot \exp(b_2\cdot t^{b_3}) \\ C(t) = c_1\cdot \exp(c_2\cdot t^{c_3}) $$

where $a_i$, $b_i$ and $c_i$ are constants.

Now, I want to find an analytical solution for $y(t)$ while $t > 1$, if an IVP $y(t = 1) = y_0 = const.$ is given. And I hope that this is somehow possible.

I know that it is possible to separate the variables of the equation, so that $y(t) = y_\text{H} + y_\text{P}$. To find the solution of the homogeneous part should not be that problem, maybe "only" to solve the integrals. The bigger Problem for me is that I have no idea how I can find the particular solution. And unfortunately I didn't find any example of such equation-type on the web ...

Another Idea from a math-script was to use "integrating factors". Therefor, I rewrote the given ode to:

$$ \dot y + \underbrace{\frac{A(t)\cdot B(t)}{C(t)\cdot (A(t)+B(t))}}_{p(t)}\cdot y = \underbrace{\frac{A(t)}{C(t)\cdot (A(t) + B(t))}}_{g(t)}\cdot x_0 $$

what leads to the following Expression as solution for $y(t)$:

$$ y(t) = \frac{\int\exp(\int p(t) \text{d}t)\cdot g(t)\text{d}t + C_1}{\exp(\int p(t)\text{d}t)} $$

But now I have the problem that I dont know how to solve the integrals of the solution for $y(t)$ that I can determine the constant $C_1$ for the solution of the IVP.

It would be fine if anyone of you has an idea how to deal with this problem. Or isn't it possible to solve this "thing" analytically?

Thank you in advance, pj

  • $\begingroup$ Using CAS: $$y(t)=e^{\int_1^t -p(s) \, ds-\int_1^{\text{t0}} -p(s) \, ds} \left(\text{y0}+e^{\int_1^{\text{t0}} -p(s) \, ds} \int_1^t e^{-\int_1^m -p(s) \, ds} \text{x0} g(m) \, dm-e^{\int_1^{\text{t0}} -p(s) \, ds} \int_1^{\text{t0}} e^{-\int_1^m -p(s) \, ds} \text{x0} g(m) \, dm\right)$$ where: IVP y[t0]=y0 $\endgroup$ Jul 23, 2017 at 15:27
  • $\begingroup$ @Mariusz Iwaniuk: Thanks! But how did you come to that result? I've tried to find a symbolic solution by the usage of Matlab with dsolve(...) but this got somehow "stuck". $\endgroup$ Jul 23, 2017 at 16:58

1 Answer 1


With Maple 2017.1 we have:

eq := {(D(y))(t)+p(t)*y(t) = g(t)*x0, y(t0) = y0};
expand(subs(_z1 = s, dsolve(eq)))

$$y \left( t \right) ={\frac {{\it x0}\,\int_{{\it t0}}^{t}\!g \left( s \right) {{\rm e}^{\int_{{\it t0}}^{s}\!p \left( s \right) \,{\rm d}s} }\,{\rm d}s}{{{\rm e}^{\int_{{\it t0}}^{t}\!p \left( s \right) \,{\rm d}s}}}}+{\frac {{\it y0}}{{{\rm e}^{\int_{{\it t0}}^{t}\!p \left( s \right) \,{\rm d}s}}}} $$

y(t) = x0*(Int(g(s)*exp(Int(p(s), s = t0 .. s)), s = t0 .. t))/exp(Int(p(s), s = t0 .. t))+y0/exp(Int(p(s), s = t0 .. t))

With Mathematica 11.1 we have:

 sol = First@DSolve[{y'[t] + p[t]*y[t] == g[t]*x0, y[t0] == y0}, y[t], t]
 Y[T] = y[t] /. sol /. K[1] -> s /. K[2] -> m

$$y(t)=e^{\int_1^t -p(s) \, ds-\int_1^{\text{t0}} -p(s) \, ds} \text{y0}+e^{\int_1^t -p(s) \, ds} \int_1^t e^{-\int_1^m -p(s) \, ds} \text{x0} g(m) \, dm-e^{\int_1^t -p(s) \, ds} \int_1^{\text{t0}} e^{-\int_1^m -p(s) \, ds} \text{x0} g(m) \, dm$$

  y[t] == E^(Integrate[-p[s], {s, 1, t}] - Integrate[-p[s], {s, 1,t0}])*y0 + 
  E^Integrate[-p[s], {s, 1, t}]*Integrate[(x0*g[m])/E^Integrate[-p[s], {s, 1, m}],{m, 1, t}] - E^Integrate[-p[s], {s, 1, t}]*
  Integrate[(x0*g[m])/E^Integrate[-p[s], {s, 1, m}], {m, 1, t0}]
  • $\begingroup$ Thanks, now I got the same result with matlab. I don't know what I did wrong ... syms y(t) p(t) q(t) x0 t0 y0 cond = y(t0) == y0 eqn = diff(y,t) + p(t)*y(t) == x0*q(t) leads to ans = exp(-int(p(x), x == t0..t))*int(x0*exp(int(p(x), x == t0..y))*q(y), y == t0..t, IgnoreAnalyticConstraints) + y0*exp(-int(p(x), x == t0..t)) $\endgroup$ Jul 24, 2017 at 9:19

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .