Update BlockRIP experiment
This commit is contained in:
@@ -0,0 +1,20 @@
|
||||
% 由于函数单调,因此可以用二分法求 x/log(9x) = k 的解
|
||||
|
||||
function result = solve_test(k)
|
||||
eps = 1e-3;
|
||||
l = 1;
|
||||
r = k;
|
||||
while r - l > eps
|
||||
mid = (l+r) / 2;
|
||||
if (foo(mid) < foo(r))
|
||||
l = mid;
|
||||
else
|
||||
r = mid;
|
||||
end
|
||||
end
|
||||
result = l;
|
||||
end
|
||||
|
||||
function f = foo(x)
|
||||
f = x / log(9 * x);
|
||||
end
|
||||
Reference in New Issue
Block a user