【トーラス構造と古典数学】式Cos(θ)+Sin(θ)(i)から式Cos(θ)+Cos(θ-π/NoS)(i)(NoS=Number of Sides)への「自然な」拡張について。

以下ではサラッとこう書いて済ましてしまいました。

[【Rで球面幾何学】何故「正方形」ではCos(θ)+Sin(θ)iが成立するのか？](https://qiita.com/ochimusha01/items/681a6f869f594075c3c2)
>回転する正多角形上で用いられる**三角関数**は<font color="red">辺ごとの区間でリセットされ、これが辺数だけ繰り返される</font>のが「**自明の場合**(<font color="blue">Trivial Case</font>)」である。

実際の証明は**ピタゴラスの定理**(<font color="blue">Pythagorean theorem</font>)あるいは**三平方の定理**(<font color="blue">Three-square theorem</font>)にまで遡ります。

[【初心者向け】ピタゴラスの定理あるいは三平方の定理からの出発](https://qiita.com/ochimusha01/items/4c7f731b0ef3cc998aa1)
![20190918061420.gif](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/597772/c7cb8211-2ac7-8acb-c35a-573af944e931.gif)
このアニメーションでは「<font color="red">大</font>」正方形に内接する「<font color="red">小</font>」正方形が回っていますが、この範囲において両者の辺長の推移は単位円上の<font color="green">Cos(θ)</font>と<font color="green">Sin(θ)</font>の相対関係で捉えられます。

- <font color="green">Cos(0)=1</font>の時に<font color="green">Sin(0)=0</font>、<font color="green">Sin(π/2)=1</font>の時に<font color="green">Cos(π/2)=0</font>
- <font color="green">Cos(π/4)=Sin(π/4)=sqrt(2)/2*2</font>。これは<font color="green">単位円に内接する正方形の1辺の長さ/2</font>に対応する。

これを用いて<font color="green">Cos(θ)</font>と<font color="green">Sin(θ)</font>の加算と乗算の結果を列記すると…

- <font color="green">Cos(θ)+Sin(θ)</font>の最小値は<font color="green">1</font>（<font color="blue">Cos(0)=1&Sin(0)=0もしくCos(π/2)=0&Sin(π/2)=1</font>）
- <font color="green">Cos(θ)+Sin(θ)</font>の最大値は<font color="green">1+sqrt(2)</font>（<font color="blue">最小値+sqrt(2)/2*2</font>）
- <font color="green">Cos(θ)*Sin(θ)</font>の最小値は<font color="green">0</font>（<font color="blue">Sin(0)=0もしくはCos(π/2)=0の時</font>）
- <font color="green">Cos(θ)*Sin(θ)</font>の最大値は<font color="green">0.5</font>（<font color="blue">sqrt(2)/2^2</font>）
- <font color="green">Cos(θ)^2+Sin(θ)^2</font>の結果は常に<font color="green">1</font>（<font color="blue">1+0~0.5+0.5~0+1</font>）

[【Rで球面幾何学】何故「正方形」ではCos(θ)+Sin(θ)iが成立するのか？](https://qiita.com/ochimusha01/items/681a6f869f594075c3c2)
![20191024192031.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/597772/17b8bb1d-3e93-2b6d-3b24-e63a67f7d74c.png)

そう、**式**<font color="green">Cos(θ)+Sin(θ)i</font>は円を描きますが、**式**<font color="green">Cos(θ)+Sin(θ)</font>は<font color="red">その多角形に外接/内接する同心円の増減比率</font>を表すのです。

<!-- html table generated in R 3.5.2 by xtable 1.8-4 package -->
<!-- Sat May  9 17:05:36 2020 -->
<table border=1>
<tr> <th>  </th> <th> Target_size </th> <th> Target_names </th> <th> Target_values </th>  </tr>
  <tr> <td align="right"> 1 </td> <td> 2^-1 </td> <td> 2^-1(2^-0.5r) </td> <td> 0.5 </td> </tr>
  <tr> <td align="right"> 2 </td> <td> 2^-1 </td> <td> 2^-1d=2^-1*4 </td> <td> 1 </td> </tr>
  <tr> <td align="right"> 3 </td> <td> 2^-1 </td> <td> 2^-1a1=2^0a0 </td> <td> sqrt(2)=1.414214 </td> </tr>
  <tr> <td align="right"> 4 </td> <td> 2^-1 </td> <td> 2^-1a1(2^-0.5a0)*4 </td> <td> 4sqrt(2)=5.656854 </td> </tr>
  <tr> <td align="right"> 5 </td> <td> 2^-0.5 </td> <td> 2^-0.5(2^0r) </td> <td> sqrt(2)/2=0.7071068 </td> </tr>
  <tr> <td align="right"> 6 </td> <td> 2^-0.5 </td> <td> 2^-0.5d=2^-0.5*4 </td> <td> sqrt(2)=1.414214 </td> </tr>
  <tr> <td align="right"> 7 </td> <td> 2^-0.5 </td> <td> 2^-0.5a1=2^0a0 </td> <td> 1 </td> </tr>
  <tr> <td align="right"> 8 </td> <td> 2^-0.5 </td> <td> 2^-1a1(2^0.5a0)*4 </td> <td> 4 </td> </tr>
  <tr> <td align="right"> 9 </td> <td> 2^0 </td> <td> 2^0(2^-0.5R,2^0.5r) </td> <td> 1 </td> </tr>
  <tr> <td align="right"> 10 </td> <td> 2^0 </td> <td> 2^0d=2^0*4 </td> <td> 2 </td> </tr>
  <tr> <td align="right"> 11 </td> <td> 2^0 </td> <td> 2^0a1=2^0.5a0 </td> <td> sqrt(8)=2sqrt(2)=2.828427 </td> </tr>
  <tr> <td align="right"> 12 </td> <td> 2^0 </td> <td> 2^0a1(2^0.5a0)*4 </td> <td> sqrt(32)=4sqrt(2)=5.656854 </td> </tr>
  <tr> <td align="right"> 13 </td> <td> 2^0.5 </td> <td> 2^0.5(2^-0R,2^1r) </td> <td> sqrt(2)=1.414214 </td> </tr>
  <tr> <td align="right"> 14 </td> <td> 2^0.5 </td> <td> 2^0.5d=2^0.5*4 </td> <td> 2sqrt(2)=2.828427 </td> </tr>
  <tr> <td align="right"> 15 </td> <td> 2^0.5 </td> <td> 2^0.5a1=2^1a0 </td> <td> 4 </td> </tr>
  <tr> <td align="right"> 16 </td> <td> 2^0.5 </td> <td> 2^0.5a1(2^0a0)*4 </td> <td> 8 </td> </tr>
  <tr> <td align="right"> 17 </td> <td> 2^1 </td> <td> 2^1(2^1-0.5R,2^0.5r) </td> <td> 2 </td> </tr>
   </table>

```R
target_size<-c("2^-1","2^-1","2^-1","2^-1","2^-0.5","2^-0.5","2^-0.5","2^-0.5","2^0","2^0","2^0","2^0","2^0.5","2^0.5","2^0.5","2^0.5","2^1")

target_names<-c("2^-1(2^-0.5r)","2^-1d=2^-1*4","2^-1a1=2^0a0","2^-1a1(2^-0.5a0)*4","2^-0.5(2^0r)","2^-0.5d=2^-0.5*4","2^-0.5a1=2^0a0","2^-1a1(2^0.5a0)*4","2^0(2^-0.5R,2^0.5r)","2^0d=2^0*4","2^0a1=2^0.5a0","2^0a1(2^0.5a0)*4","2^0.5(2^-0R,2^1r)","2^0.5d=2^0.5*4","2^0.5a1=2^1a0","2^0.5a1(2^0a0)*4","2^1(2^1-0.5R,2^0.5r)")

target_values<-c("0.5","1","sqrt(2)=1.414214","4sqrt(2)=5.656854","sqrt(2)/2=0.7071068","sqrt(2)=1.414214","1","4","1","2","sqrt(8)=2sqrt(2)=2.828427","sqrt(32)=4sqrt(2)=5.656854","sqrt(2)=1.414214","2sqrt(2)=2.828427","4","8","2")

Regula_falsi04<-data.frame(Target_size=target_size,Target_names=target_names,Target_values=target_values)
library(xtable)
print(xtable(Regula_falsi04), type = "html")
```

![20190919182043.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/597772/b4b8c5b9-6768-ce41-85e0-4ebeeadfe406.png)

```R
c0=seq(0,2*pi,length=9)
c1=c(sqrt(2),2,sqrt(2),2,sqrt(2),2,sqrt(2),2,sqrt(2))
c2=c(1,sqrt(2),1,sqrt(2),1,sqrt(2),1,sqrt(2),1)
c3=c(sqrt(2)/2,1,sqrt(2)/2,1,sqrt(2)/2,1,sqrt(2)/2,1,sqrt(2)/2)
plot(c0,c1,type="o",xlim=c(0,2*pi),ylim=c(sqrt(2)/2,2),main="Expected Multilayered Tori",ylab='x', xlab='y')
par(new=T) #上書き
plot(c0,c2,type="o",xlim=c(0,2*pi),ylim=c(sqrt(2)/2,2),main="",ylab='', xlab='')
par(new=T) #上書き
plot(c0,c3,type="o",xlim=c(0,2*pi),ylim=c(sqrt(2)/2,2),main="",ylab='', xlab='')
#外接円=内接円による境界線
abline(h=2,col=rgb(1,0,0))
abline(h=sqrt(2),col=rgb(0,1,0))
abline(h=1,col=rgb(0,0,1))
abline(h=1/sqrt(2),col=rgb(1,0,1))
abline(h=1/sqrt(2)^2,col=rgb(1,1,0))
#凡例
legend("bottomright", legend=c("Mj=2+Mn,Mn=√8/2","Mj=√2+Mn,Mn=(2-√2)/2","Mj=1+Mn,Mn=(√2-1)/2","Mj=√2/2+Mn,Mn=(1-√2/2)/2","Mj=1/2+Mn,Mn=(√2/2-1/2)/2"), lty=c(1,1,1,1,1), col=c(rgb(1,0,0),rgb(0,1,0),rgb(0,0,1),rgb(1,0,1),rgb(1,1,0))) 
```

![20190919155431.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/597772/19df26a6-1ca3-0e4c-7b71-00f470881e30.png)

```R
f0<-function(x){cos(x)+sin(x)}
plot(f0,xlim=c(0,pi/2),ylim=c(1,sqrt(2)),main="Expected Sampling results") 
```
![20190919145255.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/597772/0e1f9518-2745-56d9-89e2-261e979304d6.png)

```R
R_time=seq(0,2*pi,length=400)
Smp_time=seq(0,pi/2,length=100)

#標準円(半径1→sqrt(2))
f0<-function(x){cos(x)+cos(x-pi/2)}
S_data<-c(f0(Smp_time),f0(Smp_time),f0(Smp_time),f0(Smp_time))
plot(R_time,S_data,type="l",xlim=c(0,2*pi),ylim=c(0.5,2),main="Torus  drawn by circumscribed and inscribed circle",ylab='Circumference(radian)', xlab='Circle radius')
#半径sqrt(2)→2
par(new=T) #上書き
S_data<-c(f0(Smp_time)*sqrt(2),f0(Smp_time)*sqrt(2),f0(Smp_time)*sqrt(2),f0(Smp_time)*sqrt(2))
plot(R_time,S_data,type="l",xlim=c(0,2*pi),ylim=c(0.5,2),ylab='', xlab='')

#半径1→1/sqrt(2)
par(new=T) #上書き
S_data<-c(f0(Smp_time)/sqrt(2),f0(Smp_time)/sqrt(2),f0(Smp_time)/sqrt(2),f0(Smp_time)/sqrt(2))
plot(R_time,S_data,type="l",xlim=c(0,2*pi),ylim=c(0.5,2),ylab='', xlab='')

#半径1/sqrt(2)→1/2
par(new=T) #上書き
S_data<-c(f0(Smp_time)/sqrt(2)^2,f0(Smp_time)/sqrt(2)^2,f0(Smp_time)/sqrt(2)^2,f0(Smp_time)/sqrt(2)^2)
plot(R_time,S_data,type="l",xlim=c(0,2*pi),ylim=c(0.5,2),ylab='', xlab='')
#外接円=内接円による境界線
abline(h=2,col=rgb(1,0,0))
abline(h=sqrt(2),col=rgb(0,1,0))
abline(h=1,col=rgb(0,0,1))
abline(h=1/sqrt(2),col=rgb(1,0,1))
abline(h=1/sqrt(2)^2,col=rgb(1,1,0))
#凡例
legend("bottomright", legend=c("Mj=2+Mn,Mn=√8/2","Mj=√2+Mn,Mn=(2-√2)/2","Mj=1+Mn,Mn=(√2-1)/2","Mj=√2/2+Mn,Mn=(1-√2/2)/2","Mj=1/2+Mn,Mn=(√2/2-1/2)/2"), lty=c(1,1,1,1,1), col=c(rgb(1,0,0),rgb(0,1,0),rgb(0,0,1),rgb(1,0,1),rgb(1,1,0))) 
```
実はこの様な**内接多角形/外接多角形の関係**は**正三角形**(<font color="blue">Equilateral Triangle</font>)にも見て取れます。

![20190919074352.gif](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/597772/9ffbc521-ec9d-7c10-5abf-f5be30780267.gif)

```R
Three_square_theorem03<-function(x){
c0<-c(0,2/3*pi,-2/3*pi,0)
c0_cos<-cos(c0)
c0_sin<-sin(c0)
plot(c0_cos,c0_sin,type="l",xlim=c(-1,1),ylim=c(-1,1),main="Regular polygon rotation",xlab="Cos(θ)",ylab="Sin(θ)")
text(c0_cos,c0_sin, labels=c("a","b","c",""),col=c(rgb(1,0,0),rgb(1,0,0),rgb(1,0,0),rgb(1,0,0)),cex=c(2,2,2,2))
line_scale_01_cos<-seq(cos(c0[1]),cos(c0[2]),length=15)
line_scale_01_sin<-seq(sin(c0[1]),sin(c0[2]),length=15)
line_scale_02_cos<-seq(cos(c0[2]),cos(c0[3]),length=15)
line_scale_02_sin<-seq(sin(c0[2]),sin(c0[3]),length=15)
line_scale_03_cos<-seq(cos(c0[3]),cos(c0[1]),length=15)
line_scale_03_sin<-seq(sin(c0[3]),sin(c0[1]),length=15)
text(c(line_scale_01_cos[x],line_scale_02_cos[x],line_scale_03_cos[x]),c(line_scale_01_sin[x],line_scale_02_sin[x],line_scale_03_sin[x]), labels=c("ab","bc","ca"),col=c(rgb(0,0,1),rgb(0,0,1),rgb(0,0,1)),cex=c(2,2,2))

#塗りつぶし
polygon(c(c0_cos[1],line_scale_03_cos[x],line_scale_01_cos[x],c0_cos[1]), #x
c(c0_sin[1],line_scale_03_sin[x],line_scale_01_sin[x],c0_sin[1]), #y
density=c(30), #塗りつぶす濃度
angle=c(45),　 　　　#塗りつぶす斜線の角度
col=rgb(0,1,0)) 　 

#塗りつぶし
polygon(c(c0_cos[2],line_scale_01_cos[x],line_scale_02_cos[x],c0_cos[2]), #x
c(c0_sin[2],line_scale_01_sin[x],line_scale_02_sin[x],c0_sin[2]), #y
density=c(30), #塗りつぶす濃度
angle=c(45),　 　　　#塗りつぶす斜線の角度
col=rgb(0,1,0)) 　 

#塗りつぶし
polygon(c(c0_cos[3],line_scale_02_cos[x],line_scale_03_cos[x],c0_cos[3]), #x
c(c0_sin[3],line_scale_02_sin[x],line_scale_03_sin[x],c0_sin[3]), #y
density=c(30), #塗りつぶす濃度
angle=c(45),　 　　　#塗りつぶす斜線の角度
col=rgb(0,1,0)) 　

}

#アニメーション
library("animation")
Time_Code=c(1,2,3,4,5,6,7,8,9,10,11,12,13,14,15)
saveGIF({
for (i in Time_Code){
　Three_square_theorem03(i)
}
}, interval = 0.1, movie.name = "TEST003.gif") 
```

実際、**単位円**（<font color="blue">Unit Circle</font>）上に同心円を描く任意の正三角形内で正三角形を回すと、その片長の比は<font color="green">2:2</font>と<font color="green">1:2</font>の間を反復し続けます。そしてその比は多層化された**内接円と外接円の半径比の推移**に等しいのです。

<!-- Sat May  9 16:53:13 2020 -->
<table border=1>
<tr> <th>  </th> <th> Target_size </th> <th> Target_names </th> <th> Target_values </th>  </tr>
  <tr> <td align="right"> 1 </td> <td> 3^-1 </td> <td> 3^-1(3^0r) </td> <td> 1/2=0.5 </td> </tr>
  <tr> <td align="right"> 2 </td> <td> 3^-1 </td> <td> 3^-1h=3^-1*3 </td> <td> 3/2=1.5 </td> </tr>
  <tr> <td align="right"> 3 </td> <td> 3^-1 </td> <td> 3^-1a1=3^0a0 </td> <td> 2*sqrt(1.5)=2.44949 </td> </tr>
  <tr> <td align="right"> 4 </td> <td> 3^-1 </td> <td> 3^-1a1(3^0a0)*3 </td> <td> 6*sqrt(1.5)=7.348469 </td> </tr>
  <tr> <td align="right"> 5 </td> <td> 3^0 </td> <td> 3^0(3^-1R,3^1r) </td> <td> 1.0 </td> </tr>
  <tr> <td align="right"> 6 </td> <td> 3^0 </td> <td> 3^0h=3^0*3 </td> <td> 3.0 </td> </tr>
  <tr> <td align="right"> 7 </td> <td> 3^0 </td> <td> 3^0a1=3^1a0 </td> <td> 2*sqrt(3)=3.464102 </td> </tr>
  <tr> <td align="right"> 8 </td> <td> 3^0 </td> <td> 3^0a1(3^1a0)*3 </td> <td> 6*sqrt(3)=10.3923 </td> </tr>
  <tr> <td align="right"> 9 </td> <td> 3^1 </td> <td> 3^1(3^0R) </td> <td> 3.0 </td> </tr>
   </table>

```R
target_size<-c("3^-1","3^-1","3^-1","3^-1","3^0","3^0","3^0","3^0","3^1")

target_names<-c("3^-1(3^0r)","3^-1h=3^-1*3","3^-1a1=3^0a0","3^-1a1(3^0a0)*3","3^0(3^-1R,3^1r)","3^0h=3^0*3","3^0a1=3^1a0","3^0a1(3^1a0)*3","3^1(3^0R)")

target_values<-c("1/2=0.5","3/2=1.5","2*sqrt(1.5)=2.44949","6*sqrt(1.5)=7.348469","1.0","3.0","2*sqrt(3)=3.464102","6*sqrt(3)=10.3923","3.0")

Regula_falsi03<-data.frame(Target_size=target_size,Target_names=target_names,Target_values=target_values)
library(xtable)
print(xtable(Regula_falsi03), type = "html")
```
![20190919182420.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/597772/8d177752-0c13-76bf-a34c-7e3783dd160c.png)

```R
c0=seq(0,2*pi,length=7)
c1=c(2,4,2,4,2,4,2)
c2=c(1,2,1,2,1,2,1)
c3=c(1/2,1,1/2,1,1/2,1,1/2)
plot(c0,c1,type="o",xlim=c(0,2*pi),ylim=c(1/2,4),ylab='x', xlab='y')
par(new=T) #上書き
plot(c0,c2,type="o",xlim=c(0,2*pi),ylim=c(1/2,4),ylab='', xlab='')
par(new=T) #上書き
plot(c0,c3,type="o",xlim=c(0,2*pi),ylim=c(1/2,4), main="Expected Multilayered Tori", ylab='', xlab='')
#外接円=内接円による境界線
abline(h=2,col=rgb(1,0,0))
abline(h=1,col=rgb(0,1,0))
abline(h=0.5,col=rgb(0,0,1))
#凡例
legend("bottomright", legend=c("Mj=2+Mn,Mn=1","Mj=1+Mn,Mn=1/2","Mj=1/2+Mn,Mn=1/4"), lty=c(1,1,1), col=c(rgb(1,0,0),rgb(0,1,0),rgb(0,0,1))) 
```
![20190919181530.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/597772/72d934cf-d6d7-7695-42e2-c376d1bd76e8.png)

```R
R_time=seq(0,2*pi,length=300)
Smp_time=seq(0,2/3*pi,length=100)

#標準円(半径0.5→1)
f0<-function(x){cos(x-1/3*pi)}
S_data<-c(f0(Smp_time),f0(Smp_time),f0(Smp_time))
plot(R_time,S_data,type="l",xlim=c(0,2*pi),ylim=c(0.5,4),main="Torus  drawn by circumscribed and inscribed circle",ylab='Circumference(radian)', xlab='Circle radius')
#半径1→2
par(new=T) #上書き
S_data<-c(f0(Smp_time)*2,f0(Smp_time)*2,f0(Smp_time)*2)
plot(R_time,S_data,type="l",xlim=c(0,2*pi),ylim=c(0.5,4),ylab='', xlab='')

#半径2→4)
par(new=T) #上書き
S_data<-c(f0(Smp_time)*4,f0(Smp_time)*4,f0(Smp_time)*4)
plot(R_time,S_data,type="l",xlim=c(0,2*pi),ylim=c(0.5,4),ylab='', xlab='')
#外接円=内接円による境界線
abline(h=2,col=rgb(1,0,0))
abline(h=1,col=rgb(0,1,0))
abline(h=0.5,col=rgb(0,0,1))
#凡例
legend("bottomright", legend=c("Mj=2+Mn,Mn=1","Mj=1+Mn,Mn=1/2","Mj=1/2+Mn,Mn=1/4"), lty=c(1,1,1), col=c(rgb(1,0,0),rgb(0,1,0),rgb(0,0,1))) 
```
ただし正三角形の内接/外接関係においてはもはやその繰り返しが<font color="green">Cos(θ)とSin(θ)の相関関係</font>で説明出来ません。それは**正五角形以上**でも同じ事で、しかもかかる連続性自体がもはや観測されないのです。

![20190918203214.gif](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/597772/e906bf3b-a3d8-95a1-0fcf-13f25835912b.gif)

```R
Three_square_theorem05<-function(x){
c0<-seq(0,2*pi,length=6)
c0_cos<-cos(c0)
c0_sin<-sin(c0)
plot(c0_cos,c0_sin,type="l",main="Regular polygon rotation",xlab="Cos(θ)",ylab="Sin(θ)")
text(c0_cos,c0_sin, labels=c("a","b","c","d","e",""),col=c(rgb(1,0,0),rgb(1,0,0),rgb(1,0,0),rgb(1,0,0),rgb(1,0,0),rgb(1,0,0)),cex=c(2,2,2,2,2,2))
line_scale_01_cos<-seq(cos(c0[1]),cos(c0[2]),length=15)
line_scale_01_sin<-seq(sin(c0[1]),sin(c0[2]),length=15)
line_scale_02_cos<-seq(cos(c0[2]),cos(c0[3]),length=15)
line_scale_02_sin<-seq(sin(c0[2]),sin(c0[3]),length=15)
line_scale_03_cos<-seq(cos(c0[3]),cos(c0[4]),length=15)
line_scale_03_sin<-seq(sin(c0[3]),sin(c0[4]),length=15)
line_scale_04_cos<-seq(cos(c0[4]),cos(c0[5]),length=15)
line_scale_04_sin<-seq(sin(c0[4]),sin(c0[5]),length=15)
line_scale_05_cos<-seq(cos(c0[5]),cos(c0[1]),length=15)
line_scale_05_sin<-seq(sin(c0[5]),sin(c0[1]),length=15)
text(c(line_scale_01_cos[x],line_scale_02_cos[x],line_scale_03_cos[x],line_scale_04_cos[x],line_scale_05_cos[x]),c(line_scale_01_sin[x],line_scale_02_sin[x],line_scale_03_sin[x],line_scale_04_sin[x],line_scale_05_sin[x]), labels=c("ab","bc","cd","de","ea",""),col=c(rgb(0,0,1),rgb(0,0,1),rgb(0,0,1),rgb(0,0,1),rgb(0,0,1),rgb(0,0,1)),cex=c(2,2,2,2,2,2))

#塗りつぶし
polygon(c(c0_cos[1],line_scale_05_cos[x],line_scale_01_cos[x],c0_cos[1]), #x
c(c0_sin[1],line_scale_05_sin[x],line_scale_01_sin[x],c0_sin[1]), #y
density=c(30), #塗りつぶす濃度
angle=c(45),　 　　　#塗りつぶす斜線の角度
col=rgb(0,1,0)) 　 

#塗りつぶし
polygon(c(c0_cos[2],line_scale_01_cos[x],line_scale_02_cos[x],c0_cos[2]), #x
c(c0_sin[2],line_scale_01_sin[x],line_scale_02_sin[x],c0_sin[2]), #y
density=c(30), #塗りつぶす濃度
angle=c(45),　 　　　#塗りつぶす斜線の角度
col=rgb(0,1,0)) 　 

#塗りつぶし
polygon(c(c0_cos[3],line_scale_02_cos[x],line_scale_03_cos[x],c0_cos[3]), #x
c(c0_sin[3],line_scale_02_sin[x],line_scale_03_sin[x],c0_sin[3]), #y
density=c(30), #塗りつぶす濃度
angle=c(45),　 　　　#塗りつぶす斜線の角度
col=rgb(0,1,0)) 　

#塗りつぶし
polygon(c(c0_cos[4],line_scale_03_cos[x],line_scale_04_cos[x],c0_cos[4]), #x
c(c0_sin[4],line_scale_03_sin[x],line_scale_04_sin[x],c0_sin[4]), #y
density=c(30), #塗りつぶす濃度
angle=c(45),　 　　　#塗りつぶす斜線の角度
col=rgb(0,1,0)) 　

#塗りつぶし
polygon(c(c0_cos[5],line_scale_04_cos[x],line_scale_05_cos[x],c0_cos[5]), #x
c(c0_sin[5],line_scale_04_sin[x],line_scale_05_sin[x],c0_sin[5]), #y
density=c(30), #塗りつぶす濃度
angle=c(45),　 　　　#塗りつぶす斜線の角度
col=rgb(0,1,0)) 　

}

#アニメーション
library("animation")
Time_Code=c(1,2,3,4,5,6,7,8,9,10,11,12,13,14,15)
saveGIF({
for (i in Time_Code){
　Three_square_theorem05(i)
}
}, interval = 0.1, movie.name = "TEST005.gif") 
```
<!-- html table generated in R 3.5.2 by xtable 1.8-4 package -->
<!-- Sat May  9 15:33:06 2020 -->
<table border=1>
<tr> <th>  </th> <th> Target_size </th> <th> Target_names </th> <th> Target_values </th>  </tr>
  <tr> <td align="right"> 1 </td> <td> 5^-1 </td> <td> 5^-1 </td> <td> 1/5=0.2 </td> </tr>
  <tr> <td align="right"> 2 </td> <td> 5^-1 </td> <td> 5^-1d </td> <td> (1+sqrt(5))/2*0.2=0.3236068 </td> </tr>
  <tr> <td align="right"> 3 </td> <td> 5^-1 </td> <td> 5^-1a1 </td> <td> 0.2*1.796112=0.3592224 </td> </tr>
  <tr> <td align="right"> 4 </td> <td> 5^-1 </td> <td> 5^-1a1*5 </td> <td> 0.3592224*5=1.796112 </td> </tr>
  <tr> <td align="right"> 5 </td> <td> 5^-0.2722623 </td> <td> 5^-0.2722623 </td> <td> 0.3592224*1.796112=-0.2722623 </td> </tr>
  <tr> <td align="right"> 6 </td> <td> ... </td> <td> ... </td> <td> ... </td> </tr>
  <tr> <td align="right"> 7 </td> <td> 5^-0.131683 </td> <td> 5^-0.131683 </td> <td> 0.8090168 </td> </tr>
  <tr> <td align="right"> 8 </td> <td> 5^0 </td> <td> 5^0a0 </td> <td> 1/1.453085=0.688191 </td> </tr>
  <tr> <td align="right"> 9 </td> <td> 5^0 </td> <td> 5^0a0*5 </td> <td> 0.5567581*5=3.440955 </td> </tr>
  <tr> <td align="right"> 10 </td> <td> 5^0 </td> <td> 5^0=1 </td> <td> 1.0 </td> </tr>
  <tr> <td align="right"> 11 </td> <td> 5^0 </td> <td> 5^0d </td> <td> (1+sqrt(5))/2=1.618034 </td> </tr>
  <tr> <td align="right"> 12 </td> <td> 5^0 </td> <td> 5^0a1 </td> <td> 1.796112 </td> </tr>
  <tr> <td align="right"> 13 </td> <td> 5^0 </td> <td> 5^0a1*5 </td> <td> 1.796112*5=8.98056 </td> </tr>
  <tr> <td align="right"> 14 </td> <td> 5^0.1316829 </td> <td> 5^0.7277376 </td> <td> 1.796112*1.796112=3.226018 </td> </tr>
  <tr> <td align="right"> 15 </td> <td> ... </td> <td> ... </td> <td> ... </td> </tr>
  <tr> <td align="right"> 16 </td> <td> 5^0.535628 </td> <td> 5^0.535628 </td> <td> 3.440955*1.453085=2.368034 </td> </tr>
  <tr> <td align="right"> 17 </td> <td> 5^1 </td> <td> 5^0a1 </td> <td> 5/1.453085=3.440955 </td> </tr>
  <tr> <td align="right"> 18 </td> <td> 5^1 </td> <td> 5^0a1*5 </td> <td> 3.440955*5=17.20478 </td> </tr>
  <tr> <td align="right"> 19 </td> <td> 5^1 </td> <td> 5^1 </td> <td> 5 </td> </tr>
  <tr> <td align="right"> 20 </td> <td> 5^1 </td> <td> 5^1d </td> <td> ((1+sqrt(5))/2)*5=8.09017 </td> </tr>
   </table>

```R
target_size<-c("5^-1","5^-1","5^-1","5^-1","5^-0.2722623","...","5^-0.131683","5^0","5^0","5^0","5^0","5^0","5^0","5^0.1316829","...","5^0.535628","5^1","5^1","5^1","5^1")

target_names<-c("5^-1","5^-1d","5^-1a1","5^-1a1*5","5^-0.2722623","...","5^-0.131683","5^0a0","5^0a0*5","5^0=1","5^0d","5^0a1","5^0a1*5","5^0.7277376","...","5^0.535628","5^0a1","5^0a1*5","5^1","5^1d")

target_values<-c("1/5=0.2","(1+sqrt(5))/2*0.2=0.3236068","0.2*1.796112=0.3592224","0.3592224*5=1.796112","0.3592224*1.796112=-0.2722623","...","0.8090168","1/1.453085=0.688191","0.5567581*5=3.440955","1.0","(1+sqrt(5))/2=1.618034","1.796112","1.796112*5=8.98056","1.796112*1.796112=3.226018","...","3.440955*1.453085=2.368034","5/1.453085=3.440955","3.440955*5=17.20478","5","((1+sqrt(5))/2)*5=8.09017")

Regula_falsi05<-data.frame(Target_size=target_size,Target_names=target_names,Target_values=target_values)
library(xtable)
print(xtable(Regula_falsi05), type = "html")
```
こうした展開を連続的に扱う為に**式**<font color="green">Cos(θ)+Sin(θ)(i)</font>を**式**<font color="green">Cos(θ)+Cos(θ-π/NoS)(i)</font>(<font color="blue">NoS=Number of Sides</font>)に拡張する必要性が出てくる訳なんですね。
[【Rで球面幾何学】二辺形(Bilateral)と一辺形(One Side)？](https://qiita.com/ochimusha01/items/ce1b6988c4274a136e89)
![20191019011127.gif](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/597772/95d25b8f-9645-4642-afe4-9a44c8c89ec5.gif)
![20191019143209.gif](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/597772/69c6c393-102c-0b59-079f-d5879866ec2b.gif)
そんな感じで以下続報…