Numerical solution to diffusion-like equation with changing sign

I am trying to numerically solve an initial value problem

$$\frac{\partial f}{\partial t} = \frac{1}{x} \frac{\partial^2 f}{\partial x^2}$$

where $f = f(x,t) \text{ for } x \in [-1,-1],\ t \in [0, 1]$ is the solution to the equation, $f(x, t = 0) \equiv \breve{f}(x)$ is the initial condition and $f(-1,t),\ f(1,t) \text{ are finite}$

The trouble lies in the fact that $\frac{1}{x}$ changes sign on interval $[-1,1]$ this sends the usual BTCS implicit method to unpredictable oscillation for $x \in [-1, 0)$ (as the equation is effectively an inverse diffusion then).

Question: Is there a way to avoid this problem and solve the equation by numerical iteration method?

Note: I did some analysis of this issue, performing a spatial fourier transform of $$\frac{\partial f}{\partial t} = - \frac{\partial^2 f}{\partial x^2}$$ which, assuming $f$ is separable yields:

$$u(x,t) = \int_{-\infty}^{\infty}\exp(k^2t)\tilde{u}(k,t)\exp(ikx)dk$$ suggesting some of the spectral components for can be quite rapidly divergent. This might be the cause of the oscillation and unpredictability of the solution as the function used in the numerical scheme is discretized (hence there is no control of the spectral components involved)

Don't always stick on the numerical approach. If you think it on the analytical approach:

Let $f(x,t)=X(x)T(t)$ ,

Then $X(x)T'(t)=\dfrac{1}{x}X''(x)T(t)$

$\dfrac{T'(t)}{T(t)}=\dfrac{X''(x)}{xX(x)}=\lambda$

$\begin{cases}\dfrac{T'(t)}{T(t)}=\lambda\\X''(x)-\lambda xX(x)=0\end{cases}$

According to http://eqworld.ipmnet.ru/en/solutions/ode/ode0204.pdf, the solution of the second ODE is related to the bessel function of order $\dfrac{1}{3}$ .

• Thank you for a prompt reply! The eigenfunction expansion works here. Is there however a way to avoid the oscillations in a numerical solution and solve the problem iteratively with some finite-difference scheme? – vojta havlíček Aug 15 '13 at 15:11