This file contains hidden or 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 sys | |
from fractions import Fraction | |
prog, name, reps, lead = sys.argv[:4] | |
lead, reps = int(lead), int(reps) | |
L = [Fraction(s) for s in sys.argv[4:]] | |
L = L * reps | |
pL = [] | |
def add_invert(n,d): |
This file contains hidden or 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
from matplotlib import pyplot as plt | |
import sys, random | |
N = int(sys.argv[1]) | |
n = 100 | |
L = list() | |
for i in range(N): | |
count = 0 | |
prev = 0 |
This file contains hidden or 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
from matplotlib import pyplot as plt | |
import random | |
N = 10000 | |
n = 100 | |
L = list() | |
tL = list() | |
v = 0 | |
for i in range(N): |
This file contains hidden or 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
from matplotlib import pyplot as plt | |
import sys, random | |
k = int(sys.argv[1]) | |
N = 100000 | |
L = list() | |
for i in range(N): | |
v = 0 |
This file contains hidden or 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, operator | |
N = 1000 | |
R = range(2,N) | |
D = dict() | |
for x in R: | |
D[x] = x**2 | |
def is_square(x): |
This file contains hidden or 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,sys | |
try: | |
N = int(sys.argv[1]) + 1 | |
except: | |
print('enter the last value') | |
sys.exit() | |
R = range(2,N) |
This file contains hidden or 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 | |
from operator import itemgetter | |
t = math.pi | |
N = 1000 | |
def find_bounds(d): | |
p = d*t | |
m = int(p) | |
n = m + 1 |
This file contains hidden or 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 sys, math | |
try: | |
r = int(sys.argv[1]) | |
R = range(r) | |
except: | |
print('enter the number of cycles') | |
sys.exit() | |
def f(sin,cos): | |
cot = cos/sin |
This file contains hidden or 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
n = 5 | |
s = 6 | |
cot = 3**0.5 | |
csc = 2 | |
for i in range(n): | |
Co = s/cot | |
Ci = s/csc | |
print(i + 1, '%3.6f' % Co, '%3.6f' % Ci) | |
cot = cot + csc |
This file contains hidden or 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
from fractions import Fraction | |
N = 3 | |
def f(x): | |
h = Fraction(1,2) | |
return h * (x + N/x) | |
def g(x,y): | |
return (x*y + N)/(x + y) |
NewerOlder