I was trying to solve the following ODE, but I cannot find an easy way anywhere. I also tried using Mathematica, but it also does not provide me with a solution.
$\frac{dx}{dt}=-k_1 x+(1-x)k_2 e^{-k_3 t}$, $x(0)=0$
However on simulating I find a smooth curve increasing till a threshold time and later on, decreasing.
Can someone help me solve this ODE?
After moving the terms involving $x$ to the left side, you see a first order linear differential equation with nonconstant coefficients. The general procedure for solving such an equation is the method of integrating factors. Since we have
$$\frac{dx}{dt} + \left ( k_1 + k_2 e^{-k_3 t} \right ) x = k_2 e^{-k_3 t},$$
the integrating factor is $\exp \left ( k_1 t - \frac{k_2}{k_3} e^{-k_3 t} \right )$. In other words we have
$$\frac{d}{dt} \left ( x(t) \exp \left ( k_1 t - \frac{k_2}{k_3} e^{-k_3 t} \right ) \right ) = k_2 e^{-k_3 t} \exp \left ( k_1 t - \frac{k_2}{k_3} e^{-k_3 t} \right )$$
Now integrate both sides with respect to $t$ and divide through by the integrating factor. Note that the integral on the right side is not elementary.
This problem is a bit easier to study if you first nondimensionalize. Let $x=x_C y$ and $t=t_C s$, then the equation is
$$\frac{dy}{ds} = -k_1 t_C y + \frac{k_2 t_C e^{-k_3 t_C s}}{x_C} - y k_2 t_C e^{-k_3 t_C s}$$
Let $t_C = 1/k_3$ and $x_C = \frac{k_2}{k_3}$:
$$\frac{dy}{ds} = -\frac{k_1}{k_3} y + e^{-s} - \frac{k_2}{k_3} y e^{-s}$$
So we have reduced the problem to
$$\frac{dy}{ds} = c_1 y + c_2 y e^{-s} + e^{-s}$$
where $c_1,c_2 < 0$.