I need to plot x, -x, x^2, -x^2, sin(1/x), x*sin(1/x), x^2*sin(1/x) and sin(1/x). But the functions containing sin(1/x) looks somehow bad. How can I fix it. I also do not know how to label the graphs (writing y=sin(1/x) next to the curve y=sin(1/x).
\documentclass{article}
\usepackage{pstricks-add}
\usepackage{pst-func}
\begin{document}
\begin{pspicture}*(-5,-2)(5,2)
\SpecialCoor % For label positionning
\psaxes[labels=y,Dx=\pstPI2]{->}(0,0)(-5,-2)(5,2)
\uput[-90](!PI 0){$\pi$} \uput[-90](!PI neg 0){$-\pi$} 5 \uput[-90](!PI 2 div 0){$\frac{\pi}2$}
\uput[-90](!PI 2 div neg 0){$-\frac{\pi}2$}
\psplot[linewidth=1.5pt,linecolor=blue,algebraic]{-5}{5}{sin(1/x)}
\psplot[linewidth=1.5pt,linecolor=red,algebraic]{-5}{5}{x*sin(1/x)}
\psplot[linewidth=1.5pt,linecolor=green,algebraic]{-5}{5}{x^2*sin(1/x)}
\psplot[algebraic,linestyle=dashed]{-5}{5}{x}
\psplot[algebraic,linestyle=dashed]{-5}{5}{-x}
\psplot[algebraic,linestyle=dashed]{-5}{5}{x^2}
\psplot[algebraic,linestyle=dashed]{-5}{5}{-x^2}
\end{pspicture}
\end{document}
Best Answer
I do not think that you get a better result with the current tools. The following uses always the same units for all functions:
If you want it similar to what Spivak had, then use different units for the different curves (from the mathematical view it is wrong):