\[ \sqrt{1+\sqrt{1+\sqrt{1+\sqrt{1+\sqrt{1+\cdots}}}}}=? \] 令 \[\sqrt{1+\sqrt{1+\sqrt{1+\sqrt{1+\sqrt{1+\cdots}}}}}=x\] \(\Rightarrow 1+x =x^2 \Rightarrow x=\frac{1+\sqrt{5}}{2}\) (負不合)
精確計算
options(digits=22)
(1+sqrt(5))/2 # 黃金分割比(長寬比)
## [1] 1.618033988749894902526
驗證:
x <- sqrt(1)
for (i in 1:100000) {x <- sqrt(x+1)}
options(digits=22)
x
## [1] 1.618033988749894902526
\[ \sqrt{2+\sqrt{2+\sqrt{2+\sqrt{2+\sqrt{2+\cdots}}}}}=? \]
令 \(\sqrt{2+\sqrt{2+\sqrt{2+\sqrt{2+\sqrt{2+\cdots}}}}}=x \Rightarrow 2+x =x^2 \Rightarrow x=2\) 或 \(-1\) (不合)
驗證:
x <- sqrt(2)
for (i in 1:100000) {x <- sqrt(x+2)}
options(digits=22)
x
## [1] 2
\[ \sqrt{\frac{1}{2}+\sqrt{\frac{1}{2}+\sqrt{\frac{1}{2}+\sqrt{\frac{1}{2}+\sqrt{\frac{1}{2}+\cdots}}}}}=? \] 令 \[\sqrt{\frac{1}{2}+\sqrt{\frac{1}{2}+\sqrt{\frac{1}{2}+\sqrt{\frac{1}{2}+\sqrt{\frac{1}{2}+\cdots}}}}}=x\] \(\Rightarrow \frac{1}{2}+x =x^2 \Rightarrow x=\frac{1+\sqrt{3}}{2}\) (負不合)
精確計算
options(digits=22)
(1+sqrt(3))/2
## [1] 1.366025403784438596588
驗證:
x <- sqrt(1/2)
for (i in 1:100000) {x <- sqrt(x+1/2)}
options(digits=22)
x
## [1] 1.366025403784438596588
連分數的形式:
\[\frac{1}{1+\frac{1}{1+\frac{1}{1+\frac{1}{1+\frac{1}{1+\frac{1}{1+\cdots}}}}}} = ? \]
令 \[\frac{1}{1+\frac{1}{1+\frac{1}{1+\frac{1}{1+\frac{1}{1+\frac{1}{1+\cdots}}}}}} = x\] \(\frac{1}{1+x} =x \Rightarrow 1=x+x^2 \Rightarrow x= \frac{\sqrt{5}-1}{2}\)
精確計算
options(digits=22)
(sqrt(5)-1)/2 # 黃金分割比(寬長比)
## [1] 0.6180339887498949025257
驗證:
x <- 1
for (i in 1:100000) {x <- 1/(1+x)}
options(digits=22)
x
## [1] 0.6180339887498947915034
增加遞迴次數,改善精確度:
x <- 1
for (i in 1:1000000) {x <- 1/(1+x)}
options(digits=22)
x
## [1] 0.6180339887498947915034