# I'm searching for a table with cdf of standard normal distribution

I'm searching for a latex version of the mathematical table in german called "standard normalverteilung". Google spits out standard normal distribution but i don't think thats quite right. its this one: https://de.wikibooks.org/wiki/Tabelle_Standardnormalverteilung

Does somebody know a latex source of the table so i don't have to type it by hand?

• Feb 24 '17 at 18:27

Here's a LuaLaTeX-based implementation. It employs Lua code both to calculate the cdf values and to tabulate them in an array environment with 11 columns and 42 rows (including 1 header row).

The algorithm that calculates the cdf at x (for a positive value of x) is based on an approximation proposed in Abramovitz and Stegun, "Handbook of Mathematical Functions" (1964). For more information on this algorithm, see also Abramowitz and Stegun approximation for cumulative normal distribution. The maximum absolute error may be shown to be less than 7.5×10^{−8}. Since the numbers in the table show only 5 digits, the approximation error is negligible for the present use case.

Addendum: If you wanted to use , (comma) as the decimal marker, all you would need to do in the code shown below is (a) add the instructions

\usepackage[output-decimal-marker={,}]{siunitx}
\newcolumntype{T}[1]{S[table-format=#1,group-digits=false]}


in the preamble and (b) change the specification of the array environment from *{11}{l} to T{1.1} *{10}{T{1.5}}.

\documentclass{article}
\usepackage{luacode}
%% code based on algorithm of Abramovitz and Stegun (1964)
\begin{luacode}

-- x must be positive in Phi(x)
function Phi ( x )
pdfx = 1/(math.sqrt(2*math.pi)) * math.exp ( -x*x/2 )
t = 1 / (1+0.2316419*x)
return ( 1 - pdfx*(0.319381530*t - 0.356563782*t^2
+ 1.781477937*t^3 - 1.821255978*t^4 + 1.330274429*t^5) )
end
-- x can be positive or negative in cdfn(x)
function cdfn ( x )
if ( x==0 ) then
return ( 0.5 )
elseif ( x>0 ) then
return ( Phi ( x ) )
else
return ( 1 - Phi ( -x ) )
end
end
-- the table is generated via a set of nested for-loops
function bigloop ()
-- first, generate the header row
tex.sprint ( "x" )
for v=0,9 do
tex.sprint( "&"..v/100 )
end
tex.sprint ( "\\\$0.5ex]" ) -- next, 41 rows of calculations for u=0,40,1 do tex.sprint ( u/10 ) for v=0,9 do tex.sprint( "&"..string.format("%.5g", cdfn(u/10+v/100)) ) end tex.sprint ( "\\\\" ) end end  \end{luacode} %% Just in case it's needed: A LaTeX macro to access the cdf value directly \newcommand\cdfn[1]{\directlua{tex.sprint(cdfn(#1))}} \usepackage[a4paper,margin=2.5cm]{geometry} % choose page parameters suitably \begin{document} \[ \begin{array}{*{11}{l}} \directlua{bigloop()} % call the Lua function "bigloop" to tabulate the numbers \end{array}$
\end{document}


Here's one version (copy and paste from German Wikipedia and then import to http://www.tablesgenerator.com/latex_tables; hope it's correct):

\begin{table}[]
\centering
\caption{My caption}
\label{my-label}
\begin{tabular}{lllllllllll}
z   & 0       & 0,01    & 0,02    & 0,03    & 0,04    & 0,05    & 0,06    & 0,07    & 0,08    & 0,09    \\
0   & 0,5     & 0,50399 & 0,50798 & 0,51197 & 0,51595 & 0,51994 & 0,52392 & 0,5279  & 0,53188 & 0,53586 \\
0,1 & 0,53983 & 0,5438  & 0,54776 & 0,55172 & 0,55567 & 0,55962 & 0,56356 & 0,56749 & 0,57142 & 0,57535 \\
0,2 & 0,57926 & 0,58317 & 0,58706 & 0,59095 & 0,59483 & 0,59871 & 0,60257 & 0,60642 & 0,61026 & 0,61409 \\
0,3 & 0,61791 & 0,62172 & 0,62552 & 0,6293  & 0,63307 & 0,63683 & 0,64058 & 0,64431 & 0,64803 & 0,65173 \\
0,4 & 0,65542 & 0,6591  & 0,66276 & 0,6664  & 0,67003 & 0,67364 & 0,67724 & 0,68082 & 0,68439 & 0,68793 \\
0,5 & 0,69146 & 0,69497 & 0,69847 & 0,70194 & 0,7054  & 0,70884 & 0,71226 & 0,71566 & 0,71904 & 0,7224  \\
0,6 & 0,72575 & 0,72907 & 0,73237 & 0,73565 & 0,73891 & 0,74215 & 0,74537 & 0,74857 & 0,75175 & 0,7549  \\
0,7 & 0,75804 & 0,76115 & 0,76424 & 0,7673  & 0,77035 & 0,77337 & 0,77637 & 0,77935 & 0,7823  & 0,78524 \\
0,8 & 0,78814 & 0,79103 & 0,79389 & 0,79673 & 0,79955 & 0,80234 & 0,80511 & 0,80785 & 0,81057 & 0,81327 \\
0,9 & 0,81594 & 0,81859 & 0,82121 & 0,82381 & 0,82639 & 0,82894 & 0,83147 & 0,83398 & 0,83646 & 0,83891 \\
1   & 0,84134 & 0,84375 & 0,84614 & 0,84849 & 0,85083 & 0,85314 & 0,85543 & 0,85769 & 0,85993 & 0,86214 \\
1,1 & 0,86433 & 0,8665  & 0,86864 & 0,87076 & 0,87286 & 0,87493 & 0,87698 & 0,879   & 0,881   & 0,88298 \\
1,2 & 0,88493 & 0,88686 & 0,88877 & 0,89065 & 0,89251 & 0,89435 & 0,89617 & 0,89796 & 0,89973 & 0,90147 \\
1,3 & 0,9032  & 0,9049  & 0,90658 & 0,90824 & 0,90988 & 0,91149 & 0,91309 & 0,91466 & 0,91621 & 0,91774 \\
1,4 & 0,91924 & 0,92073 & 0,9222  & 0,92364 & 0,92507 & 0,92647 & 0,92785 & 0,92922 & 0,93056 & 0,93189 \\
1,5 & 0,93319 & 0,93448 & 0,93574 & 0,93699 & 0,93822 & 0,93943 & 0,94062 & 0,94179 & 0,94295 & 0,94408 \\
1,6 & 0,9452  & 0,9463  & 0,94738 & 0,94845 & 0,9495  & 0,95053 & 0,95154 & 0,95254 & 0,95352 & 0,95449 \\
1,7 & 0,95543 & 0,95637 & 0,95728 & 0,95818 & 0,95907 & 0,95994 & 0,9608  & 0,96164 & 0,96246 & 0,96327 \\
1,8 & 0,96407 & 0,96485 & 0,96562 & 0,96638 & 0,96712 & 0,96784 & 0,96856 & 0,96926 & 0,96995 & 0,97062 \\
1,9 & 0,97128 & 0,97193 & 0,97257 & 0,9732  & 0,97381 & 0,97441 & 0,975   & 0,97558 & 0,97615 & 0,9767  \\
2   & 0,97725 & 0,97778 & 0,97831 & 0,97882 & 0,97932 & 0,97982 & 0,9803  & 0,98077 & 0,98124 & 0,98169 \\
2,1 & 0,98214 & 0,98257 & 0,983   & 0,98341 & 0,98382 & 0,98422 & 0,98461 & 0,985   & 0,98537 & 0,98574 \\
2,2 & 0,9861  & 0,98645 & 0,98679 & 0,98713 & 0,98745 & 0,98778 & 0,98809 & 0,9884  & 0,9887  & 0,98899 \\
2,3 & 0,98928 & 0,98956 & 0,98983 & 0,9901  & 0,99036 & 0,99061 & 0,99086 & 0,99111 & 0,99134 & 0,99158 \\
2,4 & 0,9918  & 0,99202 & 0,99224 & 0,99245 & 0,99266 & 0,99286 & 0,99305 & 0,99324 & 0,99343 & 0,99361 \\
2,5 & 0,99379 & 0,99396 & 0,99413 & 0,9943  & 0,99446 & 0,99461 & 0,99477 & 0,99492 & 0,99506 & 0,9952  \\
2,6 & 0,99534 & 0,99547 & 0,9956  & 0,99573 & 0,99585 & 0,99598 & 0,99609 & 0,99621 & 0,99632 & 0,99643 \\
2,7 & 0,99653 & 0,99664 & 0,99674 & 0,99683 & 0,99693 & 0,99702 & 0,99711 & 0,9972  & 0,99728 & 0,99736 \\
2,8 & 0,99744 & 0,99752 & 0,9976  & 0,99767 & 0,99774 & 0,99781 & 0,99788 & 0,99795 & 0,99801 & 0,99807 \\
2,9 & 0,99813 & 0,99819 & 0,99825 & 0,99831 & 0,99836 & 0,99841 & 0,99846 & 0,99851 & 0,99856 & 0,99861 \\
3   & 0,99865 & 0,99869 & 0,99874 & 0,99878 & 0,99882 & 0,99886 & 0,99889 & 0,99893 & 0,99896 & 0,999   \\
3,1 & 0,99903 & 0,99906 & 0,9991  & 0,99913 & 0,99916 & 0,99918 & 0,99921 & 0,99924 & 0,99926 & 0,99929 \\
3,2 & 0,99931 & 0,99934 & 0,99936 & 0,99938 & 0,9994  & 0,99942 & 0,99944 & 0,99946 & 0,99948 & 0,9995  \\
3,3 & 0,99952 & 0,99953 & 0,99955 & 0,99957 & 0,99958 & 0,9996  & 0,99961 & 0,99962 & 0,99964 & 0,99965 \\
3,4 & 0,99966 & 0,99968 & 0,99969 & 0,9997  & 0,99971 & 0,99972 & 0,99973 & 0,99974 & 0,99975 & 0,99976 \\
3,5 & 0,99977 & 0,99978 & 0,99978 & 0,99979 & 0,9998  & 0,99981 & 0,99981 & 0,99982 & 0,99983 & 0,99983 \\
3,6 & 0,99984 & 0,99985 & 0,99985 & 0,99986 & 0,99986 & 0,99987 & 0,99987 & 0,99988 & 0,99988 & 0,99989 \\
3,7 & 0,99989 & 0,9999  & 0,9999  & 0,9999  & 0,99991 & 0,99991 & 0,99992 & 0,99992 & 0,99992 & 0,99992 \\
3,8 & 0,99993 & 0,99993 & 0,99993 & 0,99994 & 0,99994 & 0,99994 & 0,99994 & 0,99995 & 0,99995 & 0,99995 \\
3,9 & 0,99995 & 0,99995 & 0,99996 & 0,99996 & 0,99996 & 0,99996 & 0,99996 & 0,99996 & 0,99997 & 0,99997 \\
4   & 0,99997 & 0,99997 & 0,99997 & 0,99997 & 0,99997 & 0,99997 & 0,99998 & 0,99998 & 0,99998 & 0,99998
\end{tabular}
\end{table}


Another tip: Have a look at the collections under https://www.york.ac.uk/depts/maths/tables/sources.htm (you look for the CDF).

• I like the table generator Feb 24 '17 at 22:47
• wasn't able to generate the table out of HTML, anyway thanks for the paste here! Feb 25 '17 at 14:28

A simple Sage solution using the sagetex package:

\documentclass[12pt]{article}
\usepackage{kpfonts}  %Changing the default fonts
\usepackage[T1]{fontenc}
\usepackage{sagetex}
\usepackage[margin=.25in]{geometry}
\begin{document}
\pagestyle{empty}
\begin{center}
{\LARGE Gaussian Table}
\end{center}
\begin{sagesilent}
var('x')
sigma = 1
T = RealDistribution('gaussian', sigma)
output = ""
output += r"\begin{tabular}{ccccccccccc} "
output += r" z & $0$ & $1$ & $2$ & $3$ & $4$ & $5$ & $6$ & $7$ & $8$ & $9$ \\ \hline "
for i in range(0, 41):
output += r"%3.1f & %8.5f & %8.5f & %8.5f & %8.5f & %8.5f & %8.5f & %8.5f & %8.5f & %8.5f  & %8.5f  \\ "%(.1*i,T.cum_distribution_function(.1*i), T.cum_distribution_function(.1*i+.01),T.cum_distribution_function(.1*i+.02), T.cum_distribution_function(.1*i+.03), T.cum_distribution_function(.1*i+.04),T.cum_distribution_function(.1*i+.05),T.cum_distribution_function(.1*i+.06),T.cum_distribution_function(.1*i+.07),T.cum_distribution_function(.1*i+.08),T.cum_distribution_function(.1*i+.09))
output += r"\end{tabular}"
\end{sagesilent}
\begin{center}
\sagestr{output}
\end{center}
\end{document}


Which gives this output:

You need Sage installed on your computer to use the sagetex package or, better yet, a free SagemathCloud account.

Here's an xintexpr-based implementation. It employs xint code both to calculate the cdf values and to tabulate them in a tabular environment with 11 columns and 42 rows (including 1 header row).

The algorithm that calculates the cdf at x (for a positive value of x) is based on a rational approximation proposed in Abramovitz and Stegun, "Handbook of Mathematical Functions" (1964) for the erf(x) function. I picked up the formula from wikipedia. The maximum absolute error in erf(x), x>0 is said to be less than 3×10^{-7}. The algorithm evaluates as floating point number with about 16 digits of precision the quantity erfc(x) = 1 - erf(x). The approximation is meaningless when x is very large, but as our table does not exceed 5 standard deviations this is of no concern. Since the numbers in the table show only 5 digits, the approximation error can only falsify the last digit (i.e. not give the correct rounding of the mathematically exact value) (of course 999...99 or 00...00 are problematic for that discussion). From random pick-up of the table entries I found no discrepancy with the wikipedia table.

I chose the formula because it uses only a rational function: indeed adjunction of a scientific module to xintexpr with functions such as exp is yet to be done. At user level it is already possible to define such functions using Taylor series or the like, but the hard part is to implement efficient methods and first to decide if xintexpr should compute them with correct rounding in arbitrary precision (like actually done for the sqrt function).

Here is the code:

% -*- coding: iso-latin-1; -*-
\documentclass[a4paper]{article}

\usepackage[latin1]{inputenc}
\usepackage[T1]{fontenc}
% \usepackage{babel}

% \usepackage[autolanguage, np]{numprint}
\usepackage[hscale=0.85, vscale=0.85]{geometry}

\usepackage{xintexpr}

% dans le préambule les :, ;, ne sont pas encore frenchb-actifs donc ok.

% l'assignation simultanée de valeurs nécessite xint 1.2p (2017/12/05)
% au minimum

\xintdeffloatvar a_1, a_2, a_3, a_4, a_5, a_6 :=
0.0705230784,
0.0422820123,
0.0092705272,
0.0001520143,
0.0002765672,
0.0000430638;

\xintdeffloatfunc erfc(x) := % uniquement pour x positif
% la formule prise de
% https://en.wikipedia.org/wiki/Error_function#Approximation_with_elementary_functions
% garantit à erf(x) = 1 - erfc(x) une erreur absolue d'au plus 3e-7.
((((((a_6 * x + a_5) * x + a_4) * x + a_3) * x + a_2) * x + a_1) * x + 1)
** -16
; % fin de définition de erfc(x)

\xintdeffloatvar rac2inv := sqrt(2)/2;% on le calcule une fois pour toutes

% https://en.wikipedia.org/wiki/Standard_normal_table#Cumulative

% On va calculer Phi(z) = 1/2(1 + erf(z/sqrt(2))) = 1 - erfc(z/sqrt(2))/2
\xintdeffloatfunc Phi(z) := 1 - 0.5 * erfc(rac2inv * z);

% 0.5erfc() does not work about xint thinks 0.5e starts a number in scientific
% notation. Thus one must (currently) type 0.5*erfc() as above

\usepackage{array}
\begin{document}

% on pourrait aussi utiliser 0, 1, 2, ... pour \xintFor,
% mais \xintFor* est plus rapide et la première chose que
% fait \xintFor c'est de convertir au format pour \xintFor*
% sans les virgules

{\small
\begin{tabular}{|>{\bfseries}c|*{10}{l|}}
\hline
z\xintFor* #1 in {0123456789}\do
{&\multicolumn{1}{c|}{\textbf{+0.0#1}}}% or \np{+0.0#1}
\\\hline
\xintFor* #1 in {0123}\do {%
\xintFor* #2 in {0123456789}\do {%
#1.#2\xintFor* #3 in {0123456789}\do {%
&%\np{% in case \np macro of numprint is used
\xinttheiexpr[5] % arrondir à 5 chiffres après la virgule
\xintfloatexpr Phi(#1.#2#3)\relax
\relax
%}%
}% fin de boucle avec #3
\\\hline
}% fin de boucle avec #2
}% fin de boucle avec #1
4.0\xintFor* #3 in {0123456789}\do {%
&%\np{% in case \np macro of numprint is used
\xinttheiexpr[5] % arrondir à 5 chiffres après la virgule
\xintfloatexpr Phi(4.0#3)\relax
\relax
%}%
}% fin de boucle avec #3
\\\hline
\end{tabular}
}
\end{document}


And the produced tabular: