Post Reply 
Could somebody explain why?
04-08-2018, 09:24 PM
Post: #1
Could somebody explain why?
I am in CAS and have matrix of angles (CAS is in deg, mode) and m:=[[30,60],[60,30]]. When I do sin(m3(1)) I get [1/2,sqrt(3)/2], same if I do sin([[30,60]]) and these are correct ans.,the same when I access elements individually. But, when I do sin(m) I get [[.25,.75],[.75,.25]], the ans. are squares of the correct values. The same happens in Home when I use CAS.sin(as above). If sin operates on vectors ex.[30,60] and on 1x2 matrix [[30,60]] shouldn't it also correctly operate on nxm matrices and give the right ans.

PS. cos applied as above gives even stranger answers.

Cheers
Find all posts by this user
Quote this message in a reply
04-09-2018, 05:00 AM
Post: #2
RE: Could somebody explain why?
the theorem that defines transcendental function of a matrix as in Sine(M1_nxn) or e^(M1_nxn) or....with emphasis of the being a square matrix;
Cayley-Hamilton theorem is used to evaluate this types of functions;

if your matrix is matrix is nxm dimension then these transcendental function is evaluated element by element.
Find all posts by this user
Quote this message in a reply
04-09-2018, 09:45 AM
Post: #3
RE: Could somebody explain why?
I am not that deep in this kind of mathematics, but I want to give it a try.
At first glance one awaits sine working on a matrix element by element which is wrong, only if your matrix is quadratic and diagonal this will hold. In your case you may try (exp(i*M)-exp(-i*M))/(2i) which exactly gives your result, you can do diagonalization yourself, for example via jordan(M)=[P,J]. Then M=P*J*P^-1 and so sin(M)=P*sin(J)*P^-1, this works as J is diagonal, and gives the same result, so the prime is correct. I tried Wolfram, but that handles matrices as lists of lists and this may be the reason for it returning the sine of the elements. So everything seems to be dependent on implementation, the 50G refuses an evaluation of transcendential functions on matrices. I think Bernard can give deeper explanation.
If you know what you need you can use apply(x->sin(x),m).
Arno
Find all posts by this user
Quote this message in a reply
04-09-2018, 04:53 PM
Post: #4
RE: Could somebody explain why?
Thank you toshk, Arno K,

I am trying to write some kind of "work horse" program that works on matrices. I want to have the prgm. to work in such a way that it takes as arguments a matrix (nxn or nxm) and a program or function that do something to rows or elements of the matrix. I did not think about the transcendental functions such as sin when using nxn matrix. The program works OK on nxm matrices with transcendental functions even on single elements of a matrix ex. sin(nxm matrix), but with square matrices is a different story. I made my program to work on rows or columns of the matrix and that takes care of the square matreces as well.

Thank you for the explanations.

Cheers John P
Find all posts by this user
Quote this message in a reply
04-09-2018, 05:08 PM (This post was last modified: 04-09-2018 05:10 PM by toshk.)
Post: #5
RE: Could somebody explain why?
look into EXECON; or break your matrix in a single list {} and operate on them then back to matrix via list2mat(); NOT list of a list {{},{}}
cos prime parse {{},{}} as matrix too.
Find all posts by this user
Quote this message in a reply
04-09-2018, 06:18 PM
Post: #6
RE: Could somebody explain why?
My "work horse" works on matrices and lists of lists by checking "type" and if type==4 uses list2mat. I want to make for some typical ops on vect. such as MAG, ATTRIBUT, DOT, CROSS PROD etc. to behave accordingly for vector(s) or/and matrices.
Find all posts by this user
Quote this message in a reply
04-10-2018, 09:18 AM
Post: #7
RE: Could somebody explain why?
As explained by Arno K, analytic functions like sin/exp/etc. applied on a square matrix m will compute sin(m) or exp(m) etc. as defined by their series expansion, and this is done by diagonalizing (or jordanizing) m.
If you want to apply sin element by element run apply(sin,m,matrix).
Find all posts by this user
Quote this message in a reply
Post Reply 




User(s) browsing this thread: 1 Guest(s)