Differentiation
Given a polynomial, say $p(x, y) = 3x^2y + x + 2y + 1$, we can differentiate it by a variable, say $x$ and get $\partial p(x, y) / \partial x = 6xy + 1$. We can also differentiate it by both of its variable and get the vector $[6xy+1, 3x^2+1]$.
MultivariatePolynomials.differentiate
— Function.differentiate(p::AbstractPolynomialLike, v::AbstractVariable, deg::Int=1)
Differentiate deg
times the polynomial p
by the variable v
.
differentiate(p::AbstractPolynomialLike, vs, deg::Int=1)
Differentiate deg
times the polynomial p
by the variables of the vector or tuple of variable vs
and return an array of dimension deg
.
differentiate(p::AbstractArray{<:AbstractPolynomialLike, N}, vs, deg::Int=1) where N
Differentiate the polynomials in p
by the variables of the vector or tuple of variable vs
and return an array of dimension N+deg
.
Examples
p = 3x^2*y + x + 2y + 1
differentiate(p, x) # should return 6xy + 1
differentiate(p, (x, y)) # should return [6xy+1, 3x^2+1]