In my research problem, I have come across the following form of a time varying, non-homogeneous ordinary differential equation.
$$\dot x + \frac{k_1}{t} x = k_2t^{3n}\sin(bt) + k_3 t^n \sin(bt) - k_4 t^{3n} \cos(bt) + k_5 t^{n} \cos(bt)$$ where the $k_i$'s are constants.
I found in a book by Henry D'Angelo that as long as the time-varying coefficient is continuous (which it is in the interval that I'm examining said system), a solution exists for this system.
I used Mathematica to compute an analytical solution which it does fairly rapidly but the solution involves incomplete gamma functions. If the second term didn't exist i.e. $\frac{k_1}{t} x$, then I can see where the incomplete gamma integral might come from.
I do not, however understand how Mathematica constructed the analytical solution. I have tested the analytical result versus numerical results and they seem to behave identically which tests the validity of the analytical result (am I wrong in assuming this?).
If anyone can share some input on how one goes about attempting to generate solutions for such a system, I'd be much in gratitude as one can't use traditional approaches to determine $x(t)$. In fact, any reference/discussion at all would be excellent, too.
Call your RHS $g(t)$, so we have:
$$\dot x + \frac{k_1}{t} x = g(t),$$
which is a 1st order linear ODE. This can be solved introducing an integrating factor such that:
$$ \frac{\mathrm{d}}{\mathrm{d}t} \left(I x\right) = I g. $$
You can check that we obtain $I = \exp{(\int k_1/t \, \mathrm{d}t)} = t^{k_1}$. Then, integrating once you will find the solution for $x$ in the form:
The gamma function appears when integrating terms of the form $t^\alpha \sin{ \beta t}$ (or $\cos{\beta t}$), but I guess that you were interested just in the general procedure to obtain $x(t)$.
Hope this helps!
Cheers.