Finding expectation values

1. Sep 19, 2009

E92M3

I want to find <x> and ,<x^2>, <p>, and <p^2> of a particle in an infinite well where:
$$V(x)=0, \frac{-a}{4}<x<\frac{3a}{4}$$

Using the usual method, I found the wavefunction to be:
$$\psi(x)=\sqrt{\frac{2}{a}}sin[\frac{n\pi}{a}(x+\frac{a}{4})]$$

I also found:
$$<x>=\frac{2}{a}\int_{\frac{-a}{4}}^{\frac{3a}{4}}xsin^2[\frac{n\pi}{a}(x+\frac{a}{4})]dx=\frac{a}{4}$$

<x^2> is where I encounter the 1st problem. Here's my attempt:
$$<x^2>=\frac{2}{a}\int_{\frac{-a}{4}}^{\frac{3a}{4}}x^2sin^2[\frac{n\pi}{a}(x+\frac{a}{4})]dx$$
Using by parts I let:
$$u=x^2$$
$$du=2xdx$$
$$dv=sin^2[\frac{n\pi}{a}(x+\frac{a}{4})]dx$$
$$v=\frac{x}{2}-\frac{a}{2n\pi}sin[\frac{n\pi}{a}(x+\frac{a}{4})]cos[\frac{n\pi}{a}(x+\frac{a}{4})]=\frac{x}{2}-\frac{a}{4n\pi}sin[\frac{2n\pi}{a}(x+\frac{a}{4})]$$
(double angle formula used)

$$<x^2>=uv-\int vdu=\frac{2}{a}\left [ \left ((x^2)(\frac{x}{2}-\frac{a}{4n\pi}sin[\frac{2n\pi}{a}(x+\frac{a}{4})]) \right )_{\frac{-a}{4}}^{\frac{3a}{4}} -\int_{\frac{-a}{4}}^{\frac{3a}{4}}2x(\frac{x}{2}-\frac{a}{4n\pi}sin[\frac{2n\pi}{a}(x+\frac{a}{4})])dx\right ]$$
$$=\frac{2}{a}\left [ \frac{27a^3}{128}-\frac{-a^3}{128}-\int_{\frac{-a}{4}}^{\frac{3a}{4}}x^3dx+\frac{a}{4n\pi}\int_{\frac{-a}{4}}^{\frac{3a}{4}}2xsin[\frac{2n\pi}{a}(x+\frac{a}{4})])dx\right ]$$
$$=\frac{2}{a}\left [ \frac{7a^3}{32}-\frac{5a^4}{64}+\frac{a}{2n\pi}\left ( \frac{a^2}{4n^2\pi^2}sin[\frac{2n\pi}{a}(x+\frac{a}{4})])-\frac{a}{2n\pi}xcos[\frac{2n\pi}{a}(x+\frac{a}{4})])\right )_{\frac{-a}{4}}^{\frac{3a}{4}}\right ]$$
Sine term vanishes at both limits while cosine term as 1 at both limits:
$$=\frac{2}{a}\left [ \frac{7a^3}{32}-\frac{5a^4}{64}+\frac{a}{2n\pi}\left ( \frac{-3a^2}{8n\pi}+\frac{a^2}{8n\pi} \right )\right ]=\frac{7a^2}{16}-\frac{a^2}{4n^2\pi^2}-\frac{5a^3}{32}=\frac{a^2(7n^2\pi^2-4)}{16n^2\pi^2}-\frac{5a^3}{32}$$

This is obviously wrong since the units don't add up/ How can there be a^2 and a^3 at the same time? I spend hours checking and still can't find my mistake.

I plug the equation into a graphic calculator, I think the answer should be:
$$\frac{a^2(7n^2\pi^2-24)}{64n^2\pi^2}$$

Now, for <p>, can I just have:
$$<p>=m\frac{d<x>}{dt}=m\frac{d}{dt}\frac{a}{4}=0$$
Is this alright or do I have to plug the operator in and integrate?

2. Sep 20, 2009

facenian

I think I spot your mistake: from the line in <x^2>=.... in the integral you pass from
$\int_{\frac{-a}{4}}^{\frac{3a}{4}}2x(\frac{x}{2})dx$ in the firs line to $\int_{\frac{-a}{4}}^{\frac{3a}{4}}x^3dx$ in the second one