Re: This is nuts: Block[{u = 1}, g3[u]] and Block[{u = 0}, g3[u]] executes but NIntegrate[g3[u], {u, 0, Infinity}] doesn't execute
- To: mathgroup at smc.vnet.net
- Subject: [mg124209] Re: This is nuts: Block[{u = 1}, g3[u]] and Block[{u = 0}, g3[u]] executes but NIntegrate[g3[u], {u, 0, Infinity}] doesn't execute
- From: Szabolcs Horvát <szhorvat at gmail.com>
- Date: Sat, 14 Jan 2012 02:50:41 -0500 (EST)
- Delivered-to: l-mathgroup@mail-archive0.wolfram.com
On 2012.01.13. 11:51, Nasser M. Abbasi wrote: > On 1/12/2012 3:23 AM, Shravan wrote: >> Hello All, >> This program is not as daunting as it appears to be. I am >> struggling with an issue related to NIntegration. I think the problem >> is related to syntax but I am not sure. I am having tough time >> executing the following commands in mathematica. >> >> z1 = NIntegrate[g3[u], {u, 0, Infinity}] >> > > Are you sure you really want to do numerical integration from zero to infinity? > > This is numerical integration? > Hi Nasser, Just a note that there are several methods for handling situations like this and Mathematica does support it: In[24]:= f[x_?NumericQ] := 1/x^2 (* make sure symbolic integration won't happen *) In[25]:= NIntegrate[f[x], {x, 1, \[Infinity]}] Out[25]= 1. You can try to see what happens with f[x_?NumericQ] := 1/x which doesn't converge. -- Szabolcs Horv=E1t Mma QA site proposal: http://area51.stackexchange.com/proposals/37304