[ create a new paste ] login | about

Link: http://codepad.org/HiS4wJAL    [ raw code | output | fork ]

Python, pasted on Dec 2:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
import math

g = 9.8
def w(L):
    return math.sqrt(g / L)

def k(L, b):
    denom = math.sqrt(g) + b * math.sqrt(L)
    return g / (denom ** 2)
    

# Let's say our first pendulum is 1 meter long, w is 3.13 radians per second
# and with 15 more pendulums we want to reach about 9.13, so 6 / 15 is 0.4
L = 1
print L, w(L)
for i in range(15):
    L = L * k(L, 0.4)
    print "L: %s, w: %s" % (L, w(L))


Output:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
1 3.1304951685
L: 0.78623945308, w: 3.5304951685
L: 0.634353794716, w: 3.9304951685
L: 0.522577803234, w: 4.3304951685
L: 0.437938240512, w: 4.7304951685
L: 0.372312407694, w: 5.1304951685
L: 0.320404082552, w: 5.5304951685
L: 0.278640450004, w: 5.9304951685
L: 0.244540452988, w: 6.3304951685
L: 0.216337617235, w: 6.7304951685
L: 0.192746586619, w: 7.1304951685
L: 0.172814033681, w: 7.5304951685
L: 0.155820812992, w: 7.9304951685
L: 0.141216174367, w: 8.3304951685
L: 0.128572569422, w: 8.7304951685
L: 0.117554000618, w: 9.1304951685


Create a new paste based on this one


Comments: