How do I get observables to calculate uncertainty? Given an infinite potential square well with $0<x<L$, I need to calculate the uncertainties of position and momentum. The eigenstates in the position basis are
$$\lvert E_n\rangle\to \psi_n(x)=\sqrt{\frac{2}{L}}\sin\left(\frac{n\pi x}{L}\right), n = 1,2,3,...$$
I know that the position operator is defined by $x$, and the momentum operator is defined by $-i\hbar\frac{\partial }{\partial x}$, but the inequality formula for uncertainty, which is
$$\Delta A\Delta B\ge \frac{1}{2}\lvert \langle [A,B] \rangle\rvert$$ requires not operators for position and momentum, but corresponding observables. How can I get these observables?
 A: You can work in the position representation. It is not difficult:
$$\langle  \psi \mid[x,p] \mid \psi \rangle = \langle \psi \mid (xp-px)\mid \psi \rangle =\\=\int dx \ \psi^*(x) \left(-i \hbar x \ \partial_x \psi(x) + i \hbar \ \partial_x (x \ \psi(x)) \right) = \\ =-i \hbar \int dx \ \psi^* \left(x \ \psi'-(\psi+x \ \psi')\right) = \\ =i \hbar \int dx \mid \psi(x)\mid^2 = i \hbar$$
What you have to realize is that the identities $\hat x = x$ and $\hat p = -i \hbar \partial_x$ are meaningful only if you express the operators in the position basis, that is to say
$$\langle x' \mid \hat p \mid \psi \rangle = -i \hbar \partial_{x'} \ \psi(x') \\ \langle x' \mid \hat x \mid \psi \rangle = x' \ \psi(x') $$
where
$$\langle x' \mid \psi \rangle = \psi(x')$$
is the wave function in the position basis. You could also choose the momentum representation:
$$\langle p' \mid \hat p \mid \psi \rangle = p' \tilde \psi(p')\\\langle p' \mid \hat x \mid \psi \rangle = i \hbar \partial_{p'} \tilde \psi(p')\\\langle p'\mid \psi \rangle =\tilde \psi(p')$$
The result will be the same.
In general, every time you have an hermitian operator $A$ with a complete set of eigenvectors $\{\mid a \rangle\}$, you can in principle express your state vectors (kets) and operators in the $\{\mid a \rangle\}$ basis, but the mathematical form of the operators can become cumbersome if you choose the "wrong" representation. For example, the momentum operator is a nice differential operator in the position basis $\{\mid x \rangle\}$, but could become ugly if expressed in another basis.
Going back to what you wanted to compute, we obtain
$$\Delta x \Delta p \geq \frac 1 2 \mid i \hbar \mid = \frac \hbar 2$$
which is the well-known Heisenberg uncertainty principle for position and momentum.
A: Observables are operators, in particular they are of the self-adjoint type (with discrete spectrum spanning the entire Hilbert space). Given a normalised state $|\psi\rangle$, the expectation value of an operator $A$ thereupon is defined as $\langle A \rangle = \langle\psi |\, A\, |\psi\rangle$; equivalently, one can prove that the uncertainty on the measurement of the operator $A$ onto the state $|\psi\rangle$ can be expressed as 
$$
\Delta A_{|\psi\rangle} = {\langle A^2 \rangle}_{|\psi\rangle} - {(\langle A\rangle)^2}_{|\psi\rangle}.
$$
You are given the expression of the initial state and its wave function, hence you can calculate the expectation values of (any power) of the operators $\hat{x}$ and $\hat{p}$ by inserting the identity operator $1 = \int \textrm{d}x’ |x’ \rangle \langle x’ |$ on the left (respectively on the right) and perform the integrations. You should end up with the usual integrals of the wave function against its variable minus the derivative.

I know that the momentum operator is defined as $-i\hbar \partial_x$...

That is wrong. The momentum operator is $\hat{p}$ and one has $\langle x| \hat{p} |\psi\rangle = -i\hbar \partial_x \psi(x)$.
