Mathematica 9 is now available
Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2007
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2007

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: numeric integration

  • To: mathgroup at smc.vnet.net
  • Subject: [mg81159] Re: numeric integration
  • From: Bhuvanesh <lalu_bhatt at yahoo.com>
  • Date: Fri, 14 Sep 2007 03:37:31 -0400 (EDT)

NIntegrate doesn't know what you're trying to do. So, no, there shouldn't be a warning. If you look at the session transcript below, you'll see that f[x] already evaluates to a number. You have to restrict evaluation for f.

In[1]:= f = NIntegrate[Sin[x + #], {x, 0, 1}] &

Out[1]= NIntegrate[Sin[x + #1], {x, 0, 1}] & 

In[2]:= f[x]

Out[2]= 0.708073

In[3]:= NIntegrate[Sin[2x], {x, 0, 1}]

Out[3]= 0.708073

In[4]:= ClearAll[f]

In[5]:= f[y_?NumericQ] := NIntegrate[Sin[x + y], {x, 0, 1}]

In[6]:= f[x]

Out[6]= f[x]

In[7]:= NIntegrate[f[x], {x, 0, 0.1}]

Out[7]= 0.050097

Bhuvanesh,
Wolfram Research


  • Prev by Date: Re: rationalize numerator of quotient
  • Next by Date: Re: rationalize numerator of quotient
  • Previous by thread: Re: numeric integration
  • Next by thread: Re: numeric integration