2020/03/31

円錐曲線(conic curve)の書き方

円錐曲線とは


出典: フリー百科事典『ウィキペディア(Wikipedia)

 円錐曲線(えんすいきょくせん、conic curve, conic section; 円錐断面)とは、円錐面を任意の平面で切断したときの断面としてえられる曲線群の総称である。


数式表現




(1){x=acosty=asint

楕円


(2){x=acosty=bsint

放物線


(3)y=ax2+bx+c

双曲線


(4){x=±acoshty=bsinht

書き方


 R言語での書き方は以下のとおり。



 条件: a=1 の時

1
2
3
4
5
6
7
8
9
t=seq(0, 2*pi, length=180)
a=1
x=a*cos(t)
y=a*sin(t)
svg("archimedes.svg", width=5, height=5)
plot(x, y, type="l", asp=1, lwd=2, col=2)
abline(h=0)
abline(v=0)
dev.off()

楕円


 条件: a=3,b=2 の時

1
2
3
4
5
6
7
8
9
10
t=seq(0, 2*pi, length=180)
a=3
b=2
x=a*cos(t)
y=b*sin(t)
svg("ellipse.svg", width=5, height=5)
plot(x, y, type="l", asp=1, lwd=2, col=2)
abline(h=0)
abline(v=0)
dev.off()

放物線


 条件: a=1,b=0,c=0 の時

1
2
3
4
5
6
7
8
a=1
b=0
c=0
svg("parabola.svg", width=5, height=5)
curve(a*x^2+b*x+c, -2, 2, asp=1, lwd=2, col=2)
abline(h=0)
abline(v=0)
dev.off()

双曲線


 条件: a=1,b=1 の時

1
2
3
4
5
6
7
8
9
10
11
12
a=1, b=1のとき
t=seq(-pi, pi, length=300)
a=b=1
x=a*cosh(t)
y=b*sinh(t)
svg("hyperbola.svg", width=5, height=5)
plot( x, y, type="l", asp=1, lwd=2, col=2, xlim=c(-15,15), ylim=c(-15,15), ann=F)
par(new=T)
plot(-x, y, type="l", asp=1, lwd=2, col=2, xlim=c(-15,15), ylim=c(-15,15))
abline(h=0)
abline(v=0)
dev.off()

0 件のコメント:

コメントを投稿

マンデルブロ集合の彩色方法(5)

06.knit 1 発散判定式を変更する mandelbrot() 内の発散判定式 |zn|>2 を変更する...