# Solve the angular part of Schrodinger equation numerically

I would like to solve the angular part (the one for what is usually called the $\theta$ angle) of a time-independent 3D Schrodinger equation $$\frac{\mathrm{d}}{\mathrm{d}x}\left[ (1-x^2) \frac{\mathrm{d}P(x)}{\mathrm{d}x} \right]+\left[ l(l+1) - \frac{m^2}{1-x^2} \right]P(x) = 0,$$ where $l=0,1,2,\ldots$ and $m = -l, -l+1, \ldots, l$ as usual and $x\in[-1,1]$,

Now, the complication is that I want to do it numerically. Analytically, one gets a bunch of Legendre polynomials and spherical harmonics. However, for me it is unclear which boundary conditions should I set.

One boundary condition will probably be equivalent to the normalization of my solutions. In order to make it compatible with the Legendre polynomials, I can set it to $$P(1) =1.$$

However, what about the second one (it is a second-order ODE after all)? I guess, it should somehow encode the fact that my solutions should be bounded.

Any comments, including sending me to RTFM (with appropriate links) are more than welcome!

-
The other solutions are associated Legendre functions of the second kind, which blow up at $x=\pm 1$. –  Michael Brown Apr 18 '13 at 14:31
In order to help you, it would be good to know which method you are using to solve this numerically. Maybe this question would be better placed in Computational Science SE. –  lomppi Apr 18 '13 at 15:23
Michael Brown: I would consider these solutions unphysical and avoid them. Also, they are excluded by the P(1)=1 condition. sebastian: at this moment I am trying to formulate the problem, because it is not possible to feed it to any algorithm (method) as it is. Therefore, in my opinion, this is a Physics question and not a CS one. –  user1577683 Apr 18 '13 at 16:02
ok, but you should at least give a clue whether you want to take a finite difference approach or something else. otherwise it will be difficult to help you. I did some googeling and found this link. maybe it helps. –  lomppi Apr 18 '13 at 17:30
What physical problem are you trying to solve - free particle? hydrogen atom? spherical infinite well? spherical annular well? Boundary conditions depend on the problem, not the ODE. –  Chris White Apr 19 '13 at 1:41

What you are doing is an eigenvalue problem. Eigenvectors are determined by the space you are looking at, and this is why you usually specify some boundary conditions. In your case just the requirement of absence of singularities should do the job (i.e. you want some subspace of $C[-1,1]$). This is the analytical viewpoint.

The numerical viewpoint actually depends on your algorithm. First of all, if you really want "to solve the equation numerically", I assume that you are playing the game of not knowing the answer. So you do not actually know that $l$ is integer beforehand. If I were solving the problem, I would put it on a lattice and then write it as a finite-dimensional eigenvalue problem. In deriving the finite difference equations I would use the fact that my solution should be finite at the endpoints of the interval.

A way to do this is to introduce homogenious lattice at points (lets call them so) 0,1,2,3,4... Then integrate the equation from $i-1/2$ to $i+1/2$ and use middle-difference fromulae for derivatives (you will need their values at $i\pm1/2$, so the middle difference will return you back to your lattice) and middle-rectangles formula for integrals (it is important to use approximations of the proper order. I believe that I am telling you an algorithm of second-order presicion). Then you will have to do something with the endpoints. For them do the integration from $0$ to $1/2$ and respectively on the other end. In doing so you will use the fact that $(1-x^2)\frac{dP}{dx}$ is $0$ at the endpoints. And this picks up the appropriate space for your solutions.

Long story made short, I believe that at least for some calculational schemes the conditions should be that $(1-x^2)\frac{dP}{dx}$ vanishes at the endpoints.

-
This is a good answer, so I will accept it - thank you! However, I have found out that it is possible to circumvent the problem (which is somewhat equivalent to Peter's answer) by writing the equation in the original form, namely $$\frac{1}{\sin (\theta)} \frac{d}{d\theta} \sin \theta \frac{d}{d\theta} f(\theta) = b \theta,$$ where $f$ is the function to be found and the boundary conditions are $f'(\pi) = 0$ and normalization $f(\pi)=1$. Then the eigenvalue $b$ is such that the derivative at the left-hand side also vanishes: $f'(0)=0$. –  user1577683 May 6 '13 at 9:08
It should have been $$\frac{1}{\sin (\theta)} \frac{d}{d\theta} \sin \theta \frac{d}{d\theta} f(\theta) = b f(\theta)$$ in the previous comment, and I wrote up just the $m=0$ case. –  user1577683 May 6 '13 at 9:14

Since the coordinate is an angle, you should specify the periodic boundary conditions.

-