polycompose


Untitled

Compose two polynomials

Syntax

r = polycompose(p,q)

Description

r = polycompose(p,q), returns the coefficients of the polynomial r (in MATLAB® polynomial form) that results from composing polynomial p with polynomial q(x), i.e., p(q(x)), where p and q are row vectors whose elements are the coefficients of the polynomials in MATLAB® polynomial form.

Examples

Example 1 The shifted Legendre polynomials:
The so-called shifted Legendre polynomials (orthogonal on the interval ) can be defined by the polynomial composition , where are the standard Legendre polynomials (orthogonal on the interval ) and is the affine transformation , which bijectively maps the interval to the interval . The third-degree shifted Legendre polynomial, for example, can be computed by obtaining the standard third-degree Legendre polynomial,
p = polyLegendre(3)
p = 1×4
2.5000 0 -1.5000 0
defining the affine transformation in MATLAB® polynomial form,
q = [2,-1];
and then taking p composed with q, i.e.,
r = polycompose(p,q)
r = 1×4
20 -30 12 -1
which can be compared to the entry in the table here.
Note that, in general, the composition of polynomials is not commutative, i.e., polycompose(p,q) polycompose(q,p), as verified in this case by computing
s = polycompose(q,p)
s = 1×4
5 0 -3 -1
Commutativity is attained only by particular functions as demonstrated in the next example.
Example 2 A function composed with its inverse:
A function composed with its inverse is equal to x. Consider, for example, taking the composition of the function with its inverse , i.e.
r = polycompose([2 3],[1/2 -3/2])
r = 1×2
1 0
which is equal to x. In this case, the composition of the functions is commutative, i.e.,
s = polycompose([1/2 -3/2],[2 3])
s = 1×2
1 0
which is equal to r.

This function is part of……..

PolyTools_Logo_v1.1.png