用 Odeint 求解复矩阵微分方程 [英] Solve complex matrix differential equation with Odeint

查看:65
本文介绍了用 Odeint 求解复矩阵微分方程的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想解一个矩阵微分方程,喜欢这个:

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,))

但是,这在具有复杂矩阵元素的情况下不起作用.我正在寻找类似于 scipy 的东西.integrate.complex_ode 但对于 odeint.如果这是不可能的,我应该使用什么其他库来执行集成?感谢您的帮助!

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!

推荐答案

odeintw odeint 的包装器必须以与问题相同的方式使用.但是,初始值A0必须是复值向量.

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.

这篇关于用 Odeint 求解复矩阵微分方程的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆