I'm developing a tool in Matlab and since it doesn't now how manage singularities, I need to correct these two equations:
$A(\theta,\phi)=\frac{1+cos\theta}{2}\frac{J_0(kasin\theta)}{2.405^2-(kasin\theta)^2}(cos\phi+sin\phi)$
$B(\theta,\phi)=\frac{1+cos\theta}{2}\frac{J_0(kasin\theta)}{2.405^2-(kasin\theta)^2}(-sin\phi+cos\phi)$
where $J_0$ is the Bessel function of the first kind order 0 and I need to eliminate whatever singularity. The first one that I saw is the first fraction
$\frac{1+cos\theta}{2}\simeq 1-\frac{\theta^2}{2}$
then for the second one I used Taylor expansion again and I found that
$\frac{J_0(kasin\theta)}{2.405^2-(kasin\theta)^2}=\frac{J_0(x)}{x_0^2-x^2}\simeq -\frac{J_0'(x_0)}{x+x_0}$
but I have still some issue somewhere because the graph that I'm trying to obtain has a strange behaviour away from the origin. I think that what I am doing so far is correct since I don't have singularity in (0,0), but stil... If you confirm me that there are no any other singularity, than I'm probably doing something wrong in my code to manage these points. For the first one I use
if abs(1-cos(theta))<eps
do thing
else
(1+cos(theta))/2
Same approach for the other one. eps is a very small constant variable (0.01)
If $x_0$ is a zero of $J_0$, then near $x=x_0$ you have $$ \frac{J_0(x)}{x - x_0} = J_0'(x_0) + \frac{x-x_0}{2} J_0''(x_0) + \frac{(x-x_0)^2}{6} J_0'''(x_0) + \ldots $$ Use as many terms as you need to get sufficient accuracy.