1
# SOLVE ....dx/dt=3 *exp(-t)  ...AND....  dy/dt=3-y(t) 

def func1(Z,T):
    x=Z[0]
    y=Z[1]
    dx_dt=3.*np.exp(-t)
    dy_dt=3.-y
    return [dx_dt,dy_dt]

t=np.linspace(0,10) 

Z0=[0,0]

z=odeint(func1,Z0,t)

x=z[:,0] 
y=z[:,0]

I am getting an error below. I am unable to figure out where I am going wrong

Traceback (most recent call last): File "test.py", line 18, in z=odeint(func1,Z0,t) File "C:\Python27\lib\site-packages\scipy\integrate\odepack.py", line 233, in odeint int(bool(tfirst))) ValueError: setting an array element with a sequence.

James Z
  • 12,209
  • 10
  • 24
  • 44

0 Answers0