Message Boards Message Boards

0
|
4197 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

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
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
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