Programming Project: 2: Analyzing Various Non-Linear Equation Solvers
Programming Project: 2: Analyzing Various Non-Linear Equation Solvers
CS 301
John Paul Abdou
Data Structures Used:
I defined a Function class to abstract away the arithmetic involved in evaluating each function at
a given point. I included the member functions evaluate( ) and derivative( ) which returned the
values necessary to carry out the various algorithms. The implementation for bisection, secant,
modified secant, newton-raphson, and false position methods are each within a separate static
member function located within the RootFinder class. I outputted the result of the algorithms
into a csv file for ease of interpreting the data. This was done using the PrintWriter class.
Remarks:
The starting values for each algorithm was determined by observing the graphs which were made
in excel. The bisection method took the most iterations and in many cases very slowly converged
towards the root. The Secant and Newton methods at times diverged based on the specific
starting values. I adjusted the values until the secant method converged. The Modified Secant
method would at times produce extremely small approximations that could not be represented in
floating point representation. This would cause a NaN approximation. This was also remedied by
adjusting the starting values. Another interesting observation was that for function 2 all
algorithms converged very quickly to the root no matter how much I changed their starting
values.