Closed Gui-FernandesBR closed 1 month ago
Attention: Patch coverage is 83.33333%
with 1 lines
in your changes are missing coverage. Please review.
Project coverage is 73.31%. Comparing base (
92e93a7
) to head (fc6804c
). Report is 2 commits behind head on develop.
Files | Patch % | Lines |
---|---|---|
rocketpy/mathutils/function.py | 83.33% | 1 Missing :warning: |
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
Really good!
Questions:
- Are there any benefits to using the old differentiation method? Or is this one just better?
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.
- 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?
Yes, it helps the flight class to go faster. The goal of this PR was to implement a complex step differentiation method, nothing more. As I mentioned in the PR description: "This method will be used to speed up simulations in future PRs."
- Could you add second-order differentiation to this?
- First answer: I have no idea.
- After googling for 5min: Yes, I think it is possible! See https://www.acsu.buffalo.edu/~johnc/complex_step08.pdf
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?
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 derivative_function
. That might make a big difference for liquids/hybrids simulations
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.