diff --git a/inst/@sym/expm.m b/inst/@sym/expm.m index 20f80dab..b098b5cf 100644 --- a/inst/@sym/expm.m +++ b/inst/@sym/expm.m @@ -1,4 +1,4 @@ -%% Copyright (C) 2014-2016, 2019 Colin B. Macdonald +%% Copyright (C) 2014-2016, 2019, 2024 Colin B. Macdonald %% %% This file is part of OctSymPy. %% @@ -61,27 +61,35 @@ %!test %! % scalar +%! if (pycall_sympy__ ('return Version(spver) >= Version("1.9")')) %! syms x %! assert (isequal (expm(x), exp(x))) +%! end %!test %! % diagonal +%! if (pycall_sympy__ ('return Version(spver) >= Version("1.9")')) %! A = [sym(1) 0; 0 sym(3)]; %! B = [exp(sym(1)) 0; 0 exp(sym(3))]; %! assert (isequal (expm(A), B)) +%! end %!test %! % diagonal w/ x +%! if (pycall_sympy__ ('return Version(spver) >= Version("1.9")')) %! syms x positive %! A = [sym(1) 0; 0 x+2]; %! B = [exp(sym(1)) 0; 0 exp(x+2)]; %! assert (isequal (expm(A), B)) +%! end %!test %! % non-diagonal +%! if (pycall_sympy__ ('return Version(spver) >= Version("1.9")')) %! syms x positive %! A = [sym(1) 2; 0 x+2]; %! B = expm(A); %! C = double(subs(B, x, 4)); %! D = expm(double(subs(A, x, 4))); %! assert (max (max (abs (C - D))) <= 1e-11) +%! end