)%20%E3%82%92%E3%83%97%E3%83%AD%E3%83%83%E3%83%88%E3%81%99%E3%82%8B%E3%81%AB%E3%81%AF%E3%81%A9%E3%81%86%E3%81%99%E3%82%8C%E3%81%B0%E3%82%88%E3%81%84%E3%81%A7%E3%81%99%E3%81%8B%3F.png)
PGFplots を使用して、軸環境内で関数 arcsin(sin(x)) をプロットしたいと思います。得られた動作から、関数 arcsin と sin が他の何よりも先に互いに打ち消されて関数 x -> x が生成されると考えられますが、これは必ずしも適切な動作ではありません。
\documentclass{standalone}
\usepackage{tikz}
\usepackage{pgfplots}
\begin{document}
\begin{tikzpicture}[line cap=round,line join=round,x=1cm,y=1cm]
\begin{axis}[
x=1cm,y=1cm,
axis lines=middle,
ymajorgrids=true,
xmajorgrids=true,
xmin=-8.5,
xmax=8.5,
ymin=-6.5,
ymax=7.5,
xtick={-10,-9,...,10},
ytick={-7,-6,...,7},
]
\addplot[smooth,samples=100,domain=-8.5:8.5] (\x,{asin(sin(\x))});
\end{axis}
\end{tikzpicture}
\end{document}
これをどうやって解決するのでしょうか? 特に、非常に面倒になる可能性があるため、非常に多くのサブインターバルで関数を分割することを回避する方法を探しています。
答え1
@mickeo が言ったように、sin
関数のために最初に x を度に変換し、関数の後でラジアンに戻す必要がありますasin
。
\documentclass{standalone}
\usepackage{pgfplots}
\pgfplotsset{compat=1.18}
\begin{document}
\begin{tikzpicture}
\begin{axis}[
x=1cm,y=1cm,
axis lines=middle,
ymajorgrids=true,
xmajorgrids=true,
xmin=-8.5,
xmax=8.5,
ymin=-6.5,
ymax=7.5,
]
\addplot[green!50!black,very thick,smooth,samples=100,domain=-8.5:8.5] {asin(sin(deg(x)))*(pi/180)};
\end{axis}
\end{tikzpicture}
\end{document}