Created
October 1, 2023 00:03
-
-
Save debpu06/5eea2e89dd2ade292a3f57eb8bf60874 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def q6(): | |
#Starting point | |
eps = .000001 #specify the convergence criteria | |
#Step 1: initial guess x0 | |
x0=0 | |
#Step 2: compute x1 by applying the function | |
def BR(q): #this is our function of interest | |
return 1+0.1*q | |
x1 = BR(x0) #new guess | |
#Step 3: iterate | |
while abs(x1-x0)>eps: | |
x0=x1 | |
x1=BR(x0) | |
print("New guess:",x1) | |
print(x1) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment