SlideShare a Scribd company logo
Department of Computer Science
Gujarat University
Presentation
on
Finding Roots of Equations by Numerical Methods
& Calculate Avg. Time
Prepared By :
Rajan Thakkar (10017)
Parth Karkar (10013)
Dhyanesh Bhanderi (10005)
M.sc.(Artificial Intelligence & Machine Learning)
Under the Guidance of :
Dr. Savita Gandhi
Introduction to Numerical Methods
▪ The determination of the roots of an equation is one of the oldest problems in
mathematics & there have been many efforts in this regard.
▪ We learned numerical methods for finding roots of an equations. They represent
the values of x that make f(X) equal to zero.
▪ Thus, we can define the roots of an equation as the value of an equation as the
value of x that makes f(x) = 0.
▪ Roots are sometime called the zeros of equation. Root
F(x)=0
Introduction to Numerical Methods
1. Bracketing Methods (Need two initial
estimates that will bracket the root.
Always converge.)
a. Bisection Method
b. False-Position Method
1. Open Methods (Need one or two initial
estimates. May diverge.)
a. Newton-Raphson Method (Needs
the derivative of the function.)
b. Secant Method
Objectives
▪ Find solutions of Non-Liner equation and Liner Equation (User can Input)
▪ Derive the formula and follow the algorithms for the solutions of equations using
the following methods:
1. Bisection
2. False-Position
3. Secant
4. Newton-Raphson
▪ Average time Take by all the method in python as well as c++ So, we can predict
the performance.
▪ Graphical representation for better understand
Problem Statement
▪ Write a Python program to find the roots of an equation of any non-liner , liner
equation & use four different methods and find the root plus find the average
time taken by each method.(Menu driven Program )
 User will also input the first and second point.
 Also user can do new equation in the program.
 Output is view as Tabular format.
 Graphical representation of Four numerical method
 We also create c++ program for checking which language evaluation is faster.
 Note:- we also use the Kotlin Language which is use to create a mobile application so, we create a mobile application and run
all four method and also check the evaluation time
Bisection Method Algorithm
1. Start.
2. Define function f(X).
3. Choose initial guesses x0 and x1 such that f(x0)f(x1)<0.
4. Choose pre specified tolerable error e.(0.0001->4 significant digit)
5. Calculate new approximated root as x2 = (x0 + x1)/2
6. Calculate f(x0)f(x2)
a. if f(x0)f(x2) < 0 then x0 = x0 and x1 = x2
b. if f(x0)f(x2) > 0 then x0 = x2 and x1 = x1
c. if f(x0)f(x2) = 0 then go to (8)
7. if |f(x2)| > e then go to (5) otherwise go to (8)
8. Display x2 as root
9. Stop
False-Position Method Algorithm
1. Start
2. Define function f(x)
3. Choose initial guesses x0 and x1 such that f(x0)f(x1) < 0
4. Choose pre-specified tolerable error e.
5. Calculate new approximated root as:
x2 = x1 * f(x2) – x2*f(x1) / f(x2) – f(x1)
6. Calculate f(x0)f(x2)
a. if f(x0)f(x2) < 0 then x0 = x0 and x1 = x2
b. if f(x0)f(x2) > 0 then x0 = x2 and x1 = x1
c. if f(x0)f(x2) = 0 then go to (8)
7. if |f(x2)|>e then go to (5) otherwise go to (8)
8. Display x2 as root.
9. Stop
Secant Method Algorithm
1. Start
2. Define function as f(x)
3. Input initial guesses (x0 and x1), tolerable error (e) and maximum iteration (N)
4. Initialize iteration counter i = 1
5. If f(x0) = f(x1) then print "Mathematical Error" and go to (11) otherwise go to (6)
6. Calculate x2 = x1 - (x1-x0) * f(x1) / ( f(x1) - f(x0) )
7. Increment iteration counter i = i + 1
8. If i >= N then print "Not Convergent" and goto (11) otherwise goto (9)
9. If |f(x2)| > e then set x0 = x1, x1 = x2 and goto (5) otherwise goto (10)
10. Print root as x2
11. Stop
Newton Raphson Method Algorithm
1. Start
2. Define function as f(x)
3. Define first derivative of f(x) as g(x)
4. Input initial guess (x0), tolerable error (e) and maximum iteration (N
5. Initialize iteration counter i = 1
6. If g(x0) = 0 then print "Mathematical Error" and goto (12) otherwise goto (7)
7. Calculate x1 = x0 - f(x0) / g(x0)
8. Increment iteration counter i = i + 1
9. If i >= N then print "Not Convergent" and go to (12) otherwise go to (10)
10. If |f(x1)| > e then set x0 = x1 and go to (6) otherwise go to (11)
11. Print root as x1
12. Stop
Time Module
▪ Time Module to calculate the execution time of every method every iteration
and after calculate average of all iteration of every method.
▪ We use perf_counter() method to calculate the time.
▪ Basically it will work like counter when we start function than we called this function
and when function over then we store value of end time.
▪ Than we difference two of them and we find the total time take by that function
import time
start_time = time.perf_counter()
if f(x1) * f(x2) < 0.0:
...
else:
…
end_time = time.perf_counter()
diff=end_time - start_time
print(f"Execution Time is : {diff:0.6f} seconds")
Graph Plotting
import matplotlib.pyplot as plt
matplotlib library which have pyplot module so that we can use graph in python
def graph(ls):
plt.plot(*zip(*sorted(ls.items())))
# sorted() sorted by key, return a list of tuples
# Zip() unpack a list of pairs into two tuples
# items() Function show keys and values
#Spines are the lines connecting the axis tick marks and noting the boundaries of the data area.
ax.spines['right'].set_position('center')
Graph Plotting
ax.set_ylim([-20, 20])
#ylim() Function. The ylim() function in pyplot module of
#matplotlib library is used to get or set the y-limits of the current axes
plt.title('Numerical Methods ')
plt.show() #Show() use for display the graph
Above is the function which have one argument that is dictionary (ls) which have new point as key
and their point’s function evolution as value.
ls = dict()
ls.update({x3:f(fu,x3)}) so, this is the way to show the graph of each of the numerical method
Input Screen (which user can give an equation)
Menu For Different operation
OUTPUT FOR BISECTION METHOD
ENTER NEW COEFFICIENT
OUTPUT FOR FALSE POSITION METHOD
OUTPUT FOR SECANT METHOD
OUTPUT FOR NEWTON RAPHSON METHOD
RESULT(FOR AVERAGE TIMING)
Graph Bisection
X Axis – new Iteration value
Y Axis - F(x) where x = new iteration value
Graph False Position Method
X Axis – new Iteration value
Y Axis - F(x) where x = new iteration value
Graph Secant Method
X Axis – new Iteration value
Y Axis - F(x) where x = new iteration value
Graph Newton Raphson Method
X Axis – new Iteration value
Y Axis - F(x) where x = new iteration value
Kotlin Application Output (App)
Comparisons between C++ & Python & Kotlin (App)
(Time Wise)
x*x*x+x*x+x+1
x1=8
x2=-3 0.0001
Python C++ Kotlin(App)
Bisection 0.004 0.073 0.050016
False Position 0.327 0.521 0.133367
Secant 0.0035 0.023 0.009437
Newton
Raphson 0.098 0.047 0.026898
0.004
0.327
0.0035
0.098
0.073
0.521
0.023
0.047
0.050016
0.133367
0.009437
0.026898
0
0.1
0.2
0.3
0.4
0.5
0.6
Bisection False Position Secant Newton Raphson
Time Wise Compare
Python C++ Kotlin
Comparisons between C++ & Python
(Time Wise)
▪ 1
0.076627
0.499501
0.047569
0.352328
0.157
1.186
0.141
0.093
0
0.2
0.4
0.6
0.8
1
1.2
1.4
Bisection False potion Secant Newton
Eqution X^3 + X^2 + X +7
Initial Guess a=-8 b=3
python cpp
Comparisons between C++ & Python
(Time Wise)
▪ 2
0.036425
0.028661
0.022824
0.158344
0.069
0.084
0.068 0.068
0
0.02
0.04
0.06
0.08
0.1
0.12
0.14
0.16
0.18
Bisection False potion Secant Newton
Eqution X^2 + 2*x -4
Initial Guess a=1 b=2
python cpp
Comparisons between C++ & Python
(Time Wise)
▪ 3
0.048465
0.020706 0.017874
0.152216
0.131
0.1
0.078
0.062
0
0.02
0.04
0.06
0.08
0.1
0.12
0.14
0.16
Bisection False potion Secant Newton
Eqution sin(x) - 3*x
Initial Guess a=-1 b=2
python cpp
Comparisons between C++ & Python
(Time Wise) avg. of above 3
▪ 4
0.053839
0.182956
0.029422
0.220962
0.119
0.456
0.956
0.074
0
0.2
0.4
0.6
0.8
1
1.2
Bisection False potion Secant Newton
3 Equation Compare x axis- Method
y axis- Time (sec)
Python C++
Comparisons of iteration for each method
▪ ITERATION
19
15
12
106
6 5
11
3 4
7
3 3
0
20
40
60
80
100
120
X^3 + x^2 +x +7 Sin(x) - 3*x X*x +2*x -4
bisection false-position secant newton
CONCLUSION
▪ FROM ABOVE OBSERVATIONS WE CONCLUDE THAT AVERAGE TIME TAKEN
BY THE SECANT METHOD IS LESS AMONG ALL THE METHOD (IN PYTHON).
▪ AND AVERAGE TIME TAKEN BY THE NEWTON RAPSHON MATHOD IS LESS
AMONG THE ALL METHOD (IN C++).
▪ AND AVERAGE TIME TAKEN BY PYTHON IS LESS THEN THE C++.
▪ PYTHON IS FASTER THEN C++ TO SOLVE THE NUMARICAL METHODS.
▪ ALSO WE CAN CONCLUDE THAT NEWTON RAPSHON METHOD HAVE LESS
ITERATION IN BOTH PYTHON AND C++.
Future Details
1. Using Django, we can also put this method online or create webpage.
2. Automatically Take an initial guess of method.
3. Use ML algorithm or method to solve an equation
References
▪ https://www.codesansar.com/numerical-methods/ (1)
▪ Introductory methods of numerical analysis , Sastry, S.S. , , PHI Learning
Private Limited ,2015 (2)
▪ https://www.epythonguru.com/2019/12/how-to-find-derivatives-in-
python.html (3)
THANK YOU

More Related Content

PPTX
Quality Python Homework Help
PPTX
Quality Python Homework Help
PPTX
Mechanical Engineering Homework Help
PDF
A taste of Functional Programming
PDF
Rethink programming: a functional approach
PDF
Simple IO Monad in 'Functional Programming in Scala'
PDF
Amcat automata questions
PDF
Fp in scala part 2
Quality Python Homework Help
Quality Python Homework Help
Mechanical Engineering Homework Help
A taste of Functional Programming
Rethink programming: a functional approach
Simple IO Monad in 'Functional Programming in Scala'
Amcat automata questions
Fp in scala part 2

What's hot (20)

PDF
Introduction to functional programming using Ocaml
PPTX
Introduction to Monads in Scala (2)
PPTX
Algorithms DM
PPTX
statistics assignment help
PDF
N-Queens Combinatorial Problem - Polyglot FP for fun and profit - Haskell and...
PDF
Scala. Introduction to FP. Monads
PDF
Cs101 endsem 2014
PPT
PDF
Monoids - Part 1 - with examples using Scalaz and Cats
DOC
White box-sol
PPT
Ch5(loops)
PDF
The Functional Programming Triad of Folding, Scanning and Iteration - a first...
PDF
Gentle Introduction to Functional Programming
PDF
Monoids - Part 2 - with examples using Scalaz and Cats
PPTX
FUNCTIONS IN PYTHON[RANDOM FUNCTION]
PPTX
DATA TYPE IN PYTHON
Introduction to functional programming using Ocaml
Introduction to Monads in Scala (2)
Algorithms DM
statistics assignment help
N-Queens Combinatorial Problem - Polyglot FP for fun and profit - Haskell and...
Scala. Introduction to FP. Monads
Cs101 endsem 2014
Monoids - Part 1 - with examples using Scalaz and Cats
White box-sol
Ch5(loops)
The Functional Programming Triad of Folding, Scanning and Iteration - a first...
Gentle Introduction to Functional Programming
Monoids - Part 2 - with examples using Scalaz and Cats
FUNCTIONS IN PYTHON[RANDOM FUNCTION]
DATA TYPE IN PYTHON
Ad

Similar to Finding root of equation (numarical method) (20)

PPTX
Lecture 5 – Computing with Numbers (Math Lib).pptx
PPTX
Lecture 5 – Computing with Numbers (Math Lib).pptx
PPTX
PDF
Numerical differentation with c
PDF
Monadologie
DOCX
PPS 7.7 RECURSION, AS A DIFFERENT WAY OF SOLVING PROBLEMS. EXAMPLE PROGRAMS
PDF
PythonOOP
PPTX
Machine Learning - Introduction to Tensorflow
PDF
Excel macro for solving a polynomial equation
PDF
me310_6_interpolation.pdf for numerical method
PDF
Vina Score and Vin Min for almost all the models 2024
PDF
Mutation @ Spotify
PPTX
10. Recursion
PPTX
Столпы функционального программирования для адептов ООП, Николай Мозговой
PPTX
Basic Python Programs, Python Fundamentals.pptx
DOCX
error 2.pdf101316, 6(46 PM01_errorPage 1 of 5http.docx
PDF
C++ Course - Lesson 2
PDF
Recitation2IntroductionToPython.pptx.pdf
PDF
Introduction to comp.physics ch 3.pdf
Lecture 5 – Computing with Numbers (Math Lib).pptx
Lecture 5 – Computing with Numbers (Math Lib).pptx
Numerical differentation with c
Monadologie
PPS 7.7 RECURSION, AS A DIFFERENT WAY OF SOLVING PROBLEMS. EXAMPLE PROGRAMS
PythonOOP
Machine Learning - Introduction to Tensorflow
Excel macro for solving a polynomial equation
me310_6_interpolation.pdf for numerical method
Vina Score and Vin Min for almost all the models 2024
Mutation @ Spotify
10. Recursion
Столпы функционального программирования для адептов ООП, Николай Мозговой
Basic Python Programs, Python Fundamentals.pptx
error 2.pdf101316, 6(46 PM01_errorPage 1 of 5http.docx
C++ Course - Lesson 2
Recitation2IntroductionToPython.pptx.pdf
Introduction to comp.physics ch 3.pdf
Ad

Recently uploaded (20)

PPTX
1_Introduction to advance data techniques.pptx
PPTX
mbdjdhjjodule 5-1 rhfhhfjtjjhafbrhfnfbbfnb
PPTX
Acceptance and paychological effects of mandatory extra coach I classes.pptx
PDF
“Getting Started with Data Analytics Using R – Concepts, Tools & Case Studies”
PPT
Miokarditis (Inflamasi pada Otot Jantung)
PPTX
advance b rammar.pptxfdgdfgdfsgdfgsdgfdfgdfgsdfgdfgdfg
PDF
Galatica Smart Energy Infrastructure Startup Pitch Deck
PDF
annual-report-2024-2025 original latest.
PDF
.pdf is not working space design for the following data for the following dat...
PDF
22.Patil - Early prediction of Alzheimer’s disease using convolutional neural...
PDF
Foundation of Data Science unit number two notes
PPTX
Introduction to Firewall Analytics - Interfirewall and Transfirewall.pptx
PPTX
Introduction-to-Cloud-ComputingFinal.pptx
PPT
Reliability_Chapter_ presentation 1221.5784
PPTX
Microsoft-Fabric-Unifying-Analytics-for-the-Modern-Enterprise Solution.pptx
PPTX
Introduction to Knowledge Engineering Part 1
PDF
Recruitment and Placement PPT.pdfbjfibjdfbjfobj
PPT
Quality review (1)_presentation of this 21
PPTX
Business Acumen Training GuidePresentation.pptx
PDF
TRAFFIC-MANAGEMENT-AND-ACCIDENT-INVESTIGATION-WITH-DRIVING-PDF-FILE.pdf
1_Introduction to advance data techniques.pptx
mbdjdhjjodule 5-1 rhfhhfjtjjhafbrhfnfbbfnb
Acceptance and paychological effects of mandatory extra coach I classes.pptx
“Getting Started with Data Analytics Using R – Concepts, Tools & Case Studies”
Miokarditis (Inflamasi pada Otot Jantung)
advance b rammar.pptxfdgdfgdfsgdfgsdgfdfgdfgsdfgdfgdfg
Galatica Smart Energy Infrastructure Startup Pitch Deck
annual-report-2024-2025 original latest.
.pdf is not working space design for the following data for the following dat...
22.Patil - Early prediction of Alzheimer’s disease using convolutional neural...
Foundation of Data Science unit number two notes
Introduction to Firewall Analytics - Interfirewall and Transfirewall.pptx
Introduction-to-Cloud-ComputingFinal.pptx
Reliability_Chapter_ presentation 1221.5784
Microsoft-Fabric-Unifying-Analytics-for-the-Modern-Enterprise Solution.pptx
Introduction to Knowledge Engineering Part 1
Recruitment and Placement PPT.pdfbjfibjdfbjfobj
Quality review (1)_presentation of this 21
Business Acumen Training GuidePresentation.pptx
TRAFFIC-MANAGEMENT-AND-ACCIDENT-INVESTIGATION-WITH-DRIVING-PDF-FILE.pdf

Finding root of equation (numarical method)

  • 1. Department of Computer Science Gujarat University Presentation on Finding Roots of Equations by Numerical Methods & Calculate Avg. Time Prepared By : Rajan Thakkar (10017) Parth Karkar (10013) Dhyanesh Bhanderi (10005) M.sc.(Artificial Intelligence & Machine Learning) Under the Guidance of : Dr. Savita Gandhi
  • 2. Introduction to Numerical Methods ▪ The determination of the roots of an equation is one of the oldest problems in mathematics & there have been many efforts in this regard. ▪ We learned numerical methods for finding roots of an equations. They represent the values of x that make f(X) equal to zero. ▪ Thus, we can define the roots of an equation as the value of an equation as the value of x that makes f(x) = 0. ▪ Roots are sometime called the zeros of equation. Root F(x)=0
  • 3. Introduction to Numerical Methods 1. Bracketing Methods (Need two initial estimates that will bracket the root. Always converge.) a. Bisection Method b. False-Position Method 1. Open Methods (Need one or two initial estimates. May diverge.) a. Newton-Raphson Method (Needs the derivative of the function.) b. Secant Method
  • 4. Objectives ▪ Find solutions of Non-Liner equation and Liner Equation (User can Input) ▪ Derive the formula and follow the algorithms for the solutions of equations using the following methods: 1. Bisection 2. False-Position 3. Secant 4. Newton-Raphson ▪ Average time Take by all the method in python as well as c++ So, we can predict the performance. ▪ Graphical representation for better understand
  • 5. Problem Statement ▪ Write a Python program to find the roots of an equation of any non-liner , liner equation & use four different methods and find the root plus find the average time taken by each method.(Menu driven Program )  User will also input the first and second point.  Also user can do new equation in the program.  Output is view as Tabular format.  Graphical representation of Four numerical method  We also create c++ program for checking which language evaluation is faster.  Note:- we also use the Kotlin Language which is use to create a mobile application so, we create a mobile application and run all four method and also check the evaluation time
  • 6. Bisection Method Algorithm 1. Start. 2. Define function f(X). 3. Choose initial guesses x0 and x1 such that f(x0)f(x1)<0. 4. Choose pre specified tolerable error e.(0.0001->4 significant digit) 5. Calculate new approximated root as x2 = (x0 + x1)/2 6. Calculate f(x0)f(x2) a. if f(x0)f(x2) < 0 then x0 = x0 and x1 = x2 b. if f(x0)f(x2) > 0 then x0 = x2 and x1 = x1 c. if f(x0)f(x2) = 0 then go to (8) 7. if |f(x2)| > e then go to (5) otherwise go to (8) 8. Display x2 as root 9. Stop
  • 7. False-Position Method Algorithm 1. Start 2. Define function f(x) 3. Choose initial guesses x0 and x1 such that f(x0)f(x1) < 0 4. Choose pre-specified tolerable error e. 5. Calculate new approximated root as: x2 = x1 * f(x2) – x2*f(x1) / f(x2) – f(x1) 6. Calculate f(x0)f(x2) a. if f(x0)f(x2) < 0 then x0 = x0 and x1 = x2 b. if f(x0)f(x2) > 0 then x0 = x2 and x1 = x1 c. if f(x0)f(x2) = 0 then go to (8) 7. if |f(x2)|>e then go to (5) otherwise go to (8) 8. Display x2 as root. 9. Stop
  • 8. Secant Method Algorithm 1. Start 2. Define function as f(x) 3. Input initial guesses (x0 and x1), tolerable error (e) and maximum iteration (N) 4. Initialize iteration counter i = 1 5. If f(x0) = f(x1) then print "Mathematical Error" and go to (11) otherwise go to (6) 6. Calculate x2 = x1 - (x1-x0) * f(x1) / ( f(x1) - f(x0) ) 7. Increment iteration counter i = i + 1 8. If i >= N then print "Not Convergent" and goto (11) otherwise goto (9) 9. If |f(x2)| > e then set x0 = x1, x1 = x2 and goto (5) otherwise goto (10) 10. Print root as x2 11. Stop
  • 9. Newton Raphson Method Algorithm 1. Start 2. Define function as f(x) 3. Define first derivative of f(x) as g(x) 4. Input initial guess (x0), tolerable error (e) and maximum iteration (N 5. Initialize iteration counter i = 1 6. If g(x0) = 0 then print "Mathematical Error" and goto (12) otherwise goto (7) 7. Calculate x1 = x0 - f(x0) / g(x0) 8. Increment iteration counter i = i + 1 9. If i >= N then print "Not Convergent" and go to (12) otherwise go to (10) 10. If |f(x1)| > e then set x0 = x1 and go to (6) otherwise go to (11) 11. Print root as x1 12. Stop
  • 10. Time Module ▪ Time Module to calculate the execution time of every method every iteration and after calculate average of all iteration of every method. ▪ We use perf_counter() method to calculate the time. ▪ Basically it will work like counter when we start function than we called this function and when function over then we store value of end time. ▪ Than we difference two of them and we find the total time take by that function import time start_time = time.perf_counter() if f(x1) * f(x2) < 0.0: ... else: … end_time = time.perf_counter() diff=end_time - start_time print(f"Execution Time is : {diff:0.6f} seconds")
  • 11. Graph Plotting import matplotlib.pyplot as plt matplotlib library which have pyplot module so that we can use graph in python def graph(ls): plt.plot(*zip(*sorted(ls.items()))) # sorted() sorted by key, return a list of tuples # Zip() unpack a list of pairs into two tuples # items() Function show keys and values #Spines are the lines connecting the axis tick marks and noting the boundaries of the data area. ax.spines['right'].set_position('center')
  • 12. Graph Plotting ax.set_ylim([-20, 20]) #ylim() Function. The ylim() function in pyplot module of #matplotlib library is used to get or set the y-limits of the current axes plt.title('Numerical Methods ') plt.show() #Show() use for display the graph Above is the function which have one argument that is dictionary (ls) which have new point as key and their point’s function evolution as value. ls = dict() ls.update({x3:f(fu,x3)}) so, this is the way to show the graph of each of the numerical method
  • 13. Input Screen (which user can give an equation)
  • 14. Menu For Different operation
  • 17. OUTPUT FOR FALSE POSITION METHOD
  • 19. OUTPUT FOR NEWTON RAPHSON METHOD
  • 21. Graph Bisection X Axis – new Iteration value Y Axis - F(x) where x = new iteration value
  • 22. Graph False Position Method X Axis – new Iteration value Y Axis - F(x) where x = new iteration value
  • 23. Graph Secant Method X Axis – new Iteration value Y Axis - F(x) where x = new iteration value
  • 24. Graph Newton Raphson Method X Axis – new Iteration value Y Axis - F(x) where x = new iteration value
  • 26. Comparisons between C++ & Python & Kotlin (App) (Time Wise) x*x*x+x*x+x+1 x1=8 x2=-3 0.0001 Python C++ Kotlin(App) Bisection 0.004 0.073 0.050016 False Position 0.327 0.521 0.133367 Secant 0.0035 0.023 0.009437 Newton Raphson 0.098 0.047 0.026898 0.004 0.327 0.0035 0.098 0.073 0.521 0.023 0.047 0.050016 0.133367 0.009437 0.026898 0 0.1 0.2 0.3 0.4 0.5 0.6 Bisection False Position Secant Newton Raphson Time Wise Compare Python C++ Kotlin
  • 27. Comparisons between C++ & Python (Time Wise) ▪ 1 0.076627 0.499501 0.047569 0.352328 0.157 1.186 0.141 0.093 0 0.2 0.4 0.6 0.8 1 1.2 1.4 Bisection False potion Secant Newton Eqution X^3 + X^2 + X +7 Initial Guess a=-8 b=3 python cpp
  • 28. Comparisons between C++ & Python (Time Wise) ▪ 2 0.036425 0.028661 0.022824 0.158344 0.069 0.084 0.068 0.068 0 0.02 0.04 0.06 0.08 0.1 0.12 0.14 0.16 0.18 Bisection False potion Secant Newton Eqution X^2 + 2*x -4 Initial Guess a=1 b=2 python cpp
  • 29. Comparisons between C++ & Python (Time Wise) ▪ 3 0.048465 0.020706 0.017874 0.152216 0.131 0.1 0.078 0.062 0 0.02 0.04 0.06 0.08 0.1 0.12 0.14 0.16 Bisection False potion Secant Newton Eqution sin(x) - 3*x Initial Guess a=-1 b=2 python cpp
  • 30. Comparisons between C++ & Python (Time Wise) avg. of above 3 ▪ 4 0.053839 0.182956 0.029422 0.220962 0.119 0.456 0.956 0.074 0 0.2 0.4 0.6 0.8 1 1.2 Bisection False potion Secant Newton 3 Equation Compare x axis- Method y axis- Time (sec) Python C++
  • 31. Comparisons of iteration for each method ▪ ITERATION 19 15 12 106 6 5 11 3 4 7 3 3 0 20 40 60 80 100 120 X^3 + x^2 +x +7 Sin(x) - 3*x X*x +2*x -4 bisection false-position secant newton
  • 32. CONCLUSION ▪ FROM ABOVE OBSERVATIONS WE CONCLUDE THAT AVERAGE TIME TAKEN BY THE SECANT METHOD IS LESS AMONG ALL THE METHOD (IN PYTHON). ▪ AND AVERAGE TIME TAKEN BY THE NEWTON RAPSHON MATHOD IS LESS AMONG THE ALL METHOD (IN C++). ▪ AND AVERAGE TIME TAKEN BY PYTHON IS LESS THEN THE C++. ▪ PYTHON IS FASTER THEN C++ TO SOLVE THE NUMARICAL METHODS. ▪ ALSO WE CAN CONCLUDE THAT NEWTON RAPSHON METHOD HAVE LESS ITERATION IN BOTH PYTHON AND C++.
  • 33. Future Details 1. Using Django, we can also put this method online or create webpage. 2. Automatically Take an initial guess of method. 3. Use ML algorithm or method to solve an equation
  • 34. References ▪ https://www.codesansar.com/numerical-methods/ (1) ▪ Introductory methods of numerical analysis , Sastry, S.S. , , PHI Learning Private Limited ,2015 (2) ▪ https://www.epythonguru.com/2019/12/how-to-find-derivatives-in- python.html (3)