[pstricks] plot erfc and Bessel function with pstricks
Carsten Vogel
texnicer at web.de
Fri Oct 21 22:31:40 CEST 2011
Am 21.10.2011 21:51, schrieb Herbert Voss:
>
> Hope, this helps:
Herbert you are wonderful!
I added some eyecandy and tried to achieve your idea of a pspicture*
within a pspicture-environment. If correct, regard this as demonstration
of your lessons, if not: I am willing to gain wisdom.
Cheers,
Carsten
%%%%%%%%%%
\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
\newcommand{\PlotColor}[1]{\ifcase#1\or black\or red!30!black\or
red!55!black\or red!80!black\or red\fi}
\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)
\rput[bl](0,0){\begin{pspicture*}(5,5)%
\multido{\iA=0+1,\iC=1+1}{5}{\psModBessel[linewidth=.6pt,linecolor=\PlotColor{\iC},yMaxValue=6,nu=\iA]{0}{6}}\end{pspicture*}}%
rput
\psaxes(5,5)
\multido{\iA=0+1,\iC=1+1}{5}{\uput[0](!5.5 .5 \iA\space neg mul 5 add
){{\color{\PlotColor{\iC}}\rule{1ex}{1ex}\enskip}$\nu=\iA$}}
\end{pspicture}
\end{document}
More information about the PSTricks
mailing list