Created
May 1, 2009 05:36
-
-
Save bemasher/104889 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
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