Re: FunctionInterpolation and NIntegrate
- To: mathgroup at smc.vnet.net
- Subject: [mg120838] Re: FunctionInterpolation and NIntegrate
- From: Bill Rowe <readnews at sbcglobal.net>
- Date: Fri, 12 Aug 2011 05:05:57 -0400 (EDT)
- Delivered-to: l-mathgroup@mail-archive0.wolfram.com
On 8/11/11 at 7:55 AM, g.crlsn at gmail.com (gac) wrote:
>f[r_] := NIntegrate[r + s , {s, 0, 1}] g =
>FunctionInterpolation[f[r], {r, 0, 1}]
>Can anyone explain why this works, yet I get the msg:
>NIntegrate::inumr: "The integrand r+s has evaluated to non-numerical
>values for all sampling points in the region with boundaries
>{{0,1}}."
My *guess* is Mathematica first attempts to evaluate NIntegrate
before r is assigned a numeric value, generates the error
message then assigns a numeric value to r and correctly
evaluates the expression.
>Can the statements be reformed to avoid the msg?
This is simpler to answer. Just define f to work on numeric
values, i.e.
f[r_?NumericQ] := NIntegrate[r + s , {s, 0, 1}]
g = FunctionInterpolation[f[r], {r, 0, 1}]
will do what you want without the error message being generated