1
$\begingroup$

I have this sets of equations:

system=$\left(\begin{array}{c} x1'(t)=x2(t)\\ x2'(t)=-p2(t)-x2(t)\\ p1'(t)=-x1(t)\\p2'(t)=p2(t)-p1(t)\\\end{array}\right)$

and corresponding $A$ matrix is

$\left(\begin{array}{cccc} 0 & 1 & 0 & 0 \\ 0 & -1 & 0 & -1 \\ -1 & 0 & 0 & 0 \\ 0 & 0 & -1 & 1 \\\end{array}\right)$

I need to find the solution and have with the following line;

(Simplify /@ MatrixExp[t A] // N)

which resulted ie the 1,1 element of result as

$0.5 \left((0.5\, -0.288675 i) e^{(0.866025\, -0.5 i) t}+(0.5\, -0.288675 i) e^{(-0.866025+0.5 i) t}+(0.5\, +0.288675 i) e^{(-0.866025-0.5 i) t}+(0.5\, +0.288675 i) e^{(0.866025\, +0.5 i) t}\right)$

Edit: Required Codes

A = {{0, 1, 0, 0}, {0, -1, 0, -1}, {-1, 0, 0, 0}, {0, 0, -1, 1}};

(Simplify /@ MatrixExp[t A] // N) // TableForm

where $t$ is time variable.

How can I get rid of the imaginary variable inside the parenthesis and the exponential form to get something like $c_1e^a\cos(b)+c_2e^a\sin(b))$?

Result should be like this.

$\endgroup$
5
  • $\begingroup$ You've already asked a few questions so should be able to format them properly. Here, you're mixing $\LaTeX$, code, and uncompiled $\LaTeX$ (?!). Edit your post so that it's readable. Provide the codes required to reproduce your results. As it stands, there's no t or A. See here for basic tips on asking questions. I'll retract the downvote once you conform to the requirements. $\endgroup$
    – corey979
    Commented Jan 14, 2017 at 14:44
  • $\begingroup$ Look up ExpToTrig[] in the meantime. $\endgroup$ Commented Jan 14, 2017 at 14:57
  • $\begingroup$ @corey979 it was readable format for $\latex$ but it doesn't allow me to submit the question saying it seems there is a unporper formatted code. Thus I changed them into code to be able to submit. $\endgroup$
    – freezer
    Commented Jan 14, 2017 at 15:04
  • $\begingroup$ :) yes t is free variable. So how to solve :) $\endgroup$
    – freezer
    Commented Jan 14, 2017 at 15:23
  • $\begingroup$ may be it is a style thing, but I find Simplify[ MatrixExp[t A] ] more clear than Simplify /@ MatrixExp[t A] $\endgroup$
    – Nasser
    Commented Jan 14, 2017 at 21:05

1 Answer 1

3
$\begingroup$

With

m = Simplify /@ MatrixExp[t A] // Normal

do either (this gives hyperbolic functions)

out1 = FullSimplify @ ExpToTrig @ m
out1[[1, 1]]

$\cos \left(\frac{t}{2}\right) \cosh \left(\frac{\sqrt{3} t}{2}\right)-\frac{\sin \left(\frac{t}{2}\right) \sinh \left(\frac{\sqrt{3} t}{2}\right)}{\sqrt{3}}$

or (to get exponentials)

out2 = FullSimplify @ ComplexExpand @ m
out2[[1, 1]]

$\frac{e^{-\frac{\sqrt{3} t}{2}} \sin \left(\frac{t}{2}\right)}{2 \sqrt{3}}-\frac{e^{\frac{\sqrt{3} t}{2}} \sin \left(\frac{t}{2}\right)}{2 \sqrt{3}}+\frac{1}{2} e^{-\frac{\sqrt{3} t}{2}} \cos \left(\frac{t}{2}\right)+\frac{1}{2} e^{\frac{\sqrt{3} t}{2}} \cos \left(\frac{t}{2}\right)$

(I show only one element of each output because they're long).

$\endgroup$
3
  • $\begingroup$ One might want to pre-process the RootSum[] objects with Normal[] before feeding to ExpToTrig[]. $\endgroup$ Commented Jan 14, 2017 at 15:33
  • $\begingroup$ @J.M. Nice one, thanks! $\endgroup$
    – corey979
    Commented Jan 14, 2017 at 15:38
  • $\begingroup$ @corey979 thank you. $\endgroup$
    – freezer
    Commented Jan 14, 2017 at 17:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.