This conformal mapping developed in the 1860s by Hermann Schwarz and Elwin Christoffel can be used to map a circle to a square and vice versa.
The equations for mapping the circular disc to a square region (and vice versa) are:
z = x + y i
w = u + v i
F is the Legendre elliptic integral of the 1st kind.
cn is a Jacobi elliptic function.
Ke is the complete elliptic integral of the 1st kind with parameter m = ½
(x,y) are coordinates on the square
(u,v) are coordinates on the circular disc
See Section 7 of my paper (page 19) for an explanation of the formulas
Here is an example image of using the Schwarz-Christoffel mapping on a square chessboard
and another on MC Escher's "Circle Limit IV"; i.e. angels and devils inside the Poincare disk.
|Schwarz-Christoffel for squared Circle Limit IV|
Note that the Jacobi cn() function is an even function, so cn(x,k) = cn(-x,k).