# How does WolframAlpha simplify this trig expression?

I am trying to understand how WolframAlpha reduces the following trig expression $$\frac{\ln \left(\sin \left(\frac{\alpha x}{2}\right)+\cos \left(\frac{\alpha x}{2}\right)\right)}{\alpha }-\frac{\ln \left(\cos \left(\frac{\alpha x}{2}\right)-\sin \left(\frac{\alpha x}{2}\right)\right)}{\alpha }$$ into $$\frac{\ln (\tan (\alpha x)+\sec (\alpha x))}{\alpha }$$

I tried using TrigExpand, TrigReduce and FullSimplify with no use.

CODE:

FullSimplify[Integrate[Sec[\[Alpha]*x], x], Assumptions -> {\[Alpha] > 0 && Element[x, Reals]}]
• Did you try Assumptions->[Alpha]>0&& x [Element] Reals? – user64494 Jan 19 '18 at 18:23
• @user64494 yes I’ll post the code. It doesn’t work – DMH16 Jan 19 '18 at 18:27
• The command with the option Assumptions -> [Alpha] > 0 && x >= 0 && x <= Pi/(4*[Alpha]) performs (2 ArcTanh[Tan[(x [Alpha])/2]])/[Alpha]. – user64494 Jan 19 '18 at 18:36
• This will get you part way there Simplify[Log[Sin[a x/2]+Cos[a x/2]]/a-Log[Cos[a x/2]-Sin[a x/2]]/a, Sin[a x/2]+Cos[a x/2]>0 && Cos[a x/2]-Sin[a x/2]>0]To finish you probably need to think more about zeros in denominators – Bill Jan 19 '18 at 18:39
• Note that Integrate[Sec[α x], x] /. {x -> 1, α -> 3.} is different from Log[Tan[α x] + Sec[α x]]/α /. {x -> 1, α -> 3.}, so the functions are not the same. If that's not important, maybe FullSimplify[Integrate[Sec[α x], x], TransformationFunctions -> {Automatic, Log@*Exp}] suffice? – Coolwater Jan 19 '18 at 20:25

May be this can be a start. I can't find method for final transformation yet. May be it needs special rule.

ClearAll[x,a,A0,B0];
rep    =  {A0->Sin[a x/2],B0->Cos[a x/2]}
expr   =  Log[A0+B0]-Log[B0-A0] ;
result =  (FullSimplify[Log[Exp[expr]]]/.rep)/a

$$\frac{\log \left(\frac{\sin \left(\frac{a x}{2}\right)+\cos \left(\frac{a x}{2}\right)}{\cos \left(\frac{a x}{2}\right)-\sin \left(\frac{a x}{2}\right)}\right)}{a}$$

• Interesting! Thank you for the answer. I won't accept one yet, since I want to see if other ideas come by. – user372003 Jan 19 '18 at 18:52