额外的参数必须在元组中

Extra arguments must be in a tuple

我会尝试根据图片适配平等

我的密码是

import numpy as np
import scipy.integrate as integrate
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D

#define universal variables
def dH_dt(H, t=0):
    return np.array(((H1(t)-H0(t))**2)/sqrt((H0(t))**2*((H0(t))**2)))
t = np.linspace(0, 100, 10000) 
H0 = [0.0001]
H1 = [0.0001]
H, infodict = integrate.odeint(dH_dt, H0, H1, t, full_output=True)
fig = plt.figure()
ax = fig.add_subplot(111, projection='3d')
ax.plot(H[:,0], H[:,1])
plt.show()

我有类似

的错误
 File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/scipy/integrate/odepack.py", line 241, in odeint
    output = _odepack.odeint(func, y0, t, args, Dfun, col_deriv, ml, mu,
odepack.error: Extra arguments must be in a tuple.

能不能告诉我怎么解决

我想你必须尝试这样的事情:

H, infodict = integrate.odeint(dH_dt, H0, H1, args=(t,), full_output=True)

您需要在()中添加一个逗号,以便python知道它是一个元组。