BlueBrain / nmodl

Code Generation Framework For NEURON MODeling Language
https://bluebrain.github.io/nmodl/
Apache License 2.0
53 stars 15 forks source link

Add support for diffing expressions with indexed vars in `differentiate2c` #1483

Open JCGoran opened 4 days ago

JCGoran commented 4 days ago

Note that the independent var we are diffing against should not be an indexed var (yet), but every other var is fair game.

JCGoran commented 3 days ago

one could still isolate it to make sure there's one notion of how to convert random stuff to symbols.

In principle yes, but I feel that it would undoubtedly involve a bunch of heuristics (much like what SymPy is actually doing under the hood anyway). The least error-prone idea is to just put sympy_vars = {str(var) : var for var in vars}, and require the user passes an iterable of sympy objects (like [sp.Function('f'), sp.Symbol('x')]), and raise an error if they pass anything else.