1
2

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-03-06

ある意味、円描画関数の基本中の基本ともいうべきオイラーの公式(Euler's formula)」e^Θ=cos(Θ)+sin(Θ)i
【Rで球面幾何学】オイラーの公式とは、そもそも何か?
【初心者向け】「円そのもの」の近似から派生した角度概念の起源
20190512232958.gif
#変遷周期を同じくする三角関数と指数・対数関数の「巡回性」の発見
三角関数(Trigonometric function)は微分する都度時計回りに90度回転し4回で1周します。そして、指数関数(Exponential function)や対数関数(Logarithm function)もまた…
【初心者向け】三角関数と指数・対数関数の「巡回性」について。
20191014091535.gif
20191014142817.gif

#コサイン関数
D01<-expression(cos(x))
D(D01,"x")
-sin(x)
D01<-expression(-sin(x))
D(D01,"x")
-cos(x)
D01<-expression(-cos(x))
D(D01,"x")
sin(x)
D01<-expression(sin(x))
D(D01,"x")
cos(x)

#サイン関数
D01<-expression(sin(x))
D(D01,"x")
cos(x)

D01<-expression(cos(x))
D(D01,"x")
-sin(x)
D01<-expression(-sin(x))
D(D01,"x")
-cos(x)
D01<-expression(-cos(x))
D(D01,"x")
sin(x)
Angles Imaginary_solution Cosine Sine
1 0(2π)radian/0(360)degree 1+0i cos(x) sin(x)
2 π/2radian/90degree 0+0i sin(x) -cos(x)
3 πradian/180degree -1+0i -cos(x) -sin(x)
4 3/4πradian/270degree 0-0i -sin(x) cos(x)
#ガウス平面上における遷移図
target_angles<-c("0(2π)radian/0(360)degree","π/2radian/90degree","πradian/180degree ","3/4πradian/270degree")

imaginary_solution<-c("1+0i","0+0i","-1+0i","0-0i")

cosine_function<-c("cos(x)","sin(x)","-cos(x)","-sin(x)")

sine_function<-c("sin(x)","-cos(x)","-sin(x)","cos(x)")

Days_of_Future_Past_F<-data.frame(Angles=target_angles, Imaginary_solution=imaginary_solution, Cosine=cosine_function, Sine=sine_function)
library(xtable) 
print(xtable(Days_of_Future_Past_F), type = "html")

そして時はまさに近世文化成熟期に入った18世紀。指数関数(Exponential function)と対数関数(Logarithmic function)の概念を纏め上げ、マクローリン級数 (Maclaurin series) の概念を知ったばかりの数学者レオンハルド・オイラー(Leonhard Euler, 1707年〜1783年)は、三角関数と指数・対数関数が統合可能なのではないかと考えたのです。
【Rで球面幾何学】指数・対数関数の発見
20190927233136.png

#マクローリン展開の概念の導入
テイラー展開(Taylor expansion)とマクローリン展開(Maclaurin expansion) - Wikipedia

数学において、テイラー級数 (Taylor series) は関数のある一点での導関数たちの値から計算される項の無限和として関数を表したものである。そのような級数を得ることをテイラー展開という。

テイラー級数の概念はスコットランドの数学者ジェームズ・グレゴリーにより定式化され、フォーマルにはイギリスの数学者ブルック・テイラーによって1715年に導入された。0 を中心としたテイラー級数は、マクローリン級数 (Maclaurin series) とも呼ばれる。これはスコットランドの数学者コリン・マクローリンにちなんでおり、彼は18世紀にテイラー級数のこの特別な場合を積極的に活用した。

関数はそのテイラー級数の有限個の項を用いて近似することができる。テイラーの定理はそのような近似による誤差の定量的な評価を与える。テイラー級数の最初のいくつかの項として得られる多項式はテイラー多項式と呼ばれる。関数のテイラー級数は、その関数のテイラー多項式で次数を増やした極限が存在すればその極限である。関数はそのテイラー級数がすべての点で収束するときでさえもテイラー級数に等しいとは限らない。開区間(あるいは複素平面の開円板)でテイラー級数に等しい関数はその区間上の解析関数と呼ばれる。

階乗計算については以下。
【初心者向け】階乗と順列と組み合わせ
https___qiita-image-store.s3.ap-northeast-1.amazonaws.com_0_597772_7c0e924f-7db8-d57c-4d19-8b63ed042399.png

ネイピア数を底(root)とする指数関数e^xのマクローリン展開
20190617115949.gif

Macrolin_expansion_exp<-function(x){

#グラフのスケール決定
Graph_scale_x<-c(-6,6)
Graph_scale_y<-c(-1,6)
#関数と凡例の決定
switch(x,
"0"= f0<-function(x) {x/x},
"1"= f0<-function(x) {1+x},
"2"= f0<-function(x) {1+x+x^2/2},
"3"= f0<-function(x) {1+x+x^2/2+x^3/6},
"4"= f0<-function(x) {1+x+x^2/2+x^3/6+x^4/24},
"5"= f0<-function(x) {1 + x + x^2/2 + x^3/6+ x^4/24+ x^5/120},
"6"= f0<-function(x) {1 + x + x^2/2 + x^3/6+ x^4/24+ x^5/120+ x^6/720},
"7"= f0<-function(x) {1 + x + x^2/2 + x^3/6+ x^4/24+ x^5/120+ x^6/720+ x^7/5040},
"8"= f0<-function(x) {1 + x + x^2/2 + x^3/6+ x^4/24+ x^5/120+ x^6/720+ x^7/5040+ x^8/40320},
"9"= f0<-function(x) {1 + x + x^2/2 + x^3/6+ x^4/24 + x^5/120 + x^6/720 + x^7/5040 + x^8/40320 + x^9/362880 }
)

switch(x,
"0"=text<-c("1"),
"1"=text<-c("1+x"),
"2"=text<-c("1+x+x^2/2!"),
"3"=text<-c("1+x+x^2/2!+x^3/3!"),
"4"=text<-c("1+x+x^2/2!+x^3/3!+x^4/4!"),
"5"=text<-c("1+x+x^2/2!+x^3/3!+x^4/4!+x^5/5!"),
"6"=text<-c("1+x+x^2/2!+x^3/3!+x^4/4!+x^5/5!+x^6/6!"),
"7"=text<-c("1+x+x^2/2!+x^3/3!+x^4/4!+x^5/5!+x^6/6!+x^7/7!"),
"8"=text<-c("1+x+x^2/2!+x^3/3!+x^4/4!+x^5/5!+x^6/6!+x^7/7!+x^8/8!"),
"9"=text<-c("1+x+x^2/2!+x^3/3!+x^4/4!+x^5/5!+x^6/6!+x^7/7!+x^8/8!+x^9/9!")
)

f1=function(x){exp(x)}

plot(f1,xlim=Graph_scale_x,ylim=Graph_scale_y,type="l",col=rgb(0,0,0),main="Macrolin expansion", xlab="X", ylab="Y")
par(new=T)#上書き指定
plot(f0,xlim=Graph_scale_x,ylim=Graph_scale_y,type="l",col=rgb(1,0,0),main="", xlab="", ylab="")

legend("bottomleft", legend=c("e^x",text),lty=c(1,1),col=c(rgb(0,0,0),rgb(1,0,0)))
}

library("animation")
Time_Code=c("0","0","0","1","1","1","2","2","2","3","3","3","4","4","4","5","5","5","6","6","6","7","7","7","8","8","8","9","9","9")
saveGIF({
for (i in Time_Code){
  Macrolin_expansion_exp(i)
}
}, interval = 0.1, movie.name = "TEST01.gif") 

ネイピア数root)とする対数関数log(x)の求め方はトリッキーです(というより、不可能なので工夫してテイラー級数/マクローリン級数の限界を誤魔化してる感じ?)。
テイラー展開

指数関数の逆関数である対数関数についてもどうなるのか試してみたくなる.しかしに0を代入することはできないし,を微分したにも0を代入するわけにはいかないので,0の周りにテイラー展開することは出来そうにない.

かと言って,原点以外で展開したようなごちゃごちゃしたものは,それほど見てみたいという気も起きないだろう.そこで原点を少しずらしてやるという工夫をするのである.次のような関数ならば0の周りに展開ができそうだ.

f(x)=log(1+x)

この展開の収束半径は1である.つまりこの展開は-1>x>1の範囲でしか成り立っていない。いや,収束半径ちょうどのところ,x=1x=-1で収束するかどうかは個別に検証してみないと何とも言えないのだった.

まず|x|<1の場合におけるlog(1+x)-log(1-x)と両者の和log((1-x)/(1+x))の**マクローリン展開**の結果を求めます。**指数関数**の「収束が遅い部分」だけ取り出した形ですが、それ自体は全然原関数へと収束して行きません。
対数関数のTylor展開
image.gif

Macrolin_expansion_log<-function(x){
#グラフのスケール決定
Graph_scale_x<-c(-2,6)
Graph_scale_y<-c(-1,6)
#関数と凡例の決定
switch(x,
"0"= f0<-function(x) {x},
"1"= f0<-function(x) {x-x^2/2},
"2"= f0<-function(x) {x-x^2/2+x^3/3},
"3"= f0<-function(x) {x-x^2/2+x^3/3-x^4/4},
"4"= f0<-function(x) {x-x^2/2+x^3/3-x^4/4+x^5/5},
"5"= f0<-function(x) {x-x^2/2+x^3/3-x^4/4+x^5/5-x^6/6},
"6"= f0<-function(x) {x-x^2/2+x^3/3-x^4/4+x^5/5-x^6/6+x^7/7},
"7"= f0<-function(x) {x-x^2/2+x^3/3-x^4/4+x^5/5-x^6/6+x^7/7-x^8/8},
"8"= f0<-function(x) {x-x^2/2+x^3/3-x^4/4+x^5/5-x^6/6+x^7/7-x^8/8+x^9/9},
"9"= f0<-function(x) {x-x^2/2+x^3/3-x^4/4+x^5/5-x^6/6+x^7/7-x^8/8+x^9/9-x^10/10}
)

switch(x,
"0"=text0<-c("x"),
"1"=text0<-c("x-x^2/2"),
"2"=text0<-c("x-x^2/2+x^3/3"),
"3"=text0<-c("x-x^2/2+x^3/3-x^4/4"),
"4"=text0<-c("x-x^2/2+x^3/3-x^4/4+x^5/5"),
"5"=text0<-c("x-x^2/2+x^3/3-x^4/4+x^5/5-x^6/6"),
"6"=text0<-c("x-x^2/2+x^3/3-x^4/4+x^5/5-x^6/6+x^7/7"),
"7"=text0<-c("x-x^2/2+x^3/3-x^4/4+x^5/5-x^6/6+x^7/7-x^8/8"),
"8"=text0<-c("x-x^2/2+x^3/3-x^4/4+x^5/5-x^6/6+x^7/7-x^8/8+x^9/9"),
"9"=text0<-c("x-x^2/2+x^3/3-x^4/4+x^5/5-x^6/6+x^7/7-x^8/8+x^9/9-x^10/10")
)

switch(x,
"0"= f1<-function(x) {x},
"1"= f1<-function(x) {x+x^2/2},
"2"= f1<-function(x) {x+x^2/2+x^3/3},
"3"= f1<-function(x) {x+x^2/2+x^3/3+x^4/4},
"4"= f1<-function(x) {x+x^2/2+x^3/3+x^4/4+x^5/5},
"5"= f1<-function(x) {x+x^2/2+x^3/3+x^4/4+x^5/5+x^6/6},
"6"= f1<-function(x) {x+x^2/2+x^3/3+x^4/4+x^5/5+x^6/6+x^7/7},
"7"= f1<-function(x) {x+x^2/2+x^3/3+x^4/4+x^5/5+x^6/6+x^7/7+x^8/8},
"8"= f1<-function(x) {x+x^2/2+x^3/3+x^4/4+x^5/5+x^6/6+x^7/7+x^8/8+x^9/9},
"9"= f1<-function(x) {x+x^2/2+x^3/3+x^4/4+x^5/5+x^6/6+x^7/7+x^8/8+x^9/9+x^10/10}
)

switch(x,
"0"=text1<-c("x"),
"1"=text1<-c("x+x^2/2"),
"2"=text1<-c("x+x^2/2+x^3/3"),
"3"=text1<-c("x+x^2/2+x^3/3+x^4/4"),
"4"=text1<-c("x+x^2/2+x^3/3+x^4/4+x^5/5"),
"5"=text1<-c("x+x^2/2+x^3/3+x^4/4+x^5/5+x^6/6"),
"6"=text1<-c("x+x^2/2+x^3/3+x^4/4+x^5/5+x^6/6+x^7/7"),
"7"=text1<-c("x+x^2/2+x^3/3+x^4/4+x^5/5+x^6/6+x^7/7+x^8/8"),
"8"=text1<-c("x+x^2/2+x^3/3+x^4/4+x^5/5+x^6/6+x^7/7+x^8/8+x^9/9"),
"9"=text1<-c("x+x^2/2+x^3/3+x^4/4+x^5/5+x^6/6+x^7/7+x^8/8+x^9/9+x^10/10")
)

switch(x,
"0"= f2<-function(x) {2*(x)},
"1"= f2<-function(x) {2*(x+x^3/3)},
"2"= f2<-function(x) {2*(x+x^3/3+x^5/5)},
"3"= f2<-function(x) {2*(x+x^3/3+x^5/5+x^7/7)},
"4"= f2<-function(x) {2*(x+x^3/3+x^5/5+x^7/7+x^9/9)},
"5"= f2<-function(x) {2*(x+x^3/3+x^5/5+x^7/7+x^9/9+x^11/11)},
"6"= f2<-function(x) {2*(x+x^3/3+x^5/5+x^7/7+x^9/9+x^11/11+x^13/13)},
"7"= f2<-function(x) {2*(x+x^3/3+x^5/5+x^7/7+x^9/9+x^11/11+x^13/13+x^15/15)},
"8"= f2<-function(x) {2*(x+x^3/3+x^5/5+x^7/7+x^9/9+x^11/11+x^13/13+x^15/15+x^17/17)},
"9"= f2<-function(x) {2*(x+x^3/3+x^5/5+x^7/7+x^9/9+x^11/11+x^13/13-x^15/15+x^17/17+x^19/19)}
)

switch(x,
"0"=text2<-c("2(x)"),
"1"=text2<-c("2(x+x^3/3)"),
"2"=text2<-c("2(x+x^3/3+x^5/5)"),
"3"=text2<-c("2(x+x^3/3+x^5/5+x^7/7)"),
"4"=text2<-c("2(x+x^3/3+x^5/5+x^7/7+x^9/9)"),
"5"=text2<-c("2(x+x^3/3+x^5/5+x^7/7+x^9/9+x^11/11)"),
"6"=text2<-c("2(x+x^3/3+x^5/5+x^7/7+x^9/9+x^11/11+x^13/13)"),
"7"=text2<-c("2(x+x^3/3+x^5/5+x^7/7+x^9/9+x^11/11+x^13/13+x^15/15)"),
"8"=text2<-c("2(x+x^3/3+x^5/5+x^7/7+x^9/9+x^11/11+x^13/13+x^15/15+x^17/17)"),
"9"=text2<-c("2(x+x^3/3+x^5/5+x^7/7+x^9/9+x^11/11+x^13/13-x^15/15+x^17/17+x^19/19")
)

f10=function(x){log(x)}

plot(f10,xlim=Graph_scale_x,ylim=Graph_scale_y,type="l",col=rgb(0,0,0),main="Macrolin expansion", xlab="X", ylab="Y")
par(new=T)#上書き指定
plot(f0,xlim=Graph_scale_x,ylim=Graph_scale_y,type="l",col=rgb(0,0,1),main="", xlab="", ylab="")
par(new=T)#上書き指定
plot(f1,xlim=Graph_scale_x,ylim=Graph_scale_y,type="l",col=rgb(1,0,0),main="", xlab="", ylab="")
par(new=T)#上書き指定
plot(f2,xlim=Graph_scale_x,ylim=Graph_scale_y,type="l",col=rgb(0,1,0),main="", xlab="", ylab="")

legend("topleft", legend=c("log(x)",paste("log(1+x)=",text0),paste("-log(1-x)=",text1),paste("log((x+1)/(x-1))=",text2)),lty=c(1,1,1,1),col=c(rgb(0,0,0),rgb(0,0,1),rgb(1,0,0),rgb(0,1,0)))
}

library("animation")
Time_Code=c("0","0","0","1","1","1","2","2","2","3","3","3","4","4","4","5","5","5","6","6","6","7","7","7","8","8","8","9","9","9")
saveGIF({
for (i in Time_Code){
  Macrolin_expansion_log(i)
}
}, interval = 0.1, movie.name = "TEST03.gif") 

ところで古来数学者達は、それがx=1の時にπ/2で収束して円周率に迫るのでアークタンジェント(ArcTangent)近似式の高速化に血道を上げてきたのです。
円周率の公式と計算法
【数理考古学】とある円周率への挑戦?
image.gif

そして実はその過程で発見されたオイラー変換(Eulerian Transformation)適用可能なArcTangentが、ここでいうlog((x+1)/(x-1))の場合と重なってくるのです。
グレゴリー級数のみ。
image.gif

Macrolin_expansion_log<-function(x){
#グラフのスケール決定
Graph_scale_x<-c(-10,10)
Graph_scale_y<-c(-pi/2,pi/2)
#関数と凡例の決定
switch(x,
"0"= f0<-function(x) {x},
"1"= f0<-function(x) {x-x^3/3},
"2"= f0<-function(x) {x-x^3/3+x^5/5},
"3"= f0<-function(x) {x-x^3/3+x^5/5-x^7/7},
"4"= f0<-function(x) {x-x^3/3+x^5/5-x^7/7+x^9/9},
"5"= f0<-function(x) {x-x^3/3+x^5/5-x^7/7+x^9/9-x^11/11},
"6"= f0<-function(x) {x-x^3/3+x^5/5-x^7/7+x^9/9-x^11/11+x^13/13},
"7"= f0<-function(x) {x-x^3/3+x^5/5-x^7/7+x^9/9-x^11/11+x^13/13-x^15/15},
"8"= f0<-function(x) {x-x^3/3+x^5/5-x^7/7+x^9/9-x^11/11+x^13/13-x^15/15+x^17/17},
"9"= f0<-function(x) {x-x^3/3+x^5/5-x^7/7+x^9/9-x^11/11+x^13/13-x^15/15+x^17/17-x^19/19}
)

switch(x,
"0"=text0<-c("x"),
"1"=text0<-c("x-x^3/3"),
"2"=text0<-c("x-x^3/3+x^5/5"),
"3"=text0<-c("x-x^3/3+x^5/5-x^7/7"),
"4"=text0<-c("x-x^3/3+x^5/5-x^7/7+x^9/9"),
"5"=text0<-c("x-x^3/3+x^5/5-x^7/7+x^9/9-x^11/11"),
"6"=text0<-c("x-x^3/3+x^5/5-x^7/7+x^9/9-x^11/11+x^13/13"),
"7"=text0<-c("x-x^3/3+x^5/5-x^7/7+x^9/9-x^11/11+x^13/13-x^15/15"),
"8"=text0<-c("x-x^3/3+x^5/5-x^7/7+x^9/9-x^11/11+x^13/13-x^15/15+x^17/17"),
"9"=text0<-c("x-x^3/3+x^5/5-x^7/7+x^9/9-x^11/11+x^13/13-x^15/15+x^17/17-x^19/19")
)

f10=function(x){atan(x)}

plot(f10,xlim=Graph_scale_x,ylim=Graph_scale_y,type="l",col=rgb(0,0,0),main="Macrolin expansion", xlab="X", ylab="Y")
par(new=T)#上書き指定
plot(f0,xlim=Graph_scale_x,ylim=Graph_scale_y,type="l",col=rgb(1,0,0),main="", xlab="", ylab="")

legend("bottomleft", legend=c("Atan(x)",paste("Gregory=",text0)),lty=c(1,1),col=c(rgb(0,0,0),rgb(1,0,0)))
}

library("animation")
Time_Code=c("0","0","0","1","1","1","2","2","2","3","3","3","4","4","4","5","5","5","6","6","6","7","7","7","8","8","8","9","9","9")
saveGIF({
for (i in Time_Code){
  Macrolin_expansion_log(i)
}
}, interval = 0.1, movie.name = "arctan02.gif") 

image.gif
*明らかに途中からEulerian Transformationの様子がおかしいですが、現段階では直し方が分かりません。今後の課題…(2021.2.4)

Macrolin_expansion_log<-function(x){
#グラフのスケール決定
Graph_scale_x<-c(-10,10)
Graph_scale_y<-c(-pi/2,pi/2)
#関数と凡例の決定
switch(x,
"0"= f0<-function(x) {x},
"1"= f0<-function(x) {x-x^3/3},
"2"= f0<-function(x) {x-x^3/3+x^5/5},
"3"= f0<-function(x) {x-x^3/3+x^5/5-x^7/7},
"4"= f0<-function(x) {x-x^3/3+x^5/5-x^7/7+x^9/9},
"5"= f0<-function(x) {x-x^3/3+x^5/5-x^7/7+x^9/9-x^11/11},
"6"= f0<-function(x) {x-x^3/3+x^5/5-x^7/7+x^9/9-x^11/11+x^13/13},
"7"= f0<-function(x) {x-x^3/3+x^5/5-x^7/7+x^9/9-x^11/11+x^13/13-x^15/15},
"8"= f0<-function(x) {x-x^3/3+x^5/5-x^7/7+x^9/9-x^11/11+x^13/13-x^15/15+x^17/17},
"9"= f0<-function(x) {x-x^3/3+x^5/5-x^7/7+x^9/9-x^11/11+x^13/13-x^15/15+x^17/17-x^19/19}
)

switch(x,
"0"=text0<-c("x"),
"1"=text0<-c("x-x^3/3"),
"2"=text0<-c("x-x^3/3+x^5/5"),
"3"=text0<-c("x-x^3/3+x^5/5-x^7/7"),
"4"=text0<-c("x-x^3/3+x^5/5-x^7/7+x^9/9"),
"5"=text0<-c("x-x^3/3+x^5/5-x^7/7+x^9/9-x^11/11"),
"6"=text0<-c("x-x^3/3+x^5/5-x^7/7+x^9/9-x^11/11+x^13/13"),
"7"=text0<-c("x-x^3/3+x^5/5-x^7/7+x^9/9-x^11/11+x^13/13-x^15/15"),
"8"=text0<-c("x-x^3/3+x^5/5-x^7/7+x^9/9-x^11/11+x^13/13-x^15/15+x^17/17"),
"9"=text0<-c("x-x^3/3+x^5/5-x^7/7+x^9/9-x^11/11+x^13/13-x^15/15+x^17/17-x^19/19")
)

switch(x,
"0"= f1<-function(x) {x/(1+x^2)},
"1"= f1<-function(x) {x/(1+x^2)*(1+2/3*x^2/(1+x^2))},
"2"= f1<-function(x) {x/(1+x^2)*(1+2/3*x^2/(1+x^2))+(2*4)/(3*5)*(x^2/(1+x^2))^2},
"3"= f1<-function(x) {x/(1+x^2)*(1+2/3*x^2/(1+x^2))+(2*4)/(3*5)*(x^2/(1+x^2))^2},
"4"= f1<-function(x) {x/(1+x^2)*(1+2/3*x^2/(1+x^2))+(2*4)/(3*5)*(x^2/(1+x^2))^2+(2*4*6)/(3*5*7)*(x^2/(1+x^2))^3},
"5"= f1<-function(x) {x/(1+x^2)*(1+2/3*x^2/(1+x^2))+(2*4)/(3*5)*(x^2/(1+x^2))^2+(2*4*6)/(3*5*7)*(x^2/(1+x^2))^3+(2*4*6*8)/(3*5*7*9)*(x^2/(1+x^2))^4},
"6"= f1<-function(x) {x/(1+x^2)*(1+2/3*x^2/(1+x^2))+(2*4)/(3*5)*(x^2/(1+x^2))^2+(2*4*6)/(3*5*7)*(x^2/(1+x^2))^3+(2*4*6*8)/(3*5*7*9)*(x^2/(1+x^2))^4+(2*4*6*8*10)/(3*5*7*9*11)*(x^2/(1+x^2))^5},
"7"= f1<-function(x) {x/(1+x^2)*(1+2/3*x^2/(1+x^2))+(2*4)/(3*5)*(x^2/(1+x^2))^2+(2*4*6)/(3*5*7)*(x^2/(1+x^2))^3+(2*4*6*8)/(3*5*7*9)*(x^2/(1+x^2))^4+(2*4*6*8*10)/(3*5*7*9*11)*(x^2/(1+x^2))^5+(2*4*6*8*10*12)/(3*5*7*9*11*13)*(x^2/(1+x^2))^6},
"8"= f1<-function(x) {x/(1+x^2)*(1+2/3*x^2/(1+x^2))+(2*4)/(3*5)*(x^2/(1+x^2))^2+(2*4*6)/(3*5*7)*(x^2/(1+x^2))^3+(2*4*6*8)/(3*5*7*9)*(x^2/(1+x^2))^4+(2*4*6*8*10)/(3*5*7*9*11)*(x^2/(1+x^2))^5+(2*4*6*8*10*12)/(3*5*7*9*11*13)*(x^2/(1+x^2))^6+(2*4*6*8*10*12*14)/(3*5*7*9*11*13*15)*(x^2/(1+x^2))^7},
"9"= f1<-function(x) {x/(1+x^2)*(1+2/3*x^2/(1+x^2))+(2*4)/(3*5)*(x^2/(1+x^2))^2+(2*4*6)/(3*5*7)*(x^2/(1+x^2))^3+(2*4*6*8)/(3*5*7*9)*(x^2/(1+x^2))^4+(2*4*6*8*10)/(3*5*7*9*11)*(x^2/(1+x^2))^5+(2*4*6*8*10*12)/(3*5*7*9*11*13)*(x^2/(1+x^2))^6+(2*4*6*8*10*12*14)/(3*5*7*9*11*13*15)*(x^2/(1+x^2))^7+(2*4*6*8*10*12*14*16)/(3*5*7*9*11*13*15*17)*(x^2/(1+x^2))^8}
)

switch(x,
"0"=text1<-c("x/(1+x^2)"),
"1"=text1<-c("x/(1+x^2)*(1+2/3*x^2/(1+x^2))"),
"2"=text1<-c("x/(1+x^2)*(1+2/3*x^2/(1+x^2)+(2*4)/(3*5)*(x^2/(1+x^2))^2)"),
"3"=text1<-c("x/(1+x^2)*(1+2/3*x^2/(1+x^2)+(2*4)/(3*5)*(x^2/(1+x^2))^2)"),
"4"=text1<-c("x/(1+x^2)*(1+2/3*x^2/(1+x^2)+(2*4)/(3*5)*(x^2/(1+x^2))^2+(2*4*6)/(3*5*7)*(x^2/(1+x^2))^3"),
"5"=text1<-c("x/(1+x^2)*(1+2/3*x^2/(1+x^2)+(2*4)/(3*5)*(x^2/(1+x^2))^2+(2*4*6)/(3*5*7)*(x^2/(1+x^2))^3+(2*4*6*8)/(3*5*7*9)*(x^2/(1+x^2))^4"),
"6"=text1<-c("x/(1+x^2)*(1+2/3*x^2/(1+x^2)+(2*4)/(3*5)*(x^2/(1+x^2))^2+(2*4*6)/(3*5*7)*(x^2/(1+x^2))^3+(2*4*6*8)/(3*5*7*9)*(x^2/(1+x^2))^4+(2*4*6*8*10)/(3*5*7*9*11)*(x^2/(1+x^2))^5"),
"7"=text1<-c("x/(1+x^2)*(1+2/3*x^2/(1+x^2)+(2*4)/(3*5)*(x^2/(1+x^2))^2+(2*4*6)/(3*5*7)*(x^2/(1+x^2))^3+(2*4*6*8)/(3*5*7*9)*(x^2/(1+x^2))^4+(2*4*6*8*10)/(3*5*7*9*11)*(x^2/(1+x^2))^5+(2*4*6*8*10*12)/(3*5*7*9*11*13)*(x^2/(1+x^2))^6"),
"8"=text1<-c("x/(1+x^2)*(1+2/3*x^2/(1+x^2)+(2*4)/(3*5)*(x^2/(1+x^2))^2+(2*4*6)/(3*5*7)*(x^2/(1+x^2))^3+(2*4*6*8)/(3*5*7*9)*(x^2/(1+x^2))^4+(2*4*6*8*10)/(3*5*7*9*11)*(x^2/(1+x^2))^5+(2*4*6*8*10*12)/(3*5*7*9*11*13)*(x^2/(1+x^2))^6+(2*4*6*8*10*12*14)/(3*5*7*9*11*13*15)*(x^2/(1+x^2))^7"),
"9"=text1<-c("x/(1+x^2)*(1+2/3*x^2/(1+x^2)+(2*4)/(3*5)*(x^2/(1+x^2))^2+(2*4*6)/(3*5*7)*(x^2/(1+x^2))^3+(2*4*6*8)/(3*5*7*9)*(x^2/(1+x^2))^4+(2*4*6*8*10)/(3*5*7*9*11)*(x^2/(1+x^2))^5+(2*4*6*8*10*12)/(3*5*7*9*11*13)*(x^2/(1+x^2))^6+(2*4*6*8*10*12*14)/(3*5*7*9*11*13*15)*(x^2/(1+x^2))^7+(2*4*6*8*10*12*14*16)/(3*5*7*9*11*13*15*17)*(x^2/(1+x^2))^8")
)

f10=function(x){atan(x)}

plot(f10,xlim=Graph_scale_x,ylim=Graph_scale_y,type="l",col=rgb(0,0,0),main="Macrolin expansion", xlab="X", ylab="Y")
par(new=T)#上書き指定
plot(f0,xlim=Graph_scale_x,ylim=Graph_scale_y,type="l",col=rgb(0,0,1),main="", xlab="", ylab="")
par(new=T)#上書き指定
plot(f1,xlim=Graph_scale_x,ylim=Graph_scale_y,type="l",col=rgb(1,0,0),main="", xlab="", ylab="")

legend("bottomleft", legend=c("Atan(x)",paste("Gregory=",text0),paste("Euler=",text1)),lty=c(1,1,1),col=c(rgb(0,0,0),rgb(0,0,1),rgb(1,0,0)))
}

library("animation")
Time_Code=c("0","0","0","1","1","1","2","2","2","3","3","3","4","4","4","5","5","5","6","6","6","7","7","7","8","8","8","9","9","9")
saveGIF({
for (i in Time_Code){
  Macrolin_expansion_log(i)
}
}, interval = 0.1, movie.name = "arctan01.gif") 

あれ? もしかしたらこれが正解? そんな訳はない?(2021.2.5)
image.gif

Macrolin_expansion_log<-function(x){
#グラフのスケール決定
Graph_scale_x<-c(-10,10)
Graph_scale_y<-c(-pi/2,pi/2)
#関数と凡例の決定
switch(x,
"0"= f0<-function(x) {x},
"1"= f0<-function(x) {x-x^3/3},
"2"= f0<-function(x) {x-x^3/3+x^5/5},
"3"= f0<-function(x) {x-x^3/3+x^5/5-x^7/7},
"4"= f0<-function(x) {x-x^3/3+x^5/5-x^7/7+x^9/9},
"5"= f0<-function(x) {x-x^3/3+x^5/5-x^7/7+x^9/9-x^11/11},
"6"= f0<-function(x) {x-x^3/3+x^5/5-x^7/7+x^9/9-x^11/11+x^13/13},
"7"= f0<-function(x) {x-x^3/3+x^5/5-x^7/7+x^9/9-x^11/11+x^13/13-x^15/15},
"8"= f0<-function(x) {x-x^3/3+x^5/5-x^7/7+x^9/9-x^11/11+x^13/13-x^15/15+x^17/17},
"9"= f0<-function(x) {x-x^3/3+x^5/5-x^7/7+x^9/9-x^11/11+x^13/13-x^15/15+x^17/17-x^19/19}
)

switch(x,
"0"=text0<-c("x"),
"1"=text0<-c("x-x^3/3"),
"2"=text0<-c("x-x^3/3+x^5/5"),
"3"=text0<-c("x-x^3/3+x^5/5-x^7/7"),
"4"=text0<-c("x-x^3/3+x^5/5-x^7/7+x^9/9"),
"5"=text0<-c("x-x^3/3+x^5/5-x^7/7+x^9/9-x^11/11"),
"6"=text0<-c("x-x^3/3+x^5/5-x^7/7+x^9/9-x^11/11+x^13/13"),
"7"=text0<-c("x-x^3/3+x^5/5-x^7/7+x^9/9-x^11/11+x^13/13-x^15/15"),
"8"=text0<-c("x-x^3/3+x^5/5-x^7/7+x^9/9-x^11/11+x^13/13-x^15/15+x^17/17"),
"9"=text0<-c("x-x^3/3+x^5/5-x^7/7+x^9/9-x^11/11+x^13/13-x^15/15+x^17/17-x^19/19")
)

switch(x,
"0"= f1<-function(x) {x/(1+x^2)},
"1"= f1<-function(x) {x/(1+x^2)*(1+2/3*x^2/(1+x^2))},
"2"= f1<-function(x) {x/(1+x^2)*(1+2/3*x^2/(1+x^2))-(2*4)/(3*5)*(x^2/(1+x^2))^2},
"3"= f1<-function(x) {x/(1+x^2)*(1+2/3*x^2/(1+x^2))-(2*4)/(3*5)*(x^2/(1+x^2))^2},
"4"= f1<-function(x) {x/(1+x^2)*(1+2/3*x^2/(1+x^2))-(2*4)/(3*5)*(x^2/(1+x^2))^2+(2*4*6)/(3*5*7)*(x^2/(1+x^2))^3},
"5"= f1<-function(x) {x/(1+x^2)*(1+2/3*x^2/(1+x^2))-(2*4)/(3*5)*(x^2/(1+x^2))^2+(2*4*6)/(3*5*7)*(x^2/(1+x^2))^3-(2*4*6*8)/(3*5*7*9)*(x^2/(1+x^2))^4},
"6"= f1<-function(x) {x/(1+x^2)*(1+2/3*x^2/(1+x^2))-(2*4)/(3*5)*(x^2/(1+x^2))^2+(2*4*6)/(3*5*7)*(x^2/(1+x^2))^3-(2*4*6*8)/(3*5*7*9)*(x^2/(1+x^2))^4+(2*4*6*8*10)/(3*5*7*9*11)*(x^2/(1+x^2))^5},
"7"= f1<-function(x) {x/(1+x^2)*(1+2/3*x^2/(1+x^2))-(2*4)/(3*5)*(x^2/(1+x^2))^2+(2*4*6)/(3*5*7)*(x^2/(1+x^2))^3-(2*4*6*8)/(3*5*7*9)*(x^2/(1+x^2))^4+(2*4*6*8*10)/(3*5*7*9*11)*(x^2/(1+x^2))^5-(2*4*6*8*10*12)/(3*5*7*9*11*13)*(x^2/(1+x^2))^6},
"8"= f1<-function(x) {x/(1+x^2)*(1+2/3*x^2/(1+x^2))-(2*4)/(3*5)*(x^2/(1+x^2))^2+(2*4*6)/(3*5*7)*(x^2/(1+x^2))^3-(2*4*6*8)/(3*5*7*9)*(x^2/(1+x^2))^4+(2*4*6*8*10)/(3*5*7*9*11)*(x^2/(1+x^2))^5-(2*4*6*8*10*12)/(3*5*7*9*11*13)*(x^2/(1+x^2))^6+(2*4*6*8*10*12*14)/(3*5*7*9*11*13*15)*(x^2/(1+x^2))^7},
"9"= f1<-function(x) {x/(1+x^2)*(1+2/3*x^2/(1+x^2))-(2*4)/(3*5)*(x^2/(1+x^2))^2+(2*4*6)/(3*5*7)*(x^2/(1+x^2))^3-(2*4*6*8)/(3*5*7*9)*(x^2/(1+x^2))^4+(2*4*6*8*10)/(3*5*7*9*11)*(x^2/(1+x^2))^5-(2*4*6*8*10*12)/(3*5*7*9*11*13)*(x^2/(1+x^2))^6+(2*4*6*8*10*12*14)/(3*5*7*9*11*13*15)*(x^2/(1+x^2))^7-(2*4*6*8*10*12*14*16)/(3*5*7*9*11*13*15*17)*(x^2/(1+x^2))^8}
)

switch(x,
"0"=text1<-c("x/(1+x^2)"),
"1"=text1<-c("x/(1+x^2)*(1+2/3*x^2/(1+x^2))"),
"2"=text1<-c("x/(1+x^2)*(1+2/3*x^2/(1+x^2)-(2*4)/(3*5)*(x^2/(1+x^2))^2)"),
"3"=text1<-c("x/(1+x^2)*(1+2/3*x^2/(1+x^2)-(2*4)/(3*5)*(x^2/(1+x^2))^2)"),
"4"=text1<-c("x/(1+x^2)*(1+2/3*x^2/(1+x^2)-(2*4)/(3*5)*(x^2/(1+x^2))^2+(2*4*6)/(3*5*7)*(x^2/(1+x^2))^3"),
"5"=text1<-c("x/(1+x^2)*(1+2/3*x^2/(1+x^2)-(2*4)/(3*5)*(x^2/(1+x^2))^2+(2*4*6)/(3*5*7)*(x^2/(1+x^2))^3-(2*4*6*8)/(3*5*7*9)*(x^2/(1+x^2))^4"),
"6"=text1<-c("x/(1+x^2)*(1+2/3*x^2/(1+x^2)-(2*4)/(3*5)*(x^2/(1+x^2))^2+(2*4*6)/(3*5*7)*(x^2/(1+x^2))^3-(2*4*6*8)/(3*5*7*9)*(x^2/(1+x^2))^4+(2*4*6*8*10)/(3*5*7*9*11)*(x^2/(1+x^2))^5"),
"7"=text1<-c("x/(1+x^2)*(1+2/3*x^2/(1+x^2)-(2*4)/(3*5)*(x^2/(1+x^2))^2+(2*4*6)/(3*5*7)*(x^2/(1+x^2))^3-(2*4*6*8)/(3*5*7*9)*(x^2/(1+x^2))^4+(2*4*6*8*10)/(3*5*7*9*11)*(x^2/(1+x^2))^5+(2*4*6*8*10*12)/(3*5*7*9*11*13)*(x^2/(1+x^2))^6"),
"8"=text1<-c("x/(1+x^2)*(1+2/3*x^2/(1+x^2)-(2*4)/(3*5)*(x^2/(1+x^2))^2-(2*4*6)/(3*5*7)*(x^2/(1+x^2))^3+(2*4*6*8)/(3*5*7*9)*(x^2/(1+x^2))^4+(2*4*6*8*10)/(3*5*7*9*11)*(x^2/(1+x^2))^5+(2*4*6*8*10*12)/(3*5*7*9*11*13)*(x^2/(1+x^2))^6+(2*4*6*8*10*12*14)/(3*5*7*9*11*13*15)*(x^2/(1+x^2))^7"),
"9"=text1<-c("x/(1+x^2)*(1+2/3*x^2/(1+x^2)-(2*4)/(3*5)*(x^2/(1+x^2))^2+(2*4*6)/(3*5*7)*(x^2/(1+x^2))^3+(2*4*6*8)/(3*5*7*9)*(x^2/(1+x^2))^4+(2*4*6*8*10)/(3*5*7*9*11)*(x^2/(1+x^2))^5-(2*4*6*8*10*12)/(3*5*7*9*11*13)*(x^2/(1+x^2))^6+(2*4*6*8*10*12*14)/(3*5*7*9*11*13*15)*(x^2/(1+x^2))^7-(2*4*6*8*10*12*14*16)/(3*5*7*9*11*13*15*17)*(x^2/(1+x^2))^8")
)

f10=function(x){atan(x)}

plot(f10,xlim=Graph_scale_x,ylim=Graph_scale_y,type="l",col=rgb(0,0,0),main="Macrolin expansion", xlab="X", ylab="Y")
par(new=T)#上書き指定
plot(f0,xlim=Graph_scale_x,ylim=Graph_scale_y,type="l",col=rgb(0,0,1),main="", xlab="", ylab="")
par(new=T)#上書き指定
plot(f1,xlim=Graph_scale_x,ylim=Graph_scale_y,type="l",col=rgb(1,0,0),main="", xlab="", ylab="")

legend("bottomleft", legend=c("Atan(x)",paste("Gregory=",text0),paste("Euler=",text1)),lty=c(1,1,1),col=c(rgb(0,0,0),rgb(0,0,1),rgb(1,0,0)))
}

library("animation")
Time_Code=c("0","0","0","1","1","1","2","2","2","3","3","3","4","4","4","5","5","5","6","6","6","7","7","7","8","8","8","9","9","9")
saveGIF({
for (i in Time_Code){
  Macrolin_expansion_log(i)
}
}, interval = 0.1, movie.name = "arctan02.gif") 

もしかしたらオイラー変換が有効なのは奇数項、それもX=1の場合のみだったりする?(2021.2.6)
長田直樹「数値解析 第6回 収束の加速法(中編)

> pi/4
[1] 0.7853982

#ライプニッツ級数
> 1-1/3
[1] 0.6666667
> 1-1/3+1/5
[1] 0.8666667
> 1-1/3+1/5-1/7
[1] 0.7238095
> 1-1/3+1/5-1/7+1/9
[1] 0.8349206
> 1-1/3+1/5-1/7+1/9-1/11
[1] 0.7440115
> 1-1/3+1/5-1/7+1/9-1/11+1/13
[1] 0.8209346
> 1-1/3+1/5-1/7+1/9-1/11+1/13-1/15
[1] 0.754268
> 1-1/3+1/5-1/7+1/9-1/11+1/13-1/15+1/17
[1] 0.8130915
> 1-1/3+1/5-1/7+1/9-1/11+1/13-1/15+1/17-1/19
[1] 0.7604599
> 1-1/3+1/5-1/7+1/9-1/11+1/13-1/15+1/17-1/19+1/21
[1] 0.808079
> 1-1/3+1/5-1/7+1/9-1/11+1/13-1/15+1/17-1/19+1/21-1/23
[1] 0.7646007

#ライプニッツ級数へのオイラー変換の適用
> 1/2*(1+1/3)
[1] 0.6666667
> 1/2*(1+1/3+(1*2)/(3*5))
[1] 0.7333333
> 1/2*(1+1/3+(1*2)/(3*5)+(1*2*3)/(3*5*7))
[1] 0.7619048
> 1/2*(1+1/3+(1*2)/(3*5)+(1*2*3)/(3*5*7)+(1*2*3*4)/(3*5*7*9))
[1] 0.7746032
> 1/2*(1+1/3+(1*2)/(3*5)+(1*2*3)/(3*5*7)+(1*2*3*4)/(3*5*7*9)+(1*2*3*4*5)/(3*5*7*9*11))
[1] 0.7803752
> 1/2*(1+1/3+(1*2)/(3*5)+(1*2*3)/(3*5*7)+(1*2*3*4)/(3*5*7*9)+(1*2*3*4*5)/(3*5*7*9*11)+(1*2*3*4*5*6)/(3*5*7*9*11*13))
[1] 0.7830392
> 1/2*(1+1/3+(1*2)/(3*5)+(1*2*3)/(3*5*7)+(1*2*3*4)/(3*5*7*9)+(1*2*3*4*5)/(3*5*7*9*11)+(1*2*3*4*5*6)/(3*5*7*9*11*13)+(1*2*3*4*5*6*7)/(3*5*7*9*11*13*15))
[1] 0.7842824
> 1/2*(1+1/3+(1*2)/(3*5)+(1*2*3)/(3*5*7)+(1*2*3*4)/(3*5*7*9)+(1*2*3*4*5)/(3*5*7*9*11)+(1*2*3*4*5*6)/(3*5*7*9*11*13)+(1*2*3*4*5*6*7)/(3*5*7*9*11*13*15)+(1*2*3*4*5*6*7*8)/(3*5*7*9*11*13*15*17))
[1] 0.7848674
> 1/2*(1+1/3+(1*2)/(3*5)+(1*2*3)/(3*5*7)+(1*2*3*4)/(3*5*7*9)+(1*2*3*4*5)/(3*5*7*9*11)+(1*2*3*4*5*6)/(3*5*7*9*11*13)+(1*2*3*4*5*6*7)/(3*5*7*9*11*13*15)+(1*2*3*4*5*6*7*8)/(3*5*7*9*11*13*15*17)+(1*2*3*4*5*6*7*8*9)/(3*5*7*9*11*13*15*17*19))
[1] 0.7851445
> 1/2*(1+1/3+(1*2)/(3*5)+(1*2*3)/(3*5*7)+(1*2*3*4)/(3*5*7*9)+(1*2*3*4*5)/(3*5*7*9*11)+(1*2*3*4*5*6)/(3*5*7*9*11*13)+(1*2*3*4*5*6*7)/(3*5*7*9*11*13*15)+(1*2*3*4*5*6*7*8)/(3*5*7*9*11*13*15*17)+(1*2*3*4*5*6*7*8*9)/(3*5*7*9*11*13*15*17*19)+(1*2*3*4*5*6*7*8*9*10)/(3*5*7*9*11*13*15*17*19*21))
[1] 0.7852765
> 1/2*(1+1/3+(1*2)/(3*5)+(1*2*3)/(3*5*7)+(1*2*3*4)/(3*5*7*9)+(1*2*3*4*5)/(3*5*7*9*11)+(1*2*3*4*5*6)/(3*5*7*9*11*13)+(1*2*3*4*5*6*7)/(3*5*7*9*11*13*15)+(1*2*3*4*5*6*7*8)/(3*5*7*9*11*13*15*17)+(1*2*3*4*5*6*7*8*9)/(3*5*7*9*11*13*15*17*19)+(1*2*3*4*5*6*7*8*9*10)/(3*5*7*9*11*13*15*17*19*21)+(1*2*3*4*5*6*7*8*9*10*11)/(3*5*7*9*11*13*15*17*19*21*23))
[1] 0.7853396
#「加速」の意味が良く分かる?

グラフ化してみる。
Rplot24.png

cx<-0:10
cy1<-c(0.6666667,0.8666667,0.7238095,0.8349206,0.7440115,0.8209346,0.754268,0.8130915,0.7604599,0.808079,0.7646007)
cy2<-c(0.6666667,0.7333333,0.7619048,0.7746032,0.7803752,0.7830392,0.7842824,0.7848674,0.7851445,0.7852765,0.7853396)
plot(cx,cy1,xlim=c(0,10),ylim=c(0.65,0.9),type="l",col=rgb(0,0,1),main="Leibniz Series & Eulerian Transformation", xlab="x", ylab="y")
par(new=T)#上書き指定
plot(cx,cy2,xlim=c(0,10),ylim=c(0.65,0.9),type="l",col=rgb(0,1,0),main="", xlab="", ylab="")
abline(h=pi/4,col=rgb(1,0,0))
legend("topright", legend=c("π/4=0.7853982","Leibniz","Euler"),lty=c(1,1,1),col=c(rgb(1,0,0),rgb(0,0,1),rgb(0,1,0)))

ところで任意の(すべての正の実数α×2^n(1≦α<2;nは整数)の形に表せるので,log(α×2^n)log(α)+n×log(2)と示せます(ただしここにlog(3,base=2)が混ざり込む)。


> 2^0
[1] 1
> 2^1
[1] 2
> 2^0+2^1
[1] 3

#ところで
> 2^1.5849625
[1] 3
> log(3)/log(2)
[1] 1.584963
> log(3,base=2)
[1] 1.584963

#2^2
> 2^2
[1] 4
> 2^2+2^0
[1] 5
> 2^2+2^1
[1] 6

> 2^2+2^log(3,base=2)
[1] 7

#2^3
> 2^3
[1] 8

一覧表(8まで)

Values Explessions
1 1 2^0
2 2 2^1
3 3 2^0+2^1 / 2^log(3,base=2)
4 4 2^2
5 5 2^2+2^0
6 6 2^2+2^1
7 7 2^2+2^log(3,base=2)
8 8 2^3
target_values<-c("1","2","3","4","5","6","7","8")

target_explession<-c("2^0","2^1","2^0+2^1 / 2^log(3,base=2)","2^2","2^2+2^0","2^2+2^1","2^2+2^log(3,base=2)","2^3")

Regula_falsi04<-data.frame(Values=target_values,Explessions=target_explession)
library(xtable)
print(xtable(Regula_falsi04), type = "html")

つまりlog(2)の値さえ求めておけば,ここで示した近似式を用いて任意の正の実数x自然対数log(x)の値を計算出来る事になるのです。
対数関数のTylor展開
【無限遠点を巡る数理】等差数列と等比数列②基底関数概念の導入

#オイラー変換に従ったLog(2)の計算
> 2/3+2/3*(1/3)^3+2/5*(1/3)^5+2/7*(1/3)^7
[1] 0.6931348
> log(2)
[1] 0.6931472

#log(2)に基づく計算

#log(1)
> log(1)
[1] 0
> log(2)+log(1/2)
[1] 0
#log(3)
> log(3)
[1] 1.098612
> exp(log(3)-log(2))
[1] 1.5
> log(1.5)+log(2)
[1] 1.098612
#log(4)

> log(4)
[1] 1.386294
> log(2)*2
[1] 1.386294
> log(2^2)
[1] 1.386294

#log(5)

 > log(5)
[1] 1.609438

> exp(log(5)-log(2^2))
[1] 1.25
>log(1.25)+log(2^2)
[1] 1.609438

#log(6)
> log(6)
[1] 1.791759
> exp(log(6)-log(2^2))
[1] 1.5
> log(1.5)+log(2^2)
[1] 1.791759

#log(7)

> log(7)
[1] 1.94591
> exp(log(7)-log(2^2))
[1] 1.75
> log(1.75)+log(2^2)
[1] 1.94591

#log(8)

> log(8)
[1] 2.079442
> log(2)*3
[1] 2.079442
> log(2^3)
[1] 2.079442

一覧表(8まで)

Numbers Explessions Values
1 log(1) log(2^1)+log(1/2) 0
2 log(2) log(2^1) 0.6931472
3 log(3) log(1.5)+log(2^1) 1.098612
4 log(4) log(2^2) 1.386294
5 log(5) log(1.25)+log(2^2) 1.609438
6 log(6) log(1.5)+log(2^2) 1.791759
7 log(7) log(1.75)+log(2^2) 1.94591
8 log(8) log(2^3) 2.079442
target_number<-c("log(1)","log(2)","log(3)","log(4)","log(5)","log(6)","log(7)","log(8)")

target_explession<-c("log(2^1)+log(1/2)","log(2^1)","log(3/2)+log(2^1)","log(2^2)","log(5/4)+log(2^2)","log(3/2)+log(2^2)","log(7/4)+log(2^2)","log(2^3)")

target_values<-c("0","0.6931472","1.098612","1.386294","1.609438","1.791759","1.94591","2.079442")

Regula_falsi04<-data.frame(Numbers=target_number,Explessions=target_explession,Values=target_values)
library(xtable)
print(xtable(Regula_falsi04), type = "html")

ちなみにアークタンジェント関数の逆関数たるタンジェント関数のマクローリン変換は全く別の形となり、実用性がありません。
tanxの高階微分とマクローリン展開

#Arctangent関数とTangent関数の関係
> atan(1)
[1] 0.7853982
> pi/4
[1] 0.7853982
> tan(pi/4)
[1] 1

image.gif

Macrolin_expansion_tan<-function(x){

#グラフのスケール決定
Graph_scale_x<-c(-pi/2,pi/2)
Graph_scale_y<-c(-10,10)
#関数と凡例の決定
switch(x,
"1"= f0<-function(x) {x},
"2"= f0<-function(x) {x + x^3/3},
"3"= f0<-function(x) {1 + x^3/3 + 2*x^5/24},
"4"= f0<-function(x) {1 + x^3/3 + 2*x^5/24 + 17*x^7/315}
)

switch(x,
"1"=text<-c("x"),
"2"=text<-c("x + x^3/3"),
"3"=text<-c("1 + x^3/3 + 2*x^5/24"),
"4"=text<-c("1 + x^3/3 + 2*x^5/24 + 17*x^7/315")
)

plot(tan,xlim=Graph_scale_x,ylim=Graph_scale_y,type="l",col=rgb(0,0,0),main="Macrolin expansion", xlab="X", ylab="Y")
par(new=T)#上書き指定
plot(f0,xlim=Graph_scale_x,ylim=Graph_scale_y,type="l",col=rgb(1,0,0),main="", xlab="", ylab="")

legend("bottomleft", legend=c("tan",text),lty=c(1,1),col=c(rgb(0,0,0),rgb(1,0,0)))
}

library("animation")
Time_Code=c("1","1","1","2","2","2","3","3","3","4","4","4")
saveGIF({
for (i in Time_Code){
  Macrolin_expansion_tan(i)
}
}, interval = 0.1, movie.name = "tan01.gif") 

コサイン波の値については、_90度(π/2ラジアン)と270度(3π/2ラジアン)で0となる性質_が、マクローリン変換においては_奇数の冪(べき)数が0になって消える特徴_として現れます。

Target_names Target_values
1 0 radian & 0 degree 1
2 π/2 radian & 90 degree 0
3 π radian & 180 degree -1
4 3/2π& 270 degree 0
5 2π & 360 degree 1
target_names<-c("0 radian & 0 degree","π/2 radian & 90 degree","π radian & 180 degree","3/2π& 270 degree","2π & 360 degree")

target_values<-c("1","0","-1","0","1")

Circular_function<-data.frame(Target_names=target_names,Target_values=target_values)
library(xtable)
print(xtable(Circular_function), type = "html")

20190602134935.png

plot(cos,xlim=c(-4,+4),ylim=c(-1,1),main="Cosine wave", xlab="X", ylab="Y")

コサイン波のマクローリン展開

20190602094315.gif

Macrolin_expansion_cos<-function(x){

#グラフのスケール決定
Graph_scale_x<-c(-6,6)
Graph_scale_y<-c(-1,1)
#関数と凡例の決定
switch(x,
"1"= f0<-function(x) {x/x},
"2"= f0<-function(x) {1 - x^2/2},
"3"= f0<-function(x) {1 - x^2/2 + x^4/24},
"4"= f0<-function(x) {1 - x^2/2 + x^4/24 - x^6/720},
"5"= f0<-function(x) {1 - x^2/2 + x^4/24 - x^6/720 + x^8/40320},
"6"= f0<-function(x) {1 - x^2/2 + x^4/24 - x^6/720 + x^8/40320 + 
x^12/479001600},
"7"= f0<-function(x) {1 - x^2/2 + x^4/24 - x^6/720 + x^8/40320 + 
x^12/479001600 - x^14/87178291200}
)

switch(x,
"1"=text<-c("1"),
"2"=text<-c("1-x^2/2!"),
"3"=text<-c("1-x^2/2!+x^4/4!"),
"4"=text<-c("1-x^2/2!+x^4/4!-x^6/6!"),
"5"=text<-c("1-x^2/2!+ x^4/4! - x^6/6! + x^8/8!"),
"6"=text<-c("1-x^2/2!+x^4/4!-x^6/6!+x^8/8!+x^12/12!"),
"7"=text<-c("1-x^2/2!+x^4/4!-x^6/6!+x^8/8!+x^12/12!-x^14/14!"),
)

plot(cos,xlim=Graph_scale_x,ylim=Graph_scale_y,type="l",col=rgb(0,0,0),main="Macrolin expansion", xlab="X", ylab="Y")
par(new=T)#上書き指定
plot(f0,xlim=Graph_scale_x,ylim=Graph_scale_y,type="l",col=rgb(1,0,0),main="", xlab="", ylab="")

legend("bottomleft", legend=c("sin",text),lty=c(1,1),col=c(rgb(0,0,0),rgb(1,0,0)))
}

library("animation")
Time_Code=c("1","1","1","2","2","2","3","3","3","4","4","4","5","5","5","6","6","6","7","7","7")
saveGIF({
for (i in Time_Code){
  Macrolin_expansion_cos(i)
}
}, interval = 0.1, movie.name = "TEST01.gif") 

サイン波の値については、_0度(0ラジアン)と270度(πラジアン)で0となる性質_が、マクローリン変換においては_偶数の冪(べき)数が0になって消える特徴_として現れます。

Target_names Target_values
1 0 radian & 0 degree 0
2 π/2 radian & 90 degree 1
3 π radian & 180 degree 0
4 3/2π& 270 degree -1
5 2π & 360 degree 0
target_names<-c("0 radian & 0 degree","π/2 radian & 90 degree","π radian & 180 degree","3/2π& 270 degree","2π & 360 degree")

target_values<-c("0","1","0","-1","0")

Circular_function<-data.frame(Target_names=target_names,Target_values=target_values)
library(xtable)
print(xtable(Circular_function), type = "html")

20190602134519.png

plot(sin,xlim=c(-4,+4),ylim=c(-1,1),main="Sine wave", xlab="X", ylab="Y")

サイン波のマクローリン展開
20190602093127.gif

Macrolin_expansion_sin<-function(x){

#グラフのスケール決定
Graph_scale_x<-c(-6,6)
Graph_scale_y<-c(-1,1)
#関数と凡例の決定
switch(x,
"1"= f0<-function(x) {x},
"2"= f0<-function(x) {x - x^3/6},
"3"= f0<-function(x) {x - x^3/6 + x^5/120},
"4"= f0<-function(x) {x - x^3/6 + x^5/120 - x^7/5040},
"5"= f0<-function(x) {x - x^3/6 + x^5/120 - x^7/5040 + x^9/362880},
"6"= f0<-function(x) {x - x^3/6 + x^5/120 - x^7/5040 + x^9/362880 - x^11/39916800},
"7"= f0<-function(x) {x - x^3/6 + x^5/120 - x^7/5040 + x^9/362880 - x^11/39916800 + 
x^13/6227020800}
)

switch(x,
"1"=text<-c("x"),
"2"=text<-c("x-x^3/3!"),
"3"=text<-c("x-x^3/3!+x^5/5!"),
"4"=text<-c("x-x^3/3!+x^5/5!-x^7/7!"),
"5"=text<-c("x-x^3/3!+x^5/5!-x^7/7!+x^9/9!"),
"6"=text<-c("x-x^3/3!+x^5/5!-x^7/7!+x^9/9!-x^11/11!"),
"7"=text<-c("x-x^3/3!+x^5/5!-x^7/7!+x^9/9!-x^11/11!+x^13/13!")
)

plot(sin,xlim=Graph_scale_x,ylim=Graph_scale_y,type="l",col=rgb(0,0,0),main="Macrolin expansion", xlab="X", ylab="Y")
par(new=T)#上書き指定
plot(f0,xlim=Graph_scale_x,ylim=Graph_scale_y,type="l",col=rgb(1,0,0),main="", xlab="", ylab="")

legend("bottomleft", legend=c("sin",text),lty=c(1,1),col=c(rgb(0,0,0),rgb(1,0,0)))
}
library("animation")
Time_Code=c("1","1","1","2","2","2","3","3","3","4","4","4","5","5","5","6","6","6","7","7","7")
saveGIF({
for (i in Time_Code){
  Macrolin_expansion_sin(i)
}
}, interval = 0.1, movie.name = "TEST01.gif")

ここに2乗すると-1になる複素数i実数部をX軸に 、虚数部をY軸に割り当てる複素数­平面(独Komplexe Zahlenebene, 英complex plane)の概念を導入すると位相が90度ズレた同じ波を直交させると円を描く数理と上手く結び付くのです。
【初心者向け】物理学における「単位円筒(Unit Cylinder)」の概念について。
XY軸(円弧)
20191029133633.gif
XZ軸(Cos波)
20191029193635.gif
YZ軸(Sin波)
20191029194000.gif
複素数平面(独Komplexe Zahlenebene, 英complex plane) - Wikipedia

1811年頃にガウス(Johann Carl Friedrich Gauß、1777年〜1855年)によって導入されたため、ガウス平面 (Gaussian plane) とも呼ばれる。一方、それに先立つ1806年にJean-Robert Argandも同様の手法を用いたため、アルガン図(Argand Diagram)とも呼ばれている。さらに、それ以前の1797年のCaspar Wesselの書簡にも登場している。このように複素数の幾何的表示はガウス以前にも知られていたが、今日用いられているような形式で複素平面を論じたのはガウスである。三者の名前をとってガウス・アルガン平面、ガウス・ウェッセル平面などとも言われる。

統計言語Rによる「オイラーの公式」の検証例

#まずは統計言語Rから呼べるYacasライブラリを導入
library(Ryacas)
#Cos(x)=x/1! - x^2/2! + x^4/4! - x^6/6! + x^8/8!...
yacas("Taylor(x, 0, 8) Cos(x)") #マクローリン展開
expression(1 - x^2/2 + x^4/24 - x^6/720 + x^8/40320)

#sin(x)=x/1! - x^3/3! + x^5/5! - x^7/7! + x^9/9!...
yacas("Taylor(x, 0, 11) Sin(x)") #マクローリン展開
expression(x - x^3/6 + x^5/120 - x^7/5040 + x^9/362880)

#Exp(x)=x/1! + x^2/2! + x^3/3! + x^4/4! + x^4/5! + x^6/6! + x^7/7! + x^8/8! + x^9/9!...
yacas("Taylor(x, 0, 9) Exp(x)") #マクローリン展開
expression(x + x^2/2 + x^3/6 + x^4/24 + x^5/120 + x^6/720 + x^7/5040 + 
x^8/40320 + x^9/362880 + 1)

#ただ合算しただけではCos関数とSin関数の合成関数を近似するのみである。
yacas("Taylor(x, 0, 9) Sin(x)+Cos(x)")
expression(x - x^2/2 - x^3/6 + x^4/24 + x^5/120 - x^6/720 - x^7/5040 + 
x^8/40320 + x^9/362880 + 1)

#ここに「2乗すると-1になる複素数i」の概念を導入すると符号違いの問題が解決されてExp(xi)=Cos(x)+Sin(xi)が成立する。
Exp(xi)=xi/1!+xi^2/2!+xi^3/3!+xi^4/4!+xi^4/5!+xi^6/6!+xi^7/7!+xi^8/8!+xi^9/9!
Exp(xi)=1+xi-x^2/2-xi^3/3!+x^4/4!+xi^5/5!-x^6/6!-xi^7/7!+x^8/8!+xi^9/9!
Exp(xi)=(1-x^2/2+x^4/4-x^6/6!+x^8/8!)+(xi-xi^3/3!+xi^5/5!-xi^7/7!+ xi^9/9!)
Exp(xi)=Cos(x)+Sin(xi)

cos波を主体とする合成波の近似

20190602111317.gif

Macrolin_expansion_circle<-function(x){

#グラフのスケール決定
Graph_scale_x<-c(-4,4)
Graph_scale_y<-c(-4,4)
#関数と凡例の決定
switch(x,
"0"= f0<-function(x) {x/x},
"1"= f0<-function(x) {1+x*(0+1i)},
"2"= f0<-function(x) {1+x*(0+1i)+(x*(0+1i))^2/2},
"3"= f0<-function(x) {1+x*(0+1i)+(x*(0+1i))^2/2+(x*(0+1i))^3/6},
"4"= f0<-function(x) {1+x*(0+1i)+(x*(0+1i))^2/2+(x*(0+1i))^3/6+(x*(0+1i))^4/24},
"5"= f0<-function(x) {1+x*(0+1i)+(x*(0+1i))^2/2+(x*(0+1i))^3/6+(x*(0+1i))^4/24+(x*(0+1i))^5/120},
"6"= f0<-function(x) {1+x*(0+1i)+(x*(0+1i))^2/2+(x*(0+1i))^3/6+(x*(0+1i))^4/24+(x*(0+1i))^5/120+(x*(0+1i))^6/720},
"7"= f0<-function(x) {1+x*(0+1i)-(x*(0+1i))^2/2+(x*(0+1i))^3/6+(x*(0+1i))^4/24+(x*(0+1i))^5/120+(x*(0+1i))^6/720+(x*(0+1i))^7/5040},
"8"= f0<-function(x) {1+x*(0+1i)+(x*(0+1i))^2/2+(x*(0+1i))^3/6+(x*(0+1i))^4/24+(x*(0+1i))^5/120+(x*(0+1i))^6/720+(x*(0+1i))^7/5040+(x*(0+1i))^8/40320},
"9"= f0<-function(x) {1+x*(0+1i)+(x*(0+1i))^2/2+(x*(0+1i))^3/6+(x*(0+1i))^4/24 +(x*(0+1i))^5/120+(x*(0+1i))^6/720+(x*(0+1i))^7/5040 +(x*(0+1i))^8/40320 + x^9/362880 }
)

switch(x,
"0"=text<-c("1"),
"1"=text<-c("1+xi"),
"2"=text<-c("1+xi+xi^2/2!"),
"3"=text<-c("1+xi+xi^2/2!+x^3/3!"),
"4"=text<-c("1+xi+xi^2/2!+xi^3/3!+x^4/4!"),
"5"=text<-c("1+xi+xi^2/2!+xi^3/3!+x^4/4!+x^5/5!"),
"6"=text<-c("1+xi+xi^2/2!+xi^3/3!+xi^4/4!+xi^5/5!+xi^6/6!"),
"7"=text<-c("1+xi+xi^2/2!+xi^3/3!+xi^4/4!+xi^5/5!+xi^6/6!+xi^7/7!"),
"8"=text<-c("1+xi+xi^2/2!+xi^3/3!+xi^4/4!+xi^5/5!+xi^6/6!+xi^7/7!+xi^8/8!"),
"9"=text<-c("1+xi+xi^2/2!+xi^3/3!+xi^4/4!+xi^5/5!+xi^6/6!+xi^7/7!+xi^8/8!+xi^9/9!")
)
f1<-function(x){cos(x)+sin(x*(0+1i))}
plot(f1,xlim=Graph_scale_x,ylim=Graph_scale_y,type="l",col=rgb(0,0,0),main="Macrolin expansion", xlab="X", ylab="Y")
par(new=T)#上書き指定
plot(f0,xlim=Graph_scale_x,ylim=Graph_scale_y,type="l",col=rgb(1,0,0),main="", xlab="", ylab="")

legend("bottomleft", legend=c("e^xi=cos(x)+sin(xi)",text),lty=c(1,1),col=c(rgb(0,0,0),rgb(1,0,0)))
}


library("animation")
Time_Code=c("0","0","0","1","1","1","2","2","2","3","3","3","4","4","4","5","5","5","6","6","6","7","7","7","8","8","8","9","9","9")
saveGIF({
for (i in Time_Code){
  Macrolin_expansion_circle(i)
}
}, interval = 0.1, movie.name = "TEST01.gif") 

sin波を主体とする合成波の近似

20190602114504.gif

Macrolin_expansion_circle<-function(x){

#グラフのスケール決定
Graph_scale_x<-c(-4,4)
Graph_scale_y<-c(-4,4)
#関数と凡例の決定
switch(x,
"0"= f0<-function(x) {x/x},
"1"= f0<-function(x) {1+x},
"2"= f0<-function(x) {1+x-x^2/2},
"3"= f0<-function(x) {1+x-x^2/2-x^3/6},
"4"= f0<-function(x) {1+x-x^2/2-x^3/6+x^4/24},
"5"= f0<-function(x) {1+x-x^2/2-x^3/6+x^4/24+x^5/120},
"6"= f0<-function(x) {1+x-x^2/2-x^3/6+x^4/24+x^5/120-x^6/720},
"7"= f0<-function(x) {1+x-x^2/2-x^3/6+x^4/24+ x^5/120-x^6/720- x^7/5040},
"8"= f0<-function(x) {1+x-x^2/2-x^3/6+x^4/24+x^5/120-x^6/720+ x^7/5040+ x^8/40320},
"9"= f0<-function(x) {1+x-x^2/2-x^3/6+x^4/24+x^5/120-x^6/720- x^7/5040+x^8/40320+x^9/362880 }
)

switch(x,
"0"=text<-c("1"),
"1"=text<-c("1+xi"),
"2"=text<-c("1+xi-xi^2/2!"),
"3"=text<-c("1+xi-xi^2/2!-x^3/3!"),
"4"=text<-c("1+xi-xi^2/2!-xi^3/3!+x^4/4!"),
"5"=text<-c("1+xi-xi^2/2!-xi^3/3!+x^4/4!+x^5/5!"),
"6"=text<-c("1+xi-xi^2/2!-xi^3/3!+xi^4/4!+xi^5/5!-xi^6/6!"),
"7"=text<-c("1+xi-xi^2/2!-xi^3/3!+xi^4/4!+xi^5/5!-xi^6/6!-xi^7/7!"),
"8"=text<-c("1+xi-xi^2/2!-xi^3/3!+xi^4/4!+xi^5/5!-xi^6/6!-xi^7/7!+xi^8/8!"),
"9"=text<-c("1+xi+xi^2/2!-xi^3/3!+xi^4/4!+xi^5/5!-xi^6/6!-xi^7/7!+xi^8/8!+xi^9/9!")
)
f1<-function(x){cos(x)+sin(x)}
plot(f1,xlim=Graph_scale_x,ylim=Graph_scale_y,type="l",col=rgb(0,0,0),main="Macrolin expansion", xlab="X", ylab="Y")
par(new=T)#上書き指定
plot(f0,xlim=Graph_scale_x,ylim=Graph_scale_y,type="l",col=rgb(1,0,0),main="", xlab="", ylab="")

legend("bottomleft", legend=c("e^xi=cos(x)+sin(x)",text),lty=c(1,1),col=c(rgb(0,0,0),rgb(1,0,0)))
}

library("animation")
Time_Code=c("0","0","0","1","1","1","2","2","2","3","3","3","4","4","4","5","5","5","6","6","6","7","7","7","8","8","8","9","9","9")
saveGIF({
for (i in Time_Code){
  Macrolin_expansion_circle(i)
}
}, interval = 0.1, movie.name = "TEST01.gif") 

これだけではまだ円を描いたとはいえません。それを実現するには、さらに実数部をX軸に 、虚数部をY軸に割り当てる複素数­平面(球面、独Komplexe Zahlenebene, 英complex plane)の概念の導入が必須となります。ところが…
#実際のオイラーの公式は、発見された時点で円を描けた訳ではない?
20190602123436.gif

Macrolin_expansion_circle<-function(x){

#グラフのスケール決定
Graph_scale_x<-c(-2,2)
Graph_scale_y<-c(-2,2)
#関数と凡例の決定
switch(x,
"0"= f0<-function(x) {x/x},
"1"= f0<-function(x) {1+x*(0+1i)},
"2"= f0<-function(x) {1+x*(0+1i)+(x*(0+1i))^2/2},
"3"= f0<-function(x) {1+x*(0+1i)+(x*(0+1i))^2/2+(x*(0+1i))^3/6},
"4"= f0<-function(x) {1+x*(0+1i)+(x*(0+1i))^2/2+(x*(0+1i))^3/6+(x*(0+1i))^4/24},
"5"= f0<-function(x) {1+x*(0+1i)+(x*(0+1i))^2/2+(x*(0+1i))^3/6+(x*(0+1i))^4/24+(x*(0+1i))^5/120},
"6"= f0<-function(x) {1+x*(0+1i)+(x*(0+1i))^2/2+(x*(0+1i))^3/6+(x*(0+1i))^4/24+(x*(0+1i))^5/120+(x*(0+1i))^6/720},
"7"= f0<-function(x) {1+x*(0+1i)-(x*(0+1i))^2/2+(x*(0+1i))^3/6+(x*(0+1i))^4/24+(x*(0+1i))^5/120+(x*(0+1i))^6/720+(x*(0+1i))^7/5040},
"8"= f0<-function(x) {1+x*(0+1i)+(x*(0+1i))^2/2+(x*(0+1i))^3/6+(x*(0+1i))^4/24+(x*(0+1i))^5/120+(x*(0+1i))^6/720+(x*(0+1i))^7/5040+(x*(0+1i))^8/40320},
"9"= f0<-function(x) {1+x*(0+1i)+(x*(0+1i))^2/2+(x*(0+1i))^3/6+(x*(0+1i))^4/24 +(x*(0+1i))^5/120+(x*(0+1i))^6/720+(x*(0+1i))^7/5040 +(x*(0+1i))^8/40320 + x^9/362880 }
)

switch(x,
"0"=text<-c("1"),
"1"=text<-c("1+xi"),
"2"=text<-c("1+xi+xi^2/2!"),
"3"=text<-c("1+xi+xi^2/2!+x^3/3!"),
"4"=text<-c("1+xi+xi^2/2!+xi^3/3!+x^4/4!"),
"5"=text<-c("1+xi+xi^2/2!+xi^3/3!+x^4/4!+x^5/5!"),
"6"=text<-c("1+xi+xi^2/2!+xi^3/3!+xi^4/4!+xi^5/5!+xi^6/6!"),
"7"=text<-c("1+xi+xi^2/2!+xi^3/3!+xi^4/4!+xi^5/5!+xi^6/6!+xi^7/7!"),
"8"=text<-c("1+xi+xi^2/2!+xi^3/3!+xi^4/4!+xi^5/5!+xi^6/6!+xi^7/7!+xi^8/8!"),
"9"=text<-c("1+xi+xi^2/2!+xi^3/3!+xi^4/4!+xi^5/5!+xi^6/6!+xi^7/7!+xi^8/8!+xi^9/9!")
)

theta <- c(seq(0, pi, length=180),seq(-pi, 0, length=180))
plot(cos(theta), sin(theta),xlim=Graph_scale_x,ylim=Graph_scale_y,type="l",col=rgb(0,0,0),main="Macrolin expansion", xlab="Real Expanse", ylab="Imaginaly Expanse")
par(new=T)#上書き指定

Re01=Re(f0(theta))
Im01=Im(f0(theta))
plot(Re01,Im01,xlim=Graph_scale_x,ylim=Graph_scale_y,type="l",col=rgb(1,0,0),main="", xlab="", ylab="")

legend("bottomleft", legend=c("e^xi=cos(x)+sin(xi)",text),lty=c(1,1),col=c(rgb(0,0,0),rgb(1,0,0)))
}

library("animation")
Time_Code=c("0","0","0","1","1","1","2","2","2","3","3","3","4","4","4","5","5","5","6","6","6","7","7","7","8","8","8","9","9","9")
saveGIF({
for (i in Time_Code){
  Macrolin_expansion_circle(i)
}
}, interval = 0.1, movie.name = "TEST01.gif") 

そのままコーディングするとこうなっちゃうのです。とはいえもちろん、こうした形でのマクローリン級数による近似の限界が暴露されるのは、あくまで複素数­平面(球面)の概念が発明された19世紀に入ってからだった訳ですが…
【無限遠点を巡る数理】オイラーの公式と等比数列①その根本的差異について。
image.gif

Macrolin_expansion_exp<-function(x,s0){

#グラフのスケール決定
Graph_scale_x<-c(-6,6)
Graph_scale_y<-c(-1,6)
#関数と凡例の決定
switch(x,
"0"= f0<-function(x) {x/x},
"1"= f0<-function(x) {1+x},
"2"= f0<-function(x) {1+x+x^2/2},
"3"= f0<-function(x) {1+x+x^2/2+x^3/6},
"4"= f0<-function(x) {1+x+x^2/2+x^3/6+x^4/24},
"5"= f0<-function(x) {1 + x + x^2/2 + x^3/6+ x^4/24+ x^5/120},
"6"= f0<-function(x) {1 + x + x^2/2 + x^3/6+ x^4/24+ x^5/120+ x^6/720},
"7"= f0<-function(x) {1 + x + x^2/2 + x^3/6+ x^4/24+ x^5/120+ x^6/720+ x^7/5040},
"8"= f0<-function(x) {1 + x + x^2/2 + x^3/6+ x^4/24+ x^5/120+ x^6/720+ x^7/5040+ x^8/40320},
"9"= f0<-function(x) {1 + x + x^2/2 + x^3/6+ x^4/24 + x^5/120 + x^6/720 + x^7/5040 + x^8/40320 + x^9/362880 }
)

switch(x,
"0"=text<-c("1"),
"1"=text<-c("1+x"),
"2"=text<-c("1+x+x^2/2!"),
"3"=text<-c("1+x+x^2/2!+x^3/3!"),
"4"=text<-c("1+x+x^2/2!+x^3/3!+x^4/4!"),
"5"=text<-c("1+x+x^2/2!+x^3/3!+x^4/4!+x^5/5!"),
"6"=text<-c("1+x+x^2/2!+x^3/3!+x^4/4!+x^5/5!+x^6/6!"),
"7"=text<-c("1+x+x^2/2!+x^3/3!+x^4/4!+x^5/5!+x^6/6!+x^7/7!"),
"8"=text<-c("1+x+x^2/2!+x^3/3!+x^4/4!+x^5/5!+x^6/6!+x^7/7!+x^8/8!"),
"9"=text<-c("1+x+x^2/2!+x^3/3!+x^4/4!+x^5/5!+x^6/6!+x^7/7!+x^8/8!+x^9/9!")
)

s1<-f0(s0)
plot(s1,type="l",asp=1,xlim=c(-pi,pi),ylim=c(-pi,pi),main="Macrolin Expansion of EXP(1)^πi",xlab="Real",ylab="Imaginal",col=rgb(0,1,0))
par(new=T)
plot(c1,Re(s1),type="l",asp=1,xlim=c(-pi,pi),ylim=c(-pi,pi),main="",xlab="",ylab="",col=rgb(0,0,1))
par(new=T)
plot(c1,Im(s1),type="l",asp=1,xlim=c(-pi,pi),ylim=c(-pi,pi),main="",xlab="",ylab="",col=rgb(1,0,0))

legend("bottomleft", legend=c("e^πi","Cos(θ)","Sin(θ)",text),lty=c(1,1,1,1),col=c(rgb(0,1,0),rgb(0,0,1),rgb(1,0,0),rgb(0,0,0)))
}

#アニメーション描画

library("animation")

c0<-seq(-pi,pi,length=61)
s0<-(0+1i)*c0

Time_Code=c("0","0","0","1","1","1","2","2","2","3","3","3","4","4","4","5","5","5","6","6","6","7","7","7","8","8","8","9","9","9")
saveGIF({
for (i in Time_Code){
  Macrolin_expansion_exp(i,s0)
}
}, interval = 0.1, movie.name = "TEST02.gif")

【無限遠点を巡る数理】オイラーの公式と等比数列④「中学生には難しいが高校生なら気付くレベル」?
image.gif

Macrolin_expansion_sin<-function(x){

#グラフのスケール決定
Graph_scale_x<-c(-6,6)
Graph_scale_y<-c(-15,15)
#関数と凡例の決定
switch(x,
"1"= f0<-function(x) {x},
"2"= f0<-function(x) {x + x^3/6},
"3"= f0<-function(x) {x + x^3/6 + x^5/120},
"4"= f0<-function(x) {x + x^3/6 + x^5/120 + x^7/5040},
"5"= f0<-function(x) {x + x^3/6 + x^5/120 + x^7/5040 + x^9/362880},
"6"= f0<-function(x) {x + x^3/6 + x^5/120 + x^7/5040 + x^9/362880 + x^11/39916800},
"7"= f0<-function(x) {x + x^3/6 + x^5/120 + x^7/5040 + x^9/362880 + x^11/39916800 + 
x^13/6227020800}
)

switch(x,
"1"=text<-c("x"),
"2"=text<-c("x+x^3/3!"),
"3"=text<-c("x+x^3/3!+x^5/5!"),
"4"=text<-c("x+x^3/3!+x^5/5!+x^7/7!"),
"5"=text<-c("x+x^3/3!+x^5/5!+x^7/7!+x^9/9!"),
"6"=text<-c("x+x^3/3!+x^5/5!+x^7/7!+x^9/9!+x^11/11!"),
"7"=text<-c("x+x^3/3!+x^5/5!+x^7/7!+x^9/9!+x^11/11!+x^13/13!")
)

plot(sinh,xlim=Graph_scale_x,ylim=Graph_scale_y,type="l",col=rgb(0,0,0),main="Macrolin expansion", xlab="X", ylab="Y")
par(new=T)#上書き指定
plot(f0,xlim=Graph_scale_x,ylim=Graph_scale_y,type="l",col=rgb(1,0,0),main="", xlab="", ylab="")

legend("bottomleft", legend=c("sinh",text),lty=c(1,1),col=c(rgb(0,0,0),rgb(1,0,0)))
}
library("animation")
Time_Code=c("1","1","1","2","2","2","3","3","3","4","4","4","5","5","5","6","6","6","7","7","7")
saveGIF({
for (i in Time_Code){
  Macrolin_expansion_sin(i)
}
}, interval = 0.1, movie.name = "sinh01.gif")

image.gif


Macrolin_expansion_cos<-function(x){

#グラフのスケール決定
Graph_scale_x<-c(-6,6)
Graph_scale_y<-c(0,12)
#関数と凡例の決定
switch(x,
"1"= f0<-function(x) {x/x},
"2"= f0<-function(x) {1 + x^2/2},
"3"= f0<-function(x) {1 + x^2/2 + x^4/24},
"4"= f0<-function(x) {1 + x^2/2 + x^4/24 + x^6/720},
"5"= f0<-function(x) {1 + x^2/2 + x^4/24 + x^6/720 + x^8/40320},
"6"= f0<-function(x) {1 + x^2/2 + x^4/24 + x^6/720 + x^8/40320 + 
x^12/479001600},
"7"= f0<-function(x) {1 + x^2/2 + x^4/24 + x^6/720 + x^8/40320 + 
x^12/479001600 + x^14/87178291200}
)

switch(x,
"1"=text<-c("1"),
"2"=text<-c("1+x^2/2!"),
"3"=text<-c("1+x^2/2!+x^4/4!"),
"4"=text<-c("1+x^2/2!+x^4/4!+x^6/6!"),
"5"=text<-c("1+x^2/2!+ x^4/4! + x^6/6! + x^8/8!"),
"6"=text<-c("1+x^2/2!+x^4/4!+x^6/6!+x^8/8!+x^12/12!"),
"7"=text<-c("1+x^2/2!+x^4/4!+x^6/6!+x^8/8!+x^12/12!+x^14/14!"),
)

plot(cosh,xlim=Graph_scale_x,ylim=Graph_scale_y,type="l",col=rgb(0,0,0),main="Macrolin expansion", xlab="X", ylab="Y")
par(new=T)#上書き指定
plot(f0,xlim=Graph_scale_x,ylim=Graph_scale_y,type="l",col=rgb(1,0,0),main="", xlab="", ylab="")

legend("bottomleft", legend=c("cosh",text),lty=c(1,1),col=c(rgb(0,0,0),rgb(1,0,0)))
}

library("animation")
Time_Code=c("1","1","1","2","2","2","3","3","3","4","4","4","5","5","5","6","6","6","7","7","7")
saveGIF({
for (i in Time_Code){
  Macrolin_expansion_cos(i)
}
}, interval = 0.1, movie.name = "Cosh01.gif")

そんな感じで以下続報…

1
2
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
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?