
Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
It contains the numerical analysis method named reglua falsi or false position method python code with its output
Typology: Assignments
1 / 1
This page cannot be seen from the preview
Don't miss anything!

'Regula Falsi Method' import numpy as np import matplotlib.pyplot as plt import math def f(x): y=( 2 x)-(x 2 ) return y print('Kindly Enter Value of X1: ') X1= input() print('Kindly Enter Value of X2: ') X2= input() X1= int(X1) X2= int(X2) for i in range ( 20 ): if (f(X1)f(X2)<= 0 ): X3=( X2-(((f(X2))(X2-X1))/((f(X2))-(f(X1))))) if(f(X3)< 0 ): X1=X print(X1) else: X2=X print(X2) elif (f(X1)f(X2)>= 0 ): X3=( X2-(((f(X2))(X2-X1))/((f(X2))-(f(X1))))) if(f(X3)< 0 ): X1=X print(X1) else: X2=X print(X2) else: print('Kindly Change the values of X1 and X2 !')