import math def angle(r, n): return r*2*math.pi/n def angular_eval(f, phi): return (f(phi)*math.cos(phi), f(phi)*math.sin(phi)) def angular_graph(f, count): return [angular_eval(f, angle(i, count)) for i in range(count)] def circle(r): return lambda phi: r def rose(n): return lambda phi: math.cos(n*phi) + 2 if __name__ == "__main__": tests = [angular_graph(circle(1), 20), angular_graph(rose(4), 20)] print len(tests) print for test in tests: print len(test) for p in test: print p[0], p[1]