polydefint


Untitled

Definite integral of a polynomial

Syntax

I = polydefint(p,a,b)

Description

I = polydefint(p,a,b), returns the value I of the definite integral of polynomial p (in MATLAB® polynomial form) over the real interval [a,b].

Examples

Example 1 A simple example:
The definite integral
can be evaluated by first creating a row vector to represent the polynomial , i.e.,
p = [3 0 -4 10 -25];
and then using polydefint to integrate over the interval
I = polydefint(p,-1,3)
I = 49.0667
Compare to MathWorks example for polyint.
Example 2 The orthogonality of Legendre polynomials:
The Legendre polynomials are orthogonal on the interval , specifically,
where is the Kronecker delta, equal to 1 if m = n and to 0 otherwise. This property can be demonstrated by first creating two Legendre polynomials, for example,
by using the polyLegendre function:
P2 = polyLegendre(2)
P2 = 1×3
1.5000 0 -0.5000
P3 = polyLegendre(3)
P3 = 1×4
2.5000 0 -1.5000 0
and then integrating the products , and (computed using the conv function for polynomial mulitplication) over the interval by using the polydefint function:
I22 = polydefint(conv(P2,P2),-1,1)
I22 = 0.4000
I23 = polydefint(conv(P2,P3),-1,1)
I23 = 0
I33 = polydefint(conv(P3,P3),-1,1)
I33 = 0.2857
Note that I23 = 0 while
[sym(I22), sym(I33)]
ans = 

which are equal to for and , respectively.

This function is part of……..

PolyTools_Logo_v1.1.png