-
-
Notifications
You must be signed in to change notification settings - Fork 4.4k
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
Derivatives of indexed objects #11144
Conversation
@bjodah @moorepants @jcrist @asmeurer What do you think? This partially includes stuff from the PR by @joshburkart . Unlike in @joshburkart 's PR, code printers have not been changed (this may be done in the future). Support for derivatives of indexed objects has been added. Sum objects are also supported. |
Excellent! +1 |
I would like to merge this as soon as possible. Are there objections? |
If no objections arise, I'll merge this in one week. |
if symbol_set.difference(expr.free_symbols): | ||
from sympy import IndexedBase | ||
symbol_set = set(sc[0].base if sc[0].is_Indexed else sc[0] for sc in variable_count if sc[0].is_Symbol) | ||
if symbol_set.difference(expr.free_symbols).difference(expr.atoms(IndexedBase)): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@asmeurer this was the trick to allow A[i].diff(A[j])
. This is an optimization, it checks whether the deriving varible is contained in the expression, otherwise return zero (i.e. deriving a constant).
This PR provides derivatives for indexed objects.
It is roughly based on #9314 , except that