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

Added Range assumption to Kronecker Delta #17433

Merged
merged 2 commits into from Aug 17, 2019

Conversation

Upabjojr
Copy link
Contributor

Added Range assumption to Kronecker Delta

References to other Issues or PRs

Brief description of what is fixed or changed

Other comments

Release Notes

  • functions
    • Added range assumption for the indices of KroneckerDelta.

@sympy-bot
Copy link

sympy-bot commented Aug 16, 2019

Hi, I am the SymPy bot (v147). I'm here to help you write a release notes entry. Please read the guide on how to write release notes.

Your release notes are in good order.

Here is what the release notes will look like:

  • functions
    • Added range assumption for the indices of KroneckerDelta. (#17433 by @Upabjojr)

This will be added to https://github.com/sympy/sympy/wiki/Release-Notes-for-1.5.

Note: This comment will be updated with the latest check if you edit the pull request. You need to reload the page to see it.

Click here to see the pull request description that was parsed.

Added Range assumption to Kronecker Delta

<!-- Your title above should be a short description of what
was changed. Do not include the issue number in the title. -->

#### References to other Issues or PRs
<!-- If this pull request fixes an issue, write "Fixes #NNNN" in that exact
format, e.g. "Fixes #1234". See
https://github.com/blog/1506-closing-issues-via-pull-requests . Please also
write a comment on that issue linking back to this pull request once it is
open. -->


#### Brief description of what is fixed or changed


#### Other comments


#### Release Notes

<!-- Write the release notes for this release below. See
https://github.com/sympy/sympy/wiki/Writing-Release-Notes for more information
on how to write release notes. The bot will check your release notes
automatically to see if they are formatted correctly. -->

<!-- BEGIN RELEASE NOTES -->
* functions
  * Added range assumption for the indices of KroneckerDelta.
<!-- END RELEASE NOTES -->

Update

The release notes on the wiki have been updated.

assert expr[i, j].diff(A[m, n]).doit() == (
KDelta(i, m)*KDelta(j, n)*Trace(A) +
KDelta(m, n)*A[i, j]
)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

need to cross-check this result

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK, it's correct.

@Upabjojr
Copy link
Contributor Author

@asmeurer We have a new algorithm for matrix derivatives... and it was a lot easier to implement than the previous one.

@codecov
Copy link

codecov bot commented Aug 16, 2019

Codecov Report

Merging #17433 into master will increase coverage by 1.778%.
The diff coverage is 94.444%.

@@             Coverage Diff              @@
##           master    #17433       +/-   ##
============================================
+ Coverage   60.18%   61.958%   +1.778%     
============================================
  Files         631       631               
  Lines      163497    163526       +29     
  Branches    38362     38375       +13     
============================================
+ Hits        98393    101319     +2926     
+ Misses      59050     56466     -2584     
+ Partials     6054      5741      -313

@@ -137,26 +144,34 @@ def test_matrix_derivative_vectors_and_scalars():
# Cookbook example 83:
expr = (X*b + c).T*D*(X*b + c)
assert expr.diff(X) == D*(X*b + c)*b.T + D.T*(X*b + c)*b.T
assert expr[0, 0].diff(X[m, n]).doit()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there something missing from this assert?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, there is a problem with the simplification of the Kronecker delta... the expression is not optimal. I will try to fix this.

@Upabjojr Upabjojr merged commit 887ab98 into sympy:master Aug 17, 2019
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.

None yet

3 participants