MathGroup Archive 2012

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

Search the Archive

Re: FindRoot and parameters in NIntegrate

  • To: mathgroup at smc.vnet.net
  • Subject: [mg124510] Re: FindRoot and parameters in NIntegrate
  • From: Bob Hanlon <hanlonr357 at gmail.com>
  • Date: Sun, 22 Jan 2012 07:22:34 -0500 (EST)
  • Delivered-to: l-mathgroup@mail-archive0.wolfram.com
  • References: <201201211018.FAA10170@smc.vnet.net>

f[a_?NumericQ, b_?NumericQ] :=
 NIntegrate[a + b*x, {x, 0, 1}]

FindRoot[{1 + a + b, f[a, b]}, {{a, .5}, {b, .5}}]

{a -> 1., b -> -2.}

Restricting the arguments in the helper function definition ensures
that the numerical integration is not attempted with symbolic
arguments and the change in initial estimates for FindRoot avoids the
NItegrate::izero message.


Bob Hanlon


On Sat, Jan 21, 2012 at 5:18 AM, gac <g.crlsn at gmail.com> wrote:
> I am using Mathematica 8 to solve for parameters in an integral and an auxiliary equation.  A prototypical problem is
>
> FindRoot[{1 + a + b , NIntegrate[a + b x, {x, 0, 1}]}, {{a, 0}, {b, 0}}]
>
> Mathematica reports the correct answer for the parameters a and b:
>
> {a -> 1., b -> -2.}
>
> But it also reports two error messages:
>
> NIntegrate::inumr: The integrand a+b x has evaluated to non-numerical values for all sampling points in the region with boundaries {{0,1}}. >>
>
> NIntegrate::izero: Integral and error estimates are 0 on all integration subregions. Try increasing the value of the MinRecursion option. If value of integral may be 0, specify a finite value for the AccuracyGoal option. >>
>
> I would appreciate any advice or comments on this problem or the error messages.
>
> Thanks.
>
> gac
>



  • Prev by Date: Re: select 1st column element based on criteria in 2nd AND 3rd column
  • Next by Date: Re: FindRoot and parameters in NIntegrate
  • Previous by thread: FindRoot and parameters in NIntegrate
  • Next by thread: Re: FindRoot and parameters in NIntegrate