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

Add support for diffing against sympy.Indexed instances #1517

Merged
merged 2 commits into from
Oct 15, 2024

Conversation

JCGoran
Copy link
Contributor

@JCGoran JCGoran commented Oct 14, 2024

If we have an expression (string) that contains an indexed variable (like x[0]), we should be able to differentiate w.r.t. it as well.
As explained in the updated docstring, the way to do it is to pass a sympy.Indexed instance as the independent variable (not to be confused with an sympy.IndexedBase instance!).
Note that we also need to pass an sympy.IndexedBase into the SymPy list of known symbols (i.e. as one of vars), otherwise the parser breaks.

For reference, we added mod files with indexed vars in #1504.

@JCGoran JCGoran changed the title Add diffing against sympy.Indexed instances Add support for diffing against sympy.Indexed instances Oct 14, 2024
bbpadministrator pushed a commit to BlueBrain/nmodl-references that referenced this pull request Oct 14, 2024
python/nmodl/ode.py Show resolved Hide resolved
bbpadministrator pushed a commit to BlueBrain/nmodl-references that referenced this pull request Oct 15, 2024
@JCGoran JCGoran merged commit a3957f5 into master Oct 15, 2024
12 checks passed
@JCGoran JCGoran deleted the jelic/diff_indexed_vars branch October 15, 2024 11:10
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