Skip to content

Instantly share code, notes, and snippets.

@telliott99
Created October 6, 2018 19:34
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 telliott99/5269b48672cdaeca95c9c9c9d163321d to your computer and use it in GitHub Desktop.
Save telliott99/5269b48672cdaeca95c9c9c9d163321d to your computer and use it in GitHub Desktop.
'''
radius 1
inscribed square
a = (2/sqrt(2))^2 = 2
circumscribed square
A = 2^2 = 4
'''
a = 2
A = 4
s = "%5d %3.10f %3.10f"
print s % (4,a,A)
def next(a,A):
a2 = (a*A)**0.5
A2 = 2.0*(a2*A)/(a2+A)
return a2,A2
for i in range(3,17):
a,A = next(a,A)
t = (2**i, a, A)
print s % t
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment