3

May I have the code for graphing each trigonometric function and its inverse on the same Cartesian plane? I have the following code for only graphing the sine function, and I got the following error: sorry, the supplied plot command is unknown by pgfplots. Please give me a web site for the syntax for the \begin{axis} command.

\documentclass{amsart}
\usepackage{pgfplots}
\begin{document}
\begin{tikzpicture}
\begin{axis}[grid=both,domain=-2*pi:2*pi,samples=200,no marks,
xticklabels={-2$\pi$,-1.5$\pi$,...$\pi$,2$\pi$},x post scale=1.5]
\addplot {sin(deg(x))};
\end{axis}
\end{tikzpicture}
\end{document}
2

Just for typing exercise.

\documentclass[border=15pt,pstricks]{standalone}
\usepackage{pst-math,pst-plot}

\def\f{sin(x)}
\def\finv{ASIN(x)}

\psset
{
    xtrigLabels,
    ytrigLabels,
    trigLabelBase=2,
    plotpoints=200,
}

\begin{document}
\makeatletter
\begin{pspicture}[algebraic](-\psPi,-\dimexpr\pstPI2 cm +\pstPI4 cm)(\dimexpr\psPiTwo cm +\pstPI2 cm,\dimexpr\pstPI2 cm +\pstPI4 cm)
    \psaxes[dx=\pstPI2,dy=\pstPI2]{->}(0,0)(-\psPi,-\dimexpr\pstPI2 cm +\pstPI4 cm)(\dimexpr\psPiTwo cm +\pstPI4 cm,\dimexpr\pstPI2 cm +\pstPI4 cm)[$x$,0][$y$,90]
    \psset{strokeopacity=.5}
    \psplot[linecolor=blue]{Pi 2 div neg}{TwoPi}{\f}
    \psplot[linecolor=red]{-1}{1}{\finv}
\end{pspicture}
\end{document}

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.