Question about inconsistent units in equations

I’m having a problem with inconsistent units in my equation - I realize what’s going on, but I’m not sure the proper way to fix it. My conductance equations are of the form:
dg/dt = (gx/tau_rise - g)/tau_decay : 1
dgx/dt = -gx/tau_rise : 1

where tau_rise and tau_decay are in milliseconds. I get the error “Inconsistent units in differential equation” and I know why I get this error, but I’m not sure what I can do to safely change the equation so that the units match. Any help would be appreciated.

Hi, my quick assessment is ((g/tau_rise) / tau_decay) is your problem, that should result in units of (conductance / time^2) rather than (conductance / time). Looks like your conductance is unitless which should be fine, but the 1/time^2 will still be dimensionally inconsistent.
The fix would be to re-evaluate where your conductance equations are coming from, whether the expression is incorrect, or whether gx should have units of time (so that gx/tau_rise has the same units as g)

The original conductance equation is:
g(t) = (1/(tau_decay - tau_rise))(e^(-t/tau_decay) - e^(-t/tau_rise))

Are the ODEs correct for this equation, or do I have something off?

g(t) = \frac{1}{\tau_{dec}-\tau_{rise}} \left(e^{\frac{-t}{\tau_{dec}}} - e^{\frac{-t}{\tau_{rise}}}\right)
\frac{dg}{dt} = \frac{\frac{gx}{\tau_{rise}}-g}{\tau_{dec}}
If that’s the case, it looks to me like g has units of 1/time, while gx has units of 1 (dimensionless)…
Then (gx/tau - g) would be consistent, and dg/dt would have units (1 / time^2), while dgx/dt would have units of (1/time). You’d write that something like

dg/dt = (gx/tau_rise - g)/tau_decay : 1/second
dgx/dt = -gx/tau_rise : 1

(note that for differential equation, the : units are expressed without the additional 1/time factor, i.e. the units of g rather than dg/dt).

To me, this still looks “off” even if it works in Brian…

This equation should also work if gx has units of time, and g is dimensionless:

dg/dt = (gx/tau_rise - g)/tau_decay : 1
dgx/dt = -gx/tau_rise : second

all that being said, this looks remarkably similar to the equation for a “biexponential synapse” or “dual exponential synapse”

V(t)=\frac{τ2}{τ2−τ1}\left(e^\frac{−t}{τ_1}−e^\frac{-t}{τ_2}\right)
which has the following dimensionless differential form (taken from Brian2 docs here: Converting from integrated form to ODEs — Brian 2 2.5.1 documentation )

eqs = '''
dV/dt = ((tau_2 / tau_1) ** (tau_1 / (tau_2 - tau_1))*x-V)/tau_1 : 1
dx/dt = -x/tau_2                                                 : 1
'''

which looks very similar, but multiplies by an additional time term in V(t) and inside dV/dt which make both components dimensionless.

Here’s my favorite textbook chapter on this synapse model, which also has a version which describes conductance g, rather than voltage (eq. 7.4)

There g_{syn} is expressed in units of time then rescaled by an arbitrary constant to be dimensionless.

To summarize all that rambling, I think the problem lies in the specification of the original conductance equation, and what’s needed is to decide/check the assumption for the units of g, and either update the units for the differential equations, or introduce a scaling factor which makes g and gx dimensionless:

dg/dt = (gx*(tau_rescale/tau_rise) - g)/tau_decay : 1
dgx/dt = -gx/tau_rise : 1

See also:

Hi everyone,
how to formulate synapses as ODEs has been confusing quite a number of people… I think @adam is spot on with the reference to the Brian documentation, and I agree that your equations should be the same (using g instead of V), i.e. something like:

eqs = '''
dg/dt = ((tau_decay / tau_rise) ** (tau_rise / (tau_decay - tau_rise))*gx-g)/tau_rise : 1
dgx/dt = -gx/tau_decay                                                                : 1
'''

Two minor notes on these equations:

  1. they are normalized in a way that the peak of g will be the value of gx that you use for the spike – I’m not sure about the normalization in the equation you posted earlier – maybe that normalizes the integral under the curve or something like that?
  2. using tau_decay and tau_rise here – instead of the more neutral tau_1 and tau_2 – can be a bit misleading. The two time constants are actually exchangeable, it is the smaller value that defines the rise time, and the larger value that defines the decay time. Which one you call tau_1 and which one you call tau_2 does not matter.
1 Like