-
-
Notifications
You must be signed in to change notification settings - Fork 176
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
ENH: Complex step differentiation #594
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## develop #594 +/- ##
===========================================
- Coverage 73.35% 73.31% -0.05%
===========================================
Files 57 57
Lines 9429 9436 +7
===========================================
+ Hits 6917 6918 +1
- Misses 2512 2518 +6 ☔ View full report in Codecov by Sentry. |
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.
Really good!
Questions:
- Are there any benefits to using the old differentiation method? Or is this one just better?
- Have you tried plugging this in the flight class? Does it make a difference in terms of performance? If so, why not do it in this PR?
- Could you add second-order differentiation to this?
Yes, this new method only works if the function accepts complex numbers that presents an imaginary part. Also, it is required that the function should be "differentiable in complex dimension", but this is not practical insight. Therefore, the old method should still be used sometimes.
Yes, it helps the flight class to go faster. The goal of this PR was to implement a complex step differentiation method, nothing more.
Let me try to implement it the next weekend. |
@MateusStano let's forget about the second order differentiation, it was giving some errors that I really think are not worth it to debug right now. The tests are already covering basic scenarios and I know for a fact that the flight simulations are running correctly when using the complex step method (1st order). I would leave the second order for a future PR. Could you approve this one please? |
Okay. One more thing that would be good here is using complex diff for |
Pull request type
Checklist
black rocketpy/ tests/
) has passed locallypytest tests -m slow --runslow
) have passed locallyCHANGELOG.md
has been updated (if relevant)Current behavior
The
Function.differentiate()
method is the only method that can be used to derivate Function objects.New behavior
The new, powerful, and fast
Function.differentiate_complex_step()
method is here!This method will be used to speed up simulations in future PRs.
Breaking change
Additional information
This PR will close the #131 issue, a really old feature request of our repository.