diary('sept11_diary.txt')
phi = @(x) x/2 - 1/x
phi =
function_handle with value:
@(x)x/2-1/x
x=1
x =
1
x = phi(x)
x =
-0.500000000000000
phi = @(x) x/2 _ 1/x
phi = @(x) x/2 _ 1/x
↑
{Error: Invalid text character. Check for unsupported symbol, invisible character, or pasting
of non-ASCII characters.
}
phi = @(x) x/2 + 1/x
phi =
function_handle with value:
@(x)x/2+1/x
x = phi(x)
x =
-2.250000000000000
x=1
x =
1
x = phi(x)
x =
1.500000000000000
x = phi(x)
x =
1.416666666666667
x = phi(x)
x =
1.414215686274510
sqrt(2)
ans =
1.414213562373095
x = phi(x)
x =
1.414213562374690
x = phi(x)
x =
1.414213562373095
sqrt(2)
ans =
1.414213562373095
x=1
x =
1
x=phi(x); abs(sqrt(2)-x)
ans =
0.085786437626905
x=phi(x); abs(sqrt(2)-x)
ans =
0.002453104293571
x=phi(x); abs(sqrt(2)-x)
ans =
2.123901414519125e-06
x=phi(x); abs(sqrt(2)-x)
ans =
1.594724352571575e-12
x=phi(x); abs(sqrt(2)-x)
ans =
2.220446049250313e-16
x=phi(x); abs(sqrt(2)-x)
ans =
2.220446049250313e-16
x=phi(x); abs(sqrt(2)-x)
ans =
2.220446049250313e-16
x=1
x =
1
for k=1:5
end
root = []
root =
[]
for k=1:5
x=phi(x)
root(k)=x
end
x =
1.500000000000000
root =
1.500000000000000
x =
1.416666666666667
root =
1.500000000000000 1.416666666666667
x =
1.414215686274510
root =
1.500000000000000 1.416666666666667 1.414215686274510
x =
1.414213562374690
root =
1.500000000000000 1.416666666666667 1.414215686274510 1.414213562374690
x =
1.414213562373095
root =
Columns 1 through 4
1.500000000000000 1.416666666666667 1.414215686274510 1.414213562374690
Column 5
1.414213562373095
root
root =
Columns 1 through 4
1.500000000000000 1.416666666666667 1.414215686274510 1.414213562374690
Column 5
1.414213562373095
err = sqrt(2)-root
err =
Columns 1 through 4
-0.085786437626905 -0.002453104293571 -0.000002123901415 -0.000000000001595
Column 5
0.000000000000000
err(2)/err(1)^2
ans =
-0.333333333333301
err(3)/err(2)^2
ans =
-0.352941176431442
err(4)/err(3)^2
ans =
-0.353522384561164
err(5)/err(4)^2
ans =
8.731100212881161e+07
phi = @(x) x - (1+x)^2*atan(x)
phi =
function_handle with value:
@(x)x-(1+x)^2*atan(x)
atan(0)
ans =
0
x=2
x =
2
x=phi(2)
x =
-7.964338460146813
x=phi(x)
x =
62.164246367259913
x=phi(x)
x =
-6.140701648634737e+03
x=phi(x)
x =
5.920035892552534e+07
x=phi(x)
x =
-5.505142460312904e+15
x=phi(x)
x =
4.760548576056652e+31
x=phi(x)
x =
-3.559867872264201e+63
x=phi(x)
x =
1.990616662886448e+127
x=phi(x)
x =
-6.224366365223755e+254
x=phi(x)
x =
Inf
x=phi(1)
x =
-2.141592653589793
x=phi(x)
x =
-0.663799920119523
x=phi(x)
x =
-0.597562320753766
x=phi(x)
x =
-0.510328697987646
x=phi(x)
x =
-0.397183129957967
x=phi(x)
x =
-0.259794895466705
x=phi(x)
x =
-0.120530988349953
x=phi(x)
x =
-0.027751959730115
x=phi(x)
x =
-0.001525700297281
phi
phi =
function_handle with value:
@(x)x-(1+x)^2*atan(x)
phi = @(x) x - (1+x^2)*atan(x)
phi =
function_handle with value:
@(x)x-(1+x^2)*atan(x)
x=phi(1)
x =
-0.570796326794897
x=phi(x)
x =
0.116859903998913
x=phi(x)
x =
-0.001061022117045
x=phi(x)
x =
7.963096044106416e-10
x=phi(x)
x =
0
diary