I have the following expression,

(Cot[(t1 - t2)/2]*((4*I)*t1^3 - (9*I)*t1^2*x + 
   (6*I)*t1*x^2 - (2*I)*x^3 - 
   12*x*Cot[(t1 - x)/2] - 12*x*Cot[x/2] + 
   3*x^2*Csc[(t1 - x)/2]^2 - 
   3*x^2*Csc[x/2]^2 + 
   6*t1^2*Log[1 - E^((-I)*(t1 - x))] - 
   12*t1*x*Log[1 - E^((-I)*(t1 - x))] + 
   6*x^2*Log[1 - E^((-I)*(t1 - x))] - 
   12*t1^2*Log[1 - E^(I*(t1 - x))] + 
   12*t1*x*Log[1 - E^(I*(t1 - x))] - 
   6*x^2*Log[1 - E^((-I)*x)] - 
   24*Log[Sin[(t1 - x)/2]] + 
   6*t1^2*Log[Sin[(t1 - x)/2]] + 
   24*Log[Sin[x/2]] + (12*I)*(t1 - x)*
    PolyLog[2, E^((-I)*(t1 - x))] + 
   (12*I)*t1*PolyLog[2, E^(I*(t1 - x))] - 
   (12*I)*x*PolyLog[2, E^((-I)*x)] + 
   12*PolyLog[3, E^((-I)*(t1 - x))] - 
   12*PolyLog[3, E^((-I)*x)]))/9

I made two rules

rule1 = u_*Log[v_] + u_*Log[w_] :> 
  u*Log[v*w]; rule2 = -u_*Log[v_] + u_*Log[w_] :> u*Log[w/v];

To collect Log, but still it is not collecting them. What am I doing wrong ? I don't want to FullSimplify because it is running for long time.

  • $\begingroup$ @mikado, Sorry I didn't get your comment. $\endgroup$ – Jaswin May 6 '19 at 19:13
  • $\begingroup$ Sorry, my comment was partly incorrect, so I've deleted it. I find it difficult to make rules work if their Left Hand Side is too complicated. I think this is the problem here. $\endgroup$ – mikado May 6 '19 at 19:17
  • $\begingroup$ See I made a simpler rule. rule2 = -x_Log[a_] :> xLog[1/a]; this works when I have an arbitrary function. But as soon as a constant appears, it stops working. $\endgroup$ – Jaswin May 6 '19 at 19:18
  • $\begingroup$ I think that when you have a rule with terms added (as in your rule1) there are many ways Mathematica can try to match it to your expression. I don't think it is trying them all, so misses some that you can see. $\endgroup$ – mikado May 6 '19 at 19:20
  • 1
    $\begingroup$ If I scrape-n-paste just your eight Logs into a separate list and I try to reorder them to find pairs of logs that match your pattern then I don't see any such pair. Mathematica pattern matching is very brute force. It never, well probably almost never, sees two expressions that are obviously the same if you just use algebra on them and thus it decides they match. It only matches expressions of literally exactly the same form. 6*t1^2*Log[1 - E^((-I)*(t1 - x))]+6*t1^2*Log[1 - E^((-I)*(t1 - x))]/.u_*Log[v_] + u_*Log[w_] :> u*Log[v*w] "works" because both those are exactly the same form. $\endgroup$ – Bill May 6 '19 at 19:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.