solver | initial guess(es) | ea | number of iterations |
---|---|---|---|
falsepos | 1, 300 | 3.6148e-05 | 18 |
bisect | 1, 300 | 5.3371e-05 | 21 |
newtraph | 0 | 0.0015 | 400 |
mod_secant | 0 | 1.7974e-07 | 5 |
The above iteration test, makes it so that the mod_secant and newtraph methods are the beth methods for error approximation since their is less error and more iterations. Bisect, falsepos, and mod_secant have the lowest number of iterations.
This is the plot for the second part of the question which illustrated the general trend of each method.
In the data above, the bisect, the mod_secant, and the falsepos required signicantly less iterations than the newtraph.
iteration | x_i | approx error |
---|---|---|
0 | 2 | n/a |
1 | 2.2857 | 12.5 |
2 | 2.5276 | 9.5703 |
3 | 2.7422 | 7.8262 |
4 | 2.9375 | 6.6491 |
5 | 3.1182 | 5.7943 |
For this method, I debugged the nethraphsons method and ran the iteration six times to get the error approximation. For the divergence problem, I used x_1 = 2 as the initial guess and 'ea' as the error approximation and the 'e_r old' was the x_i reading for every iteration.
iteration | x_i | approx error |
---|---|---|
0 | .2 | n/a |
1 | .2 | 1.25e03v |
2 | -0.0174 | 1.6531e05 |
3 | 1.0527e-5 | 4.5122e11 |
4 | -2.3329e-15 | 4.5122e11 |
5 | 0 | 4.5122e11 |
#Homework #4
Part B) Minimum: 0.5
Part C) The minimum potential energy position is X_c = 0.9706 at theta = 0.9 degrees. This value was calculated using the for loop function in For_Loop.m.
Part D) Graph is included with the other files in the repository.