1

I am attempting to create the following pgfplot of the functionenter image description here:

\documentclass[10pt, oneside]{article} 
    \usepackage{pgfplots}
    \pgfplotsset{width=10cm,compat=1.9}
    \begin{document}
    
        \begin{tikzpicture}[scale=0.75]
        \begin{axis}[
            axis lines = left,
            ymax=1,
            ymin=0,
             xlabel = \( x \),
             ylabel = {\( f(x) \)},
             xtick={0,1},
             xticklabels={$0$,$1$},
             ytick={0,1},
             yticklabels={$0$,$1$},
            ]
        \addplot[domain=0:1, samples = 500, color=red, style=very thick] {(2 / pi)*asin(sqrt(x)) };
        \end{axis}
        \end{tikzpicture}
    
    \end{document}

But the plot erroneously outputs as enter image description here

What is the reason for this, and what would the remedy be?

1 Answer 1

1

You probably erroneously assume that the trig functions are in radians by default.

\documentclass[tikz, border=1cm]{standalone} 
\usepackage{pgfplots}
\pgfplotsset{compat=1.18}
\begin{document}
\begin{tikzpicture}
\begin{axis}[
axis lines=left,
ymin=0, ymax=1,
xlabel=\(x\),
ylabel={\(f(x)\)},
xtick={0,1}, ytick={0,1},
trig format plots=rad,
]
\addplot[red, very thick, domain=0:1, samples=200, smooth] {(2/pi)*asin(sqrt(x))};
\end{axis}
\end{tikzpicture}
\end{document}

Graph with red curve

1
  • And that I have, many thanks. Jan 25 at 4:10

You must log in to answer this question.

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