Consider the following Schrodinger equation for the harmonic oscillator with real $x$: $$ −ψ''(x) + x^ 2 ψ(x) = Eψ(x). $$
I solve the last equation using shooting method and implicit Runge-Kutta integration. For the eigenvalue $E=1$, the corresponding eigenfunction looks like:
where I set $x=4$ as $+∞$ and $x=-4$ as $-∞$ . From the Fig, we see that the eigenfunction exponentially decay at $x=\pm 4$ .
However, when eigenvalue $E=17$, the corresponding eigenfunction is too complicated so that it won't exponentially decays at $x=\pm 4$ as shown on the following Fig.
In fact, the eigenfunction decays at $x=\pm 6$ as shown on the following Fig.
My Question
The numerical infinity should be large (like $x=6$) for large eigenvalue $E$, and small (like $x=4$) for small eigenvalue. If independent from the eigenvalue, I uniformly set numerical infinity as a very large number, it would waste computational resource. So, is there any formula to determine the exact numerical infinity based on different inputted eigenvalue please?