0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

【初心者向け】「観測者問題」のあっけない解決方法?

Last updated at Posted at 2020-11-08

所謂「観測者問題」については、私もこれまで色々頭を悩ませてきました。しかし実はプログラム的にはあっけない解決方法があったんです。
#均等尺(Even scale)の場合
原型
Rplot01.png

c0<-seq(0,pi*2,length=61)
cx<-cos(c0)
cy<-sin(c0)
plot(cx,cy,type="l",xlim=c(-1,1),asp=1,ylim=c(-1,1),main="Even Scale",xlab="Cos(θ)",ylab="Sin(θ)i",col=rgb(0,1,0))
par(new=T)
plot(cx*0.9,cy*0.9,type="l",xlim=c(-1,1),asp=1,ylim=c(-1,1),main="",xlab="",ylab="",col=c(200,200,200))
par(new=T)
plot(cx*0.8,cy*0.8,type="l",xlim=c(-1,1),asp=1,ylim=c(-1,1),main="",xlab="",ylab="",col=c(200,200,200))
par(new=T)
plot(cx*0.7,cy*0.7,type="l",xlim=c(-1,1),asp=1,ylim=c(-1,1),main="",xlab="",ylab="",col=c(200,200,200))
par(new=T)
plot(cx*0.6,cy*0.6,type="l",xlim=c(-1,1),asp=1,ylim=c(-1,1),main="",xlab="",ylab="",col=c(200,200,200))
par(new=T)
plot(cx*0.5,cy*0.5,type="l",xlim=c(-1,1),asp=1,ylim=c(-1,1),main="",xlab="",ylab="",col=c(200,200,200))
par(new=T)
plot(cx*0.4,cy*0.4,type="l",xlim=c(-1,1),asp=1,ylim=c(-1,1),main="",xlab="",ylab="",col=c(200,200,200))
par(new=T)
plot(cx*0.3,cy*0.3,type="l",xlim=c(-1,1),asp=1,ylim=c(-1,1),main="",xlab="",ylab="",col=c(200,200,200))
par(new=T)
plot(cx*0.2,cy*0.2,type="l",xlim=c(-1,1),asp=1,ylim=c(-1,1),main="",xlab="",ylab="",col=c(200,200,200))
par(new=T)
plot(cx*0.1,cy*0.1,type="l",xlim=c(-1,1),asp=1,ylim=c(-1,1),main="",xlab="",ylab="",col=c(200,200,200))
par(new=T)
plot(cx*1.9,cy*1.9,type="l",xlim=c(-1,1),asp=1,ylim=c(-1,1),main="",xlab="",ylab="",col=c(200,200,200))
par(new=T)
plot(cx*1.8,cy*1.8,type="l",xlim=c(-1,1),asp=1,ylim=c(-1,1),main="",xlab="",ylab="",col=c(200,200,200))
par(new=T)
plot(cx*1.7,cy*1.7,type="l",xlim=c(-1,1),asp=1,ylim=c(-1,1),main="",xlab="",ylab="",col=c(200,200,200))
par(new=T)
plot(cx*1.6,cy*1.6,type="l",xlim=c(-1,1),asp=1,ylim=c(-1,1),main="",xlab="",ylab="",col=c(200,200,200))
par(new=T)
plot(cx*1.5,cy*1.5,type="l",xlim=c(-1,1),asp=1,ylim=c(-1,1),main="",xlab="",ylab="",col=c(200,200,200))
par(new=T)
plot(cx*1.4,cy*1.4,type="l",xlim=c(-1,1),asp=1,ylim=c(-1,1),main="",xlab="",ylab="",col=c(200,200,200))
par(new=T)
plot(cx*1.3,cy*1.3,type="l",xlim=c(-1,1),asp=1,ylim=c(-1,1),main="",xlab="",ylab="",col=c(200,200,200))
par(new=T)
plot(cx*1.2,cy*1.2,type="l",xlim=c(-1,1),asp=1,ylim=c(-1,1),main="",xlab="",ylab="",col=c(200,200,200))
par(new=T)
plot(cx*1.1,cy*1.1,type="l",xlim=c(-1,1),asp=1,ylim=c(-1,1),main="",xlab="",ylab="",col=c(200,200,200))

abline(h=0,col=rgb(1,0,0))
abline(v=0,col=rgb(1,0,0))

# 凡例を書き添える 。
legend("topright", legend=c("y=Cos(θ)+Sin(θ)i","x=y=0"), lty =c(1,1),col=c(rgb(0,1,0),rgb(1,0,0)))

関数化(見た目は同じ)
Rplot03.png

even_scale00<-function(inbetween){
c0<-seq(0,pi*2,length=61)
cx<-cos(c0)
cy<-sin(c0)
plot(cx*(1.0+inbetween),cy*(1.0+inbetween),type="l",xlim=c(-1,1),asp=1,ylim=c(-1,1),main="Even Scale",xlab="Cos(θ)",ylab="Sin(θ)i",col=c(200,200,200))
par(new=T)
plot(cx,cy,type="l",xlim=c(-1,1),asp=1,ylim=c(-1,1),main="",xlab="Cos(θ)",ylab="",col=rgb(0,1,0))
par(new=T)
plot(cx*(0.9+inbetween),cy*(0.9+inbetween),type="l",xlim=c(-1,1),asp=1,ylim=c(-1,1),main="",xlab="",ylab="",col=c(200,200,200))
par(new=T)
plot(cx*(0.8+inbetween),cy*(0.8+inbetween),type="l",xlim=c(-1,1),asp=1,ylim=c(-1,1),main="",xlab="",ylab="",col=c(200,200,200))
par(new=T)
plot(cx*(0.7+inbetween),cy*(0.7+inbetween),type="l",xlim=c(-1,1),asp=1,ylim=c(-1,1),main="",xlab="",ylab="",col=c(200,200,200))
par(new=T)
plot(cx*(0.6+inbetween),cy*(0.6+inbetween),type="l",xlim=c(-1,1),asp=1,ylim=c(-1,1),main="",xlab="",ylab="",col=c(200,200,200))
par(new=T)
plot(cx*(0.5+inbetween),cy*(0.5+inbetween),type="l",xlim=c(-1,1),asp=1,ylim=c(-1,1),main="",xlab="",ylab="",col=c(200,200,200))
par(new=T)
plot(cx*(0.4+inbetween),cy*(0.4+inbetween),type="l",xlim=c(-1,1),asp=1,ylim=c(-1,1),main="",xlab="",ylab="",col=c(200,200,200))
par(new=T)
plot(cx*(0.3+inbetween),cy*(0.3+inbetween),type="l",xlim=c(-1,1),asp=1,ylim=c(-1,1),main="",xlab="",ylab="",col=c(200,200,200))
par(new=T)
plot(cx*(0.2+inbetween),cy*(0.2+inbetween),type="l",xlim=c(-1,1),asp=1,ylim=c(-1,1),main="",xlab="",ylab="",col=c(200,200,200))
par(new=T)
plot(cx*(0.1+inbetween),cy*(0.1+inbetween),type="l",xlim=c(-1,1),asp=1,ylim=c(-1,1),main="",xlab="",ylab="",col=c(200,200,200))
par(new=T)
plot(cx*(1.9+inbetween),cy*(1.9+inbetween),type="l",xlim=c(-1,1),asp=1,ylim=c(-1,1),main="",xlab="",ylab="",col=c(200,200,200))
par(new=T)
plot(cx*(1.8+inbetween),cy*(1.8+inbetween),type="l",xlim=c(-1,1),asp=1,ylim=c(-1,1),main="",xlab="",ylab="",col=c(200,200,200))
par(new=T)
plot(cx*(1.7+inbetween),cy*(1.7+inbetween),type="l",xlim=c(-1,1),asp=1,ylim=c(-1,1),main="",xlab="",ylab="",col=c(200,200,200))
par(new=T)
plot(cx*(1.6+inbetween),cy*(1.6+inbetween),type="l",xlim=c(-1,1),asp=1,ylim=c(-1,1),main="",xlab="",ylab="",col=c(200,200,200))
par(new=T)
plot(cx*(1.5+inbetween),cy*(1.5+inbetween),type="l",xlim=c(-1,1),asp=1,ylim=c(-1,1),main="",xlab="",ylab="",col=c(200,200,200))
par(new=T)
plot(cx*(1.4+inbetween),cy*(1.4+inbetween),type="l",xlim=c(-1,1),asp=1,ylim=c(-1,1),main="",xlab="",ylab="",col=c(200,200,200))
par(new=T)
plot(cx*(1.3+inbetween),cy*(1.3+inbetween),type="l",xlim=c(-1,1),asp=1,ylim=c(-1,1),main="",xlab="",ylab="",col=c(200,200,200))
par(new=T)
plot(cx*(1.2+inbetween),cy*(1.2+inbetween),type="l",xlim=c(-1,1),asp=1,ylim=c(-1,1),main="",xlab="",ylab="",col=c(200,200,200))
par(new=T)
plot(cx*(1.1+inbetween),cy*(1.1+inbetween),type="l",xlim=c(-1,1),asp=1,ylim=c(-1,1),main="",xlab="",ylab="",col=c(200,200,200))

abline(h=0,col=rgb(1,0,0))
abline(v=0,col=rgb(1,0,0))

# 凡例を書き添える 。
legend("topright", legend=c("y=Cos(θ)+Sin(θ)i","x=y=0"), lty =c(1,1),col=c(rgb(0,1,0),rgb(1,0,0)))
}

even_scale00(0)

アニメーション化(順方向、中割り二枚)
image.gif

#アニメーション
library("animation")
Time_Code=c(0,1/30,2/30,0,1/30,2/30,0,1/30,2/30,0,1/30,2/30)
saveGIF({
for (i in Time_Code){
 even_scale00(i)
}
}, interval = 0.1, movie.name = "even_scale00.gif")

アニメーション化(逆方向、中割り二枚)
image.gif

#アニメーション
library("animation")
Time_Code=c(0,2/30,1/30,0,2/30,1/30,0,2/30,1/30,0,2/30,1/30)
saveGIF({
for (i in Time_Code){
 even_scale00(i)
}
}, interval = 0.1, movie.name = "even_scale01.gif")

アニメーション化(どちらにも見える、中割り一枚)
image.gif

#アニメーション
library("animation")
Time_Code=c(0,1/20,0,1/20,0,1/20,0,1/20,0,1/20,0,1/20)
saveGIF({
for (i in Time_Code){
 even_scale00(i)
}
}, interval = 0.1, movie.name = "even_scale02.gif")

#対数尺(Logarithmic Scale)の場合
原型
Rplot04.png

c0<-seq(0,pi*2,length=61)
cx<-cos(c0)
cy<-sin(c0)
plot(cx*(1-exp(-1)),cy*(1-exp(-1)),type="l",xlim=c(-1,1),asp=1,ylim=c(-1,1),main="Logarithmic Scale",xlab="Cos(θ)",ylab="Sin(θ)i",col=c(200,200,200,200))
par(new=T)
plot(cx*(1-exp(-2)),cy*(1-exp(-2)),type="l",xlim=c(-1,1),asp=1,ylim=c(-1,1),main="",xlab="",ylab="",col=c(200,200,200,200))
par(new=T)
plot(cx*(1-exp(-3)),cy*(1-exp(-3)),type="l",xlim=c(-1,1),asp=1,ylim=c(-1,1),main="",xlab="",ylab="",col=c(200,200,200,200))
par(new=T)
plot(cx*(1-exp(-4)),cy*(1-exp(-4)),type="l",xlim=c(-1,1),asp=1,ylim=c(-1,1),main="",xlab="",ylab="",col=c(200,200,200,200))
par(new=T)
plot(cx*(1-exp(-5)),cy*(1-exp(-5)),type="l",xlim=c(-1,1),asp=1,ylim=c(-1,1),main="",xlab="",ylab="",col=c(200,200,200,200))
par(new=T)
plot(cx*(1-exp(-6)),cy*(1-exp(-6)),type="l",xlim=c(-1,1),asp=1,ylim=c(-1,1),main="",xlab="",ylab="",col=c(200,200,200,200))
par(new=T)
plot(cx*(1-exp(-7)),cy*(1-exp(-7)),type="l",xlim=c(-1,1),asp=1,ylim=c(-1,1),main="",xlab="",ylab="",col=c(200,200,200,200))
par(new=T)
plot(cx*(1-exp(-8)),cy*(1-exp(-8)),type="l",xlim=c(-1,1),asp=1,ylim=c(-1,1),main="",xlab="",ylab="",col=c(200,200,200,200))
par(new=T)
plot(cx*(1-exp(-9)),cy*(1-exp(-9)),type="l",xlim=c(-1,1),asp=1,ylim=c(-1,1),main="",xlab="",ylab="",col=c(200,200,200,200))
par(new=T)
plot(cx,cy,type="l",xlim=c(-1,1),asp=1,ylim=c(-1,1),main="",xlab="",ylab="", col=rgb(0,1,0))

abline(h=0,col=rgb(1,0,0))
abline(v=0,col=rgb(1,0,0))

# 凡例を書き添える 。
legend("topright", legend=c("y=Cos(θ)+Sin(θ)i","x=y=0"), lty =c(1,1),col=c(rgb(0,1,0),rgb(1,0,0)))

関数化(見た目は同じ)
Rplot05.png

logarithmic_scale00<-function(inbetween){
c0<-seq(0,pi*2,length=61)
cx<-cos(c0)
cy<-sin(c0)

c0<-rev(seq(-9,0,length=10))

for (i in c0){
plot(cx*(1-exp(i+inbetween)),cy*(1-exp(i+inbetween)),type="l",xlim=c(-1,1),asp=1,ylim=c(-1,1),main="",xlab="",ylab="",col=c(200,200,200,200))
par(new=T)
}

plot(cx,cy,type="l",xlim=c(-1,1),asp=1,ylim=c(-1,1),main="Logarithmic Scale",xlab="Cos(θ)",ylab="Sin(θ)i", col=rgb(0,1,0))

abline(h=0,col=rgb(1,0,0))
abline(v=0,col=rgb(1,0,0))

# 凡例を書き添える 。
legend("topright", legend=c("y=Cos(θ)+Sin(θ)i","x=y=0"), lty =c(1,1),col=c(rgb(0,1,0),rgb(1,0,0)))
}

logarithmic_scale00(0)

アニメーション化(順方向、中割り二枚)
image.gif

#アニメーション
library("animation")
Time_Code=c(0,2/3,1/3,0,2/3,1/3,0,2/3,1/3,0,2/3,1/3)
saveGIF({
for (i in Time_Code){
 logarithmic_scale00(i)
}
}, interval = 0.1, movie.name = "logarithmic_scale01.gif")

アニメーション化(逆方向、中割り二枚)
image.gif

#アニメーション
library("animation")
Time_Code=c(0,1/3,2/3,0,1/3,2/3,0,1/3,2/3,0,1/3,2/3)
saveGIF({
for (i in Time_Code){
 logarithmic_scale00(i)
}
}, interval = 0.1, movie.name = "logarithmic_scale00.gif")

アニメーション化(どちらにも見える、中割り一枚)
image.gif

#アニメーション
library("animation")
Time_Code=c(0,1/2,0,1/2,0,1/2,0,1/2,0,1/2,0,1/2)
saveGIF({
for (i in Time_Code){
 logarithmic_scale00(i)
}
}, interval = 0.1, movie.name = "logarithmic_scale02.gif")

#「シュレーディンガーの猫」は実在した?
まぁ、とりあえずこうやって「観測者」にも生死が特定出来ない猫自体は簡単に生み出せてしまうという話です。そんな感じで、以下続報…

0
0
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
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?