# ---
# jupyter:
#   jupytext:
#     text_representation:
#       extension: .py
#       format_name: light
#       format_version: '1.5'
#       jupytext_version: 1.14.4
#   kernelspec:
#     display_name: Python 3
#     language: python
#     name: python3
# ---

from pyodesys.tests._robertson import get_ode_exprs
import sympy as sp
from sympy import symbols
sp.init_printing()

fj = [get_ode_exprs(reduced=reduced) for reduced in range(4)]

t = symbols('t')
y = A, B, C = symbols('A B C')
inits = symbols('A0 B0 C0')
p = symbols('k1 k2 k3')
p1 = p2 = p3 = p + inits
y1, y2, y3 = [B, C], [A, C], [A, B]

f0, j0 = fj[0][0](t, y, p, backend=sp), fj[0][1](t, y, p, backend=sp)
f0, sp.Matrix(j0)

f1, j1 = fj[1][0](t, y1, p1, backend=sp), fj[1][1](t, y1, p1, backend=sp)
f1, sp.Matrix(j1)

f2, j2 = fj[2][0](t, y2, p2, backend=sp), fj[2][1](t, y2, p2, backend=sp)
f2, sp.Matrix(j2)

f3, j3 = fj[3][0](t, y3, p3, backend=sp), fj[3][1](t, y3, p3, backend=sp)
f3, sp.Matrix(j3)

diff1 = sp.Matrix(f1).jacobian(y1) - sp.Matrix(j1)
diff1.simplify()
diff1

diff2 = sp.Matrix(f2).jacobian(y2) - sp.Matrix(j2)
diff2.simplify()
diff2

diff3 = sp.Matrix(f3).jacobian(y3) - sp.Matrix(j3)
diff3.simplify()
diff3

StarcoderdataJupyterScriptsDedupFiltered