Complex transformation that transforms a square into a circle. Bonjour.
I’m looking for a conformal mapping that transform a square into a circle, a cube into a sphere, eventually a rectangle into an ellipse.
 A: If you have some knowledge about complex integration, here is a function that maps the open unit disk onto the open square with vertices $K(\pm 1 \pm i)$.
$$z_0 \ \to \ Z=\varphi(z_0)=\int_{[0,z_0]}\frac{dz}{\sqrt{1+z^4}}\tag{1}$$
($[0,z_0]$ denotes the line segment from $0$ to $z_0$).
and $K=0.927037...=\int_0^1 \frac{dx}{\sqrt{1+x^4}}$ (real integral).
See on Fig. 1 a representation of the action of $\varphi$ on a polar grid.
It is a conformal mapping (with the meaning of angles preservation) : look at red and blue curves ; after the transformation, their right angles are preserved). BUT a conformal transformation isn't an isometry : it doesn't preserve distances.
Function $\varphi$ defined in (1) is an elliptic function (or more exactly the inverse of an elliptic function).

Fig. 1.
Different remarks :

*

*The poles of $\dfrac{1}{\sqrt{1+z^4}}$ are the four 4th roots of $-1$, i.e., the vertices of a square at $K'(\pm 1 \pm i)$ where $K'=\tfrac{1}{\sqrt{2}}$. We could have used integrand $\dfrac{1}{\sqrt{1-z^4}}$ instead ; the resulting transformation differs from $\varphi$ by a rotation with angle $\pi/4$.


*A nice application of this transformation : mapping in the geographical meaning of the word : it is the "Peirce projection" map (https://en.wikipedia.org/wiki/Peirce_quincuncial_projection) ; see as well this question (Conformal mapping circle onto square (and back))


*One can more generally map the upper  half plane $H$ onto the interior of any polygon $P$ by the so-called Schwarz-Christoffel transformations (https://en.wikipedia.org/wiki/Schwarz%E2%80%93Christoffel_mapping). Then by combining such a transformation with a transformation like
$Z=\dfrac{z-i}{z+i}$, one can map the unit disk D onto the interior of any polygon.


*The previous reference is connected to this very nice document : (http://archive.bridgesmathart.org/2016/bridges2016-179.pdf).


*Interest in elliptic functions arose with Euler, Legendre and Gauss (years 1750-1820) for real arguments ; they were extended to complex arguments genially in years 1830-1850, mainly by Jacobi. They play a large rôle in  many parts of mathematics ; for example they are instrumental in the rather recent proof of Fermat's theorem. For the very interesting history of elliptic functions, with for example the connection with the lemniscate curve, see (http://users.mai.liu.se/vlatk48/teaching/lect2-agm.pdf) and document (9781461457244-c1.pdf).


*Fig. 1 has been obtained using the following Matlab program (complex integration is rather easy with this language).
clear all;close all;hold on;axis equal off;
NR=50;NT=100;
t=zeros(NR,NT+1);s=t;
NRmax=NR+1;
scatter(1,0,30,'filled');text(1.05,0.1,'1');
for p=1:NR;
    for q=1:NT+1;
        z0=exp(3*(p/NRmax-1))*exp(i*2*pi*q/NT);
        s(p,q)=z0;
        z=quadl(@(z)(1./sqrt(1+z.^4)),0,z0);%integration
        t(p,q)=z;
    end;
end;
K=1.1;
plot([0,0],[-K,K]);plot([-K,K],[0,0]);
for p=30:NR;
   plot(s(p,:),'r');
end;
for q=1:NT;
   plot(s(30:NR,q),'b');
end;
d=3;
K=1.1;
plot([0,0]+d,[-K,K]);plot([-K,K]+d,[0,0]);
plot(exp(i*(0:pi/100:2*pi)),'k')
plot(0.927038*[1-i,1+i,-1+i,-1-i,1-i]+d,'k');
scatter(1+d,0,30,'filled');text(1+d+0.05,0.1,'1');
for p=30:NR;
   plot(t(p,:)+d,'r');
end;
for q=1:NT;
   plot(t(30:NR,q)+d,'b');
end;


More precisely, function $\varphi$ is defined by
$$
\varphi(z) = -\sqrt{i} \, F\bigl(i \sinh^{-1}(\sqrt{i} \, z) \,|\, -1 \bigr). 
$$
where $F(z | m)$ is the incomplete elliptic function of first kind.
Wolfram:

