TransWikia.com

How to plot the graph of sine and its inverse function in same coordinates?

TeX - LaTeX Asked on July 28, 2020

I a trying to plot this graph using tikz picture, but I am still failed to get. I don’t know what to do to plot this. I tried with this

documentclass[10pt]{article}
usepackage{pgf,tikz,pgfplots}
pgfplotsset{compat=1.15}
usepackage{mathrsfs}
usetikzlibrary{arrows}
pagestyle{empty}
begin{document}
definecolor{uuuuuu}{rgb}{0.26666666666666666,0.26666666666666666,0.26666666666666666}
begin{center}
    begin{tikzpicture}
    begin{axis}
    [width=2.3in,
    axis line style = thick,
    ymin=-1.2,ymax=1.2,
    xmin=-2.1,xmax=2.1,
    %clip=false,
    xtick=empty,
    ytick={-1,0,1},
    extra x ticks={3.14, 6.28},
    extra x tick labels={$pi$},
    every extra x tick/.style={
        xticklabel style={anchor=north west},
        %       grid=major,
        %       major grid style={dashed,black}
    },
    axis lines = center,
    xlabel=$x$,ylabel=$y$,
    domain=-.5*pi:.5*pi,
    samples=200,]
    addplot [black, thick] {sin(deg(x))};
    addplot [domain=-pi/2:pi/2, thick] {sin(x)};
%   addplot [domain=-1:1, black, thick]  {asin(x)};
    %addlegendentry{$y=arcsin(x)$};
    addplot [domain=-pi/2:pi/2, thick] {x};
    node at (axis cs:0.2, -0.22) {$O$} ;
    node at (axis cs:6.48,-0.28)   {$2pi$};
    node at (axis cs:-1.57,-0.29)   {$frac{-pi}{2}$};
    node at (axis cs:-3.55,-0.29)   {$-pi$};
    node at (axis cs:1.7,-0.29)   {$frac{pi}{2}$};
    node at (axis cs:-6.28,-0.29)   {$-2pi$};
    %   node at (axis cs:3.6,-0.9)   {$A$};
    %   node at (axis cs:5.8,-0.9)   {$B$};
    end{axis}
    end{tikzpicture}
 end{center}
end{document}

enter image description here

One Answer

so first, your figure seems wrong. This is definitely not a sin function, which only ossilates between -1 and 1.

what I belive you where trying to do, can be accomplished by this:

begin{tikzpicture}
begin{axis}[
        samples=500,
        xtick={-1.57,-1,0,1,1.57},
        xticklabels={$-pi/2$,-1,0,1,$pi/2$},
        axis line style = thick,
        axis lines = center,
    ]
    addplot [blue,domain=-pi/2:pi/2]{sin(deg(x))};
    addplot [red,domain=-1:1]{asin(x)/180*pi)};
    addplot [dashed,domain=-pi/2:pi/2]{x};
end{axis}
end{tikzpicture}

looks like this:

sin(x) and arcsin(x)

hope I could help you, Cube

Answered by Cube on July 28, 2020

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP