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


Groups > comp.soft-sys.math.mathematica > #7322

Re: Integrate function defined by numerical integration

From Bob Hanlon <hanlonr357@gmail.com>
Newsgroups comp.soft-sys.math.mathematica
Subject Re: Integrate function defined by numerical integration
Date 2011-12-18 09:35 +0000
Organization Steven M. Christensen and Associates, Inc and MathTensor, Inc.
Message-ID <jckc4s$1ig$1@smc.vnet.net> (permalink)
References <201112170741.CAA18787@smc.vnet.net>

Show all headers | View raw


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@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?
>

Back to comp.soft-sys.math.mathematica | Previous | Next — Next in thread | Find similar | Unroll thread


Thread

Re: Integrate function defined by numerical integration Bob Hanlon <hanlonr357@gmail.com> - 2011-12-18 09:35 +0000
  Re: Integrate function defined by numerical integration Hani <hanisantosa@gmail.com> - 2012-01-11 22:26 +0000

csiph-web