0

I expected the following polar plot to generate something that looks like a parabola. It does not.

\documentclass[a4paper,11pt]{article}
\usepackage{array}
\usepackage{float}
\usepackage{tikz}
\usepackage{tikz}
\usepackage{Pgfplots}
\usepgfplotslibrary{polar}
% define the title
\title{A Math Problems}
\author{Robert~J.~Sherry}
\restylefloat{figure}
\begin{document}
\maketitle
\noindent
\newline
Here is a plot in polar coordinates.
\newline
\begin{tikzpicture}
\begin{polaraxis}
    \addplot+[mark=none,domain=0:360,samples=600] 
    {4*tan(x)*sec(x)}; 
% equivalent to (x,{sin(..)cos(..)}), i.e.
% the expression is the RADIUS
\end{polaraxis}
\end{tikzpicture}
\newline
\end{document}

The output as a .10e5 in it. Actually the 5 is raised like an exponent. I do not understand why. Is that a scaling factor?

In any case, what is generated does not look like a parabola to me. The function I am plotting should be r = 4tan(x) sec(x). In rectangular coordinates that function is 4y = x^2. What am I doing wrong?

3
  • 1
    It's just a very thin parabola. Try domain=0:80 and 81, and 82, ..., 89
    – Symbol 1
    Commented Sep 10, 2021 at 3:08
  • 2
    Use \begin{polaraxis}[ymax=10] to ignore anything beyond r=10 circle.
    – Symbol 1
    Commented Sep 10, 2021 at 3:10
  • Yes, the 10e5 is a scaling factor, you're dividing by zero when x=pi/2 and 3pi/2, so the function becomes a bit large when close to those values. Commented Sep 10, 2021 at 17:33

1 Answer 1

1

Here is an answer that works for me. I split the parabola up into two parts.

\documentclass[a4paper,11pt]{article}
\usepackage{array}
\usepackage{float}
\usepackage{tikz}
\usepackage{tikz}
\usepackage{Pgfplots}
\usepgfplotslibrary{polar}
% define the title
\title{A Math Problems}
\author{Robert~J.~Sherry}
\restylefloat{figure}
\begin{document}
\maketitle
\noindent
\newline
Here is a plot in polar coordinates.
\newline
\begin{tikzpicture}
\begin{polaraxis}
    \addplot+[mark=none,domain=0:85,samples=600,color=black] 
    {4*tan(x)*sec(x)}; 
    \addplot+[mark=none,domain=95:175,samples=600,color=black] 
    {4*tan(x)*sec(x)}; 
% equivalent to (x,{sin(..)cos(..)}), i.e.
% the expression is the RADIUS
\end{polaraxis}
\end{tikzpicture}
\newline
\end{document}

You must log in to answer this question.

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