neuromodels.utils.vtrap¶
- neuromodels.utils.vtrap(x, y)[source]¶
Traps for zero in denominator of rate eqns.
HH-style model rate equations often contain expressions that are equivalent to
\[x / (\exp(u) - 1),\]where \(u = x / y\). From Taylor series approximation, one can find that the above expression is approximated by
\[y (1 - u / 2)\]if \(u << 1\).
This approximation ensures that indeterminate cases are handled properly.
- Parameters
- Returns
References
Inspired by the
vtrapfunction in the NEURON simulator; github.com/neuronsimulator/nrn/blob/master/src/nrnoc/hh.mod