from piscript.PiModule import * import math init("sinx", 400, 200) setlinejoin(1) beginpage() center() scale(2000, 80) newpath() moveto(-2,0) lineto(2,0) moveto(0,-2) lineto(0,2) stroke(1,0.5,0.5) N = 100 f = math.sin newpath() x = 2 xn = math.pi y = f(1.0/x) moveto(x, y) m = 64 dx = float(x-xn)/N for i in range(1,m): for j in range(N): x -= dx y = f(1.0/x) lineto(x, y) xn = 1.0/(math.pi*(i+1)) dx = (x - xn)/N stroke() endpage() finish()