infinite square well potential

How I can draw a perfect picture of an infinite square well potential? Other words, I need something like this. Thanks for your help

• Welcome, please consider to add an MWE: tex.meta.stackexchange.com/questions/228/…? – CampanIgnis Jul 31 '17 at 10:47
• This is very easy to draw using tikz. But this is more of a "please do this for me" question, which is not liked here. Please post a more concrete question. – daleif Jul 31 '17 at 10:57
• You must show us exactly how difficult it is to draw this figure. Add an MWE with what you have done. – skpblack Jul 31 '17 at 11:15
• Ok @ daleif, I just started using Tikz – ChercheFind Jul 31 '17 at 11:17

I guess to start using and loving TikZ you need examples =p Here is a quick draft; you may have to adjust the text and font and whatnot.

\documentclass{article}

\usepackage[english]{babel}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}

\usepackage{tikz}

\begin{document}

% #1    x coordinate.
\newcommand{\vandbarrier}[1]{%
\node at (#1, 1) {\scriptsize $V = \infty$};
\node[scale = 0.5] at (#1, 0.5) {\textbf{(Barrier)}};%
}

% #1    x coordinate.
\newcommand{\vabove}[1]{%
\node[anchor = south] at (#1, 2) {\scriptsize $V = \infty$};%
}

\begin{tikzpicture}
\fill[gray]
(0, 0) rectangle (1, 2)
(2, 0) rectangle (3, 2);

\vandbarrier{0.5}
\vandbarrier{2.5}
\vabove{1}
\vabove{2}
\node[anchor = north] at (1, 0)   {\scriptsize 0};
\node[anchor = north] at (2, 0)   {\scriptsize $L$};
\node[anchor = north] at (3, 0)   {\scriptsize $x$};
\node[anchor = south] at (1.5, 0) {\scriptsize $V = 0$};

\draw[<->] (0, 0) to (3, 0);
\draw[->]  (1, 0) to (1, 2);
\draw[->]  (2, 0) to (2, 2);
\end{tikzpicture}

\end{document}


If you think it's overkill to define the two commands I used, just copy paste the definition or whatever. I just don't like copypasting stuff. This way it is easier to modify, I think. Oh, and if this ends up being in a figure environment, you can put these two command definitions in the figure environment itself, right after the \begin, to avoid polluting the global scope.

• You're welcome. Oh and maybe the vertical alignment of the 0, L and x in the bottom part can be improved by putting a \strut in each of those few nodes, for example. And note that more beautiful arrows should be available in a TikZ library or something. These are just the default ones. – Alice M. Jul 31 '17 at 11:51
• I noted it @ Alice M. and thank you again. It's really interesting to work with Tikz that I see. You gave me a taste to go further with TIKZ. – ChercheFind Jul 31 '17 at 12:01