-
Notifications
You must be signed in to change notification settings - Fork 22
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
Add antidifferentiation #158
Add antidifferentiation #158
Conversation
Looks very good thanks. Maybe we should go for |
Done. |
Co-authored-by: Benoît Legat <[email protected]>
Is there anything else needed or is this ready to merge? |
test/poly.jl
Outdated
@polyvar x y | ||
|
||
p = (x^2 + 4 * y^3) | ||
(_, _, T) = typeof(p).parameters |
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.
Can you use coefficient_type
instead ?
I was indeed unaware of the existence of that particular function. The problem should be fixed by now. I also noticed another aspect regarding the monomials: The antidifferentiation of a monomial yields a term with a |
Yes, this should also be |
66274d3
to
7ce8832
Compare
OK, I adjusted the implementation accordingly. |
Thanks, let's wait to see the CI results but looks good to me |
This patch adds an implementation of the
antidifferentiate
function for both monomials and polynomials (fixing #157).The function
antidifferentiate(p, x)
works by either returning the productp*x
ifp
has no term with variablex
, or by incrementing the powers and adjusting the coefficients to match (thereby always ensuring that the antiderivative evaluates to zero wheneverx
is zero).I included some basic unit tests as well. I did not run
JuliaFormatter.jl
over the codebase, since numerous other files are not formatted according to those formatting rules...Let me know if anything is missing. If this lands, I would appreciated a new version to be used in my own project.