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


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

Re: FindRoot and parameters in NIntegrate

Started byDrMajorBob <btreat1@austin.rr.com>
First post2012-01-22 12:25 +0000
Last post2012-01-22 12:25 +0000
Articles 1 — 1 participant

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: FindRoot and parameters in NIntegrate DrMajorBob <btreat1@austin.rr.com> - 2012-01-22 12:25 +0000

#8103 — Re: FindRoot and parameters in NIntegrate

FromDrMajorBob <btreat1@austin.rr.com>
Date2012-01-22 12:25 +0000
SubjectRe: FindRoot and parameters in NIntegrate
Message-ID<jfgv85$pgd$1@smc.vnet.net>
Here are two fixes:

FindRoot[{1 + a + b, Integrate[a + b x, {x, 0, 1}]}, {{a, 0}, {b, 0}}]

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

Clear[f]
f[0., 0.] = 0.;
f[a_?NumericQ, b_?NumericQ] := NIntegrate[a + b x, {x, 0, 1}]
FindRoot[{1 + a + b, f[a, b]}, {{a, 0}, {b, 0}}]

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

The first error message in your post results from FindRoot trying to  
evaluate NIntegrate[a + b x, {x, 0, 1}] before giving a and b numerical  
values. The second results from evaluating it with a == b == 0.

The solutions above avoid both problems.

Bobby

On Sat, 21 Jan 2012 04:18:00 -0600, gac <g.crlsn@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
>


-- 
DrMajorBob@yahoo.com

[toc] | [standalone]


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


csiph-web