Re: Re: Can I get ComplexExpand to really work?

*To*: mathgroup at smc.vnet.net*Subject*: [mg14654] Re: [mg14635] Re: Can I get ComplexExpand to really work?*From*: Jurgen Tischer <jtischer at col2.telecom.com.co>*Date*: Sat, 7 Nov 1998 02:10:03 -0500*Organization*: Universidad del Valle*References*: <719f5p$lc6@smc.vnet.net> <71bkvu$pul@smc.vnet.net> <199811041847.NAA19354@smc.vnet.net.>*Sender*: owner-wri-mathgroup at wolfram.com

Hi Allan, imagine the list contained an error, it read 54 instead of 55 as the last element. Your calculation still gives the same function, and the test resolves to wrong. But if you define f to be p[Length[data]], everything is fine (of course the function is different). Jurgen PS: Please don't take this too serious, I never succeeded in extending those sequences in tests, I always was wondering what would happen if... Allan Hayes wrote: > > Two observations: (1) on assumptions in Integrate(2) on your sequence. > > (1) The Integral > > As has already been pointed out by several people > > Integrate[ > E^(I a b x^2),{x, -Infinity, Infinity}, Assumptions -> {a>0, b>0} > ] > > If[Im[a*b] == 0, (Sqrt[Pi/2]*(1 + I*Sign[a*b]))/ > (Sqrt[a]*Sqrt[b]), Integrate[E^(I*a*b*x^2), > {x, -Infinity, Infinity}]] > > gives nearly what you want > > If we help Mathematica a bit we get > > Integrate[ > E^(I a b x^2),{x, -Infinity, Infinity}, Assumptions -> {a b>0,a>0,b>0} > ] > > ((1 + I)*Sqrt[Pi/2])/(Sqrt[a]*Sqrt[b]) > > Which, I guess, points up the need to internally extend the assumptions > in the manner of the package Declare. > > (2) The sequence > > The sequence you gave was > data = { {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}}; and your answer, given > later, was that this is given by the function > > f(N) = (N-1) N (N+1) / 24 > > Here is a Mathematica deduction of this > > Define > p[n_] := InterpolatingPolynomial[Take[data, n], x] > > Look for where p[n] repeats > > fp = (n=1;FixedPoint[(++n; p[n]) &, 1]) > > (1/4 + (1/4 + 1/24*(-3 + x))*(-2 + x))*(-1 + x) > > Define > f[x_] = Simplify[fp] > > 1/24*(-1 + x)*x*(1 + x) > > Check > > Last/@data == Table[f[n], {n, Length[data]}] > > True > > In a symbolic case, having used Mathematica to guess the formula, we > might use induction to prove the result. > > --------------------- > Allan Hayes > Mathematica Training and Consulting > www.haystack.demon.co.uk > hay at haystack.demon.co.uk > Voice: +44 (0)116 271 4198 > Fax: +44 (0)870 164 0565 > > Topher Cawlfield wrote in message <71bkvu$pul at smc.vnet.net>... > >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. > >

**References**:**Re: Can I get ComplexExpand to really work?***From:*"Allan Hayes" <hay@haystack.demon.co.uk>