Skip to content

Commit

Permalink
Merge pull request #158 from MatisPatel/fixing--LV
Browse files Browse the repository at this point in the history
Fixing  lv equations in dynamics.ode and psl.autonomous
  • Loading branch information
drgona authored May 30, 2024
2 parents 65dc398 + 8b172c3 commit 8f17e8e
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
6 changes: 3 additions & 3 deletions src/neuromancer/dynamics/ode.py
Original file line number Diff line number Diff line change
Expand Up @@ -287,8 +287,8 @@ def __init__(self, insize=2, outsize=2):
def ode_equations(self, x):
x1 = x[:, [0]]
x2 = x[:, [-1]]
dx1 = x1 - 0.1*x1*x2
dx2 = 1.5*x2 + 0.75*0.1*x1*x2
dx1 = self.alpha*x1 - 0.4*x1*x2
dx2 = 0.1*x1*x2 - 0.4*x2
return torch.cat([dx1, dx2], dim=-1)


Expand Down Expand Up @@ -423,4 +423,4 @@ def ode_equations(self, x, u):
odes = {**ode_param_systems_auto,
**ode_param_systems_nonauto,
**ode_hybrid_systems_auto,
**ode_networked_systems}
**ode_networked_systems}
10 changes: 5 additions & 5 deletions src/neuromancer/psl/autonomous.py
Original file line number Diff line number Diff line change
Expand Up @@ -190,17 +190,17 @@ class LotkaVolterra(ODE_Autonomous):
def params(self):
variables = {'x0': [5., 100.]}
constants = {'ts': 0.1}
parameters = {'a': 1.,
'b': 0.1,
'c': 1.5,
'd': 0.75,}
parameters = {'a': 1.1,
'b': 0.4,
'c': 0.1,
'd': 0.4,}
meta = {}
return variables, constants, parameters, meta

@cast_backend
def equations(self, t, x):
dx1 = self.a*x[0] - self.b*x[0]*x[1]
dx2 = -self.c*x[1] + self.d*self.b*x[0]*x[1]
dx2 = self.c**x[0]*x[1] - self.d*x[1]
return [dx1, dx2]


Expand Down

0 comments on commit 8f17e8e

Please sign in to comment.