Sei sulla pagina 1di 9

Newton Raphson Root Approximation GUI

Submitted by:
ALBUFERA, Thomas Gabriel
ENCARNACION, Darryl
LORENZO, Cielo Veronica
MAMARADLO, Cyrene R.
QUE CHUA, Ralph Benetton

Submitted to:
Engr. Luigi Carlo De Jesus
Introduction
The Newton-Raphson method, or Newton Method, named after Isaac Newton and Joseph
Raphson, is a method for finding successively better approximations to the roots (or zeroes) of
a real-valued function. It is one example of a root-finding algorithm. It is a powerful technique for
solving equations numerically because of rate of convergence. Like so much of the differential
calculus, it is based on the simple idea of linear approximation. The Newton Method, properly
used, usually homes in on a root with devastating efficiency. The Newton-Raphson formula
consists geometrically of extending the tangent line at a current point 𝑥𝑖 until it crosses zero, then
setting the next guess 𝑥𝑖+1to the abscissa of that zero crossing. This technique derives from the
Taylor series expansion of a function near a point.

Advantages:

 One of the fastest convergences to the root


 Converges on the root quadratically.
- Near a root, the number of significant digits approximately doubles with each
step.
- This leads to the ability of the Newton-Raphson Method to “polish” a root from
another convergence technique
 Easy to convert to multiple dimensions
 Can be used to “polish” a root found by other methods

Disadvantages:

 Must find the derivative


 Poor global convergence properties
 Dependent on initial guess
- May be too far from local root
- May encounter a zero derivative
- May loop indefinitely
Notes on Efficiency

 For efficiency the user provides the routine that evaluates both f(x) and its first
derivative at the point x.
 The Newton-Raphson formula can also be applied using a numerical difference to
approximate the true local derivative but this is not recommended.
- You are doing two function evaluations per step, so at best the super-linear
order of convergence will be only √2
- If you take dx too small, you will be wiped out by round off, while if you take
it too large, your order of convergence will be only linear, no better than using
the initial evaluation 𝑓 ` (𝑥0 ) for all subsequent steps

Objective and Purpose


 To create a Graphical User Interface that will approximate the root of a polynomial up to
5th degree using Newton Raphson Root Approximation
 To graph the user input polynomial and the trend of the approximate roots
 To display the derivative, estimated value of the root of the polynomial and the
approximate error

Significance
GUI Output

Coefficient Input Box

Derivative Output

Graph of the Polynomial and


the Root Approximation Trend

Estimated Value Output

Error Output

Solve Button

Clear Button

Close Button

Initial Value Input Box

Iteration Input Box

Figure 1. GUI Buttons and Displays


Buttons and Display Functions

 Coefficient Input Box – This box will let the user to input desired coefficients for the
fifth degree equation. The program will get the estimated root of this equation.
 Initial Value Input Box – This will let the user to input the desired initial values of
‘X’ that will be used by the program to get the estimated root of the equation.
 Iteration Input Box – The user will input his desired number of iteration that will be
displayed in the estimated value output.
 Go Button – When the user press this button, the derivative output box will quickly
display the derivative of the equation, the estimated value output will display the
estimated value and the error output will display the approximated error.
 Derivative Output – This box will display the derivative coefficients of the user’s
inputted equation.
 Estimated Value Output – This is where the estimated value will be displayed. The
values for the given equation may vary when the user changed the entered number of
iteration and the initial value.
 Error Output – The Approximated error will be displayed in this output box.
 Clear Button – This button will let the user to clear or delete all the inputs and outputs
of the program.
 Close Button – When the user press this button, the program will exit or close

Algorithm
1. Input the coefficients of the desired equation in the “Coefficient Input Box”.
2. Input the desired initial value in the “Initial Value Input Box”
3. Input the desired number of iteration for the estimated value in the “Iteration Input Box”.
4. Press “Go Button” then check for the estimated value and the Approximated error. You
may change the number of iteration to see the rate of convergence.
5. Press “Clear Button” to input new equation.
6. Press “Close Button” to close the program.
Figure 2. User Input Sample

A user input a polynomial in 5th degree with an initial value of 1 and 5 iterations. Notice that the Estimated
value display, error display and graph display is still empty since the Go button is not yet pressed.

Figure 3. Calculations are Performed

With these, it can be seen that the blue line represents the graph of the polynomial and the orange line
is the trend of the approximated root which are displayed in the figure. Also, the estimated root value os
-1.0227 and has an approximate error of 9.24.
Codes

Getting the user input in their respective order, IV to


be the number for initial value and IT for the number
of iterations

Storing the gathered data and into a variable and


multiplying it to a coefficient for respective
derivatives.

Displaying the variables fX1 to fX5 to its respective


static text display seen by the user as the derivative of
the function.

Newton Raphson root approximation algorithm


proper

Plotting the graph and displaying estimated root value


and the approximate error

Go Button Callback
Close Button Callback

Setting all the needed parameters displayed in the


static texts as blank screen

Clear Button Callback


Conclusion

With the learnings of the group regarding numerical methods in approximating a root of a function,
we therefore conclude that Newton-Raphson Method can be an ideal technique for numerical
calculations since it is fast converging to the root of equation. It can only be ideal if the initial
guess is near to the root of the equation, thus creating a great efficiency as a result. By that being
said, we conclude that the Newton-Raphson greatly depends on the initial guess being set, since
this method only requires one point to be set to start the iteration process and converge to the root
as close as possible.

In doing this project, the group was able to successfully create a GUI that approximate the root of
a polynomial up to 5th degree using Newton Raphson Root Approximation and display the
estimated root and its approximate error. Also, the derivative of the user input polynomial is
displayed.

Potrebbero piacerti anche