Let $k_1 \neq k_2$ be positive reals, $t_0 > 0$ and consider the following Cauchy problem in $[0,+\infty)$: \begin{cases} y(t) + k(t)y''(t) = 0 \newline y(0) = 1/\sqrt{k_1} \newline y'(0) = 0, \end{cases} where \begin{equation} k(t) = \begin{cases} k_1 \hspace{1 cm} 0 \leq t \leq t_0 \newline k_2 \hspace{1 cm} t > t_0 \end{cases} \end{equation}
It is clear that there exists a unique $C^1$ solution $y$ in $[0,+\infty)$, obtained by gluing two smooth solutions of the equation in $[0,t_0]$ and $[t_0,+\infty)$. An explicit computation gives: \begin{equation} y(t) = \begin{cases} \dfrac{1}{\sqrt{k_1}} \mathrm{cos} \bigg(\dfrac{t}{\sqrt{k_1}} \bigg) \hspace{1 cm} 0 \leq t \leq t_0; \newline A \ \mathrm{cos}\bigg( \dfrac{t}{\sqrt{k_2}} + \phi \bigg) \hspace{1 cm} t > t_0, \end{cases} \end{equation} where $A$ and $\phi$ are obtained imposing the $C^1$ condition. With further computations one discovers that the amplitude is constant, i.e. $A = 1/\sqrt{k_1}$, if and only if $t_0 = n \pi \sqrt{k_1}$ for some $n \in \mathbb N$.
I am searching for a good numerical method for the problem in the constant-amplitude case. I have tried several classical schemes, but I discovered that when $k_2 >> k_1$ the second amplitude also grows bigger. Any suggestion?