TITLE: Why is the numerical solution of this equation unstable? Is this equation stiff?
QUESTION [14 upvotes]: I am trying to solve the following equation with an explicit fourth-order using the Runge-Kutta method:
$$y' = t(y - t \sin t)$$
with initial conditions $y(0) = 1$ over the interval $[0, 10]$.
The analytic solution is $y = t \sin t + \cos t$ but the numerical method explodes even for a time step of $0.0001$.
Any ideas?

REPLY [6 votes]: I know this question is old, but I thought I would post some extra info around this.
One reason your numerical solution to the Ordinary Differential Equation (ODE) is exploding, kind of regardless of the numerical method used, is because of the ODE itself. If you go and study some theory on numerical integration of ODEs, you will find a common model problem used to study numerical methods is:
\begin{align}
y' = \lambda y
\end{align}
Where $\lambda$ can be a complex number. The general solution to this ODE is obviously
\begin{align}
y(t) = A e^{\lambda t}
\end{align}
What you will find is that numerical methods basically always diverge from the real solution when $Re(\lambda) > 0$. 
If you look back at your ODE, the $ty$ term is analogous to the $\lambda y$ term in the model ODE. One interesting thing to note is since $t$ is positive during the lifetime of this simulation, this means, analogously, your ODE has a $Re(\lambda) > 0$, meaning you should expect the solution to diverge and thus blow up basically no matter what numerical method you use.