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

Allow derivimplicit to use finite differences. #1444

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

1uc
Copy link
Collaborator

@1uc 1uc commented Sep 20, 2024

In NOCMODL derivimplicit uses finite differences to compute each
element of the Jacobian. In stead we try to use SymPy, however, if it
fails, e.g. because it encounters an opaque function, we allow it to use
a finite difference instead.

When SymPy can't compute a derivative analytically, it replaces it
with a Derivative({func}, ({variable}, {n})), which represents the
nth derivative of func w.r.t. variable.

In this PR we crawl SymPy's AST to find Derivative objects, and
replace them with a finite difference. The step-with is the same
as used in NEURON for computing the elements of the Jacobian.

Additionally, there's some code to enable computing the \Delta x.

In NOCMODL `derivimplicit` uses finite differences to compute each
element of the Jacobian. In stead we try to use SymPy, however, if it
fails, e.g. because it encounters an opaque function, we allow it to use
a finite difference instead.
bbpadministrator pushed a commit to BlueBrain/nmodl-references that referenced this pull request Sep 20, 2024
@1uc 1uc marked this pull request as ready for review September 20, 2024 09:13
python/nmodl/ode.py Outdated Show resolved Hide resolved
python/nmodl/ode.py Outdated Show resolved Hide resolved
python/nmodl/ode.py Outdated Show resolved Hide resolved
bbpadministrator pushed a commit to BlueBrain/nmodl-references that referenced this pull request Sep 20, 2024
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

Successfully merging this pull request may close these issues.

2 participants