2 deleted 9 characters in body
source | link

I like very much the answer of @user64494 using Reduce. However, its use requires to apriori know the result. The latter is known in the present expression, but in more complex cases can be unknown. For this reason, I am giving now a more lengthy way, avoiding an in-advance knowing of the result.

The core problem here is that the functions Simplify and FullSimplify do not efficiently work on logarithms. I will first introduce two my own functions to work with the logarithms. One of them, called "collectLog" transforms the sum (or difference) of logarithms into the logarithm of the product (or ratio). The second "expandLog" acts in the opposite way.

expandLog[expr_] := Module[{rule1, rule2, a, b, x, g},
   rule1 = Log[a_*b_] -> Log[a] + Log[b];
   rule2 = Log[a_^x_] -> x*Log[a];
   g[x_] := (x /. rule1) /. rule2;
   FixedPoint[g, expr]
   ];

collectLog[expr_] := Module[{rule1a, rule1b, rule2, g, a, b, x},
   rule1a = Log[a_] + Log[b_] -> Log[a*b];
   rule1b = Log[a_] - Log[b_] -> Log[a/b];
   rule2 = x_*Log[a_] -> Log[a^x];
   g[x_] := x /. rule1a /. rule1b /. rule2;
   FixedPoint[g, expr]
   ];

With this let us first define the expression:

expr1 = ArcTan[Cot[a]];

and apply the the function TrigToExp to it:

expr2 = TrigToExp[expr1] // Factor
(*  1/2 I (Log[1 - (E^(-I a) + E^(I a))/(E^(-I a) - E^(I a))] - 
   Log[1 + (E^(-I a) + E^(I a))/(E^(-I a) - E^(I a))])  *)

The second part of the expr2 contains the difference of two logarithms and it is reasonable to apply collectLog to it:

expr3 = MapAt[Simplify[collectLog[#]] &, expr2, 2]

(* 1/2 I Log[-E^(2 I a)] *)

It is now reasonable to transform -1 into either Exp[I Pi], or Exp[-I Pi/2]Pi]. The second case will yield the answer you give in the question:

expr4 = expr3 /. -E^(2 I a) -> E^(2 I a - I \[Pi]/2)

(* 1/2 I Log[E^(2 I a - (I \[Pi])/2)] *)

Now expanding the logarithm staying in the second position in the expr4 we obtain the answer:

MapAt[expandLog, expr4, 2] // Expand

(* -a + \[Pi]/4 *2*)

Have fun!

I like very much the answer of @user64494 using Reduce. However, its use requires to apriori know the result. The latter is known in the present expression, but in more complex cases can be unknown. For this reason, I am giving now a more lengthy way, avoiding an in-advance knowing of the result.

The core problem here is that the functions Simplify and FullSimplify do not efficiently work on logarithms. I will first introduce two my own functions to work with the logarithms. One of them, called "collectLog" transforms the sum (or difference) of logarithms into the logarithm of the product (or ratio). The second "expandLog" acts in the opposite way.

expandLog[expr_] := Module[{rule1, rule2, a, b, x, g},
   rule1 = Log[a_*b_] -> Log[a] + Log[b];
   rule2 = Log[a_^x_] -> x*Log[a];
   g[x_] := (x /. rule1) /. rule2;
   FixedPoint[g, expr]
   ];

collectLog[expr_] := Module[{rule1a, rule1b, rule2, g, a, b, x},
   rule1a = Log[a_] + Log[b_] -> Log[a*b];
   rule1b = Log[a_] - Log[b_] -> Log[a/b];
   rule2 = x_*Log[a_] -> Log[a^x];
   g[x_] := x /. rule1a /. rule1b /. rule2;
   FixedPoint[g, expr]
   ];

With this let us first define the expression:

expr1 = ArcTan[Cot[a]];

and apply the the function TrigToExp to it:

expr2 = TrigToExp[expr1] // Factor
(*  1/2 I (Log[1 - (E^(-I a) + E^(I a))/(E^(-I a) - E^(I a))] - 
   Log[1 + (E^(-I a) + E^(I a))/(E^(-I a) - E^(I a))])  *)

The second part of the expr2 contains the difference of two logarithms and it is reasonable to apply collectLog to it:

expr3 = MapAt[Simplify[collectLog[#]] &, expr2, 2]

(* 1/2 I Log[-E^(2 I a)] *)

It is now reasonable to transform -1 into Exp[-I Pi/2]:

expr4 = expr3 /. -E^(2 I a) -> E^(2 I a - I \[Pi]/2)

(* 1/2 I Log[E^(2 I a - (I \[Pi])/2)] *)

Now expanding the logarithm staying in the second position in the expr4 we obtain the answer:

MapAt[expandLog, expr4, 2] // Expand

(* -a + \[Pi]/4 *)

Have fun!

I like very much the answer of @user64494 using Reduce. However, its use requires to apriori know the result. The latter is known in the present expression, but in more complex cases can be unknown. For this reason, I am giving now a more lengthy way, avoiding an in-advance knowing of the result.

The core problem here is that the functions Simplify and FullSimplify do not efficiently work on logarithms. I will first introduce two my own functions to work with the logarithms. One of them, called "collectLog" transforms the sum (or difference) of logarithms into the logarithm of the product (or ratio). The second "expandLog" acts in the opposite way.

expandLog[expr_] := Module[{rule1, rule2, a, b, x, g},
   rule1 = Log[a_*b_] -> Log[a] + Log[b];
   rule2 = Log[a_^x_] -> x*Log[a];
   g[x_] := (x /. rule1) /. rule2;
   FixedPoint[g, expr]
   ];

collectLog[expr_] := Module[{rule1a, rule1b, rule2, g, a, b, x},
   rule1a = Log[a_] + Log[b_] -> Log[a*b];
   rule1b = Log[a_] - Log[b_] -> Log[a/b];
   rule2 = x_*Log[a_] -> Log[a^x];
   g[x_] := x /. rule1a /. rule1b /. rule2;
   FixedPoint[g, expr]
   ];

With this let us first define the expression:

expr1 = ArcTan[Cot[a]];

and apply the the function TrigToExp to it:

expr2 = TrigToExp[expr1] // Factor
(*  1/2 I (Log[1 - (E^(-I a) + E^(I a))/(E^(-I a) - E^(I a))] - 
   Log[1 + (E^(-I a) + E^(I a))/(E^(-I a) - E^(I a))])  *)

The second part of the expr2 contains the difference of two logarithms and it is reasonable to apply collectLog to it:

expr3 = MapAt[Simplify[collectLog[#]] &, expr2, 2]

(* 1/2 I Log[-E^(2 I a)] *)

It is now reasonable to transform -1 into either Exp[I Pi], or Exp[-I Pi]. The second case will yield the answer you give in the question:

expr4 = expr3 /. -E^(2 I a) -> E^(2 I a - I \[Pi])

(* 1/2 I Log[E^(2 I a - I \[Pi])] *)

Now expanding the logarithm staying in the second position in the expr4 we obtain the answer:

MapAt[expandLog, expr4, 2] // Expand

(* -a + \[Pi]/2*)

Have fun!

1
source | link

I like very much the answer of @user64494 using Reduce. However, its use requires to apriori know the result. The latter is known in the present expression, but in more complex cases can be unknown. For this reason, I am giving now a more lengthy way, avoiding an in-advance knowing of the result.

The core problem here is that the functions Simplify and FullSimplify do not efficiently work on logarithms. I will first introduce two my own functions to work with the logarithms. One of them, called "collectLog" transforms the sum (or difference) of logarithms into the logarithm of the product (or ratio). The second "expandLog" acts in the opposite way.

expandLog[expr_] := Module[{rule1, rule2, a, b, x, g},
   rule1 = Log[a_*b_] -> Log[a] + Log[b];
   rule2 = Log[a_^x_] -> x*Log[a];
   g[x_] := (x /. rule1) /. rule2;
   FixedPoint[g, expr]
   ];

collectLog[expr_] := Module[{rule1a, rule1b, rule2, g, a, b, x},
   rule1a = Log[a_] + Log[b_] -> Log[a*b];
   rule1b = Log[a_] - Log[b_] -> Log[a/b];
   rule2 = x_*Log[a_] -> Log[a^x];
   g[x_] := x /. rule1a /. rule1b /. rule2;
   FixedPoint[g, expr]
   ];

With this let us first define the expression:

expr1 = ArcTan[Cot[a]];

and apply the the function TrigToExp to it:

expr2 = TrigToExp[expr1] // Factor
(*  1/2 I (Log[1 - (E^(-I a) + E^(I a))/(E^(-I a) - E^(I a))] - 
   Log[1 + (E^(-I a) + E^(I a))/(E^(-I a) - E^(I a))])  *)

The second part of the expr2 contains the difference of two logarithms and it is reasonable to apply collectLog to it:

expr3 = MapAt[Simplify[collectLog[#]] &, expr2, 2]

(* 1/2 I Log[-E^(2 I a)] *)

It is now reasonable to transform -1 into Exp[-I Pi/2]:

expr4 = expr3 /. -E^(2 I a) -> E^(2 I a - I \[Pi]/2)

(* 1/2 I Log[E^(2 I a - (I \[Pi])/2)] *)

Now expanding the logarithm staying in the second position in the expr4 we obtain the answer:

MapAt[expandLog, expr4, 2] // Expand

(* -a + \[Pi]/4 *)

Have fun!