I want to solve a complex matrix differential equation y' = Ay.
import numpy as np
from scipy.integrate import solve_ivp
def deriv(y, t, A):
return np.dot(A, y)
A = np.array([[-0.25 + 0.14j, 0, 0.33 + 0.44j],
[ 0.25 + 0.58j, -0.2 + 0.14j, 0],
[ 0, 0.2 + 0.4j, -0.1 + 0.97j]])
time = np.linspace(0, 25, 101)
y0 = np.array([[2, 3, 4], [5, 6 , 7], [9, 34, 78]])
result = solve_ivp(deriv, y0, time, args=(A,))
There already seems to be an answer in case of 'odeint'. https://stackoverflow.com/a/45970853/7952027
https://stackoverflow.com/a/26320130/7952027
https://stackoverflow.com/a/26747232/7952027
https://stackoverflow.com/a/26582411/7952027
I am curious as to whether it can be done with any of the new API of Scipy?