# How to automatically get rid of trig functions in an expression?

I have a large expression containing many terms like this:

Sin[1/2 ArcTan[(2 Log[5])/(Log[5]^2 - 2)]]


where a trig function is invoked on a rational multiple of an inverse trig function.

I want to expand trig functions such that this term turns into:

Sqrt[1/2 (1 - Sqrt[1 - (4 Log[5]^2)/(4 + Log[5]^4)])]


It is tedious to manually convert all such terms, so I am looking for a function that is able to do this automatically. Could you help me with it?

-
–  Artes Sep 25 '13 at 20:55

Try this one

Sin[1/2 ArcTan[(2 Log[5])/(-2 + Log[5]^2)]] // FunctionExpand


Another approach is to apply your own rules. You just need to get rid of the rational between the trig function and the inverse trig function. For example

Sin[1/2 ArcTan[(2 Log[5])/(-2 + Log[5]^2)]] /.
Sin[1/2 x_] :> Sqrt[1/2 (1 - Cos[x])] // FullSimplify


Verification

% // N
Sin[1/2 ArcTan[(2 Log[5])/(-2 + Log[5]^2)]] // N


0.640166

0.640166

-

You can use FullSimplify and play with the ComplexityFunction Option until you obtain a satisfactory result. For example: Let's define our function in terms of LeafCount

 c[n_][e_] := n Count[e, _Sin | _ArcTan, Infinity] + LeafCount[e]


Then:

FullSimplify[Sin[1/2 ArcTan[(2 Log[5])/(Log[5]^2 - 2)]],
ComplexityFunction -> c[#]] & /@ Range[40, 60, 4]


Which gives:

{I Sinh[1/4 (Log[1 - (I Log[25])/(-2 + Log[5]^2)] - Log[1 + (I Log[25])/(-2 + Log[5]^2)])],

I Sinh[1/4 (Log[1 - (I Log[25])/(-2 + Log[5]^2)] - Log[1 + (I Log[25])/(-2 + Log[5]^2)])],

I Sinh[1/4 (Log[1 - (I Log[25])/(-2 + Log[5]^2)] - Log[1 + (I Log[25])/(-2 + Log[5]^2)])],

I Sinh[1/4 (Log[1 - (I Log[25])/(-2 + Log[5]^2)] - Log[1 + (I Log[25])/(-2 + Log[5]^2)])],

Log[5] Sqrt[2/( 4 + Log[5]^4 - 2 Sqrt[4 + Log[5]^4] + Log[5]^2 Sqrt[4 + Log[5]^4])],

Log[5] Sqrt[2/( 4 + Log[5]^4 - 2 Sqrt[4 + Log[5]^4] + Log[5]^2 Sqrt[4 + Log[5]^4])]}

Where the last 2 answers are the same as that obtained from FunctionExpand. Only this one is more flexible.

-