Calculating the normalization constant for a wavefunction

How can I compute the normalization constant for a quantum mechanics wave-function, like $\Psi(x) = N \exp(-\lambda x^2/2)$ by using Mathematica? (The normalization constant is $N$).

• The normalization is given in terms of the integral of the absolute square of the wave function. You can calculate this using Integrate. – Marius Ladegård Meyer Nov 12 '15 at 13:30
• Caveat: the normalization constant in mathematica is most certainly not the reserved symbol N ;-) – LLlAMnYP Nov 12 '15 at 13:40

First define the wave function as

Ψ[x_] := n Exp[-λ x^2/2];

Then you define your normalization condition

condition =
Integrate[Ψ[x]^2, {x, -∞, ∞}, Assumptions -> λ > 0] == 1

(* (n^2 Sqrt[π])/Sqrt[λ] == 1 *)

Solve[condition, n]
(* {{n -> -(λ^(1/4)/π^(1/4))}, {n -> λ^(1/4)/π^(1/4)}} *)

Either of these works, the wave function is valid regardless of overall phase.

Edit: You should only do the above code if you can do the integral by hand, because everyone should go through the trick of solving the Gaussian integral for themselves at least once.

• At least once?! At least ten times! And then there's the differentiate with respect to a parameter trick, and how to generalize to multi-dimensional Gaussians, etc. – march Nov 12 '15 at 17:15
• @Jason B : The link requires authentication. It's okay, though, as I was just wondering how to do this by using mathematica; The textbook I am following covers doing it by hand pretty well. I figured it out later on on my own, but your solution is way more elegant than mine (you define a function, which is less messy)! Thanks! :-D – infiniteNOP Nov 13 '15 at 13:41