roots_and_optimization
The angle needed to reach 1.72 m at initial 15 m/s is 2.9655 degrees.
solver | initial guess(es) | ea | number of iterations |
---|---|---|---|
falsepos | 0,45 | 3.3785e-06 | 11 |
bisect | 0,45 | 5.6529e-06 | 28 |
newtraph | 0 | 9.9216e-06 | 687 |
mod_secant | 0 | 4.1357E-09 | 3 |
To plot this convergence graph, I wrote a function which takes the number of iterations needed for each function to find the correct answer, and then created vectors to record the number of iterations and the approximate error across every iteration for each solver. It then plots each set of iterations vs. error for all four lines on the same plot and saves it as a .png file.
divergence of Newton-Raphson method
iteration | x_i | approx error |
---|---|---|
0 | 2 | n/a |
1 | 2 | 12.5 |
2 | 2.5276 | 9.5703 |
3 | 2.7422 | 7.8262 |
4 | 2.9375 | 6.6491 |
5 | 3.1182 | 5.7943 |
convergence of Newton-Raphson method
iteration | x_i | approx error |
---|---|---|
0 | 0.2 | n/a |
1 | 0.2 | 1.25e3 |
2 | -.0174 | 1.6531e5 |
3 | 1.0527e-5 | 4.5122e11 |
4 | -2.3329e-15 | 4.5122e11 |
5 | 0 | 4.5122e11 |