首先:这篇文章可能不适合本网站,因此如有必要,请随意关闭它。
我改进了 Thomas Söll 的绘图这里我认为有人可能会觉得它有用。
% latex filename.tex
% dvips filename.dvi
% ps2pdf filename.ps
\documentclass[
a4paper,
dvipsnames
]{article}
\usepackage{lmodern}
\usepackage{amsmath}
\usepackage{
pst-grad,
pst-plot
}
\usepackage{xfrac}
\usepackage[
locale=DE
]{siunitx}
%%% Flydning af figurer %%%
\makeatletter
\providecommand*{\setfloatlocations}[2]{\@namedef{fps@#1}{#2}}
\makeatother
\setfloatlocations{figure}{htbp}
%%% LaTeX 3-syntaks %%%
\ExplSyntaxOn
\cs_new_eq:NN \calc \fp_eval:n
\ExplSyntaxOff
%%% Definitioner %%%
\def\radioaktivt{%
\psscalebox{0.0125}{%
\pscircle[
fillstyle=solid,
fillcolor=yellow,
linestyle=none
](0,0){5}
\pswedge*(0,0){5}{0}{60}
\pswedge*(0,0){5}{120}{180}
\pswedge*(0,0){5}{240}{300}
\pscircle*[
linecolor=yellow
](0,0){1.5}
\pscircle*(0,0){1}
}
}
\def\ikkeradioaktivt{%
\pscircle*[
linecolor=SeaGreen
](0,0){0.0625}
}
\def\henfald{rand 301 mod 50 div round 50 div }
\def\simpel#1{!#1 \henfald add \henfald \i\space 5 mul 16 div add 0.121 add }
\def\halveringerB{\calc{\Halveringer-1}}
\def\halveringerC{\calc{\Halveringer+1}}
\def\maerkerX{\calc{1.5*\i+0.75}}
\def\maerkerYa{\calc{10*2^(-\i)}}
\def\maerkerYb{\num{\calc{100*2^(-\i)}}}
\def\konstA{\calc{1.5*\i+0.25}}
\def\konstB{\calc{32*2^(-\i)}}
\def\konstC{\calc{32-\konstB}}
\def\konstD{\calc{1.5*\halveringerC+0.75}}
\def\konstE{\calc{\konstD-0.75}}
\def\konstF{\calc{\konstD+0.15}}
\newcommand*\halveringer[1]{%
\def\Halveringer{#1}
\centering
\begin{pspicture}(-1.7,-0.6)(\konstF,11.2)
\psframe[
linestyle=none,
fillstyle=gradient,
gradangle=45,
gradmidpoint=1,
gradbegin=gray!80,
gradend=gray!30
](0,0)(\konstE,10.25)
\multido{\i=0+1}{\halveringerC}{%
\psframe[
dimen=middel,
linecolor=NavyBlue,
linewidth=1pt,
fillstyle=gradient,
gradangle=90,
gradmidpoint=1,
gradbegin=NavyBlue!50,
gradend=white
](\konstA,0)(!\konstA\space 1 add \maerkerYa\space)
}
\multido{\i=0+1}{\halveringerC}{%
\psframe[
dimen=middel,
linecolor=NavyBlue,
linewidth=1pt,
fillstyle=gradient,
gradangle=90,
gradmidpoint=0,
gradbegin=SeaGreen!30,
gradend=white
](\konstA,10)(!\konstA\space 1 add \maerkerYa\space)
}
\multido{\i=0+1}{\halveringerC}{%
\rput(\konstA,0){%
\multido{\i=0+1}{\konstB}{%
\rput{!\henfald 777 mul}(\simpel{0.125}){\radioaktivt}
\rput{!\henfald 777 mul}(\simpel{0.375}){\radioaktivt}
\rput{!\henfald 777 mul}(\simpel{0.625}){\radioaktivt}
\rput{!\henfald 777 mul}(\simpel{0.875}){\radioaktivt}
}
}
\rput(\konstA,\maerkerYa){%
\multido{\i=0+1}{\konstC}{%
\rput(\simpel{0.125}){\ikkeradioaktivt}
\rput(\simpel{0.375}){\ikkeradioaktivt}
\rput(\simpel{0.625}){\ikkeradioaktivt}
\rput(\simpel{0.875}){\ikkeradioaktivt}
}
}
}
\psaxes[
ticks=none,
labels=none,
arrowinset=0.05,
arrowscale=1.6,
arrowlength=1.8
]{->}(0,0)(-0.3,-0.3)(\konstD,10.75)[$t$,0][Radioaktive atomer~(\si{\percent}),90]
\psplot[
algebraic,
linecolor=red,
linewidth=1.5pt
]{0.75}{\konstE}{10*0.5^(2*(x-0.75)/3)}
\psxTick(0.75){\text{start}}
\psxTick(2.25){T_{\sfrac{1}{2}}}
\multido{\i=2+1}{\halveringerB}{%
\psxTick(\maerkerX){\i\space \cdot T_{\sfrac{1}{2}}}
}
\multido{\i=2+1}{\halveringerB}{%
\psxTick(\maerkerX){\i\space \cdot T_{\sfrac{1}{2}}}
}
\multido{\i=0+1}{\halveringerC}{%
\psyTick(\maerkerYa){\maerkerYb}
}
\end{pspicture}
}
\pagestyle{empty}
\begin{document}
\begin{figure}
\halveringer{5}
\end{figure}
\end{document}
注释、标签和宏名称是丹麦语,但更改它们是可行的。
如果您可以进一步改进代码,请随时发表您的建议。
用法
您所要做的就是输入\halveringer
半程数并将其作为参数给出。