Loading [MathJax]/jax/output/HTML-CSS/jax.js
Ask Your Question
1

How to calculate sine of a matrix

asked 13 years ago

this post is marked as community wiki

This post is a wiki. Anyone with karma >750 is welcome to improve it.

Hi I want to calcilate sin(Mt) which M is a 3 by 3 matrix. I have no problem with calculating exp(Mt) but it seems the sine is different! I will be pleased if anyone could help...

Preview: (hide)

3 Answers

Sort by » oldest newest most voted
1

answered 13 years ago

this post is marked as community wiki

This post is a wiki. Anyone with karma >750 is welcome to improve it.

You could just use

$$ sin(x) = \frac{exp(ix)-exp(-ix)}{2*i} $$

Preview: (hide)
link
0

answered 13 years ago

kcrisman gravatar image

I'm just putting down some thoughts here that hopefully someone else will know about.

sage: M = matrix([[2,3],[3,2]])
sage: e^M
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
TypeError: mutable matrices are unhashable
sage: exp(M)
[1/2*(e^6 + 1)*e^(-1) 1/2*(e^6 - 1)*e^(-1)]
[1/2*(e^6 - 1)*e^(-1) 1/2*(e^6 + 1)*e^(-1)]
sage: M.exp()
[1/2*(e^6 + 1)*e^(-1) 1/2*(e^6 - 1)*e^(-1)]
[1/2*(e^6 - 1)*e^(-1) 1/2*(e^6 + 1)*e^(-1)]

Naturally, this is really because there isn't any sin method. However:

sage: M = matrix([[2,3],[3,2]])
sage: M.simp[tab] # nothing
sage: M = matrix(SR,[[2,3],[3,2]])
sage: M.simp[tab]
M.simplify           M.simplify_rational  M.simplify_trig

There still isn't a sin. But this could be doable. Of course, the question remains as to how many such things we would want to add. Thoughts?

Preview: (hide)
link
0

answered 13 years ago

this post is marked as community wiki

This post is a wiki. Anyone with karma >750 is welcome to improve it.

I'm trying to understand what you are doing with sin(Mt). Is one of these what you want?

sage: m=random_matrix(QQ,3); m
[-1  0 -1]
[-1  1  2]
[-2  0  1]
sage: m.apply_map(sin)
[-sin(1)       0 -sin(1)]
[-sin(1)  sin(1)  sin(2)]
[-sin(2)       0  sin(1)]
sage: t=var('t')
sage: (m*t).apply_map(sin)
[  sin(-t)         0   sin(-t)]
[  sin(-t)    sin(t)  sin(2*t)]
[sin(-2*t)         0    sin(t)]

Or do you mean you want to calculate the series k=0(1)kM2k+1(2k+1)!?

Preview: (hide)
link

Comments

Ah, I *knew* there was a way to do this that we had already added. But seriously, I think @saeed1922 wants the latter. Why doesn't e^M work, though? Or more precisely, where does the error come from? I can't find it in e.__pow__??

kcrisman gravatar imagekcrisman ( 13 years ago )

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 13 years ago

Seen: 2,859 times

Last updated: Feb 03 '12