我正在尝试求解微分方程系统
在 Python 中,确实是一个复杂的稀疏矩阵。
现在,我一直scipy.integrate.complex_ode在通过以下方式使用该类来解决系统问题。
def to_solver_function(time,vector):
sendoff = np.dot(A, np.transpose(vector))
return sendoff
solver = complex_ode(to_solver_function)
solver.set_initial_value(f(x),0)
solution = [f(x)]
for time in time_grid:
next = solver.integrate(time)
solution.append(next)
这一直工作正常,但我需要“告诉求解器”我的矩阵是稀疏的。我发现我应该使用
Asparse = sparse.lil_matrix(A)
但是我如何改变我的求解器来处理这个?