[Date Index]
[Thread Index]
[Author Index]
Re: numeric integration
*To*: mathgroup at smc.vnet.net
*Subject*: [mg81181] Re: numeric integration
*From*: "C. Seja" <p5secr2 at uni-jena.de>
*Date*: Fri, 14 Sep 2007 03:48:57 -0400 (EDT)
*References*: <fcb40h$fm3$1@smc.vnet.net>
found two simple solutions:
1) writing
f[y_?NumericQ] := NIntegrate[Sin[x + y], {x, 0, 1}]
instead of
f = NIntegrate[Sin[x + #], {x, 0, 1}] &
2) writing
NIntegrateF[f, {0, 0.1}]
instead of
NIntegrate[f[x], {x, 0, 0.1}]
with the definition
NIntegrateF[f_ , a_] :=
Module[{F},
F[x_?NumericQ] = f[x];
NIntegrate[F[x], {x, a[[1]], a[[2]]}]
];
c. seja
> Hi,
>
> I'd like to intergate a function f with NIntegrate:
> NIntegrate[f[x], {x, 0, 0.1}]
>
> But this doesn't work if, i.e.
>
> f = NIntegrate[Sin[x + #], {x, 0, 1}] &
>
> It will give a wrong result (0.7 instead of 0.05). Why? I mean, I can
> evaluate f at any point without problems, i.e. f[0.1] gives 0.37. So why
> doesn't
>
> NIntegrate[f[x], {x, 0, 0.1}]
>
> work? It doesn't even give a warning! So, is there a proper way to do this
> (without using one two-dimensional NIntegrate)?
>
> Regards
>
> C. Seja
>
>
>
Prev by Date:
**Changing Textbook.nb to label equations (chapter.section.equation)**
Next by Date:
**Re: How to make delayed functions from text info**
Previous by thread:
**Re: numeric integration**
Next by thread:
**Re: Re: numeric integration**
| |