Question: Is LinearAlgebra['MatrixFunction'] numerically a fairly reliable function?

I think that the following worksheet is self-explaining: 
 

restartNULL

interface(version)

`Standard Worksheet Interface, Maple 2023.1, Windows 10, July 7 2023 Build ID 1723669`

(1)

evalf(LinearAlgebra:-MatrixFunction(`<|>`(`<,>`(1, 0, 0), `<,>`(1, 1, I), `<,>`(3, 0, 2)), 'x'/(exp('x')-1), 'x'))

Matrix(%id = 36893489913840207380)

(2)

(* Yet in many cases, the input may be inexact, for we need to speed up computations and decrease memory usage. *)

m := Matrix([[1, 1, 3], [0, 1, 0], [0, I, 2]], datatype = complex(sfloat)):
Digits := 10:
do
    print(CodeTools:-Usage(LinearAlgebra:-MatrixFunction(m, 'x'/(exp('x') - 1), 'x'), quiet), Digits++)
until Digits > 20:

Matrix(3, 3, {(1, 1) = .5819767069, (1, 2) = -.3333333333+.1931757357*I, (1, 3) = -.8068242642, (2, 1) = 0., (2, 2) = .5819767069, (2, 3) = 0., (3, 1) = 0., (3, 2) = -.2689414214*I, (3, 3) = .3130352855}), 10

 

Matrix(3, 3, {(1, 1) = .5819767069, (1, 2) = -.33333333332+.19317573586*I, (1, 3) = -.8068242642, (2, 1) = 0., (2, 2) = .5819767069, (2, 3) = 0., (3, 1) = 0., (3, 2) = -.2689414214*I, (3, 3) = .3130352855}), 11

 

Matrix(3, 3, {(1, 1) = .5819767069, (1, 2) = -.333333333321+.193175735853*I, (1, 3) = -.8068242642, (2, 1) = 0., (2, 2) = .5819767069, (2, 3) = 0., (3, 1) = 0., (3, 2) = -.2689414214*I, (3, 3) = .3130352855}), 12

 

Matrix(3, 3, {(1, 1) = .5819767069, (1, 2) = -.3333333333209+.1931757358526*I, (1, 3) = -.8068242642, (2, 1) = 0., (2, 2) = .5819767069, (2, 3) = 0., (3, 1) = 0., (3, 2) = -.2689414214*I, (3, 3) = .3130352855}), 13

 

Matrix(3, 3, {(1, 1) = .5819767069, (1, 2) = -.33333333332087+.19317573585263*I, (1, 3) = -.8068242642, (2, 1) = 0., (2, 2) = .5819767069, (2, 3) = 0., (3, 1) = 0., (3, 2) = -.2689414214*I, (3, 3) = .3130352855}), 14

 

Matrix(3, 3, {(1, 1) = .5819767069, (1, 2) = -.333333333320870+.193175735852624*I, (1, 3) = -.8068242642, (2, 1) = 0., (2, 2) = .5819767069, (2, 3) = 0., (3, 1) = 0., (3, 2) = -.2689414214*I, (3, 3) = .3130352855}), 15

 

Matrix(3, 3, {(1, 1) = .5819767068693265, (1, 2) = .9999999999999999-3.806824264*I, (1, 3) = -.8068242641099854, (2, 1) = 0., (2, 2) = .5819767068693265, (2, 3) = 0., (3, 1) = 0., (3, 2) = -.2689414214*I, (3, 3) = .3130352854993314}), 16

 

Matrix(3, 3, {(1, 1) = .58197670686932644, (1, 2) = .99999999999999997-3.806824264*I, (1, 3) = -.80682426410998598, (2, 1) = 0., (2, 2) = .58197670686932644, (2, 3) = 0., (3, 1) = 0., (3, 2) = -.2689414214*I, (3, 3) = .31303528549933112}), 17

 

Matrix(3, 3, {(1, 1) = .581976706869326423, (1, 2) = -.999999999999999997+2.19317573589001464*I, (1, 3) = -.806824264109985348, (2, 1) = 0., (2, 2) = .581976706869326423, (2, 3) = 0., (3, 1) = 0., (3, 2) = -.2689414214*I, (3, 3) = .313035285499331308}), 18

 

Matrix(3, 3, {(1, 1) = .5819767068693264245, (1, 2) = -.2500000000000000000-0.5682426411e-1*I, (1, 3) = -.8068242641099853627, (2, 1) = 0., (2, 2) = .5819767068693264245, (2, 3) = 0., (3, 1) = 0., (3, 2) = -.2689414214*I, (3, 3) = .3130352854993313037}), 19

 

Matrix(%id = 36893489913905117652), 20

(3)

# Is `linalg:-matfunc` better than `LinearAlgebra:-MatrixFunction`?!
Digits := 10:
linalg:-matfunc(m, 'x'/(exp('x') - 1), 'x');

Matrix(3, 3, {(1, 1) = .5819767070, (1, 2) = -.3386968877+.2092663986*I, (1, 3) = -.8068242645, (2, 1) = 0., (2, 2) = .5819767070, (2, 3) = 0., (3, 1) = 0., (3, 2) = -.2689414215*I, (3, 3) = .3130352855})

(4)

(*
Even for a 3×3 matrix, the number of digits has to be set to 20.
So … how can you certify that the following output is validated?
*)
_seed := 1234:

LinearAlgebra:-MatrixFunction(LinearAlgebra:-RandomMatrix(50, density = .5, generator = -2*Pi .. 2*Pi, datatype = complex[8]), 'x'/(exp('x')-1), 'x')

Warning, the use of _seed is deprecated.  Please consider using one of the alternatives listed on the _seed help page.

 

Matrix(%id = 36893490216779135924)

(5)


 

Download funm.mws

How do you confirm the validity of the last output? 

> op(3, eval(LinearAlgebra:-MatrixFunction));
 = 
  Copyright (c) 2002 Waterloo Maple Inc. All rights reserved.

And does this mean that LinearAlgebra['MatrixFunction'] is so out-dated that the return value is less effective in certain cases?

Please Wait...