Main Content

Analytic Solution to Integral of Polynomial

This example shows how to use thepolyintfunction to integrate polynomial expressions analytically. Use this function to evaluate indefinite integral expressions of polynomials.

Define the Problem

Consider the real-valued indefinite integral,

( 4 x 5 - 2 x 3 + x + 4 ) d x

The integrand is a polynomial, and the analytic solution is

2 3 x 6 - 1 2 x 4 + 1 2 x 2 + 4 x + k

where k is the constant of integration. Since the limits of integration are unspecified, theintegralfunction family is not well-suited to solving this problem.

Express the Polynomial with a Vector

Create a vector whose elements represent the coefficients for each descending power ofx

p = [4 0 -2 0 1 4];

Integrate the Polynomial Analytically

Integrate the polynomial analytically using thepolyintfunction. Specify the constant of integration with the second input argument.

k = 2; I = polyint(p,k)
I =1×70.6667 0 -0.5000 0 0.5000 4.0000 2.0000

The output is a vector of coefficients for descending powers ofx。这个结果与解析解,but has a constant of integrationk = 2

See Also

|

Related Topics