Re: Integrate returns 0
- To: mathgroup at smc.vnet.net
- Subject: [mg23915] Re: [mg23888] Integrate returns 0
- From: BobHanlon at aol.com
- Date: Fri, 16 Jun 2000 00:56:55 -0400 (EDT)
- Sender: owner-wri-mathgroup at wolfram.com
In a message dated 6/15/2000 1:13:26 AM, felix.klee at inka.de writes: >when I define the function > f[x_,n_]:=D[Exp[-x^2],{x,n}]^2 >and execute > Integrate[f[x,n],{x,-Infinity,Infinity}] >the result is > 0 > >However this is not correct for all parameters n since > Integrate[f[x,1],{x,-Infinity,Infinity}] >returns > Sqrt[Pi/2] > >Is this a bug in Mathematica or am I doing something wrong? > You need to delay integration until a specific value of n is defined. f[x_, n_] := D[Exp[-x^2], {x, n}]^2 g[x_, n_Integer] := Integrate[f[x, n] , {x, -Infinity, Infinity}] Table[g[x, n], {n, 0, 5}] {Sqrt[Pi/2], Sqrt[Pi/2], 3*Sqrt[Pi/2], 15*Sqrt[Pi/2], 105*Sqrt[Pi/2], 945*Sqrt[Pi/2]} (Integrate[#, {x, -Infinity, Infinity}] & /@ Table[f[x, n], {n, 0, 5}]) == Table[Integrate[f[x, n], {x, -Infinity, Infinity}], {n, 0, 5}] == Table[g[x, n], {n, 0, 5}] True Bob Hanlon