1 | initial version |
It turns out that Sage's various interpreters do have ways to get matrix trig functions :
giac
has matrix trig functions :
sage: matrix(giac.sin(A)._sage_()) [ sin(2) -sin(2) + sin(1) -3sin(2) + 3sin(1)] [-3sin(2) + 3sin(1) 3sin(2) - 2sin(1) 9sin(2) - 9sin(1)] [ sin(2) - sin(1) -sin(2) + sin(1) -3sin(2) + 4sin(1)]
sympy
has not matrix trig functions. But it has matrix exponential (and logarithm), which can be used to find matrix trigonoimetric functions, as noted by @Max Alekseyev :
sage: matrix([[u for u in v] for v in ((IA)._sympy_().exp()-(-IA)._sympy_().ex ....: p())._sage_()/2/I]).apply_map(lambda u:u.demoivre(force=True)) [ sin(2) -sin(2) + sin(1) -3sin(2) + 3sin(1)] [-3sin(2) + 3sin(1) 3sin(2) - 2sin(1) 9sin(2) - 9sin(1)] [ sin(2) - sin(1) -sin(2) + sin(1) -3sin(2) + 4sin(1)]
You can cheat and use Mathematica, or the (gratis but not free) Wolfram engine :
age: matrix(sin._mathematica_().MatrixFunction(A).sage()) [ sin(2) -sin(2) + sin(1) -3sin(2) + 3sin(1)] [-3sin(2) + 3sin(1) 3sin(2) - 2sin(1) 9sin(2) - 9sin(1)] [ sin(2) - sin(1) -sin(2) + sin(1) -3sin(2) + 4sin(1)]
One notes that conversions of matrices to/from interpreters may be problematic which implies some workarounds in the previous examples...
HTH,
2 | No.2 Revision |
It turns out that Sage's various interpreters do have ways to get matrix trig functions :
giac
has matrix trig functions :
sage: matrix(giac.sin(A)._sage_()) [ sin(2) -sin(2) + sin(1) -3sin(2) + 3sin(1)] [-3sin(2) + 3sin(1) 3sin(2) - 2sin(1) 9sin(2) - 9sin(1)] [ sin(2) - sin(1) -sin(2) + sin(1) -3sin(2) + 4sin(1)]
sympy
has not matrix trig functions. But it has matrix exponential (and logarithm), which can be used to find matrix trigonoimetric functions, as noted by @Max Alekseyev :
sage: matrix([[u for u in v] for v in ((IA)._sympy_().exp()-(-IA)._sympy_().ex ....: p())._sage_()/2/I]).apply_map(lambda u:u.demoivre(force=True)) [ sin(2) -sin(2) + sin(1) -3sin(2) + 3sin(1)] [-3sin(2) + 3sin(1) 3sin(2) - 2sin(1) 9sin(2) - 9sin(1)] [ sin(2) - sin(1) -sin(2) + sin(1) -3sin(2) + 4sin(1)]
You can cheat and use Mathematica, or the (gratis but not free) Wolfram engine :
age: sage: matrix(sin._mathematica_().MatrixFunction(A).sage())
[ sin(2) -sin(2) + sin(1) -3sin(2) + 3sin(1)]
[-3sin(2) + 3sin(1) 3sin(2) - 2sin(1) 9sin(2) - 9sin(1)]
[ sin(2) - sin(1) -sin(2) + sin(1) -3sin(2) + 4sin(1)]
One notes that conversions of matrices to/from interpreters may be problematic which implies some workarounds in the previous examples...
HTH,
3 | No.3 Revision |
It turns out that Sage's various interpreters do have ways to get matrix trig functions :
giac
has matrix trig functions :
sage: matrix(giac.sin(A)._sage_())
[ sin(2) -sin(2) + sin(1) sympy
has not matrix trig functions. But it has matrix exponential (and logarithm), which can be used to find matrix trigonoimetric functions, as noted by @Max Alekseyev :
sage: matrix([[u for u in v] for v in You can cheat and use Mathematica, or the (gratis but not free) Wolfram engine :
sage: matrix(sin._mathematica_().MatrixFunction(A).sage())
[ sin(2) -sin(2) + sin(1) One notes that conversions of matrices to/from interpreters may be problematic which implies some workarounds in the previous examples...
HTH,