支点(无限接近的根号)
x=sqrt(2+x) (init value x=sqrt(2) )
Go
a(n)=sqrt(2+a(n-1))
Go
a(n-1)=2*cos angel(n-1);
Go
2*cos angel (n) = sqrt (2 + 2* cos angel(n-1) )
GO
2*cos angel (n) = 2*cos angel(n-1)/2
Go
angel (n)=angel(n-1)/2
Go
init value x=sqrt(2)
angel 1=pi/4=1/2*pi*(1/2)^1
Go
angel n=1/2*pi*(1/2)^n
(defun pow (num count)
(if (> count 0)
(* num (pow num (- count 1) ) )
1
)
)
(defun expr (n)
(if (eq n 1)
(sqrt 2)
(sqrt (+ 2 (expr (- n 1))))))
(setq pi 3.1415926)
(defun formula (n)
(* 2 (cos (* (/ 1.0 2)
pi
(pow (/ 1.0 2) n)))))
(defun test (n)
(if (> n 0)
(progn
(print (formula n))
(print 'compare)
(print (expr n))
(test (- n 1) ))
(print 'over)))
(test 10)