fredag 29 april 2011

IEEE Explore and KTH

To access IEEE Explore, etc., from my laptop:

* Connect to KTH OPEN on the wireless network, then,
change to use the KTH OPEN router to access the KTH Library


    # route change lib.kth.se 130.229.128.1
    # route change focus.lib.kth.se 130.229.128.1


Then go to lib.kth.se and look for IEEE Explore
or just go to http://focus.lib.kth.se

fredag 15 april 2011

PYPI

I couldn't resist the title of this post :-)


def pi(digits=100):
    pi_digits=""
    SCALE = 10000
    ARRINIT = 2000
    carry = 0
    arr = [ARRINIT]*(digits+1)
    for i in range(digits, 0, -14):
        sum = 0
        for j in range(i-1,0,-1):
            sum = sum * j + SCALE * arr[j]
            arr[j] = sum % (j * 2 - 1)
            sum = sum / (j * 2 - 1)
        pi_digits += "%04d" % (carry + sum / SCALE)
        carry = sum % SCALE
    return pi_digits