諸概念の迷宮(Things got frantic)

歴史とは何か。それは「専有(occupation)=自由(liberty)」と「消費(demand)=生産(Supply)」と「実証主義(positivism)=権威主義(Authoritarianism)」「敵友主義=適応主義(Snobbism)」を巡る虚々実々の駆け引きの積み重ねではなかったか。その部分だけ抽出して並べると、一体どんな歴史観が浮かび上がってくるのか。はてさて全体像はどうなるやら。

【雑想】「暗殺教室」のアレ?

とりあえずrglライブラリの活用法を考えてる統計言語Rユーザーとしては、こういうの見掛けると脊髄反射的に動かして見たくなります。

f:id:ochimusha01:20191101212704g:plain

 統計言語Rによるプログラミング例

library(rgl)
p0 <- c(0,0,0)
temp <- c(0.5, -0.5)
p <- expand.grid(temp,temp,temp)

dist.p0 <- function(x) sum(x^2)
dist.p <- function(x, y){
sum*1
}

n <- 50
x <- seq(-0.5, 0.5, length = n)
x <- expand.grid(x,x,x)

p0.range <- function(x){
all(dist.p1(x) > dist.p0(x))
}

temp3 <- x[apply(x, 1, p0.range),]

nrow(temp3) / n^3 * 100 #何%の点が条件をみたしたか

p2 <- matrix(0, nrow=3, ncol=3)
diag(p2) <- 1
p2 <- rbind(p2, -p2)

dist.p2 <- function(y){
apply(p2, 1, function(x)dist.p(x, y))
}

 

posible.outer <- function(x){
epsiron <- 0.02
any(c(abs(dist.p1(x) - dist.p0(x)) < epsiron, abs(dist.p2(x) - dist.p0(x)) < epsiron))
}

temp4 <- temp3[apply(temp3, 1, posible.outer),]

col.calc <- function(x){
epsiron <- 0.02
t1 <- abs(dist.p1(x) - dist.p0(x)) < epsiron
t2 <- abs(dist.p2(x) - dist.p0(x)) < epsiron
sum(t1 * 1:8) + sum(t2 * 9:14)
}

col0 <- apply(temp4, 1, col.calc)

col1 <- rainbow(14)
col <- col1[col0]
col[is.na(col)] <- "#00000000"
plot3d(temp4, col=col)

#唯一の追加行(Gifアニメーションへの変換)

movie3d(spin3d(axis=c(0,0,1),rpm=5),duration=10,fps=25,movie="~/Desktop/test05")

とりあえず敬意を評して回して見ました。実行に要した時間は、私の型落ちMac book airで30秒ほど。具体的内容については時間が出来次第、吟味する予定です…

*1:x - y) ^ 2)
}
dist.p1 <- function(y){
apply(p, 1, function(x)dist.p(x, y