texlive[66845] Master/texmf-dist: pst-func (14apr23)
commits+karl at tug.org
commits+karl at tug.org
Fri Apr 14 22:25:52 CEST 2023
Revision: 66845
http://tug.org/svn/texlive?view=revision&revision=66845
Author: karl
Date: 2023-04-14 22:25:52 +0200 (Fri, 14 Apr 2023)
Log Message:
-----------
pst-func (14apr23)
Modified Paths:
--------------
trunk/Master/texmf-dist/doc/generic/pst-func/Changes
trunk/Master/texmf-dist/doc/generic/pst-func/pst-func-doc.pdf
trunk/Master/texmf-dist/doc/generic/pst-func/pst-func-doc.tex
trunk/Master/texmf-dist/dvips/pst-func/pst-func.pro
trunk/Master/texmf-dist/tex/generic/pst-func/pst-func.tex
trunk/Master/texmf-dist/tex/latex/pst-func/pst-func.sty
Modified: trunk/Master/texmf-dist/doc/generic/pst-func/Changes
===================================================================
--- trunk/Master/texmf-dist/doc/generic/pst-func/Changes 2023-04-14 20:25:31 UTC (rev 66844)
+++ trunk/Master/texmf-dist/doc/generic/pst-func/Changes 2023-04-14 20:25:52 UTC (rev 66845)
@@ -1,4 +1,5 @@
..... pst-func.tex
+1.02 2023-04-14 - added \psNonCentralFDist (noncentral F-distribution)
1.01 2023-04-02 - added \psNonCentralTDist (noncentral Student's distribution)
1.00 2022-09-11 - fix \psBessel: use toDeg instead of k
- set algebraic=false
@@ -122,6 +123,7 @@
..... pst-func.pro
+0.20 2023-04-04 - make epsX more sensitive
0.19 2023-04-02 - added /ConfHyperFunc { % Confluent Hypergeometric Function of the First Kind
needed by \psNonCentralTDist
0.18 2021-10-30 - added arraysum and arrayprod
Modified: trunk/Master/texmf-dist/doc/generic/pst-func/pst-func-doc.pdf
===================================================================
(Binary files differ)
Modified: trunk/Master/texmf-dist/doc/generic/pst-func/pst-func-doc.tex
===================================================================
--- trunk/Master/texmf-dist/doc/generic/pst-func/pst-func-doc.tex 2023-04-14 20:25:31 UTC (rev 66844)
+++ trunk/Master/texmf-dist/doc/generic/pst-func/pst-func-doc.tex 2023-04-14 20:25:52 UTC (rev 66845)
@@ -1,6 +1,6 @@
\RequirePackage{pdfmanagement-testphase}
\DeclareDocumentMetadata{}
-%% $Id: pst-func-doc.tex 691 2023-04-03 10:51:04Z herbert $
+%% $Id: pst-func-doc.tex 697 2023-04-14 10:17:32Z herbert $
\documentclass[fontsize=11pt,english,BCOR=10mm,DIV=12,bibliography=totoc,parskip=false,headings=small,
headinclude=false,footinclude=false,oneside]{pst-doc}
\usepackage{pst-func}
@@ -1435,7 +1435,8 @@
\subsection{Binomial distribution}\label{sec:bindistri}
\begin{sloppypar}
-The following five macros plot binomial probability mass function \Lcs{psBinomial} and \Lcs{psBinomialC} in curve style, the normalized one is \Lcs{psBinomialN}. The cumulative distribution function $F$ \Lcs{psBinomialF} and the complement of the cumulative distribution function ($1-F$) \Lcs{psBinomialFS}
+The following five macros plot binomial probability mass function \Lcs{psBinomial} and \Lcs{psBinomialC} in curve style, the normalized one is \Lcs{psBinomialN}. The cumulative distribution function
+$F$ \Lcs{psBinomialF} and the complement of the cumulative distribution function ($1-F$) \Lcs{psBinomialFS}
The vertical range for the plots is the $y$-Intervall $[0;1]$.
Rescaling other values can be done by setting the \Lkeyword{yunit} option
to any other value.
@@ -2008,6 +2009,111 @@
\end{LTXexample}
\clearpage
+
+\subsection{Noncentral $F$-distribution}
+
+The noncentral F-distribution is given by
+
+
+\begin{align}
+P(x)=\sum\limits_{k=0}^{\infty}{\frac{e^{-\lambda/2}(\lambda/2)^{k}}
+ {B\left({\frac {\nu_{2}}{2}},{\frac {\nu _{1}}{2}}+k\right)k!}}
+\left({\frac {\nu _{1}}{\nu _{2}}}\right)^{{\frac {\nu _{1}}{2}}+k}
+ \left({\frac {\nu _{2}}{\nu_{2}
+ +\nu _{1}f}}\right)^{{\frac{\nu_{1}
+ +\nu _{2}}{2}}+k}x^{\nu_{1}/2-1+k}
+\end{align}
+
+
+\iffalse
+\begin{align}
+P(x) &= e^\frac{\frac{-\lambda}2+(\lambda n_1x)}{2(n_2+n_1x)}
+n_1^{\frac{n_1}2} n_2^{\frac{n_2}2} x^{\frac{n_1}2-1}
+(n_2+n_1x)^{\frac{-(n_1+n_2)}2}
+\frac{\Gamma(\frac12 n_1)\Gamma\left(1+\frac12 n_2\right)
+ \mathop{L}_\frac{n_2}2^{\frac{n_1}2-1}\left(-\frac{\lambda n_1 x}{2(n_2+n_1x)}\right)}
+ {B\left(\frac12 n_1,\frac12 n_2\right)\Gamma\left(\frac12 (n_1+n_2)\right)}
+\\
+ &= \frac1{B\left(\frac12 n_1,\frac12 n_2\right)}
+ \left(
+ e^{\frac\lambda2}n_1^{\frac{n_1}2} n_2^{\frac{n_2}2} x^{\frac{n_1}2-1}
+ (n_2+n_1x)^{\frac{-(n_1+n_2)}2}
+ {}_1F_1\left( \frac12(n_1+n_2); \, \frac12n_1; \, \frac{\lambda n_1 x}{2(n_2+n_1x)} \right)
+ \right)
+\end{align}
+
+
+%(e^(lambda/2)x^(n_1/2-1)(xn_1+n_2)^(-(n_1+n_2)/2)n_1^(n_1/2)n_2^(n_2/2)_1F_1(1/2(n_1+n_2);1/2n_1;(xlambdan_1)/(2(xn_1+n_2)))),
+%\]
+
+\fi
+
+
+where %$\Gamma(z)$ is the gamma function,
+$B(\alpha,\beta)$ is the beta function
+
+\begin{align}
+B(p,q) &= \frac{\Gamma(p)\Gamma(q)}{\Gamma(p+q)}\\
+ &= \frac{(p-1)!(q-1)!}{(p+q-1)!}
+\end{align}
+
+\iffalse
+ and $L_m^n(z)$ is a generalized Laguerre polynomial.
+
+ \begin{align}
+% L_n(x) &= \sum_{k=0}^n \frac{(-1)^k}{k!} \binom{n}{k} x^k \\
+L_n^{k(x)} &= \frac{e^xx^{-k}}{n!} \frac{d^n}{dx^n} e^{-x}x^{n+k} \\
+ &= (-1)^k \frac{d^k}{dx^k} L_{n+k}(x)\\
+ &= \frac{(-1)^nx^(-(k+1)/2)}{n!} e^\frac x2 W_{\frac k2+n+\frac12, \frac k2}(x)\\
+ &= \sum_{m=0}^n(-1)^m \frac{(n+k)!}{(n-m)!(k+m)!m!}x^m
+ \end{align}
+
+where $W_{k,m}(x)$ is a Whittaker function.
+
+\fi
+
+
+
+\begin{BDef}
+\Lcs{psNonCentralFDist}\OptArgs\Largb{x0}\Largb{x1}
+\end{BDef}
+%
+The default settings are $\mu=1$, $\nu=1$ and $\lambda=0$, which is the same as the default F-distribution.
+
+\begin{LTXexample}[pos=t,preset=\centering]
+\psset{xunit=1cm,yunit=10cm}
+\begin{pspicture*}(-2,-0.02)(10.5,1.1)
+\psset{linewidth=1pt}
+% \psFDist[linecolor=blue,mue=5,nue=20,lambda=0]{0.01}{5}
+\psaxes[Dy=0.1]{->}(0,0)(10,1)
+\psFDist[linecolor=red,mue=5,nue=20]{0.01}{10}
+\psNonCentralFDist[linecolor=green,mue=5,nue=20,lambda=1.6]{0.01}{10}
+\end{pspicture*}
+\end{LTXexample}
+
+
+\begin{LTXexample}[pos=t,preset=\centering]
+\psset{xunit=2cm,yunit=10cm,plotpoints=100}
+\begin{pspicture*}(-0.5,-0.07)(5.5,0.8)
+ \psline[linestyle=dashed](0.5,0)(0.5,0.75)
+ \psline[linestyle=dashed](! 2 7 div 0)(! 2 7 div 0.75)
+ \psset{linewidth=1pt}
+ \psFDist{0.1}{5}
+ \psFDist[linecolor=red,mue=5,nue=20]{0.01}{5}
+ \psNonCentralFDist[linecolor=green,mue=5,nue=20,lambda=1.6]{0.01}{5}
+ \psNonCentralFDist[linecolor=blue,nue=5,mue=20,lambda=1.6]{0.01}{5}
+ \psFDist[linecolor=blue,mue=12,nue=3]{0.01}{5}
+ \psNonCentralFDist[linecolor=green,mue=12,nue=3,lambda=1.6]{0.01}{5}
+ \psaxes[Dy=0.1]{->}(0,0)(5,0.75)
+\end{pspicture*}
+\end{LTXexample}
+
+
+
+
+
+\clearpage
+
\subsection{Beta distribution}
A general type of statistical distribution which is related to the gamma distribution.
Modified: trunk/Master/texmf-dist/dvips/pst-func/pst-func.pro
===================================================================
--- trunk/Master/texmf-dist/dvips/pst-func/pst-func.pro 2023-04-14 20:25:31 UTC (rev 66844)
+++ trunk/Master/texmf-dist/dvips/pst-func/pst-func.pro 2023-04-14 20:25:52 UTC (rev 66845)
@@ -1,4 +1,4 @@
-%% $Id: pst-func.pro 689 2023-04-03 06:46:27Z herbert $
+%% $Id: pst-func.pro 694 2023-04-05 19:17:32Z herbert $
%%
%% This is file `pst-func.pro',
%%
@@ -16,13 +16,12 @@
%% `pst-func' is a PSTricks package to plot special math functions
%%
%%
-%% version 0.19 / 2023-04-02 Herbert Voss
+%% version 0.20 / 2023-04-04 Herbert Voss
%
/tx at FuncDict 100 dict def
tx at FuncDict begin
%
-/eps1 1.0e-05 def
-/eps2 1.0e-04 def
+/eps4 1.0e-04 def
/eps5 1.0e-05 def
/eps8 1.0e-08 def
%
@@ -29,13 +28,25 @@
/PiHalf 1.57079632679489661925640 def
/CEuler 0.5772156649 def % Euler-Mascheroni constant
%
-/factorial { % n on stack, returns n!
- dup 32 gt { pop 1e32 } {
- dup 0 eq { 1 }{
- dup 1 gt { dup 1 sub factorial mul } if }
- ifelse } ifelse
-} def
+/factorialR {
+ dup 1e32 gt { pop 1e32 } {
+ dup 0 eq % check for the argument being 0
+ { pop 1 } % if so, the result is 1
+ { dup 1 sub factorial % call recursively with n - 1
+ mul % multiply the result with n
+ } ifelse
+ } ifelse
+} def
%
+%Iterative
+/factorial {
+ 1 % initial value for the product
+ 1 1 % for's start value and increment
+ 4 -1 roll % bring the argument to the top as for's end value
+ { mul } for
+} def
+%
+%
/MoverN { % m n on stack, returns the binomial coefficient m over n
2 dict begin
/n exch def /m exch def
@@ -195,7 +206,7 @@
{
/Iter Iter 1 add def
Nx func /F exch def % f(Nx)
- F abs eps2 lt { exit } if
+ F abs eps4 lt { exit } if
Nx func' /FS exch def % f'(Nx)
FS 0 eq { /FS 1.0e-06 def } if
Nx func'' /F2S exch def % f''(Nx)
@@ -202,7 +213,7 @@
1.0 1.0 F F2S mul FS dup mul div sub div /J exch def
J F mul FS div /Diff exch def
/Nx Nx Diff sub def
- Diff abs eps1 lt Iter MaxIter gt or { exit } if
+ Diff abs eps5 lt Iter MaxIter gt or { exit } if
} loop
Nx % the returned value ist the zero point
} def
@@ -212,13 +223,13 @@
/Iter 0 def /MaxIter 200 def
{ pstack
y0 func /F exch def
- F abs eps2 lt { exit } if
+ F abs eps4 lt { exit } if
y0 F sub /Phi exch def
Phi func /F2 exch def
- F2 abs eps2 le { exit }{
+ F2 abs eps4 le { exit }{
Phi y0 sub dup mul Phi F2 sub 2 Phi mul sub y0 add Div /Diff exch def
y0 Diff sub /y0 exch def
- Diff abs eps1 le { exit } if
+ Diff abs eps5 le { exit } if
} ifelse
/Iter Iter 1 add def
Iter MaxIter gt { exit } if
@@ -371,7 +382,7 @@
% https://mathworld.wolfram.com/ConfluentHypergeometricFunctionoftheFirstKind.html
/ConfHyperFunc { % Confluent Hypergeometric Funtion of the First Kind
% on stack must be a b z
- 10 dict begin
+ 15 dict begin
/z ED /b ED /a ED
/sum 1 def
/k 0 def
@@ -389,6 +400,19 @@
end
} def
%
+% https://mathworld.wolfram.com/BetaFunction.html
+/BETA {% BETA function ((p-1)!(q-1)!)/(p+q-1)!
+ % on stack must be p q
+ 2 dict begin
+ /q ED
+ /p ED
+ p 1 sub factorial q 1 sub factorial
+ mul
+ p q add 1 sub factorial
+ div
+ end
+} def
+%
end
%
/arraySum { % on stack the array
Modified: trunk/Master/texmf-dist/tex/generic/pst-func/pst-func.tex
===================================================================
--- trunk/Master/texmf-dist/tex/generic/pst-func/pst-func.tex 2023-04-14 20:25:31 UTC (rev 66844)
+++ trunk/Master/texmf-dist/tex/generic/pst-func/pst-func.tex 2023-04-14 20:25:52 UTC (rev 66845)
@@ -1,4 +1,4 @@
-%% $Id: pst-func.tex 689 2023-04-03 06:46:27Z herbert $
+%% $Id: pst-func.tex 697 2023-04-14 10:17:32Z herbert $
%%
%% This is file `pst-func.tex',
%%
@@ -31,8 +31,8 @@
% interface to the `xkeyval' package
\pst at addfams{pst-func}
%
-\def\fileversion{1.01}
-\def\filedate{2023/04/02}
+\def\fileversion{1.02}
+\def\filedate{2023/04/14}
\message{`PST-func' v\fileversion, \filedate\space (hv)}
%
\pstheader{pst-func.pro}
@@ -1573,6 +1573,60 @@
\ignorespaces%
}
%
+\def\psNonCentralFDist{\pst at object{psNonCentralFDist}}
+\def\psNonCentralFDist at i#1#2{%
+ \ifdim#1pt<\z@ \psframebox*{\color{red}!!!\#1 must be greater than 0!!!}
+ \else
+ \leavevmode
+ \pst at killglue
+ \begingroup
+ \addbefore at par{plotpoints=500,nue=1,mue=1,lambda=0}%
+ \use at par
+ \iffalse %\ifluatex for later use
+ \luaexec{ require("pst-func")
+ printDataPlotFileFDist(#1,#2,\psk at plotpoints,\psk at mue,\psk at nue,\psk at lambda,"\jobname-lua","true") }%
+ \fileplot{\jobname-lua.data}%
+ \else
+ \psplot[algebraic=false]{#1}{#2}[/F_BETA \psk at mue 2 div \psk at nue 2 div tx at FuncDict begin BETA end def]{
+ /constA Euler \psk at lambda -2 div exp def
+ /Sum
+ constA F_BETA
+% \psk at nue 2 div \psk at mue 2 div tx at FuncDict begin BETA end
+ div % first fraction
+ \psk at mue \psk at nue div \psk at mue 2 div exp
+ mul
+ \psk at nue dup \psk at mue x mul add div \psk at mue \psk at nue add 2 div exp
+ mul
+ x \psk at mue 2 div 1 sub exp
+ mul
+ def
+ /K 1 def
+ {
+ constA \psk at lambda 2 div K exp mul % nominator
+ \psk at nue 2 div \psk at mue 2 div K add tx at FuncDict begin BETA end K factorial mul % denominator
+ div % first fraction
+ \psk at mue \psk at nue div \psk at mue 2 div K add exp
+ mul
+ \psk at nue dup \psk at mue x mul add div \psk at mue \psk at nue add 2 div K add exp
+ mul
+ x \psk at mue 2 div 1 sub K add exp
+ mul
+ dup abs 1e-5 lt
+ { pop exit }
+ { Sum add /Sum ED
+ K 1 add /K ED } ifelse
+ K 100 ge { (Error ConfHyperFunc: K=100) == exit } if
+ } loop
+ Sum
+ }%
+ \fi
+ \endgroup
+ \fi
+ \ignorespaces
+}
+
+
+%
\define at key[psset]{pst-func}{m}[0]{\def\psk at cauchy@m{#1 }}
\define at key[psset]{pst-func}{b}[1]{\def\psk at cauchy@b{#1 }}
\psset[pst-func]{m=0,b=1}
Modified: trunk/Master/texmf-dist/tex/latex/pst-func/pst-func.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex/pst-func/pst-func.sty 2023-04-14 20:25:31 UTC (rev 66844)
+++ trunk/Master/texmf-dist/tex/latex/pst-func/pst-func.sty 2023-04-14 20:25:52 UTC (rev 66845)
@@ -5,12 +5,14 @@
\RequirePackage{pst-tools}
\RequirePackage{pstricks-add}
\RequirePackage{pst-xkey}
+\RequirePackage{iftex}
+\ifluatex \RequirePackage{luacode} \fi
%
\input{pst-func.tex}
\ProvidesFile{pst-func.tex}
[\filedate\space v\fileversion\space `PST-func' (hv)]
\IfFileExists{pst-func.pro}{%
- \ProvidesFile{pst-func.pro}[2023/04/02 v. 0.19, PostScript prologue file (hv)]
+ \ProvidesFile{pst-func.pro}[2023/04/04 v. 0.20, PostScript prologue file (hv)]
\@addtofilelist{pst-func.pro}}{}%
\endinput
-%% $Id: pst-func.sty 693 2023-04-03 10:56:01Z herbert $
+%% $Id: pst-func.sty 698 2023-04-14 10:19:52Z herbert $
More information about the tex-live-commits
mailing list.