Skip to main content

Module multivar_calculus

Module multivar_calculus 

Source
Expand description

Multivariable symbolic differentiation — gradient, Jacobian, Hessian (Calculus plan §3, the ★★ standout). Built on the CAS’s existing single-variable differentiate, so every partial is a symbolic, provenance-bearing derivative (citable via the CAS’s to_quins/ expr_citation_hash) — honest math, not a black-box autodiff number.

Why this is the highest-demand gap: the learning spine needs it now — IRLS (logistic/Poisson GLM) needs the gradient + Hessian, the Bayesian Laplace approximation needs the Hessian of the log-posterior, and second-order optimisers need a Hessian. The symbolic forms here are differentiated once, then evaluated numerically at a point (gradient_at/hessian_at) for those consumers.

No hot kernel (symbolic); the numeric evaluation of a gradient at scale is the bridge’s DenseLinear/ElementwiseMap case.

Functions§

gradient
The gradient ∇f = [∂f/∂x₁, …, ∂f/∂xₙ] as one simplified expression per variable.
gradient_at
Evaluate the gradient numerically at point (variable → value). None if any partial fails to evaluate there (e.g. a division by zero in the domain).
hessian
The Hessian H[i][j] = ∂²f/∂xᵢ∂xⱼ as an n×n matrix of simplified expressions. Symmetric by Clairaut’s theorem (computed both ways implicitly via repeated differentiation).
hessian_at
Evaluate the Hessian numerically at point. None if any entry fails to evaluate.
jacobian
The Jacobian of a vector of expressions: row i is ∇fᵢ. Shape exprs.len() × vars.len().
partial
∂expr/∂var — a single partial derivative (simplified). Thin alias over the CAS.