I want to draw two beta distributions comparing a prior and posterior distribution but it seems that the coefficients are too large for LaTeX? How do I fix it without changing the function? It has a few errors including Dimension too large and Number too big.
\documentclass[10pt]{article}
\usepackage{pgf,tikz}
\usetikzlibrary{arrows}
\pagestyle{empty}
\begin{document}
\definecolor{qqccqq}{rgb}{0,0.8,0}
\definecolor{qqttcc}{rgb}{0,0.2,0.8}
\begin{tikzpicture}[line cap=round,line join=round,>=triangle 45,x=8.333333333333332cm,y=1.0cm]
\draw[->,color=black] (-0.1,0) -- (1.1,0);
\foreach \x in {,0.2,0.4,0.6,0.8,1}
\draw[shift={(\x,0)},color=black] (0pt,2pt) -- (0pt,-2pt) node[below] {\footnotesize $\x$};
\draw[color=black] (1.04,0.04) node [anchor=south west] { $\theta$};
\draw[->,color=black] (0,-0.5) -- (0,5.5);
\foreach \y in {,1,2,3,4,5}
\draw[shift={(0,\y)},color=black] (2pt,0pt) -- (-2pt,0pt) node[left] {\footnotesize $\y$};
\draw[color=black] (0pt,-10pt) node[right] {\footnotesize $0$};
\clip(-0.1,-0.5) rectangle (1.1,5.5);
\draw[dash pattern=on 1pt off 1pt,color=qqttcc, smooth,samples=100,domain=8.000000000003847E-7:0.9999990727280006] plot(\x,{3682570000*(1-(\x))^(10.67)*(\x)^(21.49)});
\draw[color=qqccqq, smooth,samples=100,domain=8.000000000003847E-7:0.9999990727280006] plot(\x,{2120.93*(1-(\x))^(2.67)*(\x)^(9.49)});
\draw (0.49,4.17) node[anchor=north west] {$g(\theta|D)$};
\draw (0.89,3.23) node[anchor=north west] {$g(\theta)$};
\end{tikzpicture}
\end{document}



fixedpointarithmeticlibrary of thefpulibrary. Both come with tikz and both allow to rescale every value by some prescribed amount. Perhaps that fixes the problem after some trial and error. If not, you may have bad luck unless you rely on other non-tikz solutions. – Christian Feuersänger Apr 23 '13 at 20:07