Pictures for the Shelf

Phase portraits and curvature

The pictures for differential equations and differential geometry (roadmap 13.1 and 13.2): phase portraits with proved equilibria, solutions in time, the moving frame of a curve, and surfaces coloured by curvature.

Phase portraits

For a planar system x′=f(x,y)x' = f(x, y), y′=g(x,y)y' = g(x, y), phasePortrait([f, g], { x, y, orbits }) draws:

  • arrows of the direction field, all one length so only the direction shows;
  • the nullclines f=0f = 0 (where motion is vertical) and g=0g = 0 (horizontal), traced by marching squares;
  • orbits through the given points, followed forward and backward by Runge–Kutta in floats;
  • every equilibrium in the window, found and proved unique in a small box by analytic's planarSystem(...).equilibria, and labelled by its kind from the certified trace and determinant of the Jacobian: saddle when det⁡J<0\det J < 0; a node or spiral, stable or not, by the sign of tr⁡J\operatorname{tr} J and of (tr⁡J)2−4det⁡J(\operatorname{tr} J)^2 - 4 \det J.

The arrows and orbits are estimated; the equilibria are proved, and fig.equilibria has their boxes. When the search covers the whole window, complete says there are no others.

Solutions in time

solutionFrames(u, times) draws u(x,t)u(x, t) at each time on one window: the heat equation's modes decaying, a wave travelling. Play them with framesSVG.

The moving frame

For a plane curve r(t)\mathbf r(t), the unit tangent is T=r′/∣r′∣T = \mathbf r'/|\mathbf r'|, the normal NN is TT turned a quarter turn, and the curvature is κ=(x′y′′−y′x′′)/∣r′∣3\kappa = (x'y'' - y'x'')/|\mathbf r'|^3. The osculating circle has radius 1/∣κ∣1/|\kappa| and centre r+N/κ\mathbf r + N/\kappa. frameAlongCurve(r, t) gets all of these certified from analytic's curve(...).at(t) and draws them; frameFrames moves the frame along the curve.

Curvature on a surface

curvatureSurface([x, y, z], { u, v }) colours each cell of a parametric surface by its Gaussian curvature K=(LN−M2)/(EG−F2)K = (LN - M^2)/(EG - F^2), or by the mean curvature: red where it is positive (the surface bends the same way in every direction, like a sphere), blue where it is negative (a saddle), white near zero. On a torus the outside is red and the inside blue, and Gauss–Bonnet says the two cancel: ∬K dA=2πχ=0\iint K \, dA = 2\pi\chi = 0. curveOnSurface lifts a path in (u,v)(u, v) to the surface, for a geodesic or the path of a transported vector.

Try itEdit the code and run it with @ratmath/graphics and Core's Rational in scope. The last line's value is shown; PRINT(…) adds lines, TEX(…) typesets math, and SHOW(svg) draws a picture.
Ctrl/⌘ + Enter runs