You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The example below was mainly copied from docs.scipy.org, and set_f_params worked well when the solver is integrate.ode, however, if changing ode to integrate.complex_ode, error happened when invoked set_f_params. The enviroment of Python is: Python3.4.3, Scipy0.15
from scipy.integrate import complex_ode
y0, t0 = [1.0j, 2.0], 0
def f(t, y, arg1):
return [1j*arg1*y[0] + y[1], -arg1*y[1]**2]
def jac(t, y, arg1):
return [[1j*arg1, 1], [0, -arg1*2*y[1]]]
#r = ode(f, jac).set_integrator('zvode', method='bdf')
r = complex_ode(f, jac)
r.set_initial_value(y0, t0).set_f_params(2.0).set_jac_params(2.0)
t1 = 10
dt = 1
while r.successful() and r.t < t1:
r.integrate(r.t+dt)
#print("%g %g" % (r.t, r.y))
print(r.y);
Error message:
Traceback (most recent call last):
File "C:\Users\Administrator\Desktop\aaa.py", line 16, in <module>
r.integrate(r.t+dt)
File "C:\Python34\lib\site-packages\scipy\integrate\_ode.py", line 567, in integrate
y = ode.integrate(self, t, step, relax)
File "C:\Python34\lib\site-packages\scipy\integrate\_ode.py", line 394, in integrate
self.f_params, self.jac_params)
File "C:\Python34\lib\site-packages\scipy\integrate\_ode.py", line 849, in run
y1, t, istate = self.runner(*args)
File "C:\Python34\lib\site-packages\scipy\integrate\_ode.py", line 497, in _wrap
f = self.cf(*((t, y[::2] + 1j * y[1::2]) + f_args))
TypeError: 'float' object is not subscriptable
The text was updated successfully, but these errors were encountered:
The example below was mainly copied from docs.scipy.org, and set_f_params worked well when the solver is integrate.ode, however, if changing ode to integrate.complex_ode, error happened when invoked set_f_params. The enviroment of Python is: Python3.4.3, Scipy0.15
The text was updated successfully, but these errors were encountered: