Function: matfunc - function of a matrix

Calling sequence:

matfunc(A,f);

Parameters:

A - a square matrix.

f - a function or expression in one variable.

Description:

Examples:

> A:= matrix([[11,3],[5,3]]);

A := matrix([[11, 3], [5, 3]])

Find a square root of A .

> B:= matfunc(A,sqrt);

B := matrix([[1/2*sqrt(7+sqrt(31))-2/31*sqrt(31)*sq...
B := matrix([[1/2*sqrt(7+sqrt(31))-2/31*sqrt(31)*sq...
B := matrix([[1/2*sqrt(7+sqrt(31))-2/31*sqrt(31)*sq...

Check that it works:

> map(normal,evalm(B^2));

matrix([[11, 3], [5, 3]])

Find a logarithm of A .

> matfunc(A,ln);

matrix([[1/2*ln(7+sqrt(31))-2/31*sqrt(31)*ln(7-sqrt...
matrix([[1/2*ln(7+sqrt(31))-2/31*sqrt(31)*ln(7-sqrt...
matrix([[1/2*ln(7+sqrt(31))-2/31*sqrt(31)*ln(7-sqrt...
matrix([[1/2*ln(7+sqrt(31))-2/31*sqrt(31)*ln(7-sqrt...

> map(simplify,linalg[exponential](%));

matrix([[11, 3], [5, 3]])

A matrix whose characteristic polynomial is an irreducible quintic:

> A:= linalg[companion](x^5 + x^4 -2* x^2 + 1,x);

A := matrix([[0, 0, 0, 0, -1], [1, 0, 0, 0, 0], [0,...

> matfunc(A,sqrt);

Sum(matrix([[sqrt(_R)*(-2*_R+_R^3+_R^4)/(4*_R^3+5*_...
Sum(matrix([[sqrt(_R)*(-2*_R+_R^3+_R^4)/(4*_R^3+5*_...
Sum(matrix([[sqrt(_R)*(-2*_R+_R^3+_R^4)/(4*_R^3+5*_...
Sum(matrix([[sqrt(_R)*(-2*_R+_R^3+_R^4)/(4*_R^3+5*_...
Sum(matrix([[sqrt(_R)*(-2*_R+_R^3+_R^4)/(4*_R^3+5*_...
Sum(matrix([[sqrt(_R)*(-2*_R+_R^3+_R^4)/(4*_R^3+5*_...
Sum(matrix([[sqrt(_R)*(-2*_R+_R^3+_R^4)/(4*_R^3+5*_...
Sum(matrix([[sqrt(_R)*(-2*_R+_R^3+_R^4)/(4*_R^3+5*_...
Sum(matrix([[sqrt(_R)*(-2*_R+_R^3+_R^4)/(4*_R^3+5*_...
Sum(matrix([[sqrt(_R)*(-2*_R+_R^3+_R^4)/(4*_R^3+5*_...
Sum(matrix([[sqrt(_R)*(-2*_R+_R^3+_R^4)/(4*_R^3+5*_...
Sum(matrix([[sqrt(_R)*(-2*_R+_R^3+_R^4)/(4*_R^3+5*_...

A floating-point example.

> Af:= matrix([[0, 0, 36.], [1, 0, -49.], [0, 1, 14.]]);

Af := matrix([[0, 0, 36.], [1, 0, -49.], [0, 1, 14....

> Bf:=matfunc(Af,sqrt);

Bf := matrix([[.6000000001, -.5999999994, 6.6000000...

> evalm(Bf^2);

matrix([[.6e-9, .2e-8, 35.99999998], [.9999999990, ...

See also: eigenvalues , exponential , linalg

Maple Advisor Database R. Israel 1999