MathGroup Archive 2011

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

Search the Archive

Re: Integrate function defined by numerical integration

  • To: mathgroup at smc.vnet.net
  • Subject: [mg123765] Re: Integrate function defined by numerical integration
  • From: Bob Hanlon <hanlonr357 at gmail.com>
  • Date: Sun, 18 Dec 2011 04:34:40 -0500 (EST)
  • Delivered-to: l-mathgroup@mail-archive0.wolfram.com
  • References: <201112170741.CAA18787@smc.vnet.net>

Since func is defined using numerical techniques, restrict its
definition to numerixal arguments.

Clear[func]

func[x_?NumericQ] :=
  NIntegrate[
   x*Sec[alpha]^2*Exp[-x/Cos[alpha]],
   {alpha, -ArcCos[x/2], ArcCos[x/2]}];

NIntegrate[func[x], {x, 0.2, 1}]

1.02655


Bob Hanlon

On Sat, Dec 17, 2011 at 2:41 AM, Hani <hanisantosa at gmail.com> wrote:
> Hello all, I have a problem. Suppose I have a function:
>
> func[x_] := NIntegrate[ x*Sec[alpha]^2*Exp[-x/Cos[alpha]], {alpha, -
> ArcCos[x/2], ArcCos[x/2]}].
>
> Basically the argument of the function, x, also appears as boundary of
> integration
>
> Now, when I want to do this integral:
>
> NIntegrate[func[x], {x, 0.2, 1}]
>
> there are error messages: NIntegrate::nlim: alpha = cos^-1(0.5 x) is
> not a valid limit of integration. >>
>
> Although in the end, the result appears. Now, how to handle this
> problem? I think in this case, we can get the result because func[x_]
> itself is simple. But actually my func[x_] is much more complicated,
> it contains interpolating function too, and when I do the integral, it
> takes long time without result. Can anyone help me?
>



  • Prev by Date: How to obtain StandardPhysicalConstants package for Mathematica?
  • Next by Date: Graphics don't look the same when pasted into MS Word
  • Previous by thread: Integrate function defined by numerical integration
  • Next by thread: How to obtain StandardPhysicalConstants package for Mathematica?