Not sure why my odeint part of the code isn’t working. I’velooked at the documentation for the function, but I can’t see whereI’m going wrong with the inputs. Any help would be greatlyappreciated.
import numpy as np
import matplotlib.pyplot as plt
import scipy.linalg as la
import scipy.integrate as spi
HMON def coriolis(w, Omega, phi,ue,t): x0 = 1 x1 = 1 nxo = xo nx1 = -Omega**2*x0+2*phi*11*np.sin(phi) result = np.array[nxo, nx1] return result 8 tf = np. linspace(0,50,500) 9 x51 = spi.odeint(coriolis, 0.1,0.2,0, tf) 10 plt.plot(x51[:,0],x51[:,1]) 11 x51 = spi.odeint(coriolis,-3,-3,0, tf) 12 plt.plot(x51[:,0],x51[:,1]) 13 x51 = spi.odeint(coriolis,4,4,6,tf) 14 plt.plot(x51[:,0],x51[:,1]) 15 plt.show() ———— ValueError Traceback (most recent call last) <ipython-input-44-77aba4bdfba5> in <module> 7 return result 8 tf = np.linspace(0,50,500) —-> 9 x1 = spi.odeint(coriolis, 0.1,0.2,0, tf) 10 plt.plot(x51[:,0],x51[:,1]) 11 x51 = spi.odeint(coriolis, -3,-3,0, tf) /opt/conda/lib/python3.7/site-packages/scipy/integrate/odepack.py in odeint(fun C, yo, t, args, Dfun, col_deriv, full_output, ml, mu, rtol, atol, tcrit, ho, hm ax, hmin, ixpr, mxstep, mxhnil, mxordn, mxords, printmessg, tfirst) 231 mu = -1 # changed to zero inside function call 232 dt = np.diff(t) 234 if not((dt >= 0).all() or (dt <= ) all): 235 raise ValueError(“The values in t must be monotonically increas –> 233 ing” <_array_function_internals> in diff(*args, **kwargs) /opt/conda/lib/python3.7/site-packages/numpy/lib/function_base.py in diff(a, n, axis, prepend, append) 1237 n d = a.ndim 1238 if nd == 0: -> 1239 raise ValueError(“diff requires input that is at least one dime nsional”) 1240 axis = normalize_axis_index (axis, nd) 1241 ValueError: diff requires input that is at least one dimensional Show transcribed image text HMON def coriolis(w, Omega, phi,ue,t): x0 = 1 x1 = 1 nxo = xo nx1 = -Omega**2*x0+2*phi*11*np.sin(phi) result = np.array[nxo, nx1] return result 8 tf = np. linspace(0,50,500) 9 x51 = spi.odeint(coriolis, 0.1,0.2,0, tf) 10 plt.plot(x51[:,0],x51[:,1]) 11 x51 = spi.odeint(coriolis,-3,-3,0, tf) 12 plt.plot(x51[:,0],x51[:,1]) 13 x51 = spi.odeint(coriolis,4,4,6,tf) 14 plt.plot(x51[:,0],x51[:,1]) 15 plt.show() ———— ValueError Traceback (most recent call last) in 7 return result 8 tf = np.linspace(0,50,500) —-> 9 x1 = spi.odeint(coriolis, 0.1,0.2,0, tf) 10 plt.plot(x51[:,0],x51[:,1]) 11 x51 = spi.odeint(coriolis, -3,-3,0, tf) /opt/conda/lib/python3.7/site-packages/scipy/integrate/odepack.py in odeint(fun C, yo, t, args, Dfun, col_deriv, full_output, ml, mu, rtol, atol, tcrit, ho, hm ax, hmin, ixpr, mxstep, mxhnil, mxordn, mxords, printmessg, tfirst) 231 mu = -1 # changed to zero inside function call 232 dt = np.diff(t) 234 if not((dt >= 0).all() or (dt 233 ing” in diff(*args, **kwargs) /opt/conda/lib/python3.7/site-packages/numpy/lib/function_base.py in diff(a, n, axis, prepend, append) 1237 n d = a.ndim 1238 if nd == 0: -> 1239 raise ValueError(“diff requires input that is at least one dime nsional”) 1240 axis = normalize_axis_index (axis, nd) 1241 ValueError: diff requires input that is at least one dimensional
Expert Answer
Answer to Not sure why my odeint part of the code isn’t working. I’ve looked at the documentation for the function, but I can’t se…