How does the image of $\sqrt{2/L} \ \sin\left({k_n x}\right)$ satisfy the boundary conditions for the infinite square well? [closed]

I understand mathematically how $$\sqrt{2/L} \ \sin\left({k_n x}\right)$$ satisfies the boundary conditions for the infinite square well in terms of the fact that $$\psi(0) = \psi(a) = 0$$, and excuse the naiveté of such a question, but if I pull up the image of $$\sqrt{2/L} \ \sin\left({k_n x}\right)$$ on an online calculator, it is this:

So, is $$\sqrt{2/L} \ \sin\left({k_n x}\right)$$ a solution, or:

$$\psi_n(x) = \begin{cases} \sqrt{2/L} \ \sin\left({k_n x}\right), & \text{0 \le x \le L} \\ 0 & \text{otherwise} \end{cases}$$

• The second one is the correct answer as you have guessed ;) Nov 3 '18 at 15:25
• @SahandTabatabaei Why do we then typically state the solution is merely $\sqrt{2/L} \ \sin\left({k_n x}\right)$? Is the piecewise function implicit? Is this an abuse of notation? Nov 3 '18 at 15:26
• It's usually implicitly assumed that the only range of the $x$ axis that we're interested in is the $(0,L)$ interval, since outside this range the wavefunction is trivially zero. Nov 3 '18 at 15:29

$$\psi_n(x) = \begin{cases} \sqrt{2/L} \ \sin\left({k_n x}\right), & \text{0 \le x \le L} \\ 0 & \text{otherwise} \end{cases}$$
is the solution. What you've plotted is $$\sqrt{2/L} \ \sin\left({k_n x}\right)$$ for $$-\infty \le x \le \infty$$.