Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.soft-sys.math.mathematica > #4332 > unrolled thread

FunctionInterpolation and NIntegrate

Started bygac <g.crlsn@gmail.com>
First post2011-08-11 11:57 +0000
Last post2011-08-12 09:04 +0000
Articles 2 — 2 participants

Back to article view | Back to comp.soft-sys.math.mathematica


Contents

  FunctionInterpolation and NIntegrate gac <g.crlsn@gmail.com> - 2011-08-11 11:57 +0000
    Re: FunctionInterpolation and NIntegrate "Kevin J. McCann" <kjm@KevinMcCann.com> - 2011-08-12 09:04 +0000

#4332 — FunctionInterpolation and NIntegrate

Fromgac <g.crlsn@gmail.com>
Date2011-08-11 11:57 +0000
SubjectFunctionInterpolation and NIntegrate
Message-ID<j20g47$8vd$1@smc.vnet.net>
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}}."

Can the statements be reformed to avoid the msg?

Thanks.

Glenn

[toc] | [next] | [standalone]


#4338

From"Kevin J. McCann" <kjm@KevinMcCann.com>
Date2011-08-12 09:04 +0000
Message-ID<j22qb7$gmj$1@smc.vnet.net>
In reply to#4332
Glenn,

I believe this happens because, in spite of the fact that NIntegrate is 
numerical, it still tries to do symbolic things before getting down to 
it. I don't exactly understand. Anyway, to get around this, you can set 
up your function f so that it only evaluates if the argument is numeric 
by doing the following:

Clear[f,r,s]
f[r_?NumericQ]:=NIntegrate[r+s],{s,0,1}]

Try evaluating f[a] with and without the addition, and you will see that 
with it, you just get back f[a].

Kevin

On 8/11/2011 7:57 AM, 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}}."
>
> Can the statements be reformed to avoid the msg?
>
> Thanks.
>
> Glenn
>

[toc] | [prev] | [standalone]


Back to top | Article view | comp.soft-sys.math.mathematica


csiph-web