add homework10
This commit is contained in:
112
homework10/numerical_results.txt
Normal file
112
homework10/numerical_results.txt
Normal file
@@ -0,0 +1,112 @@
|
||||
|
||||
============================================================
|
||||
Problem (a): cos(x) - x, x0=0.5
|
||||
============================================================
|
||||
|
||||
Method: Newton
|
||||
Iter | Value (x_k) | Error/Resid
|
||||
------------------------------------------------------------
|
||||
0 | 0.5 | 2.390851e-01
|
||||
1 | 0.7552224171 | 1.613728e-02
|
||||
2 | 0.7391416661 | 5.653293e-05
|
||||
3 | 0.7390851339 | 7.056461e-10
|
||||
4 | 0.7390851332 | 0.000000e+00
|
||||
5 | 0.7390851332 | 0.000000e+00
|
||||
|
||||
Method: Chord
|
||||
Iter | Value (x_k) | Error/Resid
|
||||
------------------------------------------------------------
|
||||
0 | 0.5 | 2.390851e-01
|
||||
1 | 0.7552224171 | 1.613728e-02
|
||||
2 | 0.7369022576 | 2.182876e-03
|
||||
3 | 0.7393704622 | 2.853290e-04
|
||||
4 | 0.7390476612 | 3.747205e-05
|
||||
...
|
||||
13 | 0.7390851332 | 4.333200e-13
|
||||
14 | 0.7390851332 | 5.695444e-14
|
||||
|
||||
Method: Secant
|
||||
Iter | Value (x_k) | Error/Resid
|
||||
------------------------------------------------------------
|
||||
0 | 0.5 | 2.390851e-01
|
||||
1 | 0.7556018135 | 1.651668e-02
|
||||
2 | 0.738106944 | 9.781892e-04
|
||||
3 | 0.7390815948 | 3.538433e-06
|
||||
4 | 0.739085134 | 7.646579e-10
|
||||
5 | 0.7390851332 | 5.551115e-16
|
||||
6 | 0.7390851332 | 0.000000e+00
|
||||
|
||||
============================================================
|
||||
Problem (b): sin(x), x0=3.0
|
||||
============================================================
|
||||
|
||||
Method: Newton
|
||||
Iter | Value (x_k) | Error/Resid
|
||||
------------------------------------------------------------
|
||||
0 | 3 | 1.415927e-01
|
||||
1 | 3.142546543 | 9.538895e-04
|
||||
2 | 3.141592653 | 2.893161e-10
|
||||
3 | 3.141592654 | 0.000000e+00
|
||||
4 | 3.141592654 | 0.000000e+00
|
||||
|
||||
Method: Chord
|
||||
Iter | Value (x_k) | Error/Resid
|
||||
------------------------------------------------------------
|
||||
0 | 3 | 1.415927e-01
|
||||
1 | 3.142546543 | 9.538895e-04
|
||||
2 | 3.141583011 | 9.642404e-06
|
||||
3 | 3.141592751 | 9.747184e-08
|
||||
4 | 3.141592653 | 9.853101e-10
|
||||
5 | 3.141592654 | 9.960477e-12
|
||||
6 | 3.141592654 | 1.003642e-13
|
||||
7 | 3.141592654 | 1.332268e-15
|
||||
|
||||
Method: Secant
|
||||
Iter | Value (x_k) | Error/Resid
|
||||
------------------------------------------------------------
|
||||
0 | 3 | 1.415927e-01
|
||||
1 | 3.142873442 | 1.280788e-03
|
||||
2 | 3.141588403 | 4.250744e-06
|
||||
3 | 3.141592654 | 1.158629e-12
|
||||
4 | 3.141592654 | 0.000000e+00
|
||||
5 | 3.141592654 | 0.000000e+00
|
||||
|
||||
============================================================
|
||||
Problem (c): x^2 + 1, x0=0.5
|
||||
============================================================
|
||||
|
||||
Method: Newton
|
||||
Iter | Value (x_k) | Error/Resid
|
||||
------------------------------------------------------------
|
||||
0 | 0.5 | 1.250000e+00
|
||||
1 | -0.75 | 1.562500e+00
|
||||
2 | 0.2916666667 | 1.085069e+00
|
||||
3 | -1.568452381 | 3.460043e+00
|
||||
4 | -0.4654406117 | 1.216635e+00
|
||||
...
|
||||
18 | -1.820817243 | 4.315375e+00
|
||||
19 | -0.6358066524 | 1.404250e+00
|
||||
|
||||
Method: Chord
|
||||
Iter | Value (x_k) | Error/Resid
|
||||
------------------------------------------------------------
|
||||
0 | 0.5 | 1.250000e+00
|
||||
1 | -0.75 | 1.562500e+00
|
||||
2 | -2.3125 | 6.347656e+00
|
||||
3 | -8.66015625 | 7.599831e+01
|
||||
4 | -84.65846252 | 7.168055e+03
|
||||
...
|
||||
8 | -7.660265913e+30 | 5.867967e+61
|
||||
9 | -5.867967385e+61 | 3.443304e+123
|
||||
|
||||
Method: Secant
|
||||
Iter | Value (x_k) | Error/Resid
|
||||
------------------------------------------------------------
|
||||
0 | 0.5 | 1.250000e+00
|
||||
1 | -0.756281407 | 1.571962e+00
|
||||
2 | 5.37745098 | 2.991698e+01
|
||||
3 | -1.096446714 | 2.202195e+00
|
||||
4 | -1.610857647 | 3.594862e+00
|
||||
...
|
||||
18 | 0.3478146096 | 1.120975e+00
|
||||
19 | -2.615940634 | 7.843145e+00
|
||||
Reference in New Issue
Block a user