This post shows how to use SymPy to express the Agnesian of order one \(\mathcal{A}_t^1\) of a system of ordinary differential equations. See Seilis 2022 for a description of the Agnesian operator. Briefly, it represents a form of non-statistical notion of “covariance”.
In this case let us choose the Lorenz system (Lorenz 1963).
\[\frac{dx}{dt} = \sigma (y - x)\]
\[\frac{dy}{dt} = x (\rho - z) - y\]
\[\frac{dz}{dt} = xy - \beta z\]
"""Compute Agnesian order 1 for the Lorenz system with SymPy."""
from __future__ import annotations
from sympy import Function, Symbol, latex, prod
def agnesian_lorenz_order1() -> str:
"""Return the LaTeX string for A_t^1 for the Lorenz system.
Returns
-------
str
LaTeX representation of the Agnesian of order one.
"""
sigma = Symbol("\\sigma", real=True)
rho = Symbol("\\rho", real=True)
beta = Symbol("\\beta", real=True)
t = Symbol("t", real=True)
x = Function("x")(t)
y = Function("y")(t)
z = Function("z")(t)
v = [sigma * (y - x), x * (rho - z - y), x * y - beta * z]
dvdt = [i.diff(t) for i in v]
return latex(prod(dvdt))This trivially gives the result:
\[\mathcal{A}_t^1 \vec v (t) = \sigma \left(\left(- \frac{d}{d t} y{\left(t \right)} - \frac{d}{d t} z{\left(t \right)}\right) x{\left(t \right)} + \left(\rho - y{\left(t \right)} - z{\left(t \right)}\right) \frac{d}{d t} x{\left(t \right)}\right) \left(- \frac{d}{d t} x{\left(t \right)} + \frac{d}{d t} y{\left(t \right)}\right) \left(- \beta \frac{d}{d t} z{\left(t \right)} + x{\left(t \right)} \frac{d}{d t} y{\left(t \right)} + y{\left(t \right)} \frac{d}{d t} x{\left(t \right)}\right)\]