Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

I'm trying to force Mathematica to use following transformation function

tf[e_] := 
  e /. {BarnesG[1 + 2 x_] :> 
     2^(x (2 x - 1)) Pi^(-x - 1/2) (
      BarnesG[3/2 + x] BarnesG[1/2 + x] BarnesG[1 + x]^2)/
      BarnesG[1/2]^2};

After evaluation of the previous line simplification

Simplify[BarnesG[1 + 2 x], 
 TransformationFunctions -> {Automatic, tf}]

does not yield desirable result but instead returns original

BarnesG[1 + 2 x]

What am I doing wrong?

Any help is appreciated, thank you!

share|improve this question
add comment

1 Answer 1

I guess Simplify does not use your rule, because the result would be more complex (LeafCount) than the original input.

The following is really a hack which seems only to work because of internal behavior of Simplify.

ClearAll[tf, rule];
tf[BarnesG[1 + 2 x_]] := rule;
Simplify[BarnesG[1 + 2 x], TransformationFunctions -> {Automatic, tf}];
rule = 2^(x (2 x - 1)) Pi^(-x - 
      1/2) (BarnesG[3/2 + x] BarnesG[1/2 + x] BarnesG[1 + x]^2)/
    BarnesG[1/2]^2;

Now you can call Simplify as you did

Simplify[BarnesG[1 + 2 x], TransformationFunctions -> {Automatic, tf}]

Mathematica graphics

Possible (!) explanation

I assume the following happens: When you call this the first time, without rule having any value

tf[BarnesG[1 + 2 x_]] := rule;
Simplify[BarnesG[1 + 2 x], TransformationFunctions -> {Automatic, tf}];

then Simplify seems to cache that the simplification to rule is better, because it has a lower LeafCount. Once this is done, the rule is applied, even if rule is now set to an expression which is more complex than the original one.

share|improve this answer
    
I am using v9.0.1 and this does not work for me. It returns unevaluated. –  RunnyKine Sep 29 '13 at 21:17
    
@RunnyKine Indeed, when I tried it, it worked. Let me investigate. –  halirutan Sep 29 '13 at 21:27
    
@RunnyKine Can you try again. It seems I accidentally revealed some cashing issue, which enables this hack. –  halirutan Sep 29 '13 at 22:03
    
I get @halirutan's result (V9.0.1, Mac). –  Michael E2 Sep 30 '13 at 0:04
    
So this works now. I wonder why it only works if you use Simplify twice as in your code. –  RunnyKine Sep 30 '13 at 5:19
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.