# 共通のオプション設定
reset
# なめらかな曲線のために
set samples 500
# x軸 y軸を描く
set zeroaxis
# グリッド(格子)を描く
set grid
#
set xlabel "x"
#
set key sample 1
べき関数
$y = x^{-2}, \ x^{-1}, \ x^2, \ x^3$ のグラフ例。
set xtics 1
set ytics 2.5
plot [-5:5][-10:10] x**(-2) lw 2 title "x^{-2}", \
x**(-1) lw 2 title "x^{-1}", \
x**2 lw 2 title "x^2", \
x**3 lw 2 title "x^3"
$\displaystyle y = \sqrt{x}, \ \frac{1}{\sqrt{x}}$ のグラフ例。
set xtics 1
set ytics 1
plot [0:5][0:5] sqrt(x) lw 2 title "√x", \
1/sqrt(x) lw 2 title "1/√x"
… ということで,関数の分母がゼロになるような場合でも文句を言わずにグラフを描いてくれる。
指数関数
$y = e^{-x}, \ e^x$ のグラフ例。
set xtics 1
set ytics 5
plot [-5:5][0:30] exp(-x) lw 2 title "e^{-x}", \
exp(x) lw 2 title "e^x"
三角関数
$ y = \sin x, \ \cos x, \ \tan x $ のグラフ例。
set xtics ("-2π" -2*pi, "-3π/2" -1.5*pi, "-π" -pi, "-π/2" -0.5*pi, "0" 0, \
"2π" 2*pi, "3π/2" 1.5*pi, "π" pi, "π/2" 0.5*pi)
set ytics 1
plot [-2*pi:2*pi+0.2] [-5:5] sin(x) lw 2 title "sin x", \
cos(x) lw 2 title "cos x", \
tan(x) lw 2 title "tan x"
逆三角関数
$y = \sin^{-1} x = \arcsin x =$ asin(x)
の定義域は $-1 \leq x \leq 1$
$y = \cos^{-1} x = \arccos x =$ acos(x)
の定義域は $-1 \leq x \leq 1$
$y = \tan^{-1} x = \arctan x =$ atan(x)
の定義域は $-\infty < x < \infty$
set xtics 0.2
set ytics ("-π/2" -pi/2, "-π/4" -pi/4, "0" 0, "π/4" pi/4,\
"π/2" pi/2, "3π/4" 3*pi/4, "π" pi)
plot [-1:1] asin(x) lw 2 title "arcsin x", \
acos(x) lw 2 title "arccos x"
set xtics 10
set ytics ("-π/2" -pi/2, "-π/4" -pi/4, "0" 0, \
"π/4" pi/4, "π/2" pi/2)
set key top left
plot [-30:30] [-pi/2:pi/2] atan(x) lw 2 title "arctan x"
双曲線関数
$y = \sinh x, \ \cosh x, \ \tanh x$ のグラフ例。
set xtics 1
set ytics 20
set key right bottom
plot [-5:5][-50:50] sinh(x) lw 2 title "sinh x", \
cosh(x) lw 2 title "cosh x"
set xtics 1
set ytics 0.2
plot [-5:5] tanh(x) lw 2 title "tanh x"
逆双曲線関数
$ y = \sinh^{-1} x = \mbox{arsinh}\ x = $ asinh(x)
の定義域は $-\infty < x < \infty$
$ y = \cosh^{-1} x = \mbox{arcosh}\ x = $ acosh(x)
の定義域は $1 \leq x < \infty$
$ y = \tanh^{-1} x = \mbox{artanh}\ x = $ atanh(x)
の定義域は $-1 < x < 1$
set xtics 5
set ytics 1
set key top left
set xrange [-20:20]
plot sample \
[-20:20] asinh(x) lw 2 title "sinh^{-1} x" ,\
[1:20] acosh(x) lw 2 title "cosh^{-1} x"
set xtics 0.25
set ytics 2
set xrange [-1.05:1.05]
set yrange [-6:6]
plot sample [-0.99999:0.99999] atanh(x) lw 2 title "tanh^{-1} x"