8

Updated:

I want a graph that drops vertically about 1/3 of the way across and 2/3 across. When I input this into Texmaker it has multiple errors including

Dimension too large
Package PGF Math Error: I cannot calculate the logarithm of '0,0' 
(in '{2(0,0)^(3/2)-3(0,0)+1.4}').

Even the standalone doesn't work, so is it a package problem?

MWE:

\documentclass[border=5pt]{standalone}
\usepackage{tikz}
\usetikzlibrary{arrows} 
\begin{document}
\begin{tikzpicture}[line cap=round,line join=round,>=triangle 45,x=4.34618291761148cm,y=4.205741626794257cm]
\draw[->,color=black] (-0.1,0) -- (1.97,0);
\foreach \x in {,1}
\draw[shift={(\x,0)},color=black] (0pt,2pt) -- (0pt,-2pt);
\draw[color=black] (1.81,0.02) node [anchor=south west] { Order Quantity};
\draw[->,color=black] (0,-0.14) -- (0,2);
\foreach \y in {,1}
\draw[shift={(0,\y)},color=black] (2pt,0pt) -- (-2pt,0pt);
\clip(-0.1,-0.14) rectangle (1.97,2);
\draw[dash pattern=on 2pt off 2pt, smooth,samples=100,domain=0.01:1.9707826086956564] plot(\x,{2*(\x)^(3/2)-3*(\x)+2});
\draw[dash pattern=on 2pt off 2pt, smooth,samples=100,domain=0.01:1.9707826086956564] plot(\x,{2*(\x)^(3/2)-3*(\x)+1.7});
\draw[dash pattern=on 2pt off 2pt, smooth,samples=100,domain=0.01:1.9707826086956564] plot(\x,{2*(\x)^(3/2)-3*(\x)+1.4});
\draw[line width=1.2pt, smooth,samples=100,domain=0.01:0.6666666666666666] plot(\x,{2*(\x)^(3/2)-3*(\x)+2});
\draw[line width=1.2pt, smooth,samples=100,domain=0.6666666666666666:1.3333333333333333] plot(\x,{2*(\x)^(3/2)-3*(\x)+1.7});
\draw[line width=1.2pt, smooth,samples=100,domain=1.3333333333333333:1.9707826086956564] plot(\x,{2*(\x)^(3/2)-3*(\x)+1.4});
\draw [line width=1.2pt] (0.67,1.09)-- (0.67,0.79);
\draw [line width=1.2pt] (1.33,0.78)-- (1.33,0.48);
\draw (1.01,0.03) node[anchor=north west] {$Q^*$};
\draw (-0.06,0.79) node[anchor=north west] {$C^*$};
\draw (0.01,1.99) node[anchor=north west] {Average Cost per Unit Time};
\end{tikzpicture}

\end{document}

1 Answer 1

8

This happens because the domain for the plots is set to start at 0, where the logarithm isn't defined. Just set the domains to start at 0.01 or some other small value:

\documentclass[border=5pt]{standalone}
\usepackage{tikz}
\usetikzlibrary{arrows} 
\begin{document}
\begin{tikzpicture}[line cap=round,line join=round,>=triangle 45,x=4.34618291761148cm,y=4.205741626794257cm]
\draw[->,color=black] (-0.1,0) -- (1.97,0);
\foreach \x in {,1}
\draw[shift={(\x,0)},color=black] (0pt,2pt) -- (0pt,-2pt);
\draw[color=black] (1.81,0.02) node [anchor=south west] { Order Quantity};
\draw[->,color=black] (0,-0.14) -- (0,2);
\foreach \y in {,1}
\draw[shift={(0,\y)},color=black] (2pt,0pt) -- (-2pt,0pt);
\clip(-0.1,-0.14) rectangle (1.97,2);
\draw[dash pattern=on 2pt off 2pt, smooth,samples=100,domain=0.01:1.9707826086956564] plot(\x,{2*(\x)^(3/2)-3*(\x)+2});
\draw[dash pattern=on 2pt off 2pt, smooth,samples=100,domain=0.01:1.9707826086956564] plot(\x,{2*(\x)^(3/2)-3*(\x)+1.7});
\draw[dash pattern=on 2pt off 2pt, smooth,samples=100,domain=0.01:1.9707826086956564] plot(\x,{2*(\x)^(3/2)-3*(\x)+1.4});
\draw[line width=1.2pt, smooth,samples=100,domain=0.01:0.6666666666666666] plot(\x,{2*(\x)^(3/2)-3*(\x)+2});
\draw[line width=1.2pt, smooth,samples=100,domain=0.6666666666666666:1.3333333333333333] plot(\x,{2*(\x)^(3/2)-3*(\x)+1.7});
\draw[line width=1.2pt, smooth,samples=100,domain=1.3333333333333333:1.9707826086956564] plot(\x,{2*(\x)^(3/2)-3*(\x)+1.4});
\draw [line width=1.2pt] (0.67,1.09)-- (0.67,0.79);
\draw [line width=1.2pt] (1.33,0.78)-- (1.33,0.48);
\draw (1.01,0.03) node[anchor=north west] {$Q^*$};
\draw (-0.06,0.79) node[anchor=north west] {$C^*$};
\draw (0.01,1.99) node[anchor=north west] {Average Cost per Unit Time};
\end{tikzpicture}
\end{document} 
5
  • For some reason, the answer you posted gives me the exact same problem. Says: Dimension too large. It references these lines: \draw[dash pattern=on 2pt off 2pt, smooth,samples=100,domain=0.01:1.9707826086956564] plot(\x,{2*(\x)^(3/2)-3*(\x)+2}); \draw[dash pattern=on 2pt off 2pt, smooth,samples=100,domain=0.01:1.9707826086956564] plot(\x,{2*(\x)^(3/2)-3*(\x)+1.7}); \draw[dash pattern=on 2pt off 2pt, smooth,samples=100,domain=0.01:1.9707826086956564] plot(\x,{2*(\x)^(3/2)-3*(\x)+1.4}); \draw[line width=1.2pt, smooth,samples=100,domain=0.01:0.6666666666666666] plot(\x,{2*(\x)^(3/2)-3*(\x)+2});
    – DannyBland
    Feb 12, 2013 at 14:42
  • Could you edit your question to include a full minimal example document (starting from \documentclass)?
    – Jake
    Feb 12, 2013 at 14:47
  • I tried using just the standalone that you posted and that had the same problem that it had when in my full document. I don't understand it since it obviously worked for you?
    – DannyBland
    Feb 12, 2013 at 17:50
  • @DannyBland: Ah yes, sorry, it works for me because I'm using the CVS version of TikZ, where a bug in the math library has been fixed. See tex.stackexchange.com/questions/31775/… for the fix
    – Jake
    Feb 12, 2013 at 17:55
  • @DannyBland: Your updated MWE works. I have TeXLive 12.
    – Sony
    Feb 12, 2013 at 18:10

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .