# Plot composite functions using tikz

I'm trying to plot something which I thought was very simple:

sin(ln(x))

But this exact line in my plot doesn't work:

\addplot[draw=red]{sin(deg(ln(x)))};


The error that I receive is:

Missing number, treated as zero.
<to be read again>
n
l.41 \addplot[draw=red]{sin(deg(ln(x)))};


Is there a simple solution?

• Could you edit your question to include a complete minimal example document that reproduces the error? At the moment, it's impossible to tell what the problem is. That code line looks fine.
– Jake
Apr 7 '16 at 20:03
• @Jake sorry I didn't include a complete example. Since plotting other functions worked, I assumed (wrongly) that the problem was in my syntax. The answer below got it right with the domain problem though. Thanks for commenting! Apr 7 '16 at 21:21

## 1 Answer

The default domain is -5 to 5, so you're likely trying to calculate the logarithm of negative numbers.

\documentclass{standalone}
\usepackage{pgfplots}
\begin{document}
\begin{tikzpicture}
\begin{axis}
\addplot[draw=red,domain=0.01:360,samples=1000]{sin(deg(ln(x)))};
\end{axis}
\end{tikzpicture}
\end{document}


• That's exactly the problem, but I was convinced that my syntax was wrong because it only failed when I put those functions together. Thank you so much for the solve! Apr 7 '16 at 21:18