Matrices-Unit29.mws

MATRICES AND MATRIX OPERATIONS: Unit 29

Dr. Wlodzislaw Kostecki

The Papua New Guinea University of Technology (PNGUT)

Department of Electrical and Communication Engineering

Lae, Morobe Province

Papua New Guinea

Copyright © 2000 by Wlodzislaw Kostecki

All rights reserved

-------------------------------------------------------------------

(29) Integration of matrices comprising functions

OBJECTIVES :

To state the condition necessary for a matrix containing functions of one variable to have an integral with respect to this variable.

To introduce the concept of an integrable matrix.

To provide a definition of the indefinite integral of a matrix in the form of a symbolic expression.

To provide an example of an indefinite integral of a rectangular matrix whose elements are functions.

To specify and illustrate properties of matrix integration.

To provide a definition of the definite integral of a matrix in the form of a symbolic expression.

To state the condition necessary for a matrix containing functions of one variable to have a proper integral with respect to this variable.

To provide an example of a proper integral of a square matrix whose elements are functions.

To provide alternative methods of exact and floating-point evaluation of a proper integral of a matrix.

To show how to evaluate a proper integral of a matrix whose elements are functions but the integration limits have a symbolic form and their numerical values become known in a later phase of computation.

To point out that Maple can compute improper integrals of matrices comprising functions.

To define the improper integral of a matrix and specify the two distinct cases of such an integral.

To provide two examples of computation of improper matrix integrals due to infinite interval of integration.

To provide two examples of computation of improper matrix integrals due to discontinuity of the integrand in the interval of integration.

> restart : with(linalg, equal, multiply) :

If some or all elements of a matrix [ A ] are functions of one variable t , it is convenient to denote the matrix as [ A ( t ) ] when considering integration of such a matrix.

A. Indefinite integrals

When those elements of a matrix [ A ( t ) ] that are functions are all differentiable with respect to t in some common interval t[0] < t < t[1] , then an indefinite integral of [ A ( t ) ] with respect to t may be defined. Then, also the matrix [ A ( t ) ] is said to be integrable in the interval t[0] < t < t[1] .

Consider a ( 2 × 3 ) matrix [ A ( t ) ] given as

> A(t) := matrix(2, 3, [a[11](t), a[12](t), a[13](t), a[21](t), a[22](t), a[23](t)]) : 'A(t)' = A(t) ;

A(t) = matrix([[a[11](t), a[12](t), a[13](t)], [a[2...

The indefinite integral of [ A ( t ) ] with respect to t is defined to be the matrix of the same order with elements Int(a[ij](t),t) , viz.

> `indef_int(A)` := map(Int, A(t), t) : Int('A(t)', t) = matrix(`indef_int(A)`) ;

Int(A(t),t) = matrix([[Int(a[11](t),t), Int(a[12](t...

This operation can be displayed in "like-in-a-book" form, viz.

> Int(A(t), t) = matrix(`indef_int(A)`) ;

Int(matrix([[a[11](t), a[12](t), a[13](t)], [a[21](...

* * *

N.B. The integration of the matrix elements returns the most general antiderivative or primitive of each element with the tacit understanding that all constants of integration are zeros .

* * *

For example, let the elements of a ( 2 × 3 ) matrix [ A ( t ) ] be the functions as shown

> A(t) := matrix(2, 3, [2*exp(-3*t), sin(t/2), cosh(2*t), 3/sqrt(t), 2*t^2, 3*ln(2*t)]) : 'A(t)' = A(t) ;

A(t) = matrix([[2*exp(-3*t), sin(1/2*t), cosh(2*t)]...

The indefinite integral of [ A ( t ) ] is the following ( 2 × 3 ) matrix:

> `indef_int(A)` := map(int, A(t), t) : Int('A(t)', t) = matrix(`indef_int(A)`) ;

Int(A(t),t) = matrix([[-2/3*exp(-3*t), -2*cos(1/2*t...

or, in "like-in-a-book" form,

> Int(A(t), t) = matrix(`indef_int(A)`) ;

Int(matrix([[2*exp(-3*t), sin(1/2*t), cosh(2*t)], [...

* * *

N.B. If two matrices, [ A ( t ) ] and [ B ( t ) ], are conformable for addition and integrable in some common interval, the indefinite integral of their sum is equal to the sum of the antiderivatives of both matrices

Int([A(t)+B(t)],t) = Int(A(t),t)+Int(B(t),t)

For example, let ( 2 × 3 ) matrices [ A ( t ) ] and [ B ( t ) ] be given as

> A(t) := matrix(2, 3, [t, t^3, -1, t^2, 2*t, -3*t^2]) : B(t) := matrix(2, 3, [2, t^2, t^3, -2*t, 3*t^2, -1]) :

> 'A(t)' = A(t) ; 'B(t)' = B(t) ;

A(t) = matrix([[t, t^3, -1], [t^2, 2*t, -3*t^2]])

B(t) = matrix([[2, t^2, t^3], [-2*t, 3*t^2, -1]])

(a) The indefinite integral of the sum of the two matrices is the following ( 2 × 3 ) matrix:

> `indef_int(A+B)` := map(sort, map(int, evalm(A(t)+B(t)), t)) :

> Int(['A(t)' + 'B(t)'], t) = matrix(`indef_int(A+B)`) ;

Int([A(t)+B(t)],t) = matrix([[1/2*t^2+2*t, 1/4*t^4+...

(b) The sum of the antiderivatives of both matrices is the following ( 2 × 3 ) matrix:

> `indef_int(A) + indef_int(B)` := map(sort, evalm(map(int, A(t), t) + map(int, B(t), t))) :

> Int('A(t)', t) + Int('B(t)', t) = matrix(`indef_int(A) + indef_int(B)`) ;

Int(A(t),t)+Int(B(t),t) = matrix([[1/2*t^2+2*t, 1/4...

The equal function applied to the resultant matrices of (a) and (b), i.e.

> equal(`indef_int(A+B)`, `indef_int(A) + indef_int(B)`) ;

true

returns the Boolean value true , which verifies that both matrices are equal.

* * *

N.B. The indefinite integral of the product of a scalar (number) and a matrix is equal to the product of the scalar and the matrix antiderivative

Int(k*A(t),t) = k*Int(A(t),t)

For example, consider a ( 2 × 3 ) matrix [ A ( t ) ] given as

> A(t) := matrix(2, 3, [t, t^3, -1, t^2, 2*t, -3*t^2]) : 'A(t)' = A(t) ;

A(t) = matrix([[t, t^3, -1], [t^2, 2*t, -3*t^2]])

and the scalar k = 3 .

> k := 3 :

(a) The indefinite integral of the product of the scalar and the matrix is the following ( 2 × 3 ) matrix:

> `indef_int(kA)` := map(int, evalm(k * A(t)), t) : Int('k*A(t)', t) = matrix(`indef_int(kA)`) ;

Int(k*A(t),t) = matrix([[3/2*t^2, 3/4*t^4, -3*t], [...

(b) The product of the scalar and the matrix antiderivative is the following ( 2 × 3 ) matrix:

> `k indef_int(A)` := evalm(k * map(int, A(t), t)) : 'k' * Int('A(t)', t) = matrix(`k indef_int(A)`) ;

k*Int(A(t),t) = matrix([[3/2*t^2, 3/4*t^4, -3*t], [...

Both matrices of (a) and (b) are equal by inspection.

* * *

N.B. The indefinite integral of a zero matrix [ 0 ] is the same zero matrix

Int(`0`,t) = [ 0 ]

For example, consider the ( 2 × 3 ) matrix [ 0 ]

> `0` := matrix(2, 3, [0, 0, 0, 0, 0, 0]) : `0` = matrix(`0`) ;

`0` = matrix([[0, 0, 0], [0, 0, 0]])

The indefinite integral of the matrix [ 0 ] is the same zero matrix

> `indef_int(0)` := map(int, `0`, t) : Int(`0`, t) = matrix(`indef_int(0)`) ;

Int(`0`,t) = matrix([[0, 0, 0], [0, 0, 0]])

* * *

B. Definite integrals

When those elements of a matrix [ A ( t ) ] that are functions are all differentiable with respect to t in a common interval [a, b] , then a definite integral of [ A ( t ) ] over this interval may be defined.

Consider a ( 2 × 3 ) matrix [ A ( t ) ] given as

> A(t) := matrix(2, 3, [a[11](t), a[12](t), a[13](t), a[21](t), a[22](t), a[23](t)]) : 'A(t)' = A(t) ;

A(t) = matrix([[a[11](t), a[12](t), a[13](t)], [a[2...

The definite integral of [ A ( t ) ] over an interval [a, b] is defined to be the matrix of the same order with elements Int(a[ij](t),t = a .. b) , viz.

> `def_int(A)` := map(Int, A(t), t=a..b) : Int('A(t)', t=a..b) = matrix(`def_int(A)`) ;

Int(A(t),t = a .. b) = matrix([[Int(a[11](t),t = a ...

This operation can be displayed in "like-in-a-book" form, viz.

> Int(A(t), t=a..b) = matrix(`def_int(A)`) ;

Int(matrix([[a[11](t), a[12](t), a[13](t)], [a[21](...

(1) Proper integrals

If neither end point of the integration interval [a, b] is infinity and the integrand has no singularity in this interval, the integral is proper .

For example, consider a ( 2 × 2 ) matrix [ A ( t ) ] given as

> A(t) := matrix(2, 2, [9*exp(-2*t), 3/sqrt(t), sin(t/2), t*cos(t)]) : 'A(t)' = A(t) ;

A(t) = matrix([[9*exp(-2*t), 3*1/(sqrt(t))], [sin(1...

and compute its integral over the interval [1, 3] , i.e.

> `prp_int(A)` := map(Int, A(t), t=1..3) : Int('A(t)', t=1..3) = matrix(`prp_int(A)`) ;

Int(A(t),t = 1 .. 3) = matrix([[Int(9*exp(-2*t),t =...

Exact evaluation of the resultant matrix may be performed using the function map together with the arrow-type procedure including the function value , viz.

> Int('A(t)', t=1..3) = map(x->value(x), `prp_int(A)`) ;

Int(A(t),t = 1 .. 3) = matrix([[-9/2*exp(-6)+9/2*ex...

Floating-point evaluation of the exact resultant matrix may be done using any of the following alternative methods.

Method 1 . Using the function evalf and any of the functions evalm , matrix , or op :

> Int('A(t)', t=1..3) = evalf(evalm(`prp_int(A)`)) ; Int('A(t)', t=1..3) = evalf(matrix(`prp_int(A)`)) ; Int('A(t)', t=1..3) = evalf(op(`prp_int(A)`)) ;

Int(A(t),t = 1 .. 3) = matrix([[.5978543898, 4.3923...

Int(A(t),t = 1 .. 3) = matrix([[.5978543898, 4.3923...

Int(A(t),t = 1 .. 3) = matrix([[.5978543898, 4.3923...

Method 2 . Using the function convert together with the form (type) float and any of the functions evalm , matrix , or op :

> Int('A(t)', t=1..3) = convert(evalm(`prp_int(A)`), float) ; Int('A(t)', t=1..3) = convert(matrix(`prp_int(A)`), float) ; Int('A(t)', t=1..3) = convert(op(`prp_int(A)`), float) ;

Int(A(t),t = 1 .. 3) = matrix([[.5978543898, 4.3923...

Int(A(t),t = 1 .. 3) = matrix([[.5978543898, 4.3923...

Int(A(t),t = 1 .. 3) = matrix([[.5978543898, 4.3923...

Method 3 . Using the function map together with the arrow-type procedure including the function evalf :

> Int('A(t)', t=1..3) = map(x->evalf(x), `prp_int(A)`) ;

Int(A(t),t = 1 .. 3) = matrix([[.5978543898, 4.3923...

* * *

N.B. Where the end points a and b of the integration interval [a, b] are not given in numerical form, Maple can evaluate the definite integral of a matrix symbolically.

For example, consider the same matrix [ A ( t ) ] as before.

The integral of the matrix over the interval [a, b] is

> `prp_int(A)` := map(Int, A(t), t=a..b) : Int('A(t)', t=a..b) = matrix(`prp_int(A)`) ;

Int(A(t),t = a .. b) = matrix([[Int(9*exp(-2*t),t =...

Symbolic evaluation of the matrix integral over the interval [a, b] yields the following matrix:

> `prp_int(A)` := map(x->value(x), `prp_int(A)`) : Int('A(t)', t=a..b) = matrix(`prp_int(A)`) ;

Int(A(t),t = a .. b) = matrix([[-9/2*exp(-2*b)+9/2*...

If numerical values of the integral limits are specified and input in a later phase of computations, e.g.

> a := Pi/4 : b := 3*Pi/2 : 'a' = a ; 'b' = b ;

a = 1/4*Pi

b = 3/2*Pi

then exact evaluation of the matrix may be performed as follows:

> `prp_int(A)` := eval(subs('a'=a, 'b'=b, matrix(`prp_int(A)`))) :

> Int('A(t)', t=a..b) = matrix(`prp_int(A)`) ;

Int(A(t),t = 1/4*Pi .. 3/2*Pi) = matrix([[-9/2*exp(...

Floating-point evaluation of the above matrix yields

> `prp_int(A)` := evalf(matrix(`prp_int(A)`)) : Int('A(t)', t=a..b) = matrix(`prp_int(A)`) ;

Int(A(t),t = 1/4*Pi .. 3/2*Pi) = matrix([[.93509494...

* * *

(2) Improper integrals

When the integrand tends to infinity at some point in the interval of integration or the interval itself is infinite in length, the integral is improper .

Maple is also able to compute integrals of matrices if improper integrals are involved. Consider the two cases of improper integrals.

CASE 1 . Improper integral due to infinite interval of integration [ a , infinity ) .

Example 1 . Compute the integral of a ( 2 × 3 ) matrix [ A ( t ) ] given as

> A(t) := matrix(2, 3) :

> A(t)[1,1] := exp(-5*t^2) : A(t)[1,2] := t^2*exp(-3*t^2) : A(t)[1,3] := exp(-2*t)*sin(t)/t : A(t)[2,1] := t/(exp(t)+1) : A(t)[2,2] := exp(-2*t^2)*cos(3*t) : A(t)[2,3] := t/(exp(t)-1) :

> A(t) := A(t) : 'A(t)' = A(t) ;

A(t) = matrix([[exp(-5*t^2), t^2*exp(-3*t^2), exp(-...

The integral of the matrix over the interval [ 0 , infinity ) is

> `imp_int(A)` := map(Int, A(t), t=0..infinity) : Int('A(t)', t=0..infinity) = matrix(`imp_int(A)`) ;

Int(A(t),t = 0 .. infinity) = matrix([[Int(exp(-5*t...

Symbolic evaluation of the matrix integral yields the following exact matrix:

> `imp_int(A)` := map(x->value(x), `imp_int(A)`) : Int('A(t)', t=0..infinity) = matrix(`imp_int(A)`) ;

Int(A(t),t = 0 .. infinity) = matrix([[1/10*sqrt(5)...

Floating-point evaluation of the exact resultant matrix gives

> `imp_int(A)` := evalf(matrix(`imp_int(A)`)) : Int('A(t)', t=0..infinity) = matrix(`imp_int(A)`) ;

Int(A(t),t = 0 .. infinity) = matrix([[.3963327299,...

Example 2 . Compute the integral of a ( 2 × 3 ) matrix [ B ( t ) ] given as

> B(t) := matrix(2, 3) :

> B(t)[1,1] := (sin(t)/t)^2 : B(t)[1,2] := sin(t)*cos(t/2)/t : B(t)[1,3] := 1/(1+t^2) : B(t)[2,1] := tan(t)/t : B(t)[2,2] := cos(t/4)*sin(t/2)/t : B(t)[2,3] := sin(2*t)/t :

> B(t) := B(t) : 'B(t)' = B(t) ;

B(t) = matrix([[sin(t)^2/(t^2), sin(t)*cos(1/2*t)/t...

The integral of the matrix over the interval [ 0 , infinity ) is

> `imp_int(B)` := map(Int, B(t), t=0..infinity) : Int('B(t)', t=0..infinity) = matrix(`imp_int(B)`) ;

Int(B(t),t = 0 .. infinity) = matrix([[Int(sin(t)^2...

Symbolic evaluation of the matrix integral yields the following exact matrix:

> `imp_int(B)` := map(x->value(x), `imp_int(B)`) : Int('B(t)', t=0..infinity) = matrix(`imp_int(B)`) ;

Int(B(t),t = 0 .. infinity) = matrix([[1/2*Pi, 1/2*...

Floating-point evaluation of the exact resultant matrix gives

> `imp_int(B)` := evalf(matrix(`imp_int(B)`)) : Int('B(t)', t=0..infinity) = matrix(`imp_int(B)`) ;

Int(B(t),t = 0 .. infinity) = matrix([[1.570796327,...

CASE 2 . Improper integral due to discontinuity of the integrand in the interval of integration [a, b] .

Example 1 . Compute the integral over the interval [0, 1] for a ( 2 × 2 ) matrix [ A ( t ) ] given as

> A(t) := matrix(2, 2) :

> A(t)[1,1] := ln(t)/(t-1) : A(t)[1,2] := ln(1+t)/t : A(t)[2,1] := ln(t)/(t^2-1) : A(t)[2,2] := (1+t)*ln(t)/(t-1) :

> A(t) := A(t) : 'A(t)' = A(t) ;

A(t) = matrix([[ln(t)/(t-1), ln(1+t)/t], [ln(t)/(t^...

The integral of the matrix over the interval [0, 1] is

> `imp_int(A)` := map(Int, A(t), t=0..1) : Int('A(t)', t=0..1) = matrix(`imp_int(A)`) ;

Int(A(t),t = 0 .. 1) = matrix([[Int(ln(t)/(t-1),t =...

Notice that each integrand has a singularity at either t = 0 or t = 1 in the sense that the integrand tends to infinity as proc (t) options operator, arrow; 0 end proc or proc (t) options operator, arrow; 1 end proc , respectively.

Symbolic evaluation of the matrix integral yields the following exact matrix:

> `imp_int(A)` := map(x->value(x), `imp_int(A)`) : Int('A(t)', t=0..1) = matrix(`imp_int(A)`) ;

Int(A(t),t = 0 .. 1) = matrix([[1/6*Pi^2, 1/12*Pi^2...

Floating-point evaluation of the exact resultant matrix gives

> `imp_int(A)` := evalf(matrix(`imp_int(A)`)) : Int('A(t)', t=0..1) = matrix(`imp_int(A)`) ;

Int(A(t),t = 0 .. 1) = matrix([[1.644934068, .82246...

Example 2 . Compute the integral over the interval [0, Pi/2] for a ( 2 × 2 ) matrix [ B ( t ) ] given as

> B(t) := matrix(2, 2) :

> B(t)[1,1] := (sin(4*t)/sin(t))^2 : B(t)[1,2] := ln(cos(t)^4) : B(t)[2,1] := 1/sqrt(t) : B(t)[2,2] := ln(1/cos(t)) :

> B(t) := B(t) : 'B(t)' = B(t) ;

B(t) = matrix([[sin(4*t)^2/(sin(t)^2), ln(cos(t)^4)...

The integral of the matrix over the interval [0, Pi/2] is

> `imp_int(B)` := map(Int, B(t), t=0..Pi/2) : Int('B(t)', t=0..Pi/2) = matrix(`imp_int(B)`) ;

Int(B(t),t = 0 .. 1/2*Pi) = matrix([[Int(sin(4*t)^2...

Notice that each integrand has a singularity in the interval [0, Pi/2] at either t = 0 or t = Pi/2 in the sense that the integrand tends to infinity as proc (t) options operator, arrow; 0 end proc or proc (t) options operator, arrow; Pi/2 end proc , respectively.

Symbolic evaluation of the matrix integral yields the following exact matrix:

> `imp_int(B)` := map(x->value(x), `imp_int(B)`) : Int('B(t)', t=0..Pi/2) = matrix(`imp_int(B)`) ;

Int(B(t),t = 0 .. 1/2*Pi) = matrix([[2*Pi, -2*Pi*ln...

Floating-point evaluation of the exact resultant matrix gives

> `imp_int(B)` := evalf(matrix(`imp_int(B)`)) : Int('B(t)', t=0..Pi/2) = matrix(`imp_int(B)`) ;

Int(B(t),t = 0 .. 1/2*Pi) = matrix([[6.283185308, -...

Disregarding the meaningless imaginary parts simplifies the above to

> `imp_int(B)` := evalm(Re(`imp_int(B)`)) : Int('B(t)', t=0..Pi/2) = matrix(`imp_int(B)`) ;

Int(B(t),t = 0 .. 1/2*Pi) = matrix([[6.283185308, -...

* * *

Proceed to Unit (30) for " Application of the function exp( [ A ] t ) in solving matrix equations ".

-------------------------------------------------------------------