東京大学 情報理工学系研究科 電子情報学専攻 2026年1月実施 専門 第3問
Author
Description
Recalled statement. (1) Write nonrecursive binary-search pseudocode.
(2) Use it to approximate with error .
(3) Write recursive binary-search pseudocode.
(4) For , prove
and approximate with .
(5) Apply Newton's method to , starting at , to obtain an approximation with .
题目描述
用非递归、递归二分法计算 ,并研究递推 的上下界及相邻差比;最后从 开始使用牛顿法。二分法、递推和牛顿法的误差要求依次为 。回忆题缺少递推初值及误差定义。
Kai
Here the numerical error means absolute error. For bisection choose the valid bracket . For (4), the stated ordering holds if ; the numerical example below chooses . These are explicit conditions of this solution.
(1)
For this root-finding problem, binary search is bisection on the monotone function for .
Bisection(f, left, right, epsilon):
# f(left) <= 0 <= f(right), epsilon > 0
while (right-left)/2 >= epsilon:
middle = (left+right)/2
if f(middle) == 0: return middle
if f(middle) < 0: left = middle
else: right = middle
return (left+right)/2
The root stays inside the bracket, so the returned midpoint has absolute error at most half its width, strictly less than epsilon.
(2)
Starting with , the brackets after each update are:
| Update | Left | Right |
|---|---|---|
| 1 | 1 | 1.5 |
| 2 | 1.25 | 1.5 |
| 3 | 1.375 | 1.5 |
| 4 | 1.375 | 1.4375 |
| 5 | 1.40625 | 1.4375 |
| 6 | 1.40625 | 1.421875 |
The midpoint is , with certified error at most .
(3)
BisectionRecursive(f, left, right, epsilon):
middle = (left+right)/2
if (right-left)/2 < epsilon or f(middle) == 0:
return middle
if f(middle) < 0:
return BisectionRecursive(f, middle, right, epsilon)
return BisectionRecursive(f, left, middle, epsilon)
Both versions use iterations. The recursive version additionally uses that many stack frames.
(4)
Let . On , is decreasing and . Thus a value below is mapped above it, and conversely. Induction from proves
For any ,
With and , and using , this yields
The quotient in the question follows when ; at the sequence is constant and the quotient is undefined. For , the consecutive differences contract by a factor at most , establishing convergence to the positive fixed point .
For ,
Since and , one valid answer is
The continued fraction associated with this recurrence is . A continued fraction with every denominator equal to instead has value .
(5)
Newton's iteration is
With ,
Every iterate is at least , because
In particular, and
Thus meets the required accuracy.