Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

First: This post might not be appropirate for this site, so feel free to close it if necessary.

I have improved on the drawing by Thomas Söll from here and I thought someone might find it useful.

% 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}

output

The comments, labels, and macro names are Danish but changing them should be doable.

If you can improve further on the code, feel free to post your suggestion(s).

Usage

All you have to do is type \halveringer and give the number of halftimes as argument.

share|improve this question

closed as off-topic by David Carlisle, Svend Tveskæg, egreg, Werner, Scott H. Jun 28 '13 at 0:15

  • This question does not fall within the scope of TeX, LaTeX or related typesetting systems as defined in the help center.
If this question can be reworded to fit the rules in the help center, please edit the question.

1  
Why not become contributor at tex.blogoverflow:Topics-->PSTricks –  texenthusiast Jun 27 '13 at 22:58
    
Maybe a short mention of the changes you made could be useful. –  Laurent Jun 27 '13 at 22:59
5  
This appears to be off-topic because it is not a question –  David Carlisle Jun 27 '13 at 23:04
    
@texenthusiast Unfortunately, I'm nowhere near good enough at using PSTricks for that. –  Svend Tveskæg Jun 27 '13 at 23:05
1  
what kind of automation with more verbose description might help ? Nobody is good enough for anything until somebody pulls/streches to something :). –  texenthusiast Jun 27 '13 at 23:11

Browse other questions tagged or ask your own question.