Reputation: 1824
I want to solve a matrix differential equation, like this one:
import numpy as np
from scipy.integrate import odeint
def deriv(A, t, Ab):
return np.dot(Ab, A)
Ab = np.array([[-0.25, 0, 0],
[ 0.25, -0.2, 0],
[ 0, 0.2, -0.1]])
time = np.linspace(0, 25, 101)
A0 = np.array([10, 20, 30])
MA = odeint(deriv, A0, time, args=(Ab,))
However, this does not work in the case of having complex matrix elements. I am looking for something similar to scipy.integrate.complex_ode
but for odeint
. If this is not possible, what other library should I use to perform the integration? I appreciate your help!
Upvotes: 1
Views: 3294
Reputation: 1824
odeintw
wrapper for odeint
must be used in the same fashion as in the question. However, the initial value A0
must be complex-valued vector.
Upvotes: 3