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


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

Re: Integrate function defined by numerical integration

Started byBob Hanlon <hanlonr357@gmail.com>
First post2011-12-18 09:35 +0000
Last post2012-01-11 22:26 +0000
Articles 2 — 2 participants

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

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  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

#7322 — Re: Integrate function defined by numerical integration

FromBob Hanlon <hanlonr357@gmail.com>
Date2011-12-18 09:35 +0000
SubjectRe: Integrate function defined by numerical integration
Message-ID<jckc4s$1ig$1@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@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?
>

[toc] | [next] | [standalone]


#7757

FromHani <hanisantosa@gmail.com>
Date2012-01-11 22:26 +0000
Message-ID<jel2a9$lo4$1@smc.vnet.net>
In reply to#7322
On Dec 18 2011, 10:35 am, Bob Hanlon <hanlonr...@gmail.com> wrote:
> 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 <hanisant...@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?

Thank you Bob

[toc] | [prev] | [standalone]


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


csiph-web