円が直線である座標

  • こちらから
  • デカルト座標y=0の直線は、「その座標」ではy=0
  • y=xの直線は、y^2+x^2=1
  • y=axの直線は、(y-\frac{1}{a})^2+x^2=\frac{1}{a^2}とか…
  • 無限遠は、y=|x|上か…
  • こんな座標系はどんな座標系?
SphericalCoordinate<-function(x,y){
	if(x==0){list(x=x,y=0)}else{
		a<-y/x
		list(x=1/a*cos(atan(x)-pi/2),y=1/a*sin(atan(x)-pi/2)+1/a)
	}
}
Nrep<-10
xssum<-NULL
col<-c()
Niter<-100
ns<-1:Nrep
for(rep in 1:Nrep){
	n<-ns[rep]
	col<-c(col,rep(rep,Niter))
	x<-y<-seq(from=0,to=10,length.out=Niter)
	as<-runif(n)
	for(i in 1:length(x)){
		y[i]<-sum(as*x[i]^(1:(n)))

	}

	x2<-x
	y2<-y
	for(i in 1:length(x2)){
		tmp<-SphericalCoordinate(x[i],y[i])
		x2[i]<-tmp$x
		y2[i]<-tmp$y
	}



	tmp<-matrix(c(x2,y2),ncol=2)
	xssum<-rbind(xssum,tmp)
}

for(i in 1:Nrep){
	plot(xssum[((i-1)*Niter+1):(i*Niter),1],xssum[((i-1)*Niter+1):(i*Niter),2],col=i,type="l",xlim=c(0,max(xssum)),ylim=c(0,max(xssum)))
	par(new=TRUE)

}
abline(0,1)