LoginSignup
1
3

More than 5 years have passed since last update.

円は正n角形である。n = ?

Last updated at Posted at 2016-07-15

背景

周りの人に『円は正?角形』と聞いたら、『意味が分からない』と『ゼロ角形』と答える人は、ほぼ全員だ。本日、やっと『infinity』と答えてくれる人が出てきた。

正n角形

正n角形.png

答えは、『円は正$\infty$角形』

コード

plot.new()
plot.window( xlim = c(-1,1), ylim = c(-1,1) )

# 正三角形
x3 <- seq( -pi * 1.5, pi * 0.5, length = 4 )
# 正四角形
x4 <- seq( -pi * 1.5, pi * 0.5, length = 5 )
# 正五角形
x5 <- seq( -pi * 1.5, pi * 0.5, length = 6 )
# 正六角形
x6 <- seq( -pi * 1.5, pi * 0.5, length = 7 )
# 正八角形
x8 <- seq( -pi * 1.5, pi * 0.5, length = 9 )
# 正十六角形
x16 <- seq( -pi * 1.5, pi * 0.5, length = 17 )
# 正三十二角形
x32 <- seq( -pi * 1.5, pi * 0.5, length = 33 )
# 正六十四角形
x64 <- seq( -pi * 1.5, pi * 0.5, length = 65 )
# 正n角形
n <- 2^10 # 任意な数字
xn <- seq( -pi * 1.5, pi * 0.5, length = n+1 )

fname <- paste( "正n角形", ".png", sep="" )
png( file = fname, height = 800, width = 800 )
par( mfrow = c(3,3) )
plot( cos(x3), sin(x3), type = "l", xlab = "3", ylab = "" )
plot( cos(x4), sin(x4), type = "l", xlab = "4", ylab = "" )
plot( cos(x5), sin(x5), type = "l", xlab = "5", ylab = "" )
plot( cos(x6), sin(x6), type = "l", xlab = "6", ylab = "" )
plot( cos(x8), sin(x8), type = "l", xlab = "8", ylab = "" )
plot( cos(x16), sin(x16), type = "l", xlab = "16", ylab = "" )
plot( cos(x32), sin(x32), type = "l", xlab = "32", ylab = "" )
plot( cos(x64), sin(x64), type = "l", xlab = "64", ylab = "" )
plot( cos(xn), sin(xn), type = "l", xlab = "n", ylab = "" )
dev.off()
1
3
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
3