Reasons to use numerical methods, if analytic solution exists?
Particularly,
I've discovered that the so-called mass-spring equation has both an analytic solution and it's also solvable by e.g. RK4.
But why would one want to use RK4 then?
Reasons to use numerical methods, if analytic solution exists?
Particularly,
I've discovered that the so-called mass-spring equation has both an analytic solution and it's also solvable by e.g. RK4.
But why would one want to use RK4 then?
Analytic solutions are simply one useful method of representing solutions. For your example, your analytic solution tells you that the system has sinusoidal oscillation, and all your knowledge of sinusoids can be brought to bear on further understanding of the problem.
But other analytic solutions might tell you less. What do you know about the behavior of $_2F_1(a, b, z)$ for many different arguments? Probably less. So even if you do have an analytic solution, it might not be a useful representation for further understanding.
Another representation useful for understanding is a graph. In this case, even the analytic solution must be evaluated by some numerical method in order to draw the plot. Arguably the numerical methods for evaluating special functions are more advanced than those of ODE steppers (though some special functions are evaluated by ODE steppers!) and you'd probably prefer the blazing fast x86 sine instruction to the laborious process of setting up RK4 and interpolating it to create a plot.