title: Mathematica: Filling under an infinite function
body: <h1>Mathematica: Filling an infinitely deep potential well</h1>
  
  <p><em>Comment: The proper page for Mathematica questions is <a href="https://mathematica.stackexchange.com/">this one</a></em></p>
  
  <p>I would like to visualize a potential well for a particle in a box in Mathematica similar to the second picture from Wikipedia <a href="https://en.wikipedia.org/wiki/Particle_in_a_box" rel="nofollow noreferrer">here</a>. 
  I have defined my function piecewise </p>
  
  <pre><code>(*Length of the box*)
  L     = 4; 
  
  (*Infinitly deep potential well between 0 and L*)
  V[x_] := Piecewise[{
              {\[Infinity], x &lt;= 0},
              {0, 0 &lt; x &lt; L}, 
              {\[Infinity], L &lt;= x}}]
  </code></pre>
  
  <p>and would like to obtain a plot function which gives a filled area where the potential goes to infinity.</p>
  
  <p>Unfortunately my tries end up in shaded areas between the "zero region" of the potential, while I would like to have the shading in the infinity region.</p>
  
  <pre><code>Table[Plot[V[x], {x, -5, 10}, 
  Filling -&gt; f], {f, {Top, Bottom, Axis, 0.3}}]
  </code></pre>