0% found this document useful (0 votes)
38 views6 pages

Programming Project: 2: Analyzing Various Non-Linear Equation Solvers

A report on finding the root to 2 specific non-linear equations using the bisection, secant, modified-secant, newton's method, and false-position methods.

Uploaded by

John
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
38 views6 pages

Programming Project: 2: Analyzing Various Non-Linear Equation Solvers

A report on finding the root to 2 specific non-linear equations using the bisection, secant, modified-secant, newton's method, and false-position methods.

Uploaded by

John
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 6

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.

Function 1: f(x) = 2x – 11.7x + 17.7x – 5


3 2
a = 0,b =1 x0=0.5,x1=0.75 x=0.5,D=0.1 x=0 xl=0,xu=1
a=1.5,b=2.5 x0=1.5,x1=2.5 x=1.5,D=0.1 x=1.5 xl=2.5,xu=1.5
a=3,b=4 x0=3,x1=4 x=3,D=0.1 x=4 xl=3,xu=4

Function 2: f(x) = x + 10 – xcosh(50/x)


a=120,b=130 x0=120,x1=130 x=120,D=0.1 x=120 xl=120,xu=130

You might also like