Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix calculating jacobian from mix of rate rules and reactions. #958

Open
luciansmith opened this issue Jan 27, 2022 · 0 comments
Open

Fix calculating jacobian from mix of rate rules and reactions. #958

luciansmith opened this issue Jan 27, 2022 · 0 comments

Comments

@luciansmith
Copy link

The following two scripts work fine:

r = te.loada ('''
      species x
      x' = -k1*x
      k1 = 0.1; x = 1
''')

print(r.getFullJacobian())

gives you:

        x
x [[ -0.1]]

and:

r = te.loada ('''
      S1 -> S2; k3*S1
      S1 = 10
      k3=0.5
''')

print(r.getFullJacobian())

gives you:

        S1, S2
S1 [[ -0.5,  0],
S2  [  0.5,  0]]

but if you try to combine them:

r = te.loada ('''
      species x
      x' = -k1*x
      k1 = 0.1; x = 1
      S1 -> S2; k3*S1
      S1 = 10
      k3=0.5
''')

print(r.getFullJacobian())

you get:

        S1, S2, x
S1 [[    0,  0, 0],
S2  [ -0.5,  0, 0],
x   [  0.5,  0, 0]]

which gets the row values wrong for the 0.5, -0.5, and misses out [x,x] entirely.

If you make 'x' a boundary species, it falls back out of the Jacobian and you get the correct values again, but only for S1/S2.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant