This model compares the bisection and secant methods for finding roots of 2nd order polynomials (i.e. of the form C1*x^2 + C2*x + C3). For each solution method, there is an implementation using a looping container and an implementation using a script element. The model illustrates important differences in the two methods.
Expected Results: To test several values of C1, C2 and C3, these inputs are defined as discrete stochastics with the following equal-probability values: -5, -4, -3, -2, -1, 1, 2, 3, 4 and 5. The model runs for 1000 realizations to provide good coverage of all possibilities. This results in polynomials with no real roots, one root and two roots. For comparison, expected roots are calculated in selector elements using the quadratic equation. The value -9999 is used to indicate non-real roots.
Limitations of the Two Methods: The bisection method requires two input values to be specified between which it is assumed there is a single root. In this example, the bounds for the bisection method are 1e-9 and 1e9. This means that it will only find a solution if there is a single positive root. If there are two roots or no roots between those values, then no solution will be found and the result will be set to -9999. The secant method also requires two input values to be specified to start the iterative root-finding algorithm. The initial inputs in this example are -10 and 10. If there are two roots, it is not necessarily clear, based on the two input values, which root will be found.