All pastes #915074 Raw Edit

Unnamed

public python v1 · immutable
#915074 ·published 2008-02-23 14:15 UTC
rendered paste body
n = 10nt = 10list1 = [0.0] * nlist2 = [0.0] * nlist1[1] = 5.0list2[1] = 5.0c = 1.0c2 = 0.25print "0 =>",print list1for t in range(1, nt+1):        list = [0.0] * n        for x in range(0, n):                right = x + 1                left = x - 1                if right >= n:                        vright = 0.0                else:                        vright = list1[right]                if left < 0:                        vleft = 0.0                else:                        vleft = list1[left]                list[x] = c2 * (vright + vleft - (2*list1[x])) - list2[x] + (2 * list1[x])        print "%d =>" % t,        print list        list2 = list1        list1 = listprint list