Differentiation and integration of polynomials
This example shows the application of functions derivative() and integrate() from the library Polynomials.jl for the analytical finding of derivatives and integrals of polynomials.
Connecting the library of Polynomials.jl:
using Polynomials
Differentiation of polynomials
Define the polynomial
p = Polynomial([7, 0, -4, 1])
Let's find the first derivative of the polynomial :
q_1 = derivative(p)
Let's find the second derivative of the polynomial :
q_2 = derivative(p, 2)
Let's find the derivative of a rational expression , where and - polynomials:
a = Polynomial([5, 3, 1]);
b = Polynomial([6, 4, 2]);
ab = a // b
The first derivative of such an expression will be equal to:
In case the function derivative() When calculating the derivative of a rational function, it returns one value, then the resulting value will also be a rational function.:
c = derivative(ab)
If the function derivative() When calculating the derivative of a rational function, it returns two values, then we get the polynomials of the numerator and denominator of the resulting expression.:
c_n, c_d = derivative(ab)
[c_n, c_d]
Integrating polynomials
Let's find the integral of the polynomial
s_0 = integrate(q_1)
Let's find the integral of the same polynomial, but with the addition of a free coefficient.:
s = integrate(q_1, 7)
Conclusion
In this demo, we discussed ways to differentiate and integrate polynomials using the library Polynomials.jl.