get_conditionally_linear_system function

(Shortest import: from brian2.stateupdaters.exponential_euler import get_conditionally_linear_system)

brian2.stateupdaters.exponential_euler.get_conditionally_linear_system(eqs, variables=None)[source]

Convert equations into a linear system using sympy.

Parameters:

eqs : Equations

The model equations.

Returns:

coefficients : dict of (sympy expression, sympy expression) tuples

For every variable x, a tuple (M, B) containing the coefficients M and B (as sympy expressions) for M * x + B

Raises

ValueError
If one of the equations cannot be converted into a M * x + B form.

Examples

>>> from brian2 import Equations
>>> eqs = Equations("""
... dv/dt = (-v + w**2) / tau : 1
... dw/dt = -w / tau : 1
... """)
>>> system = get_conditionally_linear_system(eqs)
>>> print(system['v'])
(-1/tau, w**2.0/tau)
>>> print(system['w'])
(-1/tau, 0)