Complexplorer¶
Complexplorer turns a complex function into something you can look at — and, if you want, hold. It draws phase portraits, lifts them into 3D analytic landscapes, wraps them onto the Riemann sphere, unfolds multivalued functions onto their Riemann surfaces, and exports any of it as an STL you can print.
import complexplorer as cp
cp.plot(
cp.Rectangle(4, 4),
lambda z: (z**2 - 1) / (z**2 + 1),
cmap=cp.Phase(phase_sectors=6, auto_scale_r=True),
legend=True,
)
That is the whole first step. Installation and a first portrait takes it slowly.
The idea, in six pictures¶
A portrait is a decodable picture, not a pretty one¶
Hue is the phase of f(z) and the shaded cells are its contour bands, so zeros and poles read as
opposite winding directions. The inset legend is the same colormap applied to the identity map,
which is what makes the picture decodable.
Height adds magnitude without changing the colours¶
The same function twice: flat, then with |f(z)| lifted into height. The zeros sink and the poles
rise, while the colours stay put — the landscape adds magnitude without changing what the hue
means.
→ 3D landscapes and the Riemann sphere
The sphere and the surface are different objects¶
Two different objects that are easy to confuse. The sphere compactifies the plane so one
single-valued function can include the point at infinity. The surface is the two-sheeted cover on
which the multivalued sqrt(z) becomes single-valued.
A domain is a set you can do arithmetic on¶
The outline is two overlapping disks unioned together, with a third punched out of the middle.
Excluding a neighbourhood of the pole is not cosmetic: it keeps the huge values near z = 0 out of
the sampling entirely.
Engineering mode is the same machinery, aimed¶
One stable transfer function in four views. The zeros sit exactly on the jω axis at ±2j — the notch — while the poles stay inside the left half-plane. The portrait shows where they are; Bode and Nyquist show what they do to a signal.
The last step is a physical object¶
The relief is the mathematics, the mesh is the geometry that survives losing the colour, and the print is the object on a desk. Ten poles become ten spikes around the central zero.
→ STL export and the physical workflow
Where to go next¶
| If you want to | Start here |
|---|---|
| Install it and draw something | Installation and a first portrait |
| Understand what you are looking at | Reading a phase portrait |
| See everything the library can draw | Gallery |
| Look up a function | API reference |
| Drive it from a terminal | Command line |
| Upgrade from 1.x or 2.x | Migration guide |
Every image on this site is generated by python examples/showcase.py, from the recipes recorded
in examples/gallery/showcase.json — including the ones above.