# [Tex/LaTex] I’m searching for a table with cdf of standard normal distribution

calculationstables

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?

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}{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{\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}