# [pstricks] Bessel function $J_2$ in pstricks

Henrik Aratyn aratyn at uic.edu
Wed Jan 7 15:20:41 CET 2004

I tried to generalize to the Bessel function $J_2$
the code for the first two Bessel functions
($J_0$ and $J_1$) given by Manuel Luque in his very useful file at :
http://members.aol.com/Mluque5130/bessel.zip.
The obvious generalization I tried :
%%%%%%%%%%%%%%%%%
\def\BesselTwo{%
%\pscustom[linecolor=red]{%
\pscustom[linecolor=black]{%
\code{/factorielle
{ dup 1 gt
{ dup 1 sub factorielle mul } if
}
def}
\code{/ntermeJ2 %
{/k exch def
-1 k exp %(-1)^k
k factorielle % k!
k 2 add factorielle % (k+2)!
mul
2 2 k mul 2 add exp % 2^(2k+2)
mul
mul }
def}
%\parametricplot[plotpoints=1000]{-10}{10}{%
/Bessel
t 2 div
1 1 16 {
/rang exch def
%       t rang 2 mul 1 add exp
t rang 2 mul 2 add exp
rang ntermeJ2 div
} for def
t Bessel}}}
%%%%%%%%%%%%%%%%%%%%%%%%%%
produces a graph which at a closer look resembles a fourth order
approximation
of $J_2$ with an unfortunate divergence around x=4.1.
I would appreciate any suggestion how to get a graph of $J_2$ in pstricks
by fixing the above code or some similar means .
I am trying to avoid resorting to drawing \pscurve on the list of points
produced by a plot of $J_2$?

Thanks,
Henrik Aratyn