I have a function Zstart(n, l) that outputs a start number for certain combinations (n, l) (from which on the corresponding orbitals are filled).
Everything works, but question out of interest: Can this be implemented more easily (in pgfmath).
\documentclass[margin=5mm, varwidth]{standalone}
\usepackage{tikz}
\begin{document}
\tikzset{
declare function={
Zstart(\n,\l)=(%
\n==1 && \l==0 ? 1% 1s
: (\n==2 && \l==0 ? 3% 2s
: (\n==3 && \l==0 ? 11% 3s
: (\n==4 && \l==0 ? 19% 4s
: (\n==5 && \l==0 ? 37% 5s
: (\n==6 && \l==0 ? 55% 6s
: (\n==7 && \l==0 ? 87% 7s
: (\n==8 && \l==0 ? 119% 8s
: (\n==2 && \l==1 ? 5% 2p
: (\n==3 && \l==1 ? 13% 3p
% ....
: -1))))))) ))% ....
);
},
}
Examples:
\foreach \n/\l in {1/0, 4/0, 2/1, 55/66}{
Zstart(\n, \l) = \pgfmathprint{Zstart(\n, \l)} \\
}
\end{document}