-differentiate( [x^2+y, z^2+4x], [x, y, z]) # should return [2x 1 0; 4 0 2z]</code></pre></div><a class="docs-sourcelink" target="_blank" href="https://github.com/JuliaAlgebra/MultivariatePolynomials.jl/blob/29c1647fb1633209b2bccc79e0bdbc6dc5bc2567/src/differentiation.jl#L1-L30">source</a></section></article><h1 id="Antidifferentiation"><a class="docs-heading-anchor" href="#Antidifferentiation">Antidifferentiation</a><a id="Antidifferentiation-1"></a><a class="docs-heading-anchor-permalink" href="#Antidifferentiation" title="Permalink"></a></h1><p>Given a polynomial, say <code>p(x, y) = 3x^2y + x + 2y + 1</code>, we can antidifferentiate it by a variable, say <code>x</code> and get <span>$\int_0^x p(X, y)\mathrm{d}X = x^3y + 1/2x^2 + 2xy + x$</span>. We can also antidifferentiate it by both of its variable and get the vector <code>[x^3y + 1/2x^2 + 2xy + x, 3/2x^2y^2 + xy + y^2 + y]</code>.</p><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="MultivariatePolynomials.antidifferentiate" href="#MultivariatePolynomials.antidifferentiate"><code>MultivariatePolynomials.antidifferentiate</code></a> — <span class="docstring-category">Function</span><span class="is-flex-grow-1 docstring-article-toggle-button" title="Collapse docstring"></span></header><section><div><pre><code class="language-julia hljs">antidifferentiate(p::AbstractPolynomialLike, v::AbstractVariable, deg::Union{Int, Val}=1)</code></pre><p>Antidifferentiate <code>deg</code> times the polynomial <code>p</code> by the variable <code>v</code>. The free constant involved by the antidifferentiation is set to 0.</p><pre><code class="nohighlight hljs">antidifferentiate(p::AbstractPolynomialLike, vs, deg::Union{Int, Val}=1)</code></pre><p>Antidifferentiate <code>deg</code> times the polynomial <code>p</code> by the variables of the vector or tuple of variable <code>vs</code> and return an array of dimension <code>deg</code>. It is recommended to pass <code>deg</code> as a <code>Val</code> instance when the degree is known at compile time, e.g. <code>antidifferentiate(p, v, Val{2}())</code> instead of <code>antidifferentiate(p, x, 2)</code>, as this will help the compiler infer the return type.</p><p><strong>Examples</strong></p><pre><code class="language-julia hljs">p = 3x^2*y + x + 2y + 1
0 commit comments