3

I wanted to try to make a rule to do norm squared integrals. For example, instead of the following:

Integrate[ Conjugate[Exp[-\[Beta] Abs[x]]]  Exp[-\[Beta] Abs[x]], 
           {x, -Infinity, Infinity}] 

I tried creating a function to do so, but require the function to take a function:

Clear[complexNorm, g, x] 
complexNorm[ g_[ x_ ] ] := Integrate[ Conjugate[g[x]]  * g[x], 
                                      {x, -Infinity, Infinity}]
v = complexNorm[ Exp[ - \[Beta] Abs[x]]]  // Trace

Mathematica doesn't have any trouble doing the first integral, but the final result of the trace when my helper function is used, shows just:

complexNorm[E^(-\[Beta] Abs[x])]

with no evaluation of the desired integral?

The syntax closely follows an example I found in http://www.mathprogramming-intro.org/download/MathProgrammingIntro.pdf [page 155], but it doesn't work for me.

1
  • I should have probably added some comments on the applicability of that pattern, on that page. The goal of that example was somewhat different though. Whenever I come up with a new version of the book, will make this part more clear. Commented Oct 3, 2011 at 10:12

1 Answer 1

6

The reason why your expression doesn't evaluate to what you expect is because complexNorm is expecting a pattern of the form f_[x_]. It returned what you put in because it couldn't pattern match what you gave it. If you still want to use your function, you can modify it to the following:

complexNorm[g_] := Integrate[ Conjugate[g] * g, {x, -Infinity, Infinity}]

Notice that you're just matching with anything now. Then, you just call it as complexNorm[expr]. This requires expr to have x in it somewhere though, or you'll get all kinds of funny business.


Also, can't you just use Abs[x]^2 for the norm squared? Abs[x] usually gives you a result of the form Sqrt[Conjugate[x] x].

That way you can just write:

complexNorm[g_] := Integrate[Abs[g]^2, {x, -Infinity, Infinity}]


Since you're doing quantum mechanics, you may find the following some nice syntatic sugar to use:

\[LeftAngleBracket] f_ \[RightAngleBracket] := 
 Integrate[Abs[f]^2, {x, -\[Infinity], \[Infinity]}]

That way you can write your expectation values exactly as you would expect them.

Sign up to request clarification or add additional context in comments.

2 Comments

Re: the also. Yes, but I wanted to do the integral of g^* d g next, where d is a second order derivative operator.
@PeeterJoot: I added a little something extra to the end of my post again. You might find it interesting.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.