[pstricks] plot erfc and Bessel function with pstricks

Herbert Voss Herbert.Voss at FU-Berlin.DE
Fri Oct 21 21:51:23 CEST 2011


> http://en.wikipedia.org/wiki/Bessel_function#Modified_Bessel_functions_:_I.CE.B1.2C_K.CE.B1
>
>
> i hope I explained the topic better this time.

Hope, this helps:

\documentclass{article}
\usepackage{pst-func}

\makeatletter
\define at key[psset]{pst-func}{nu}[1]{\def\psk at nu{#1 }}
\psset{nu=0}
%
\def\psModBessel{\@ifnextchar[{\psModBessel at i}{\psModBessel at i[]}}
\def\psModBessel at i[#1]#2#3{{%%%  #2 = n
   \pst at killglue
   \psset{#1}%
   \psplot{#2}{#3}[ /nu \psk at nu def /epsilon 1e-20 def
   /Fact { 1 exch 2 exch 1 exch { mul } for } def
   /Gamma { 1 sub Fact } def ]{%
   	/Sum 0 def
   	/Iter 0 def
     {/Sum_Iter
        x dup mul 4 div Iter exp        % nominator
        nu Iter add 1 add Gamma Iter Fact mul  % denominator
        Div def
      Sum_Iter abs epsilon lt { exit } if
      /Sum Sum Sum_Iter add def
      /Iter Iter 1 add  def Iter ==
     } loop
     x 0.5 mul nu exp Sum mul
   }%
}\ignorespaces}

\makeatother
\begin{document}
\[ I_\nu(x)=\left(\frac12 x\right)^\nu
   \sum\limits_{k=0}^{\infty}  \frac{{\left(\frac14 
x^2\right)}^k}{k!\Gamma(\nu+k+1)} \]

\begin{pspicture}(5,5)
\psaxes(5,5)
\multido{\iA=0+1}{5}{\psModBessel[yMaxValue=5,nu=\iA]{0}{5}}
\end{pspicture}

\end{document}

Herbert

-------------- next part --------------
A non-text attachment was scrubbed...
Name: Bildschirmfoto.png
Type: image/png
Size: 13877 bytes
Desc: not available
URL: <http://tug.org/pipermail/pstricks/attachments/20111021/f2ab2e28/attachment.png>


More information about the PSTricks mailing list