\documentclass[a4paper]{jarticle}
\usepackage{color}
\usepackage{tplot}
\topmargin=-5mm
\oddsidemargin=8mm
\evensidemargin=8mm
\textheight=230mm
\textwidth=150mm
\parindent=0pt
%\tracingrestores=1

\begin{document}
\verb@\funcdef@ による関数定義は手軽だがかなり遅い．\\
より高速な関数を定義したいときは \verb@\installBuiltin@ を使う．\\
Taylor多項式で近似する場合もこちらの方が書きやすい．\\[1mm]

%<*BesselJO>
\makeatletter
\def\BESSELJO#1{{%
  \dimendef\X0\ABS#1\X=#1\relax
  \dimendef\A1\dimendef\B2\dimendef\C3\relax
  \ifdim\X<8\p@\relax
    \A=\v@l\X\X\divide\A4\relax
    \C=\p@\B=\C
    \count@=0\relax
    \loop
      \advance\count@1\relax
      \B=-\v@l\A\B
      \divide\B\count@
      \divide\B\count@
    \ifdim\B=\z@\else
      \advance\C\B
    \repeat
  \else
    \ratio\rr{2\p@}{\v@l\X\PI@}\global#1=\rr\p@\SQRT#1\A=#1
    \ratio\rr{\p@}{\v@l\X\X}\B=\rr\p@
    \ratio\rr{\p@}{8\X}\C=\rr\p@
    \advance\X-.25\PI@
    \global#1=\X\SIN#1\edef\SS{\v@l#1}%
    \global#1=\X\COS#1\edef\CC{\v@l#1}%
    \global#1=\p@\global\advance#1-.07031\B\global#1=\CC#1
    \global\advance#1+\SS\C\C=\v@l\A#1
  \fi
  \global#1=\C}}
\installBuiltin\besselJO\BESSELJO[1]%
%</BesselJO>

%<*BesselJI>
\def\BESSELJI#1{{%
  \ifdim#1<\z@\edef\@sign{-}\ABS#1\else\edef\@sign{}\fi
  \dimendef\X0\X=#1\relax
  \dimendef\A1\dimendef\B2\dimendef\C3\relax
  \ifdim\v@l\X\X<75\p@\relax
    \@BB=\p@
    \BESSELJ\@BB#1
  \else
    \ratio\rr{2\p@}{\v@l\X\PI@}\global#1=\rr\p@\SQRT#1\A=#1
    \ratio\rr{\p@}{\v@l\X\X}\B=\rr\p@
    \ratio\rr{\p@}{8\X}\C=\rr\p@
    \advance\X-.75\PI@
    \global#1=\X\SIN#1\edef\SS{\v@l#1}%
    \global#1=\X\COS#1\edef\CC{\v@l#1}%
    \global#1=\p@\global\advance#1+.1172\B\global#1=\CC#1
    \global\advance#1+\SS\C
    \global#1=\v@l\A#1
  \fi
  \global#1=\@sign#1}}
\installBuiltin\besselJI\BESSELJI[1]%
%</BesselJI>

%<*BesselJ(\n,\x)>
\def\BESSELJ#1#2{{%
  \divide#1by\p@\edef\n{\number#1}%
  \dimendef\X0\X=#2\relax
  \dimendef\A1\dimendef\B2\dimendef\C3\relax
  \eval\xx{\max(130,\n*\n+4*\n)}%
  \ifdim\v@l\X\X<\xx\p@
    \A=\v@l\X\X\divide\A4\relax
    \C=\p@\B=\C
    \countdef\kk9\relax
    \count@=0\relax
    \kk=\n\relax
    \loop
      \advance\count@1\relax
      \advance\kk1\relax
      \B=-\v@l\A\B
      \divide\B\count@
      \divide\B\kk
    \ifdim\B=\z@\else
      \advance\C\B
    \repeat
    \count@=0\relax
    \loop\ifnum\count@<\n
      \advance\count@1\relax
      \divide\C2\relax
      \divide\C\count@
      \C=\v@l\X\C
    \repeat
  \else
    #1=\X\BESSELJO#1\A=#1\relax
    #1=\X\BESSELJI#1\B=#1\relax
    \ifnum\n=0\relax\C=\A\else
    \ifnum\n=1\relax\C=\B\else
      \count@=1\relax
      \loop\ifnum\count@<\n
        \evald\C{2*\the\count@/\X*\B-\A}%
        \A=\B\B=\C
        \advance\count@1\relax
      \repeat
    \fi\fi
  \fi
  \global#2=\C}}
\installBuiltin\besselJ\BESSELJ[2]%
%</BesselJ(\n,\x)>
\makeatother

\unitlength=20mm
\begin{picture}(6.6,2.4)(-3.3,-1.0)
%\saveoff
\setlinewidth{.3mm}
\plot500[\x=-\pi:\pi;\besselJO(10*\x)]
\plot500[\x=-\pi:\pi;\besselJI(10*\x)]
\setlinewidth{.2mm}
\linex{->}[-3.3,0][3.3,0]
\linex{->}[0,-1.0][0,1.2]
\putx{l}[3.3,0]{$x$}
\putx{b}[0,1.2]{$y$}
\end{picture}

\vskip10mm
\begin{picture}(6.6,2.0)(-3.3,-1.0)
%\saveoff
\setlinewidth{.3mm}
\plot500[\x=-\pi:\pi;\besselJ(1,5*\x)]
\plot500[\x=-\pi:\pi;\besselJ(2,5*\x)]
\plot500[\x=-\pi:\pi;\besselJ(3,5*\x)]
\plot500[\x=-\pi:\pi;\besselJ(4,5*\x)]
\plot500[\x=-\pi:\pi;\besselJ(5,5*\x)]
\setlinewidth{.2mm}
\linex{->}[-3.3,0][3.3,0]
\linex{->}[0,-1.0][0,1.0]
\putx{l}[3.3,0]{$x$}
\putx{b}[0,1.0]{$y$}
\end{picture}

\vskip10mm
\begin{picture}(6.6,2.0)(-3.3,-1.0)
%\saveoff
\setlinewidth{.3mm}
\plot500[\x=-\pi:\pi;\besselJ(6,10*\x)]
\plot500[\x=-\pi:\pi;\besselJ(7,10*\x)]
\plot500[\x=-\pi:\pi;\besselJ(8,10*\x)]
\plot500[\x=-\pi:\pi;\besselJ(9,10*\x)]
\plot500[\x=-\pi:\pi;\besselJ(10,10*\x)]
\setlinewidth{.2mm}
\linex{->}[-3.3,0][3.3,0]
\linex{->}[0,-1.0][0,1.0]
\putx{l}[3.3,0]{$x$}
\putx{b}[0,1.0]{$y$}
\end{picture}

\vskip10mm
\begin{picture}(6.6,2.0)(-3.3,-1.0)
%\saveoff
\setlinewidth{.3mm}
\plot500[\x=-\pi:\pi;\besselJ(12,20*\x)]
\plot500[\x=-\pi:\pi;\besselJ(14,20*\x)]
\plot500[\x=-\pi:\pi;\besselJ(16,20*\x)]
\plot500[\x=-\pi:\pi;\besselJ(18,20*\x)]
\plot500[\x=-\pi:\pi;\besselJ(20,20*\x)]
\setlinewidth{.2mm}
\linex{->}[-3.3,0][3.3,0]
\linex{->}[0,-1.0][0,1.0]
\putx{l}[3.3,0]{$x$}
\putx{b}[0,1.0]{$y$}
\end{picture}

\end{document}
