Message Boards Message Boards

0
|
4129 Views
|
3 Replies
|
0 Total Likes
View groups...
Share
Share this post:

[?] Get expansion / simplification under integral?

Posted 7 years ago

Is there a way to ask Mathematica to simplify an expression like

(Integrate[(h[p1]*Subscript[C, p1])/E^(I*p1*x), {p1, -Infinity, Infinity}] + 
   Integrate[E^(I*p1*x)*hDag[p1]*Subscript[C, p1], {p1, -Infinity, Infinity}])*
  (Integrate[(h[p2]*Subscript[C, p2])/E^(I*p2*x), {p2, -Infinity, Infinity}] + 
   Integrate[E^(I*p2*x)*hDag[p2]*Subscript[C, p2], {p2, -Infinity, Infinity}])

such that the result is of the form

Integrate[E^(I*(-p1 + p2)*x)*Subscript[C, p1]*Subscript[C, p2], {p1, -Infinity, Infinity}, 
  {p2, -Infinity, Infinity}]

and so on...?

POSTED BY: Arny Toynbee
3 Replies
Posted 7 years ago

Thanks Michael. To use the solution in my specific case, should I be using the following?

i0 := (Integrate[(h[p1]*Subscript[C, p1])/E^(I*p1*x), {p1, -Infinity, Infinity}] + Integrate[E^(I*p1*x)*hDag[p1]*Subscript[C, p1], 
     {p1, -Infinity, Infinity}])*(Integrate[(h[p2]*Subscript[C, p2])/E^(I*p2*x), {p2, -Infinity, Infinity}] + 
    Integrate[E^(I*p2*x)*hDag[p2]*Subscript[C, p2], {p2, -Infinity, Infinity}])

I am using Mathematica 9, and the commands don't seem to work, or my input must be incorrect.

POSTED BY: Arny Toynbee

Yes, that is the exact same i0 I used to get the output I showed. I get the same output in V9 and in V11. The output in my response seems correct to me, but it does not agree exactly with the form in your OP. Yours does not have hDag[p1] etc., and I do not see how they would cancel out of the result. (I just assumed you typed something quickly just to give the form of the integral.)

Since it works for me in V9, I need to know when you say "the commands don't seem to work," what exactly happens?

By the way, it would run faster if Integrate was not reevaluated every time a transformation is applied. In V9, you can use Hold and ReleaseHold; in V10 and after, one can use Inactivate[] and Inactive[]`:

intXF = {
   # /. Verbatim[Hold@Integrate][f1_, x1 : PatternSequence[{_, _, _} ..]] *
           Verbatim[Hold@Integrate][f2_, x2 : PatternSequence[{_, _, _} ..]] :> 
      Hold[Integrate][f1*f2, x1, x2] &,
   # /. (c1_: 1) Verbatim[Hold@Integrate][f1_, x : PatternSequence[{_, _, _} ..]] +
           (c2_: 1) Verbatim[Hold@Integrate][f2_, x : PatternSequence[{_, _, _} ..]] :> 
      Hold[Integrate][c1*f1 + c2*f2, x] &
   };

ReleaseHold@ Simplify[i0 /. Integrate -> Hold[Integrate], 
  TransformationFunctions -> {Automatic, intXF@*Expand, Sequence @@ intXF}]
POSTED BY: Michael Rogers

I don't think there's a built-in way, but you can do it with patterns and rule replacements. Here is a way to extend Simplify with TransformationFunctions and the transformations in intXF. Sometimes it may help to penalize an expression for having extra Integrate terms. In that case, use the option ComplexityFunction with intCF.

intXF = {
   # /. Verbatim[Integrate][f1_, x1 : PatternSequence[{_, _, _} ..]] *
    Verbatim[Integrate][f2_, x2 : PatternSequence[{_, _, _} ..]] :> 
      Integrate[f1*f2, x1, x2] &,
   # /. (c1_: 1) Verbatim[Integrate][f1_, x : PatternSequence[{_, _, _} ..]] +
     (c2_: 1) Verbatim[Integrate][f2_, x : PatternSequence[{_, _, _} ..]] :> 
      Integrate[c1*f1 + c2*f2, x] &
   };
intCF = Simplify`SimplifyCount[#] + 5 Count[#, Integrate, Infinity] &;

Simplify[i0
 , TransformationFunctions -> {Automatic, Sequence @@ intXF}
 (*,ComplexityFunction\[Rule]intCF*)]

(* Out[]=
Integrate[((h[p1] + E^((2*I)*p1*x)*hDag[p1])*(h[p2] + E^((2*I)*p2*x)*hDag[p2])*Subscript[C, p1]*Subscript[C, p2]) / E^(I*(p1 + p2)*x),
 {p1, -Infinity, Infinity}, {p2, -Infinity, Infinity}]
*)

For general use, it would be good to put some checks in the transformation functions to make sure that the application of Fubini's rule is at least formally valid (such as that f1 is independent of the variables in x2, etc.).

POSTED BY: Michael Rogers
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract