def schwarz_christoffel_coeff(points): a = exp(2j*pi*linspace(0, 1, len(points), endpoint=False)) a.shape = (1, -1) p = [points[-1]] + points + points[0:1] b = array([ (angle( (p[k-1]-p[k])/(p[k+1]-p[k]) )/pi)%2.0 - 1.0 for k in xrange(1, len(p)-1) ]) b.shape = (1,-1) return (a,b)
if loop: pa.append(path.closepath()) return pa # Get transformation coefficients, and print them out figure = figures[opts.figure] a, b = schwarz_christoffel_coeff(figure) print a print b+1.0 # Set up discretization points for the grid M = opts.M N = opts.N * len(figure) R = 1.0 - 2**linspace(0, -M, M+1, endpoint=True) Theta = linspace(0, 2*pi, N, endpoint=False) if not opts.show_domain: # Compute f(z) over grid W = zeros(shape=(M, N), dtype=complex) for v in xrange(0, N): Z = R * exp(1j*Theta[v]) for u in xrange(0, M): W[u,v] = gauss_quad32(schwarz_christoffel_integrand, (a, b, Z[u], Z[u+1]-Z[u])) W = cumsum(W, axis=0) else: # Domain contours are just concentric circles W = 36.0 * R[1:].reshape(-1,1) * exp(1j*Theta).reshape(1,-1)