使用 complex_ode 求解微分方程

问题描述

我有一个 differential equation,我正在尝试使用 complex_ode 解决它,但是我的代码没有产生与 theoretical result 一致的结果。谁能发现我做错了什么?

from scipy.integrate import complex_ode
import numpy as np
import matplotlib.pyplot as plt

def equation(x,t): 
    return 1j*x

sol = complex_ode(equation)
sol.set_initial_value(1)
t_max = 10
dt = 0.1

sol_array = np.array([])
t_array = np.array([])

while sol.successful() and sol.t < t_max:
    sol_array = np.append(sol_array,sol.y)
    t_array = np.append(t_array,sol.t)
    sol.integrate(sol.t+dt)

plt.plot(t_array,np.abs(sol_array))

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)