← All Labs
INTERACTIVE APPLET · COMPLEX ANALYSIS · CONFORMAL MAPS

A Complex-Function Playground

A complex function \(f(z)\) is best understood not as algebra but as a motion of the plane. Lay down a grid of little squares, apply \(f\) to every point, and watch the grid bend into a lattice of curved cells — the picture is the function. Type any \(f(z)\) — \(z^2\), \(1/z\), \(e^z\), a Möbius map — and this applet shows the input plane on the left and its warped image on the right. Drag the coloured sample points and see exactly where they land; scrub the morph to melt the identity grid into \(f\); or flip to domain colouring to read zeros and poles as colour vortices. Wherever \(f'(z)\ne 0\) the grid stays locally square — that right-angle-preserving magic is what "conformal" means.

Every little square of the input grid is rotated & scaled by \(f'(z)\)

Watch the plane warp under f(z)

Drag the coloured points · scrub the morph · scroll to zoom · hover to read the local rotation & stretch
Canvas · live expression parser

DRIVE IT

hover the input plane to inspect a point
vertical lines (Re = const) horizontal lines (Im = const) draggable sample points
On the left is the untouched input plane; on the right is its image after every point has been fed through \(f\). Notice that where the map is well-behaved the warped cells still meet at right angles — analytic maps are conformal. Drag a green point on the left and watch its twin jump on the right.
f(z) =
GRID DENSITY1.0×
ZOOM (view half-width)2.50
Syntax: z, i, pi, e; operators + − * / ^; functions sin cos tan exp log sqrt sinh cosh tanh conj abs re im gamma zeta. Implicit multiplication works: 2z, (z-1)(z+1). Try (z-1)/(z+1) or z + 0.35/z.

WALKTHROUGH

  1. Start on the default f(z) = z², view "Warp — split". The left grid is plain; on the right the vertical and horizontal lines have bent into two families of confocal parabolas. Look closely: they still cross at 90°. That is squaring reshaping the plane.
  2. Switch to Warp — morph and press ▶ Play. The identity grid melts continuously into \(f\). The origin is a special place: near it the little cells shrink to nothing because \(f'(0)=0\) — a double point where two sheets pinch together.
  3. Hover the input plane. The readout shows \(f'(z)\), its magnitude (how much the grid is locally stretched) and its angle (how much it is locally rotated). Move toward the origin on \(z^2\) and watch \(|f'|\to 0\); move outward and it grows.
  4. Load 1/z. Drag a green point toward the origin on the left and watch its image fly off to infinity on the right — the origin is a pole. Load the Möbius map \((z-1)/(z+1)\): circles and lines map to circles and lines, and the whole right plane is a single warped web.
  5. Flip to Domain colour and load z³ − 1: three dark colour vortices at the cube roots of unity — the zeros — with the hue wheeling once around each. Toggle the grid overlay to see the warp and the colouring at once. Then try exp(z) and sin(z) to meet their infinite ladders of behaviour.

AHA

THE INSIGHT
A complex function is not a table of numbers or an abstract rule — it is a distortion of the plane you can watch happen. And it is a very special kind of distortion: because \(f\) is analytic, near any point where \(f'\neq 0\) it acts like "rotate by \(\arg f'(z)\), scale by \(|f'(z)|\)" — so infinitesimal squares stay squares, just turned and resized. The whole of complex analysis is the study of maps that bend space while keeping every little angle intact.

RESEARCH NOTE

The reason the grid stays locally square is the Cauchy–Riemann equations: writing \(f=u+iv\), \(u_x=v_y\) and \(u_y=-v_x\). These force the Jacobian of \(f\) (as a map \(\mathbb{R}^2\to\mathbb{R}^2\)) to be a rotation-scaling matrix \(\left[\begin{smallmatrix}a&-b\\ b&a\end{smallmatrix}\right]\) with \(a+bi=f'(z)\); its determinant is \(|f'(z)|^2\), the local area magnification. Further reading: Tristan Needham, Visual Complex Analysis; Elias Wegert, Visual Complex Functions; and the domain-colouring lab in this repo (#19), whose colour view is reused here.

EXPLANATION

The obstacle to drawing a complex function \(f:\mathbb{C}\to\mathbb{C}\) is dimensional: the input \(z=x+iy\) needs a plane and so does the output \(w=u+iv\), so an honest graph would live in four dimensions. This playground takes the most literal way around that wall — the grid-warp or "transformation of the plane" view. Instead of graphing \(f\), it treats \(f\) as a machine that moves points. Cover the input plane with a grid of straight lines, apply \(f\) to a dense sample of points along each line, and redraw the images. Straight lines generally become curves, and the whole grid deforms into a woven mesh of cells. Because you kept the same coloured lines, you can trace exactly where any region of the input went. This is the picture behind the phrase "\(z\mapsto z^2\)": the right half-plane doubles to cover the whole plane, angles at the origin are doubled, and the vertical/horizontal grid becomes two interlocking families of parabolas.

What elevates this from a pretty deformation to the heart of the subject is a single fact: analytic maps are conformal. Zoom into any point \(z_0\) where \(f'(z_0)\neq 0\) and the map, to first order, is \(f(z)\approx f(z_0)+f'(z_0)\,(z-z_0)\). Multiplication by the fixed complex number \(f'(z_0)=re^{i\theta}\) is exactly a rotation by \(\theta\) followed by a scaling by \(r\) — the one linear map that turns squares into squares. So no matter how violently the global grid bends, each infinitesimal cell is merely rotated and resized; the crossing angles stay at 90°. That is why the warped grid in this applet always looks locally square except at isolated points. Those exceptional points are precisely where \(f'=0\): there the linear term vanishes, the next term \((z-z_0)^k\) takes over, and angles get multiplied by \(k\) — you see cells pinch and fan out, as at the origin of \(z^2\) or \(z^3\).

The algebra guaranteeing all this is the Cauchy–Riemann equations. Split \(f\) into real and imaginary parts \(f=u(x,y)+iv(x,y)\) and view it as an ordinary map of the real plane; its Jacobian is \(\left[\begin{smallmatrix}u_x&u_y\\ v_x&v_y\end{smallmatrix}\right]\). Requiring the complex derivative to exist forces \(u_x=v_y\) and \(u_y=-v_x\), which collapses that Jacobian into the special form \(\left[\begin{smallmatrix}a&-b\\ b&a\end{smallmatrix}\right]\) — a scaled rotation with \(a+bi=f'\). Its determinant, the local area factor, is \(a^2+b^2=|f'(z)|^2\), and this applet's hover readout shows you \(|f'|\) and \(\arg f'\) live so you can feel the stretch and twist at any point. A matrix that reshapes the plane while preserving angles is the exact bridge to idea #40 in this repo (matrices as machines that move space): a complex function is, at every point, one of those angle-preserving matrices, varying smoothly from place to place.

The second view, domain colouring, is the complementary lens borrowed from lab #19. Rather than drawing where the grid goes, it paints every input pixel by its output value: hue encodes the phase \(\arg f(z)\) and brightness encodes the magnitude \(|f(z)|\). Now the global features leap out. A zero of order \(m\) is a dark point around which the hue wheel cycles \(m\) times; a pole is a bright point where the hue wheels the other way. Toggling the grid overlay on top of the colouring lets you hold both stories in one image: the mesh shows how neighbourhoods are stretched and turned, while the colour shows the destinations directly and flags the singular points the grid only hints at. Between the two views — motion and colour — a complex function stops being an inscrutable formula and becomes a landscape you can pan, zoom, drag, and read. This applet builds directly on #19's expression parser and colouring; here that same engine drives a live, draggable warp of the plane.