Re: Can I get ComplexExpand to really work?

*To*: mathgroup at smc.vnet.net*Subject*: [mg14572] Re: Can I get ComplexExpand to really work?*From*: Topher Cawlfield <cawlfiel at uiuc.edu>*Date*: Fri, 30 Oct 1998 03:07:41 -0500*Organization*: University of Illinois at Champaign-Urbana*References*: <719f5p$lc6@smc.vnet.net>*Sender*: owner-wri-mathgroup at wolfram.com

Many thanks for the help! (I'm not quite sure how to best respond since this newsgroup seems to be acting funny) Daniel Lichtblau, P.J. Hinton, and Lars Hohmuth suggested that I use the "Assumptions" option with Integrate. Thanks, I didn't know about that! This works well in the most simple case, but doesn't work quite right in more general cases. Integrate[E^(I a b x^2), {x, -Infinity, Infinity}, Assumptions->{a>0 , b>0}] Essentially returns Sqrt[Pi/(2 a b)] (1 + I Sign[a b]) This is progress, but I could make the argument that if a>0 and b>0, then Sign[a b] = 1. If I use "Assumptions->{a b > 0}" instead, I get the more simple result. M. R. Schaferkotter suggested that I try the Declare.m package from mathsource. I haven't tried this yet, but I will soon. --- For the specific problem I was working on, I was finally able to use Mathematica very successfully! I thought I would post it here since it worked so well, and must have saved me at least a month of grinding through algebra and making mistakes. Well, it didn't save me a month really, it just made one technique practical whereas it wouldn't have been otherwise. I want to use a Feynman path integral approach to find the transition amplitude for an electron in a constant electric field. This boils down to doing a lot of integrals, noticing a pattern, and deducing the limiting case of performing an infinite number of integrals. I won't go into all the details, but I would end up needing to perform integrals like: Integrate[E^(I(a x^2 + b x y + c y^2 + d y z + e z^2 + f)), {x, -Infinity, Infinity}, {y, -Infinity, Infinity}, {z, -Infinity, Infinity}] where a, b, c, d, e, and f are simple ratios of physical constants and parameters in the problem. The best way to evaluate these by hand is to first "complete the square" in x: Integrate[E^(I(a (x+junk)^2 + more junk)),...] The value of "junk" doesn't matter since you can rescale x. The limits of integration, being infinite, don't change. You can use the integration rule I was getting at above. Then, repeat the process by completing the square in y of "more junk", applying the integration rule again, and moving on to z. I couldn't find any functions in mathematica that would complete the square for me, but the CoefficientList function helped a lot. I made my own function: CompleteTheSquare[p_, x_] := Module[{coeffs, fp}, coeffs = CoefficientList[p, x]; fp = coeffs[[3]] (x + coeffs[[2]] / (2 coeffs[[3]]) )^2; parts = {coeffs[[3]], Simplify[p - fp], fp}; fp + parts[[2]]] ] This function returns the modified polynomial, and also sets the symbol 'parts' to a list containing the various pieces of the result. I then defined a function that "did the integration": MyInt[a_] := Sqrt[- Pi / a] So that the integral of E^(a (x-b)^2 + c) is MyInt[a] E^c. And finally I made a function that did a Do loop over the integrals. This was a bit of work, but the results were really quite nice. By hand I could have only done 1 or 2 such integrals before tiring, and that would have taken me hours. With this I could try any number. I went up to 10, which just took a Mathematica a couple minutes. The morals of the story (IMO): (1) Use Mathematica for what it's good at. (2) One still needs to be somewhat knowledgable of and practiced with mathematical techniques. Even though Mathematica can do integrals fairly well, it's still important to know how to do them "by hand". This is a good thing. - Topher Cawlfield p.s. The fun part of the problem, besides the Mathematica programming, was figuring out a strange number series that came up: What's f(N)? N | f(N) ---|---- 1 | 0 2 | 1/4 3 | 1 4 | 5/2 5 | 5 6 | 35/4 7 | 14 8 | 21 9 | 30 10 | 165/4 11 | 55 I'll post the answer tomorrow. These were coefficients in the answer. To get one of them requires doing N-1 integrals symbolicly.