Skip to content

Instantly share code, notes, and snippets.

@debpu06
Created October 1, 2023 00:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save debpu06/5eea2e89dd2ade292a3f57eb8bf60874 to your computer and use it in GitHub Desktop.
Save debpu06/5eea2e89dd2ade292a3f57eb8bf60874 to your computer and use it in GitHub Desktop.
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