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

Antidifferentiate #81

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open

Antidifferentiate #81

wants to merge 4 commits into from

Conversation

bmxam
Copy link

@bmxam bmxam commented Dec 5, 2022

As proposed in #80 , here is a PR with the implementation of an antidifferentiate function, proposed here : JuliaAlgebra/MultivariatePolynomials.jl#230. I copy below the description of the MultiVariatePolynomials PR#230 below:

With this PR, I propose to introduce a function to get the antiderivative of multivariate polynomial. Note that the word primitive, (more natural in my native language), is already used by the Julia language; hence the antiderivative name. An associated PR in TypedPolynomials is proposed.

I tried to copy what is currently done for differentiate. Except for RationalPoly, which are not always possible to antidifferentiate with polynoms. I provided some unit tests as well.

With this new function, it would then be easy to integrate a multivariate polynomial on (simple) geometries such as lines, quads, cubes etc.

Note : for personal reasons, I may be absent in the next few weeks. Don't hesitate to continue the PR process "without me".

@bmxam
Copy link
Author

bmxam commented May 11, 2023

Hi Benoît (and everyone),

Now that the "antiderivative" PR has been merged in MultivariatePolynomials.jl, the present PR can be examined. Note that some unit tests are provided.

@polyvar x y z

@test @inferred(antidifferentiate(x, x)) == 1//2*x^2
@test @inferred(antidifferentiate(x, y)) == x*y
Copy link
Member

Choose a reason for hiding this comment

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

These can be moved to MultivariatePolynomials/test/differentiation.jl

@test @inferred(exponents(antidifferentiate(x^0*y*z^2,x))==(1,1,2))

m = x^2
@test @wrappedallocs(antidifferentiate(m, x)) == 0
Copy link
Member

Choose a reason for hiding this comment

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

These can be moved to MultivariatePolynomials/test/allocations.jl

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.

2 participants