Description of problem
I am using python odeint function to solve differential equation. But it shows
DimensionMismatchError.
Minimal code to reproduce problem
@check_units(V = volt,m = 1, h = 1, results= amp/meter2)
def I_Na(V,m,h):return g_Na * m3 * h * (V - E_Na)
Potassium (K = element name)
@check_units(V = volt,n = 1, results= amp/meter2)
def I_K(V, n): return g_K * n4 * (V - E_K)
Leak
@check_units(V = volt, results= amp/meter**2)
def I_L(V): return g_L * (V - E_L)
@check_units(V = volt,m = 1, n =1, h = 1, results= (volt/second, 1, 1,1))
def dALLdt(X, t):
V, m, h, n = X
#calculate membrane potential & activation variables
dVdt = (I_inj(t) - I_Na(V, m, h) - I_K(V, n) - I_L(V)) / Cm(V)
dmdt = alpha_m(V)*(1.0-m) - beta_m(V)*m
dhdt = alpha_h(V)*(1.0-h) - beta_h(V)*h
dndt = alpha_n(V)*(1.0-n) - beta_n(V)*n
return dVdt*mV/second, dmdt, dhdt, dndt
X = odeint(dALLdt, [-65.0*mV, 0.05, 0.6, 0.32], t)
V = X[:,0]*mV
m = X[:,1]
h = X[:,2]
n = X[:,3]
What you have aready tried
Expected output (if relevant)
Actual output (if relevant)
Full traceback of error (if relevant)
DimensionMismatchError: Function “I_Na” expected a quantitity with unit volt for argument “V” but got -0.065 (unit is 1).