I am writing a code to compute some matrix quantities. The result involves Sec andCsc functions, and I want a form displayng only Sinand Cos. I have already seen this question, but the solution suggested does not solve my problem, since I get the following:
Ef = {{-Sin[ζ], 0, 0, 0, 0, 0, 0, 0}, {0, Cos[ζ], 0, 0, 0,
0, 0, 0}, {0, 0, Cos[ζ], 0, 0, 0,
0, γ Cos[ζ]}, {0, 0, 0, Sin[ζ], 0,
0, -γ Sin[ζ], 0}, {0, 0, 0, 0, -1/Sin[ζ], 0, 0,
0}, {0, 0, 0, 0, 0, 1/Cos[ζ], 0, 0}, {0, 0, 0, 0, 0,
0, (1/Cos[ζ]), 0}, {0, 0, 0, 0, 0, 0, 0, 1/Sin[ζ]}};
G = Transpose[Ef].Ef;
MatrixForm[G]
ginv = Table[G[[i]][[j]], {i, 5, 8}, {j, 5, 8}];
g = Inverse[ginv];
MatrixForm[g] // FullSimplify
$$g= \begin{pmatrix} \sin ^2(\zeta ) & 0 & 0 & 0 \\ 0 & \cos ^2(\zeta ) & 0 & 0 \\ 0 & 0 & \frac{\csc ^2(\zeta )}{\gamma ^2+4 \csc ^2(2 \zeta )} & 0 \\ 0 & 0 & 0 & \frac{\sec ^2(\zeta )}{\gamma ^2+4 \csc ^2(2 \zeta )}\end{pmatrix}$$
But I would like the equivalent form (but easier to cope with),
$$g = \begin{pmatrix} \sin ^2(\zeta ) & 0 & 0 & 0 \\ 0 & \cos ^2(\zeta ) & 0 & 0 \\ 0 & 0 & \frac{\cos ^2(\zeta )}{1+\gamma ^2 \sin^2 (\zeta) \cos^2 (\zeta)} & 0 \\ 0 & 0 & 0 & \frac{\sin ^2(\zeta )}{1+\gamma ^2 \sin^2 (\zeta) \cos^2 (\zeta)}\end{pmatrix}$$
Using
$PrePrint = # /. {Csc[z_] :> 1/Defer@Sin[z],
Sec[z_] :> 1/Defer@Cos[z]} &;
I just manage to obtain terms like $$ \frac{1}{\cos^2 (\zeta) \left( \gamma^2 + \frac{4}{\sin^2(2\zeta)}\right)}$$
and further TrigExpand does not have any effect.
Someone has any suggestion?
TrigExpandwill ever convert the last expression. It is a case ofa/a != 1as it may be the case, thata == 0. – LLlAMnYP Mar 16 '15 at 12:03