Use the Bisection Method to find the root of a function describing the equilibrium angle from the horizontal of a pair of equal springs suspending a mass. Example: > ./BisectionMethod Output: 1 0.321963 2 -0.00834326 3 0.104785 4 0.0385497 5 0.0129939 6 0.00183198 7 -0.00337497 8 -0.000801823 9 0.000507435 10 -0.000149097f(0.53252) = -0.000149097 The value of theta in degrees is 30.5111 |
Source Code |
False Position Method Example: > ./FalsePositionMethod Output: 1 -0.0791721 2 -0.0790662 3 -0.0789577 4 -0.0788467 ... ... 704 -0.000175035 705 -0.000173194 706 -0.000171373 707 -0.000169571f(0.532477) = -0.000169571 The value of theta in degrees is 30.5087 |
Source Code |
Newton-Raphson Method Example: > ./NewtonRaphsonMethod Output: 1 0.0524164 2 0.00714035 3 0.00020607 4 1.87727e-07f(0.532827) = 1.87727e-07 The value of theta in degrees is 30.5287 |
Source Code |
Shawn Havery (PHZ4151C in Spring 2008): The results of the successive approximations for the three methods are plotted here. Note that a log scale has been used for the iterations due to the large disparity between the rates of convergence of the False Position Method versus the other two. The three methods all obtained the same root with almost similar precision: 30.5111 degrees (Bisection Method) 30.5087 degrees (False Position Method) 30.5287 degrees (Newton-Raphson Method)This is not surprising since the desired precision of f(theta) = 0 ± 0.00017 was hard-coded into every program. The three methods did not, however, have the same rate of convergence to the answer. In this particular case at least, the Newton-Raphson Method converged the fastest (4 iterations), followed by the Bisection Method (10 iterations). The slowest method by far was the False Position Method, which took a whopping 707 iterations to converge on the root within the desired precision. This result was unexpected, as the False Position Method uses more information about the function than does the Bisection Method, and thus it was expected to perform better. The Newton-Raphson Method, however, was indeed the fastest, which was expected given the sophistication of that particular method. |