Newton Raphson Method in Python - Numerical Methods

  Рет қаралды 1,051

Swanee River Learning

Swanee River Learning

Күн бұрын

Please don't forget to include the greater than/smaller than symbols in the while loop (as shown in the video) as KZbin doesn't allow me to put any 'angled brackets'.
Code:
#Problem ... find the roots of the function x2 + 2x - 15 using the Newton Raphson Method
def f(x):
return x**2 + 2*x -15
def df(x):
return 2*x + 2
#Parameters
TOL = 1.0e-10
MAX_ITER=10
itr = 0
x=-2 # initial guess
result = f(x)
#Main program
while abs(result) TOL and itr MAX_ITER:
itr+=1
result = f(x)
print('iteration',itr,'result',result)
x = x- result/df(x) #NR Formula
if abs(result) TOL:
print('Converged to',x)
else:
print('Did not converge')

Пікірлер: 1
@pixelberrychoicespodcast5861
@pixelberrychoicespodcast5861 Жыл бұрын
Omg thanks a bunch❤
Finding Zeros of Functions In Python (Bisection Method and Scipy)
15:26
THEY WANTED TO TAKE ALL HIS GOODIES 🍫🥤🍟😂
00:17
OKUNJATA
Рет қаралды 24 МЛН
When You Get Ran Over By A Car...
00:15
Jojo Sim
Рет қаралды 29 МЛН
I Can't Believe We Did This...
00:38
Stokes Twins
Рет қаралды 109 МЛН
Newton Raphson Method | Numerical Methods | Formula & Example
21:37
Dr.Gajendra Purohit
Рет қаралды 1,5 МЛН
Newton-Raphson Method | Numerical Computing in Python
17:31
mechtutor com
Рет қаралды 59 М.
How To Use Multiprocessing In Python
5:00
Taylor's Software
Рет қаралды 491
Unlocking your CPU cores in Python (multiprocessing)
12:16
mCoding
Рет қаралды 297 М.
Derivatives In PYTHON (Symbolic AND Numeric)
17:37
Mr. P Solver
Рет қаралды 47 М.
If __name__ == "__main__" for Python Developers
8:47
Python Simplified
Рет қаралды 386 М.
Newton-Raphson Method
15:10
NPTEL-NOC IITM
Рет қаралды 4,2 М.
Newton’s Method (Theory, Examples & Codes) | Numerical Methods
18:56
The ORDER BY Algorithm Is Harder Than You Think
13:46
Tony Saro
Рет қаралды 57 М.
Newton Raphson Method Using Python Programming
8:48
ELECTROMATHEMATICS
Рет қаралды 13 М.