Fundamentals / Numerical mathematics / Nonlinear equations / Notebooks

Newton's method for an unknown covariance square root

A pair of independent unit-variance signals must be transformed to a prescribed covariance ellipse. One can solve a scalar square-root equation along each principal axis. A calibration that starts in a different frame exposes the genuinely matrix-valued derivative. Derive it, solve for its correction, and determine which residual will detect a wrong update.

Change parameters · Explore the workshop parameters

Change one input at a time and compare the recalculated curves with the argument above. The browser evaluates this small model locally; the accompanying numerical values state its assumptions and reference checks. Reset restores the reference inputs, and the data can be downloaded as CSV.

Save notebook (.ipynb)

Python runs on this device. The first run loads the scientific libraries.

The optional OneSimulation calculation uses the local OneSimulation installation. Save this notebook to run that comparison in Jupyter.

A target covariance is fixed in the laboratory axes. Start with a positive matrix whose axes are tilted, use the full matrix derivative, and compare the result with a spectral reference. NumPy and Matplotlib suffice.

Solve the Sylvester equation in the current eigenbasis

The derivative of the square at X maps H to XH+HX. In the eigenbasis of a positive X each entry of that sum is an entry of H times a sum of two positive eigenvalues.

View the iteration as a change of ellipse

A unit circle transformed by the root gives a one-standard-deviation covariance contour (its probability content depends on dimension). The right-hand graph charts the relative residual. Finite precision sets the visible floor.

Verify the derivative by vectorising it

Column stacking converts the Sylvester equation into a four-by-four linear system. Compare the two constructions. In a local OneSimulation environment the explicit system uses its dense linear solver; elsewhere NumPy solves it.