cubic_secant2
cubic_secant2
Use the secant method to search for a root of the cubic function.
F(1) = -1
F(2) = 5
{Undefined function or variable 'cubic2'.
Error in cubic_secant2>@(x)cubic2(x)
Error in secant (line 7)
c = ( a * f(b) - b * f(a) ) / ( f(b) - f(a) );
Error in cubic_secant2 (line 16)
[ a, b, it ] = secant ( @(x)cubic2(x), a, b, xtol, ftol, itmax );
}
cubic_secant2
cubic_secant2
Use the secant method to search for a root of the cubic function.
F(1) = -1
F(2) = 5
r =
12.4282
2: Estimated convergence rate = 12.4282
r =
0.0122
3: Estimated convergence rate = 0.0121683
r =
66.7313
4: Estimated convergence rate = 66.7313
r =
1.4921
5: Estimated convergence rate = 1.49207
r =
1.6206
6: Estimated convergence rate = 1.62055
r =
1.6004
7: Estimated convergence rate = 1.60043
After 7 iterations:
F(1.32472) = -3.22853e-13
it <= itmax? true
|a-b| <= xtol? true
|f(b)| <= ftol? true
diary off
cubic_secant2
cubic_secant2
Use the secant method to search for a root of the cubic function.
F(1) = -1
F(2) = 5
2: Estimated convergence rate = 12.4282
3: Estimated convergence rate = 0.0121683
4: Estimated convergence rate = 66.7313
5: Estimated convergence rate = 1.49207
6: Estimated convergence rate = 1.62055
7: Estimated convergence rate = 1.60043
After 7 iterations:
F(1.32472) = -3.22853e-13
it <= itmax? true
|a-b| <= xtol? true
|f(b)| <= ftol? true
diary hump_secant2.txt