\documentclass[margin=5mm, varwidth]{standalone}
\usepackage{xintexpr}
\usepackage[ngerman]{babel}
\usepackage[autolanguage,np]{numprint}
\begin{document}
\section*{Standardnormalverteilungstabelle mit \texttt{xint}}
% https://de.wikipedia.org/wiki/Standardnormalverteilungstabelle#Fl%C3%A4cheninhalte_unter_dem_Graphen_der_Standardnormalverteilung
\[\Phi_{0,1}(z) = \frac1{\sqrt{2\pi}}\int_{-\infty}^z e^{-\frac12t^2\mathrm\frac12t^2}\mathrm{d}t}\]t\]
% sn = "standard normal"
% sn(x) = 0.5 + 0.5 erf(x/sqrt(2)))
% approximation to erf (error less than 1.2e-7):
% https://de.wikipedia.org/wiki/Fehlerfunktion#Numerische_Berechnung
% erf(x) \approx 1 - tau(x) for x>=0
% sn(x) \approx 1 - 0.5 tau(x/sqrt(2))
%
% tau (x) = t *
% exp (-x^2-1.26551223
% +1.00002368 t
% +0.37409196 t^2
% +0.09678418 t^3
% -0.18628806 t^4
% +0.27886807 t^5
% -1.13520398 t^6
% +1.48851587 t^7
% -0.82215223 t^8
% +0.17087277 t^9)
% t = 1/(1+0.5 |x|)
% t is renamed to h when used with x/sqrt(2)=0.5 sqrt(2) x
% It turns out this syntax :
%
% \xintNewFloatExpr{\sn}[1]{subsn(1 - 0.5 * h * exp(
% -0.5*x^2 -1.26551223
% +1.00002368*h +0.37409196*h^2
% +0.09678418*h^3 -0.18628806*h^4
% +0.27886807*h^5 -1.13520398*h^6
% +1.48851587*h^7 -0.82215223*h^8
% +0.17087277*h^9), h= 1/(1+0.25*sqrt(2)*x); x = #1)}
%
% works but the computation of h is redone on each occurrence
% in the polynomial...
% This is more efficient
\xintdeffloatfunc snapprox(x,h) = 1 - 0.5 * h * exp(
-0.5*x^2 -1.26551223
+1.00002368*h +0.37409196*h^2
+0.09678418*h^3 -0.18628806*h^4
+0.27886807*h^5 -1.13520398*h^6
+1.48851587*h^7 -0.82215223*h^8
+0.17087277*h^9);
\xintNewFloatExpr{\sn}[1]{snapprox(#1, 1/(1+0.25*sqrt(2)*#1))}
% rounds (by default) to 5 fixed decimal places for final display,
% use package numprint for language specific formatting
% (replace with siunitx if preferred)
\NewDocumentCommand{\SN}{O{5} m}{\np{\xintRound{#1}{\sn{#2}}}}
% alternatively \xintieval[#1]{\foo{#2}} works too.
% Direct input \textbackslash sn\{0.61\} works:
% sn(0.61) = \SN{0.61}
% \def\x{0.61}
% Direct input \textbackslash sn\{\textbackslash x\} - works as well:
% sn(\x) = \SN{\x}
% one can automatize more... (would be needed for easily doing
% variants with other evaluation points)
\newcommand\myrow[1]{\np{#1}&\SN{#10}
&\SN{#11}
&\SN{#12}
&\SN{#13}
&\SN{#14}
&\SN{#15}
&\SN{#16}
&\SN{#17}
&\SN{#18}
&\SN{#19}}
\footnotesize
\noindent
\begingroup
%\xintSetDigits{8} would speed up things a bit by telling
% xint to compute only with 8 digits
\setlength{\tabcolsep}{2pt}% normal value is 6pt
% input mark-up should be automatized but well now it is done
\begin{tabular}{r|*{10}{l|}}
\multicolumn{1}{c|}{z}&
\multicolumn{1}{c|}{\np{0}}&
\multicolumn{1}{c|}{\np{0.01}}&
\multicolumn{1}{c|}{\np{0.02}}&
\multicolumn{1}{c|}{\np{0.03}}&
\multicolumn{1}{c|}{\np{0.04}}&
\multicolumn{1}{c|}{\np{0.05}}&
\multicolumn{1}{c|}{\np{0.06}}&
\multicolumn{1}{c|}{\np{0.07}}&
\multicolumn{1}{c|}{\np{0.08}}&
\multicolumn{1}{c|}{\np{0.09}}\\\hline
% there is surely a way to automatize this...
\myrow{0.0}\\
\myrow{0.1}\\
\myrow{0.2}\\
\myrow{0.3}\\
\myrow{0.4}\\
\myrow{0.5}\\
\myrow{0.6}\\
\myrow{0.7}\\
\myrow{0.8}\\
\myrow{0.9}\\\hline
\myrow{1.0}\\
\myrow{1.1}\\
\myrow{1.2}\\
\myrow{1.3}\\
\myrow{1.4}\\
\myrow{1.5}\\
\myrow{1.6}\\
\myrow{1.7}\\
\myrow{1.8}\\
\myrow{1.9}\\\hline
\myrow{2.0}\\
\myrow{2.1}\\
\myrow{2.2}\\
\myrow{2.3}\\
\myrow{2.4}\\
\myrow{2.5}\\
\myrow{2.6}\\
\myrow{2.7}\\
\myrow{2.8}\\
\myrow{2.9}\\\hline
\myrow{3.0}\\
\myrow{3.1}\\
\myrow{3.2}\\
\myrow{3.3}\\
\myrow{3.4}\\
\myrow{3.5}\\
\myrow{3.6}\\
\myrow{3.7}\\
\myrow{3.8}\\
\myrow{3.9}\\\hline
\myrow{4.0}%\\
% \myrow{4.1}\\
% \myrow{4.2}\\
% \myrow{4.3}\\
% \myrow{4.4}\\
% \myrow{4.5}\\
% \myrow{4.6}\\
% \myrow{4.7}\\
% \myrow{4.8}\\
% \myrow{4.9}
\end{tabular}
\endgroup
\end{document}
\documentclass[margin=5mm, varwidth]{standalone}
\usepackage{xintexpr}
\usepackage[ngerman]{babel}
\usepackage[autolanguage,np]{numprint}
\begin{document}
\section*{Standardnormalverteilungstabelle mit \texttt{xint}}
% https://de.wikipedia.org/wiki/Standardnormalverteilungstabelle#Fl%C3%A4cheninhalte_unter_dem_Graphen_der_Standardnormalverteilung
\[\Phi_{0,1}(z) = \frac1{\sqrt{2\pi}}\int_{-\infty}^z e^{-\frac12t^2\mathrm{d}t}\]
% sn = "standard normal"
% sn(x) = 0.5 + 0.5 erf(x/sqrt(2)))
% approximation to erf (error less than 1.2e-7):
% https://de.wikipedia.org/wiki/Fehlerfunktion#Numerische_Berechnung
% erf(x) \approx 1 - tau(x) for x>=0
% sn(x) \approx 1 - 0.5 tau(x/sqrt(2))
%
% tau (x) = t *
% exp (-x^2-1.26551223
% +1.00002368 t
% +0.37409196 t^2
% +0.09678418 t^3
% -0.18628806 t^4
% +0.27886807 t^5
% -1.13520398 t^6
% +1.48851587 t^7
% -0.82215223 t^8
% +0.17087277 t^9)
% t = 1/(1+0.5 |x|)
% t is renamed to h when used with x/sqrt(2)=0.5 sqrt(2) x
% It turns out this syntax :
%
% \xintNewFloatExpr{\sn}[1]{subsn(1 - 0.5 * h * exp(
% -0.5*x^2 -1.26551223
% +1.00002368*h +0.37409196*h^2
% +0.09678418*h^3 -0.18628806*h^4
% +0.27886807*h^5 -1.13520398*h^6
% +1.48851587*h^7 -0.82215223*h^8
% +0.17087277*h^9), h= 1/(1+0.25*sqrt(2)*x); x = #1)}
%
% works but the computation of h is redone on each occurrence
% in the polynomial...
% This is more efficient
\xintdeffloatfunc snapprox(x,h) = 1 - 0.5 * h * exp(
-0.5*x^2 -1.26551223
+1.00002368*h +0.37409196*h^2
+0.09678418*h^3 -0.18628806*h^4
+0.27886807*h^5 -1.13520398*h^6
+1.48851587*h^7 -0.82215223*h^8
+0.17087277*h^9);
\xintNewFloatExpr{\sn}[1]{snapprox(#1, 1/(1+0.25*sqrt(2)*#1))}
% rounds (by default) to 5 fixed decimal places for final display,
% use package numprint for language specific formatting
% (replace with siunitx if preferred)
\NewDocumentCommand{\SN}{O{5} m}{\np{\xintRound{#1}{\sn{#2}}}}
% alternatively \xintieval[#1]{\foo{#2}} works too.
% Direct input \textbackslash sn\{0.61\} works:
% sn(0.61) = \SN{0.61}
% \def\x{0.61}
% Direct input \textbackslash sn\{\textbackslash x\} - works as well:
% sn(\x) = \SN{\x}
% one can automatize more... (would be needed for easily doing
% variants with other evaluation points)
\newcommand\myrow[1]{\np{#1}&\SN{#10}
&\SN{#11}
&\SN{#12}
&\SN{#13}
&\SN{#14}
&\SN{#15}
&\SN{#16}
&\SN{#17}
&\SN{#18}
&\SN{#19}}
\footnotesize
\noindent
\begingroup
%\xintSetDigits{8} would speed up things a bit by telling
% xint to compute only with 8 digits
\setlength{\tabcolsep}{2pt}% normal value is 6pt
% input mark-up should be automatized but well now it is done
\begin{tabular}{r|*{10}{l|}}
\multicolumn{1}{c|}{z}&
\multicolumn{1}{c|}{\np{0}}&
\multicolumn{1}{c|}{\np{0.01}}&
\multicolumn{1}{c|}{\np{0.02}}&
\multicolumn{1}{c|}{\np{0.03}}&
\multicolumn{1}{c|}{\np{0.04}}&
\multicolumn{1}{c|}{\np{0.05}}&
\multicolumn{1}{c|}{\np{0.06}}&
\multicolumn{1}{c|}{\np{0.07}}&
\multicolumn{1}{c|}{\np{0.08}}&
\multicolumn{1}{c|}{\np{0.09}}\\\hline
% there is surely a way to automatize this...
\myrow{0.0}\\
\myrow{0.1}\\
\myrow{0.2}\\
\myrow{0.3}\\
\myrow{0.4}\\
\myrow{0.5}\\
\myrow{0.6}\\
\myrow{0.7}\\
\myrow{0.8}\\
\myrow{0.9}\\\hline
\myrow{1.0}\\
\myrow{1.1}\\
\myrow{1.2}\\
\myrow{1.3}\\
\myrow{1.4}\\
\myrow{1.5}\\
\myrow{1.6}\\
\myrow{1.7}\\
\myrow{1.8}\\
\myrow{1.9}\\\hline
\myrow{2.0}\\
\myrow{2.1}\\
\myrow{2.2}\\
\myrow{2.3}\\
\myrow{2.4}\\
\myrow{2.5}\\
\myrow{2.6}\\
\myrow{2.7}\\
\myrow{2.8}\\
\myrow{2.9}\\\hline
\myrow{3.0}\\
\myrow{3.1}\\
\myrow{3.2}\\
\myrow{3.3}\\
\myrow{3.4}\\
\myrow{3.5}\\
\myrow{3.6}\\
\myrow{3.7}\\
\myrow{3.8}\\
\myrow{3.9}\\\hline
\myrow{4.0}%\\
% \myrow{4.1}\\
% \myrow{4.2}\\
% \myrow{4.3}\\
% \myrow{4.4}\\
% \myrow{4.5}\\
% \myrow{4.6}\\
% \myrow{4.7}\\
% \myrow{4.8}\\
% \myrow{4.9}
\end{tabular}
\endgroup
\end{document}
\documentclass[margin=5mm, varwidth]{standalone}
\usepackage{xintexpr}
\usepackage[ngerman]{babel}
\usepackage[autolanguage,np]{numprint}
\begin{document}
\section*{Standardnormalverteilungstabelle mit \texttt{xint}}
% https://de.wikipedia.org/wiki/Standardnormalverteilungstabelle#Fl%C3%A4cheninhalte_unter_dem_Graphen_der_Standardnormalverteilung
\[\Phi_{0,1}(z) = \frac1{\sqrt{2\pi}}\int_{-\infty}^z e^{-\frac12t^2}\mathrm{d}t\]
% sn = "standard normal"
% sn(x) = 0.5 + 0.5 erf(x/sqrt(2)))
% approximation to erf (error less than 1.2e-7):
% https://de.wikipedia.org/wiki/Fehlerfunktion#Numerische_Berechnung
% erf(x) \approx 1 - tau(x) for x>=0
% sn(x) \approx 1 - 0.5 tau(x/sqrt(2))
%
% tau (x) = t *
% exp (-x^2-1.26551223
% +1.00002368 t
% +0.37409196 t^2
% +0.09678418 t^3
% -0.18628806 t^4
% +0.27886807 t^5
% -1.13520398 t^6
% +1.48851587 t^7
% -0.82215223 t^8
% +0.17087277 t^9)
% t = 1/(1+0.5 |x|)
% t is renamed to h when used with x/sqrt(2)=0.5 sqrt(2) x
% It turns out this syntax :
%
% \xintNewFloatExpr{\sn}[1]{subsn(1 - 0.5 * h * exp(
% -0.5*x^2 -1.26551223
% +1.00002368*h +0.37409196*h^2
% +0.09678418*h^3 -0.18628806*h^4
% +0.27886807*h^5 -1.13520398*h^6
% +1.48851587*h^7 -0.82215223*h^8
% +0.17087277*h^9), h= 1/(1+0.25*sqrt(2)*x); x = #1)}
%
% works but the computation of h is redone on each occurrence
% in the polynomial...
% This is more efficient
\xintdeffloatfunc snapprox(x,h) = 1 - 0.5 * h * exp(
-0.5*x^2 -1.26551223
+1.00002368*h +0.37409196*h^2
+0.09678418*h^3 -0.18628806*h^4
+0.27886807*h^5 -1.13520398*h^6
+1.48851587*h^7 -0.82215223*h^8
+0.17087277*h^9);
\xintNewFloatExpr{\sn}[1]{snapprox(#1, 1/(1+0.25*sqrt(2)*#1))}
% rounds (by default) to 5 fixed decimal places for final display,
% use package numprint for language specific formatting
% (replace with siunitx if preferred)
\NewDocumentCommand{\SN}{O{5} m}{\np{\xintRound{#1}{\sn{#2}}}}
% alternatively \xintieval[#1]{\foo{#2}} works too.
% Direct input \textbackslash sn\{0.61\} works:
% sn(0.61) = \SN{0.61}
% \def\x{0.61}
% Direct input \textbackslash sn\{\textbackslash x\} - works as well:
% sn(\x) = \SN{\x}
% one can automatize more... (would be needed for easily doing
% variants with other evaluation points)
\newcommand\myrow[1]{\np{#1}&\SN{#10}
&\SN{#11}
&\SN{#12}
&\SN{#13}
&\SN{#14}
&\SN{#15}
&\SN{#16}
&\SN{#17}
&\SN{#18}
&\SN{#19}}
\footnotesize
\noindent
\begingroup
%\xintSetDigits{8} would speed up things a bit by telling
% xint to compute only with 8 digits
\setlength{\tabcolsep}{2pt}% normal value is 6pt
% input mark-up should be automatized but well now it is done
\begin{tabular}{r|*{10}{l|}}
\multicolumn{1}{c|}{z}&
\multicolumn{1}{c|}{\np{0}}&
\multicolumn{1}{c|}{\np{0.01}}&
\multicolumn{1}{c|}{\np{0.02}}&
\multicolumn{1}{c|}{\np{0.03}}&
\multicolumn{1}{c|}{\np{0.04}}&
\multicolumn{1}{c|}{\np{0.05}}&
\multicolumn{1}{c|}{\np{0.06}}&
\multicolumn{1}{c|}{\np{0.07}}&
\multicolumn{1}{c|}{\np{0.08}}&
\multicolumn{1}{c|}{\np{0.09}}\\\hline
% there is surely a way to automatize this...
\myrow{0.0}\\
\myrow{0.1}\\
\myrow{0.2}\\
\myrow{0.3}\\
\myrow{0.4}\\
\myrow{0.5}\\
\myrow{0.6}\\
\myrow{0.7}\\
\myrow{0.8}\\
\myrow{0.9}\\\hline
\myrow{1.0}\\
\myrow{1.1}\\
\myrow{1.2}\\
\myrow{1.3}\\
\myrow{1.4}\\
\myrow{1.5}\\
\myrow{1.6}\\
\myrow{1.7}\\
\myrow{1.8}\\
\myrow{1.9}\\\hline
\myrow{2.0}\\
\myrow{2.1}\\
\myrow{2.2}\\
\myrow{2.3}\\
\myrow{2.4}\\
\myrow{2.5}\\
\myrow{2.6}\\
\myrow{2.7}\\
\myrow{2.8}\\
\myrow{2.9}\\\hline
\myrow{3.0}\\
\myrow{3.1}\\
\myrow{3.2}\\
\myrow{3.3}\\
\myrow{3.4}\\
\myrow{3.5}\\
\myrow{3.6}\\
\myrow{3.7}\\
\myrow{3.8}\\
\myrow{3.9}\\\hline
\myrow{4.0}%\\
% \myrow{4.1}\\
% \myrow{4.2}\\
% \myrow{4.3}\\
% \myrow{4.4}\\
% \myrow{4.5}\\
% \myrow{4.6}\\
% \myrow{4.7}\\
% \myrow{4.8}\\
% \myrow{4.9}
\end{tabular}
\endgroup
\end{document}
\documentclass[margin=5mm, varwidth]{standalone}
\usepackage{xintexpr}
\usepackage[ngerman]{babel}
\usepackage[autolanguage,np]{numprint}
\begin{document}
\section*{Standardnormalverteilungstabelle mit \texttt{xint}}
% https://de.wikipedia.org/wiki/Standardnormalverteilungstabelle#Fl%C3%A4cheninhalte_unter_dem_Graphen_der_Standardnormalverteilung
\[\Phi_{0,1}(z) = \frac1{\sqrt{2\pi}}\int_{-\infty}^z e^{-\frac12t^2\mathrm{d}t}\]
% sn = "standard normal"
% sn(x) = 0.5 + 0.5 erf(x/sqrt(2)))
% approximation to erf (error less than 1.2e-7):
% https://de.wikipedia.org/wiki/Fehlerfunktion#Numerische_Berechnung
% erf(x) \approx 1 - tau(x) for x>=0
% sn(x) \approx 1 - 0.5 tau(x/sqrt(2))
%
% tau (x) = t *
% exp (-x^2-1.26551223
% +1.00002368 t
% +0.37409196 t^2
% +0.09678418 t^3
% -0.18628806 t^4
% +0.27886807 t^5
% -1.13520398 t^6
% +1.48851587 t^7
% -0.82215223 t^8
% +0.17087277 t^9)
% t = 1/(1+0.5 |x|)
% t is renamed to h when used with x/sqrt(2)=0.5 sqrt(2) x
% It turns out this syntax :
%
% \xintNewFloatExpr{\sn}[1]{subsn(1 - 0.5 * h * exp(
% -0.5*x^2 -1.26551223
% +1.00002368*h +0.37409196*h^2
% +0.09678418*h^3 -0.18628806*h^4
% +0.27886807*h^5 -1.13520398*h^6
% +1.48851587*h^7 -0.82215223*h^8
% +0.17087277*h^9), h= 1/(1+0.25*sqrt(2)*x); x = #1)}
%
% works but the computation of h is redone on each occurrence
% in the polynomial...
% This is more efficient
\xintdeffloatfunc snapprox(x,h) = 1 - 0.5 * h * exp(
-0.5*x^2 -1.26551223
+1.00002368*h +0.37409196*h^2
+0.09678418*h^3 -0.18628806*h^4
+0.27886807*h^5 -1.13520398*h^6
+1.48851587*h^7 -0.82215223*h^8
+0.17087277*h^9);
\xintNewFloatExpr{\sn}[1]{snapprox(#1, 1/(1+0.25*sqrt(2)*#1))}
% rounds (by default) to 5 fixed decimal places for final display,
% use package numprint for language specific formatting
% (replace with siunitx if preferred)
\NewDocumentCommand{\SN}{O{5} m}{\np{\xintRound{#1}{\sn{#2}}}}
\NewDocumentCommand{\SN}{m}{\np{\xintRound{5}{\sn{#1}}}}
% alternatively \xintieval[5]\xintieval[#1]{\foo{#1#2}} works too.
% Direct input \textbackslash sn\{0.61\} works:
% sn(0.61) = \SN{0.61}
% \def\x{0.61}
% Direct input \textbackslash sn\{\textbackslash x\} - works as well:
% sn(\x) = \SN{\x}
% one can automatize more... (would be needed for easily doing
% variants with other evaluation points)
\newcommand\myrow[1]{\np{#1}&\SN{#10}
&\SN{#11}
&\SN{#12}
&\SN{#13}
&\SN{#14}
&\SN{#15}
&\SN{#16}
&\SN{#17}
&\SN{#18}
&\SN{#19}}
\footnotesize
\noindent
\begingroup
%\xintSetDigits{8} would speed up things a bit by telling
% xint to compute only with 8 digits
\setlength{\tabcolsep}{2pt}% normal value is 6pt
% input mark-up should be automatized but well now it is done
\begin{tabular}{r|*{10}{l|}}
\multicolumn{1}{c|}{z}&
\multicolumn{1}{c|}{\np{0}}&
\multicolumn{1}{c|}{\np{0.01}}&
\multicolumn{1}{c|}{\np{0.02}}&
\multicolumn{1}{c|}{\np{0.03}}&
\multicolumn{1}{c|}{\np{0.04}}&
\multicolumn{1}{c|}{\np{0.05}}&
\multicolumn{1}{c|}{\np{0.06}}&
\multicolumn{1}{c|}{\np{0.07}}&
\multicolumn{1}{c|}{\np{0.08}}&
\multicolumn{1}{c|}{\np{0.09}}\\\hline
% there is surely a way to automatize this...
\myrow{0.0}\\
\myrow{0.1}\\
\myrow{0.2}\\
\myrow{0.3}\\
\myrow{0.4}\\
\myrow{0.5}\\
\myrow{0.6}\\
\myrow{0.7}\\
\myrow{0.8}\\
\myrow{0.9}\\\hline
\myrow{1.0}\\
\myrow{1.1}\\
\myrow{1.2}\\
\myrow{1.3}\\
\myrow{1.4}\\
\myrow{1.5}\\
\myrow{1.6}\\
\myrow{1.7}\\
\myrow{1.8}\\
\myrow{1.9}\\\hline
\myrow{2.0}\\
\myrow{2.1}\\
\myrow{2.2}\\
\myrow{2.3}\\
\myrow{2.4}\\
\myrow{2.5}\\
\myrow{2.6}\\
\myrow{2.7}\\
\myrow{2.8}\\
\myrow{2.9}\\\hline
\myrow{3.0}\\
\myrow{3.1}\\
\myrow{3.2}\\
\myrow{3.3}\\
\myrow{3.4}\\
\myrow{3.5}\\
\myrow{3.6}\\
\myrow{3.7}\\
\myrow{3.8}\\
\myrow{3.9}\\\hline
\myrow{4.0}%\\
% \myrow{4.1}\\
% \myrow{4.2}\\
% \myrow{4.3}\\
% \myrow{4.4}\\
% \myrow{4.5}\\
% \myrow{4.6}\\
% \myrow{4.7}\\
% \myrow{4.8}\\
% \myrow{4.9}
\end{tabular}
\endgroup
\end{document}
\documentclass[margin=5mm, varwidth]{standalone}
\usepackage{xintexpr}
\usepackage[ngerman]{babel}
\usepackage[autolanguage,np]{numprint}
\begin{document}
\section*{Standardnormalverteilungstabelle mit \texttt{xint}}
% https://de.wikipedia.org/wiki/Standardnormalverteilungstabelle#Fl%C3%A4cheninhalte_unter_dem_Graphen_der_Standardnormalverteilung
\[\Phi_{0,1}(z) = \frac1{\sqrt{2\pi}}\int_{-\infty}^z e^{-\frac12t^2\mathrm{d}t}\]
% sn = "standard normal"
% sn(x) = 0.5 + 0.5 erf(x/sqrt(2)))
% approximation to erf (error less than 1.2e-7):
% https://de.wikipedia.org/wiki/Fehlerfunktion#Numerische_Berechnung
% erf(x) \approx 1 - tau(x) for x>=0
% sn(x) \approx 1 - 0.5 tau(x/sqrt(2))
%
% tau (x) = t *
% exp (-x^2-1.26551223
% +1.00002368 t
% +0.37409196 t^2
% +0.09678418 t^3
% -0.18628806 t^4
% +0.27886807 t^5
% -1.13520398 t^6
% +1.48851587 t^7
% -0.82215223 t^8
% +0.17087277 t^9)
% t = 1/(1+0.5 |x|)
% t is renamed to h when used with x/sqrt(2)=0.5 sqrt(2) x
% It turns out this syntax :
%
% \xintNewFloatExpr{\sn}[1]{subsn(1 - 0.5 * h * exp(
% -0.5*x^2 -1.26551223
% +1.00002368*h +0.37409196*h^2
% +0.09678418*h^3 -0.18628806*h^4
% +0.27886807*h^5 -1.13520398*h^6
% +1.48851587*h^7 -0.82215223*h^8
% +0.17087277*h^9), h= 1/(1+0.25*sqrt(2)*x); x = #1)}
%
% works but the computation of h is redone on each occurrence
% in the polynomial...
% This is more efficient
\xintdeffloatfunc snapprox(x,h) = 1 - 0.5 * h * exp(
-0.5*x^2 -1.26551223
+1.00002368*h +0.37409196*h^2
+0.09678418*h^3 -0.18628806*h^4
+0.27886807*h^5 -1.13520398*h^6
+1.48851587*h^7 -0.82215223*h^8
+0.17087277*h^9);
\xintNewFloatExpr{\sn}[1]{snapprox(#1, 1/(1+0.25*sqrt(2)*#1))}
% rounds to 5 fixed decimal places for final display,
% use package numprint for language specific formatting
% (replace with siunitx if preferred)
\NewDocumentCommand{\SN}{m}{\np{\xintRound{5}{\sn{#1}}}}
% alternatively \xintieval[5]{\foo{#1}} works too.
% Direct input \textbackslash sn\{0.61\} works:
% sn(0.61) = \SN{0.61}
% \def\x{0.61}
% Direct input \textbackslash sn\{\textbackslash x\} - works as well:
% sn(\x) = \SN{\x}
% one can automatize more... (would be needed for easily doing
% variants with other evaluation points)
\newcommand\myrow[1]{\np{#1}&\SN{#10}
&\SN{#11}
&\SN{#12}
&\SN{#13}
&\SN{#14}
&\SN{#15}
&\SN{#16}
&\SN{#17}
&\SN{#18}
&\SN{#19}}
\footnotesize
\noindent
\begingroup
%\xintSetDigits{8} would speed up things a bit by telling
% xint to compute only with 8 digits
\setlength{\tabcolsep}{2pt}% normal value is 6pt
% input mark-up should be automatized but well now it is done
\begin{tabular}{r|*{10}{l|}}
\multicolumn{1}{c|}{z}&
\multicolumn{1}{c|}{\np{0}}&
\multicolumn{1}{c|}{\np{0.01}}&
\multicolumn{1}{c|}{\np{0.02}}&
\multicolumn{1}{c|}{\np{0.03}}&
\multicolumn{1}{c|}{\np{0.04}}&
\multicolumn{1}{c|}{\np{0.05}}&
\multicolumn{1}{c|}{\np{0.06}}&
\multicolumn{1}{c|}{\np{0.07}}&
\multicolumn{1}{c|}{\np{0.08}}&
\multicolumn{1}{c|}{\np{0.09}}\\\hline
% there is surely a way to automatize this...
\myrow{0.0}\\
\myrow{0.1}\\
\myrow{0.2}\\
\myrow{0.3}\\
\myrow{0.4}\\
\myrow{0.5}\\
\myrow{0.6}\\
\myrow{0.7}\\
\myrow{0.8}\\
\myrow{0.9}\\\hline
\myrow{1.0}\\
\myrow{1.1}\\
\myrow{1.2}\\
\myrow{1.3}\\
\myrow{1.4}\\
\myrow{1.5}\\
\myrow{1.6}\\
\myrow{1.7}\\
\myrow{1.8}\\
\myrow{1.9}\\\hline
\myrow{2.0}\\
\myrow{2.1}\\
\myrow{2.2}\\
\myrow{2.3}\\
\myrow{2.4}\\
\myrow{2.5}\\
\myrow{2.6}\\
\myrow{2.7}\\
\myrow{2.8}\\
\myrow{2.9}\\\hline
\myrow{3.0}\\
\myrow{3.1}\\
\myrow{3.2}\\
\myrow{3.3}\\
\myrow{3.4}\\
\myrow{3.5}\\
\myrow{3.6}\\
\myrow{3.7}\\
\myrow{3.8}\\
\myrow{3.9}\\\hline
\myrow{4.0}%\\
% \myrow{4.1}\\
% \myrow{4.2}\\
% \myrow{4.3}\\
% \myrow{4.4}\\
% \myrow{4.5}\\
% \myrow{4.6}\\
% \myrow{4.7}\\
% \myrow{4.8}\\
% \myrow{4.9}
\end{tabular}
\endgroup
\end{document}
\documentclass[margin=5mm, varwidth]{standalone}
\usepackage{xintexpr}
\usepackage[ngerman]{babel}
\usepackage[autolanguage,np]{numprint}
\begin{document}
\section*{Standardnormalverteilungstabelle mit \texttt{xint}}
% https://de.wikipedia.org/wiki/Standardnormalverteilungstabelle#Fl%C3%A4cheninhalte_unter_dem_Graphen_der_Standardnormalverteilung
\[\Phi_{0,1}(z) = \frac1{\sqrt{2\pi}}\int_{-\infty}^z e^{-\frac12t^2\mathrm{d}t}\]
% sn = "standard normal"
% sn(x) = 0.5 + 0.5 erf(x/sqrt(2)))
% approximation to erf (error less than 1.2e-7):
% https://de.wikipedia.org/wiki/Fehlerfunktion#Numerische_Berechnung
% erf(x) \approx 1 - tau(x) for x>=0
% sn(x) \approx 1 - 0.5 tau(x/sqrt(2))
%
% tau (x) = t *
% exp (-x^2-1.26551223
% +1.00002368 t
% +0.37409196 t^2
% +0.09678418 t^3
% -0.18628806 t^4
% +0.27886807 t^5
% -1.13520398 t^6
% +1.48851587 t^7
% -0.82215223 t^8
% +0.17087277 t^9)
% t = 1/(1+0.5 |x|)
% t is renamed to h when used with x/sqrt(2)=0.5 sqrt(2) x
% It turns out this syntax :
%
% \xintNewFloatExpr{\sn}[1]{subsn(1 - 0.5 * h * exp(
% -0.5*x^2 -1.26551223
% +1.00002368*h +0.37409196*h^2
% +0.09678418*h^3 -0.18628806*h^4
% +0.27886807*h^5 -1.13520398*h^6
% +1.48851587*h^7 -0.82215223*h^8
% +0.17087277*h^9), h= 1/(1+0.25*sqrt(2)*x); x = #1)}
%
% works but the computation of h is redone on each occurrence
% in the polynomial...
% This is more efficient
\xintdeffloatfunc snapprox(x,h) = 1 - 0.5 * h * exp(
-0.5*x^2 -1.26551223
+1.00002368*h +0.37409196*h^2
+0.09678418*h^3 -0.18628806*h^4
+0.27886807*h^5 -1.13520398*h^6
+1.48851587*h^7 -0.82215223*h^8
+0.17087277*h^9);
\xintNewFloatExpr{\sn}[1]{snapprox(#1, 1/(1+0.25*sqrt(2)*#1))}
% rounds (by default) to 5 fixed decimal places for final display,
% use package numprint for language specific formatting
% (replace with siunitx if preferred)
\NewDocumentCommand{\SN}{O{5} m}{\np{\xintRound{#1}{\sn{#2}}}}
% alternatively \xintieval[#1]{\foo{#2}} works too.
% Direct input \textbackslash sn\{0.61\} works:
% sn(0.61) = \SN{0.61}
% \def\x{0.61}
% Direct input \textbackslash sn\{\textbackslash x\} - works as well:
% sn(\x) = \SN{\x}
% one can automatize more... (would be needed for easily doing
% variants with other evaluation points)
\newcommand\myrow[1]{\np{#1}&\SN{#10}
&\SN{#11}
&\SN{#12}
&\SN{#13}
&\SN{#14}
&\SN{#15}
&\SN{#16}
&\SN{#17}
&\SN{#18}
&\SN{#19}}
\footnotesize
\noindent
\begingroup
%\xintSetDigits{8} would speed up things a bit by telling
% xint to compute only with 8 digits
\setlength{\tabcolsep}{2pt}% normal value is 6pt
% input mark-up should be automatized but well now it is done
\begin{tabular}{r|*{10}{l|}}
\multicolumn{1}{c|}{z}&
\multicolumn{1}{c|}{\np{0}}&
\multicolumn{1}{c|}{\np{0.01}}&
\multicolumn{1}{c|}{\np{0.02}}&
\multicolumn{1}{c|}{\np{0.03}}&
\multicolumn{1}{c|}{\np{0.04}}&
\multicolumn{1}{c|}{\np{0.05}}&
\multicolumn{1}{c|}{\np{0.06}}&
\multicolumn{1}{c|}{\np{0.07}}&
\multicolumn{1}{c|}{\np{0.08}}&
\multicolumn{1}{c|}{\np{0.09}}\\\hline
% there is surely a way to automatize this...
\myrow{0.0}\\
\myrow{0.1}\\
\myrow{0.2}\\
\myrow{0.3}\\
\myrow{0.4}\\
\myrow{0.5}\\
\myrow{0.6}\\
\myrow{0.7}\\
\myrow{0.8}\\
\myrow{0.9}\\\hline
\myrow{1.0}\\
\myrow{1.1}\\
\myrow{1.2}\\
\myrow{1.3}\\
\myrow{1.4}\\
\myrow{1.5}\\
\myrow{1.6}\\
\myrow{1.7}\\
\myrow{1.8}\\
\myrow{1.9}\\\hline
\myrow{2.0}\\
\myrow{2.1}\\
\myrow{2.2}\\
\myrow{2.3}\\
\myrow{2.4}\\
\myrow{2.5}\\
\myrow{2.6}\\
\myrow{2.7}\\
\myrow{2.8}\\
\myrow{2.9}\\\hline
\myrow{3.0}\\
\myrow{3.1}\\
\myrow{3.2}\\
\myrow{3.3}\\
\myrow{3.4}\\
\myrow{3.5}\\
\myrow{3.6}\\
\myrow{3.7}\\
\myrow{3.8}\\
\myrow{3.9}\\\hline
\myrow{4.0}%\\
% \myrow{4.1}\\
% \myrow{4.2}\\
% \myrow{4.3}\\
% \myrow{4.4}\\
% \myrow{4.5}\\
% \myrow{4.6}\\
% \myrow{4.7}\\
% \myrow{4.8}\\
% \myrow{4.9}
\end{tabular}
\endgroup
\end{document}
\documentclass[margin=5mm, varwidth]{standalone}
\usepackage{xintexpr}
\usepackage[ngerman]{babel}
\usepackage[autolanguage,np]{numprint}
\begin{document}
\section*{Standardnormalverteilungstabelle mit \texttt{xint}}
% https://de.wikipedia.org/wiki/Standardnormalverteilungstabelle#Fl%C3%A4cheninhalte_unter_dem_Graphen_der_Standardnormalverteilung
\[\Phi_{0,1}(z) = \frac1{\sqrt{2\pi}}\int_{-\infty}^z e^{-\frac12t^2\mathrm{d}t}\]
% sn = "standard normal"
% sn(x) = 0.5 + 0.5 erf(x/sqrt(2)))
% approximation to erf (error less than 1.2e-7):
% https://de.wikipedia.org/wiki/Fehlerfunktion#Numerische_Berechnung
% erf(x) \approx 1 - tau(x) for x>=0
% sn(x) \approx 1 - 0.5 tau(x/sqrt(2))
%
% tau (x) = t *
% exp (-x^2-1.26551223
% +1.00002368 t
% +0.37409196 t^2
% +0.09678418 t^3
% -0.18628806 t^4
% +0.27886807 t^5
% -1.13520398 t^6
% +1.48851587 t^7
% -0.82215223 t^8
% +0.17087277 t^9)
% t = 1/(1+0.5 |x|)
% t is renamed to h when used with x/sqrt(2)=0.5 sqrt(2) x
% It turns out this syntax :
%
% \xintNewFloatExpr{\sn}[1]{subsn(1 - 0.5 * h * exp(
% -0.5*x^2 -1.26551223
% +1.00002368*h +0.37409196*h^2
% +0.09678418*h^3 -0.18628806*h^4
% +0.27886807*h^5 -1.13520398*h^6
% +1.48851587*h^7 -0.82215223*h^8
% +0.17087277*h^9), h= 1/(1+0.25*sqrt(2)*x); x = #1)}
%
% works but the computation of h is redone on each occurrence
% in the polynomial...
% This is more efficient
\xintdeffloatfunc snapprox(x,h) = 1 - 0.5 * h * exp(
-0.5*x^2 -1.26551223
+1.00002368*h +0.37409196*h^2
+0.09678418*h^3 -0.18628806*h^4
+0.27886807*h^5 -1.13520398*h^6
+1.48851587*h^7 -0.82215223*h^8
+0.17087277*h^9);
\xintNewFloatExpr{\sn}[1]{snapprox(#1, 1/(1+0.25*sqrt(2)*#1))}
% rounds to 65 fixed decimal places for final display,
% use package numprint for language specific formatting
% (replace with siunitx if preferred)
\NewDocumentCommand{\SN}{m}{\np{\xintRound{5}{\sn{#1}}}}
% alternatively \xintieval[5]{\foo{#1}} works too.
% Direct input \textbackslash sn\{0.61\} works:
% sn(0.61) = \SN{0.61}
% \def\x{0.61}
% Direct input \textbackslash sn\{\textbackslash x\} - works as well:
% sn(\x) = \SN{\x}
% one can automatize more... (would be needed for easily doing
% variants with other evaluation points)
\newcommand\myrow[1]{\np{#1}&\SN{#10}
&\SN{#11}
&\SN{#12}
&\SN{#13}
&\SN{#14}
&\SN{#15}
&\SN{#16}
&\SN{#17}
&\SN{#18}
&\SN{#19}}
\footnotesize
\noindent
\begingroup
%\xintSetDigits{8} would speed up things a bit by telling
% xint to compute only with 8 digits
\setlength{\tabcolsep}{2pt}% normal value is 6pt
% input mark-up should be automatized but well now it is done
\begin{tabular}{r|*{10}{l|}}
\multicolumn{1}{c|}{z}&
\multicolumn{1}{c|}{\np{0}}&
\multicolumn{1}{c|}{\np{0.01}}&
\multicolumn{1}{c|}{\np{0.02}}&
\multicolumn{1}{c|}{\np{0.03}}&
\multicolumn{1}{c|}{\np{0.04}}&
\multicolumn{1}{c|}{\np{0.05}}&
\multicolumn{1}{c|}{\np{0.06}}&
\multicolumn{1}{c|}{\np{0.07}}&
\multicolumn{1}{c|}{\np{0.08}}&
\multicolumn{1}{c|}{\np{0.09}}\\\hline
% there is surely a way to automatize this...
\myrow{0.0}\\
\myrow{0.1}\\
\myrow{0.2}\\
\myrow{0.3}\\
\myrow{0.4}\\
\myrow{0.5}\\
\myrow{0.6}\\
\myrow{0.7}\\
\myrow{0.8}\\
\myrow{0.9}\\\hline
\myrow{1.0}\\
\myrow{1.1}\\
\myrow{1.2}\\
\myrow{1.3}\\
\myrow{1.4}\\
\myrow{1.5}\\
\myrow{1.6}\\
\myrow{1.7}\\
\myrow{1.8}\\
\myrow{1.9}\\\hline
\myrow{2.0}\\
\myrow{2.1}\\
\myrow{2.2}\\
\myrow{2.3}\\
\myrow{2.4}\\
\myrow{2.5}\\
\myrow{2.6}\\
\myrow{2.7}\\
\myrow{2.8}\\
\myrow{2.9}\\\hline
\myrow{3.0}\\
\myrow{3.1}\\
\myrow{3.2}\\
\myrow{3.3}\\
\myrow{3.4}\\
\myrow{3.5}\\
\myrow{3.6}\\
\myrow{3.7}\\
\myrow{3.8}\\
\myrow{3.9}\\\hline
\myrow{4.0}%\\
% \myrow{4.1}\\
% \myrow{4.2}\\
% \myrow{4.3}\\
% \myrow{4.4}\\
% \myrow{4.5}\\
% \myrow{4.6}\\
% \myrow{4.7}\\
% \myrow{4.8}\\
% \myrow{4.9}
\end{tabular}
\endgroup
\end{document}
\documentclass[margin=5mm, varwidth]{standalone}
\usepackage{xintexpr}
\usepackage[ngerman]{babel}
\usepackage[autolanguage,np]{numprint}
\begin{document}
\section*{Standardnormalverteilungstabelle mit \texttt{xint}}
% https://de.wikipedia.org/wiki/Standardnormalverteilungstabelle#Fl%C3%A4cheninhalte_unter_dem_Graphen_der_Standardnormalverteilung
\[\Phi_{0,1}(z) = \frac1{\sqrt{2\pi}}\int_{-\infty}^z e^{-\frac12t^2\mathrm{d}t}\]
% sn = "standard normal"
% sn(x) = 0.5 + 0.5 erf(x/sqrt(2)))
% approximation to erf (error less than 1.2e-7):
% https://de.wikipedia.org/wiki/Fehlerfunktion#Numerische_Berechnung
% erf(x) \approx 1 - tau(x) for x>=0
% sn(x) \approx 1 - 0.5 tau(x/sqrt(2))
%
% tau (x) = t *
% exp (-x^2-1.26551223
% +1.00002368 t
% +0.37409196 t^2
% +0.09678418 t^3
% -0.18628806 t^4
% +0.27886807 t^5
% -1.13520398 t^6
% +1.48851587 t^7
% -0.82215223 t^8
% +0.17087277 t^9)
% t = 1/(1+0.5 |x|)
% t is renamed to h when used with x/sqrt(2)=0.5 sqrt(2) x
% It turns out this syntax :
%
% \xintNewFloatExpr{\sn}[1]{subsn(1 - 0.5 * h * exp(
% -0.5*x^2 -1.26551223
% +1.00002368*h +0.37409196*h^2
% +0.09678418*h^3 -0.18628806*h^4
% +0.27886807*h^5 -1.13520398*h^6
% +1.48851587*h^7 -0.82215223*h^8
% +0.17087277*h^9), h= 1/(1+0.25*sqrt(2)*x); x = #1)}
%
% works but the computation of h is redone on each occurrence
% in the polynomial...
% This is more efficient
\xintdeffloatfunc snapprox(x,h) = 1 - 0.5 * h * exp(
-0.5*x^2 -1.26551223
+1.00002368*h +0.37409196*h^2
+0.09678418*h^3 -0.18628806*h^4
+0.27886807*h^5 -1.13520398*h^6
+1.48851587*h^7 -0.82215223*h^8
+0.17087277*h^9);
\xintNewFloatExpr{\sn}[1]{snapprox(#1, 1/(1+0.25*sqrt(2)*#1))}
% rounds to 6 fixed decimal places for final display,
% use package numprint for language specific formatting
% (replace with siunitx if preferred)
\NewDocumentCommand{\SN}{m}{\np{\xintRound{5}{\sn{#1}}}}
% alternatively \xintieval[5]{\foo{#1}} works too.
% Direct input \textbackslash sn\{0.61\} works:
% sn(0.61) = \SN{0.61}
% \def\x{0.61}
% Direct input \textbackslash sn\{\textbackslash x\} - works as well:
% sn(\x) = \SN{\x}
% one can automatize more... (would be needed for easily doing
% variants with other evaluation points)
\newcommand\myrow[1]{\np{#1}&\SN{#10}
&\SN{#11}
&\SN{#12}
&\SN{#13}
&\SN{#14}
&\SN{#15}
&\SN{#16}
&\SN{#17}
&\SN{#18}
&\SN{#19}}
\footnotesize
\noindent
\begingroup
%\xintSetDigits{8} would speed up things a bit by telling
% xint to compute only with 8 digits
\setlength{\tabcolsep}{2pt}% normal value is 6pt
% input mark-up should be automatized but well now it is done
\begin{tabular}{r|*{10}{l|}}
\multicolumn{1}{c|}{z}&
\multicolumn{1}{c|}{\np{0}}&
\multicolumn{1}{c|}{\np{0.01}}&
\multicolumn{1}{c|}{\np{0.02}}&
\multicolumn{1}{c|}{\np{0.03}}&
\multicolumn{1}{c|}{\np{0.04}}&
\multicolumn{1}{c|}{\np{0.05}}&
\multicolumn{1}{c|}{\np{0.06}}&
\multicolumn{1}{c|}{\np{0.07}}&
\multicolumn{1}{c|}{\np{0.08}}&
\multicolumn{1}{c|}{\np{0.09}}\\\hline
% there is surely a way to automatize this...
\myrow{0.0}\\
\myrow{0.1}\\
\myrow{0.2}\\
\myrow{0.3}\\
\myrow{0.4}\\
\myrow{0.5}\\
\myrow{0.6}\\
\myrow{0.7}\\
\myrow{0.8}\\
\myrow{0.9}\\\hline
\myrow{1.0}\\
\myrow{1.1}\\
\myrow{1.2}\\
\myrow{1.3}\\
\myrow{1.4}\\
\myrow{1.5}\\
\myrow{1.6}\\
\myrow{1.7}\\
\myrow{1.8}\\
\myrow{1.9}\\\hline
\myrow{2.0}\\
\myrow{2.1}\\
\myrow{2.2}\\
\myrow{2.3}\\
\myrow{2.4}\\
\myrow{2.5}\\
\myrow{2.6}\\
\myrow{2.7}\\
\myrow{2.8}\\
\myrow{2.9}\\\hline
\myrow{3.0}\\
\myrow{3.1}\\
\myrow{3.2}\\
\myrow{3.3}\\
\myrow{3.4}\\
\myrow{3.5}\\
\myrow{3.6}\\
\myrow{3.7}\\
\myrow{3.8}\\
\myrow{3.9}\\\hline
\myrow{4.0}%\\
% \myrow{4.1}\\
% \myrow{4.2}\\
% \myrow{4.3}\\
% \myrow{4.4}\\
% \myrow{4.5}\\
% \myrow{4.6}\\
% \myrow{4.7}\\
% \myrow{4.8}\\
% \myrow{4.9}
\end{tabular}
\endgroup
\end{document}
\documentclass[margin=5mm, varwidth]{standalone}
\usepackage{xintexpr}
\usepackage[ngerman]{babel}
\usepackage[autolanguage,np]{numprint}
\begin{document}
\section*{Standardnormalverteilungstabelle mit \texttt{xint}}
% https://de.wikipedia.org/wiki/Standardnormalverteilungstabelle#Fl%C3%A4cheninhalte_unter_dem_Graphen_der_Standardnormalverteilung
\[\Phi_{0,1}(z) = \frac1{\sqrt{2\pi}}\int_{-\infty}^z e^{-\frac12t^2\mathrm{d}t}\]
% sn = "standard normal"
% sn(x) = 0.5 + 0.5 erf(x/sqrt(2)))
% approximation to erf (error less than 1.2e-7):
% https://de.wikipedia.org/wiki/Fehlerfunktion#Numerische_Berechnung
% erf(x) \approx 1 - tau(x) for x>=0
% sn(x) \approx 1 - 0.5 tau(x/sqrt(2))
%
% tau (x) = t *
% exp (-x^2-1.26551223
% +1.00002368 t
% +0.37409196 t^2
% +0.09678418 t^3
% -0.18628806 t^4
% +0.27886807 t^5
% -1.13520398 t^6
% +1.48851587 t^7
% -0.82215223 t^8
% +0.17087277 t^9)
% t = 1/(1+0.5 |x|)
% t is renamed to h when used with x/sqrt(2)=0.5 sqrt(2) x
% It turns out this syntax :
%
% \xintNewFloatExpr{\sn}[1]{subsn(1 - 0.5 * h * exp(
% -0.5*x^2 -1.26551223
% +1.00002368*h +0.37409196*h^2
% +0.09678418*h^3 -0.18628806*h^4
% +0.27886807*h^5 -1.13520398*h^6
% +1.48851587*h^7 -0.82215223*h^8
% +0.17087277*h^9), h= 1/(1+0.25*sqrt(2)*x); x = #1)}
%
% works but the computation of h is redone on each occurrence
% in the polynomial...
% This is more efficient
\xintdeffloatfunc snapprox(x,h) = 1 - 0.5 * h * exp(
-0.5*x^2 -1.26551223
+1.00002368*h +0.37409196*h^2
+0.09678418*h^3 -0.18628806*h^4
+0.27886807*h^5 -1.13520398*h^6
+1.48851587*h^7 -0.82215223*h^8
+0.17087277*h^9);
\xintNewFloatExpr{\sn}[1]{snapprox(#1, 1/(1+0.25*sqrt(2)*#1))}
% rounds to 5 fixed decimal places for final display,
% use package numprint for language specific formatting
% (replace with siunitx if preferred)
\NewDocumentCommand{\SN}{m}{\np{\xintRound{5}{\sn{#1}}}}
% alternatively \xintieval[5]{\foo{#1}} works too.
% Direct input \textbackslash sn\{0.61\} works:
% sn(0.61) = \SN{0.61}
% \def\x{0.61}
% Direct input \textbackslash sn\{\textbackslash x\} - works as well:
% sn(\x) = \SN{\x}
% one can automatize more... (would be needed for easily doing
% variants with other evaluation points)
\newcommand\myrow[1]{\np{#1}&\SN{#10}
&\SN{#11}
&\SN{#12}
&\SN{#13}
&\SN{#14}
&\SN{#15}
&\SN{#16}
&\SN{#17}
&\SN{#18}
&\SN{#19}}
\footnotesize
\noindent
\begingroup
%\xintSetDigits{8} would speed up things a bit by telling
% xint to compute only with 8 digits
\setlength{\tabcolsep}{2pt}% normal value is 6pt
% input mark-up should be automatized but well now it is done
\begin{tabular}{r|*{10}{l|}}
\multicolumn{1}{c|}{z}&
\multicolumn{1}{c|}{\np{0}}&
\multicolumn{1}{c|}{\np{0.01}}&
\multicolumn{1}{c|}{\np{0.02}}&
\multicolumn{1}{c|}{\np{0.03}}&
\multicolumn{1}{c|}{\np{0.04}}&
\multicolumn{1}{c|}{\np{0.05}}&
\multicolumn{1}{c|}{\np{0.06}}&
\multicolumn{1}{c|}{\np{0.07}}&
\multicolumn{1}{c|}{\np{0.08}}&
\multicolumn{1}{c|}{\np{0.09}}\\\hline
% there is surely a way to automatize this...
\myrow{0.0}\\
\myrow{0.1}\\
\myrow{0.2}\\
\myrow{0.3}\\
\myrow{0.4}\\
\myrow{0.5}\\
\myrow{0.6}\\
\myrow{0.7}\\
\myrow{0.8}\\
\myrow{0.9}\\\hline
\myrow{1.0}\\
\myrow{1.1}\\
\myrow{1.2}\\
\myrow{1.3}\\
\myrow{1.4}\\
\myrow{1.5}\\
\myrow{1.6}\\
\myrow{1.7}\\
\myrow{1.8}\\
\myrow{1.9}\\\hline
\myrow{2.0}\\
\myrow{2.1}\\
\myrow{2.2}\\
\myrow{2.3}\\
\myrow{2.4}\\
\myrow{2.5}\\
\myrow{2.6}\\
\myrow{2.7}\\
\myrow{2.8}\\
\myrow{2.9}\\\hline
\myrow{3.0}\\
\myrow{3.1}\\
\myrow{3.2}\\
\myrow{3.3}\\
\myrow{3.4}\\
\myrow{3.5}\\
\myrow{3.6}\\
\myrow{3.7}\\
\myrow{3.8}\\
\myrow{3.9}\\\hline
\myrow{4.0}%\\
% \myrow{4.1}\\
% \myrow{4.2}\\
% \myrow{4.3}\\
% \myrow{4.4}\\
% \myrow{4.5}\\
% \myrow{4.6}\\
% \myrow{4.7}\\
% \myrow{4.8}\\
% \myrow{4.9}
\end{tabular}
\endgroup
\end{document}
Loading
Loading
lang-tex

