Skip to content

Instantly share code, notes, and snippets.

@bemasher
Created May 1, 2009 05:36
Show Gist options
  • Save bemasher/104889 to your computer and use it in GitHub Desktop.
Save bemasher/104889 to your computer and use it in GitHub Desktop.
import math
res_val = 19872
approx_list = []
parallel = lambda r1, r2: float(r1 * r2) / float(r1 + r2)
for sig in range(0, 4):
if len(approx_list) > 0:
pass
else:
for r1 in stockroom[len(stockroom) / 2:]:
for r2 in stockroom:
if math.trunc(parallel(r1, r2) / (10**sig)) == math.trunc(float(res_val) / (10**sig)):
if (r2, r1, parallel(r1, r2)) not in approx_list:
approx_list.append((r1, r2, parallel(r1, r2)))
for r1, r2, req in approx_list:
print '\t'.join([str(r1), str(r2), str(req)])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment