Graphics, Figures & TablesCosecant and Secant functions

Information and discussion about graphics, figures & tables in LaTeX documents.
Post Reply
coachbennett1981
Posts: 274
Joined: Fri Feb 05, 2010 10:15 pm

Cosecant and Secant functions

Post by coachbennett1981 »

Does anyone know code to plot these functions. I have tried the following and get a fail message for an output:

Code: Select all

\begin{pspicture}(11,-2)(-3.5,8)
\psaxes[labels=none,ticks=none,trigLabelBase=2,dx=\psPiH, xunit=\psPi,trigLabels,linewidth=1.5pt]{<->}(0,0)(-2,-3)(3,4)[$x$,0][$y$,90]
\psplot[linestyle=dashed,yMaxValue=4,linewidth=1.5pt,plotpoints=2000,linecolor=red]{-1.56}{1.56}{1/sin(x)} 
\psset{algebraic}
\end{pspicture}
I have changed the domain values in case there was a problem with the asymptotes. I also tried using.

Code: Select all

csc(x)
in place of 1/sin(x).


Here is the code for my document.

Code: Select all

\documentclass[12pt]{exam}
\usepackage{geometry}                % See geometry.pdf to learn the layout options. There are lots.
\geometry{letterpaper}                   % ... or a4paper or a5paper or ... 
%\geometry{landscape}                % Activate for for rotated page geometry
%\usepackage[parfill]{parskip}    % Activate to begin paragraphs with an empty line rather than an indent
\usepackage{graphicx}
\usepackage{amssymb}
\usepackage{multicol}
\usepackage{amsmath}
\usepackage{pst-plot}
\usepackage{pstricks-add}
\addpoints
\DeclareGraphicsRule{.tif}{png}{.png}{`convert #1 `dirname #1`/`basename #1 .tif`.png}
\pagestyle{headandfoot}
\firstpageheader{Section 4.6}{Precalculus}{Other Trig Functions}
\runningheader{Section 4.6}{Precalculus}{Other Trig Functions}
\firstpagefooter{}{}{}
\begin{document}
		\begin{pspicture}(11,-2)(-3.5,8)
\psaxes[labels=none,ticks=none,trigLabelBase=2,dx=\psPiH, xunit=\psPi,trigLabels,linewidth=1.5pt]{<->}(0,0)(-2,-3)(3,4)[$x$,0][$y$,90]
\psplot[linestyle=dashed,yMaxValue=4,linewidth=1.5pt,plotpoints=2000,linecolor=red]{-1.56}{1.56}{1/sin(x)} 
\psset{algebraic}
\end{pspicture}
\end{document}
Thank you for your time.

Nick
Last edited by coachbennett1981 on Fri Feb 25, 2011 4:10 pm, edited 2 times in total.

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

Learn LaTeX easily with newest books:

The LaTeX Beginner's Guide: 2nd edition and perfect for students writing a thesis

The LaTeX Cookbook: 2nd edition full of practical examples for mathematics, physics, chemistry, and more

LaTeX Graphics with TikZ: the first book about TikZ for perfect drawings in your LaTeX thesis

coachbennett1981
Posts: 274
Joined: Fri Feb 05, 2010 10:15 pm

Cosecant and Secant functions

Post by coachbennett1981 »

I used the following code:

Code: Select all

\begin{pspicture}(-0.5,-3)(6.5,4)
\psaxes[trigLabelBase=2,dx=\psPiH, xunit=\psPi,trigLabels]{->}(0,0)(-3,-3)(3.7,4)[$x$,0][$y$,90]
\psset{algebraic}
\psplot[linewidth=1.6pt,plotpoints=2000,linecolor=red,arrows=<->]{-8}{9.42}{sin(x)}
\psplot[linewidth=1.6pt,plotpoints=2000,linecolor=blue,arrows=<->]{-8}{9.42}{1/sin(x)}
\end{pspicture}
coachbennett1981
Posts: 274
Joined: Fri Feb 05, 2010 10:15 pm

Re: Cosecant and Secant functions

Post by coachbennett1981 »

is there a way to get rid of the asymptote lines?
Post Reply