I calc values of the Standard normal table (with 5-digit accuracy).
So I wrote a calculation with numerica.sty (using approximate values of the error function).
This
This works so far;
if I put in a concrete value like ... [..., x=0.61].
But I would like to have this as a macro, say \sn{<#1>}, for example \sn{0.61} → 0.72907. But I would like to have this as a macro, say \sn{<#1>}, for example \sn{0.61} → 0.72907.
I tried to put the whole thing into a newcommand, but this seems to be not that easy.
I'd like to implement this inside
What do I have to do?pdflatex, using a package (not Lua, Mathematica, etc.). I've implemented it here using the numerica package because it worked without problems (including the use of the help-variable h, see MWE). However, I'm not sure if numerica is the best choice. The xintexpr package seems promising, but I'm currently unclear on its syntax.
PS: I'd like to implement this inside pdflatex, using a package (not Lua, Mathematica, etc.). I've implemented it here using the numerica package because it worked without problems (including the use of the help-variable h, see MWE). However, I'm not sure if numerica is the best choice. The xintexpr package seems promising, but I'm currently unclear on its syntax.
In any case: if anyone knows of a better implementation using a different package (e.g., xint.sty), it would be nice too. In any case: if anyone knows of a better implementation using a different package (e.g., xint.sty), it would be nice too.
\documentclass[margin=10mm, varwidth]{standalone}
\usepackage{numerica}
\begin{document}
\section{Test with \texttt{numerica}}
\xdef\x{0.61}
sn(\x) = \eval*{%
0.5 (2-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=0.61% cannot use \x here :(
][5]
\section{Test with \texttt{xint}}
... ? ....
\end{document}

