I tested pow.yac_symbol with a 2 by 2 matrix using a negative n power and it worked properly.
Apparently the inverse of x in the case above takes forever on my machine using any of the following: y_fn(ysym(x), "MatrixPower", -1), yac_str(paste0("MatrixPower(", ysym(x), ",", -1, ")")), and solve(x)
I also tried the same matrix as input in yacas (see below) and the same happens. There is nothing wrong with the implementation of pow.yac_symbol. It just takes to long to obtain a solution in yacas for this case. Obtaining the inverse of a matrix is not a trivial task.
I tested
pow.yac_symbol
with a 2 by 2 matrix using a negativen
power and it worked properly.Apparently the inverse of
x
in the case above takes forever on my machine using any of the following:y_fn(ysym(x), "MatrixPower", -1)
,yac_str(paste0("MatrixPower(", ysym(x), ",", -1, ")"))
, andsolve(x)
I also tried the same matrix as input in
yacas
(see below) and the same happens. There is nothing wrong with the implementation ofpow.yac_symbol
. It just takes to long to obtain a solution inyacas
for this case. Obtaining the inverse of a matrix is not a trivial task.Note, however, that
pow.default
does not have this issue.In summary,
pow.yac_symbol
is in order, however, it might have performance issues with negative exponents for larger matrix inputs andpow.default
using exponentiation by squaring is fast enough for most applications.Let me know which direction you wish to take.
Originally posted by @jeksterslab in https://github.com/r-cas/ryacas/issues/56#issuecomment-779276725