MathGroup Archive 2005

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

Search the Archive

Re: NIntegrate-FindRoot acting up in version 5.1

  • To: mathgroup at smc.vnet.net
  • Subject: [mg57006] Re: NIntegrate-FindRoot acting up in version 5.1
  • From: "antononcube" <antononcube at gmail.com>
  • Date: Thu, 12 May 2005 02:33:08 -0400 (EDT)
  • References: <d5sja8$nm3$1@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

Hi,

Your problem might be solved if you define a function, like

fang[ang_?NumberQ]:= (eqn = FindRoot[ len == c b r / v, {b, 0},
WorkingPrecision->100, AccuracyGoal->80 ] ; beta = b  /.  eqn;  fnax)

and use the command

NIntegrate[fang[ang], {ang,  0,  3Pi/2,  2Pi},  WorkingPrecision->80,
AccuracyGoal->9 ]

I hope this will work (can't say without the actual inputs).

Anton Antonov,
Wolfram Research, Inc.


John Roberts wrote:
> I originally made the input shown below in Mathematica 4.1.1. Version

> 4.1.1 ran it flawlessly and always produced the correct result from
> NIntegrate with no warnings or error messages. Now, when I run the
same
> notebook with version 5.1.0 it crashes and gives the "FindRoot:
:nlnum"
> message shown below:
>
> In1:   len = Sqrt[ (z^2 + (x Cos[ang] + r Sin[b] )^2  + (-r Cos[b] -
x
> Sin[ang])^2 ] ;
>
> In2:  speed = NIntegrate[ (eqn = FindRoot[ len == c b r / v, {b,
> 0}, WorkingPrecision->100,
>         AccuracyGoal->80 ] ; beta = b  /.  eqn;  fnax) , {ang,  0,
> 3Pi/2,  2Pi},  WorkingPrecision->80,  AccuracyGoal->9 ]
>
> Out2: FindRoot: :nlnum : The function value {0. + Sqrt[0.0172266 +
(0. +
> 0.05 <<1>>)^2 + (-0.125 - 0.05 Sin[<<1>>])^2]
>          is not a list of numbers with dimensions {1} at {b} = {0.}.
>
> As can be seen from the input shown above, NIntegrate integrates the
> expression fnax with respect to the angle ang. But fnax is also a
> function of the initial angle beta or b (beta = b), so each time
> NIntegrate calculates the value of fnax it must first use FindRoot to

> find the value of beta that corresponds to the value of ang that it
is
> using. I did not include the expression for fnax here because it is
> rather large, but there is nothing exotic about fnax, it is just a
lot
> of terms with Sin and Cos functions.
>
> All of the values z, x, r, c v are input with 120 decimal places of
> precision or with infinite precision (no decimal point).
>
> It should also be noted that I checked the FindRoot part alone
(without
> NIntegrate) at various points along the range of integration from ang

> = 0 to ang = 2 Pi, and FindRoot got the correct value of beta at
> every point with no warnings or error messages; so the problem
appears
> to be associated with how NIntegrate uses FindRoot in Mathematica 5.1

> rather than with FindRoot itself.
> 
> 
> Thanks in advance for any help you can give me,
> 
> John R.


  • Prev by Date: Re: Crossing of 3D functions
  • Next by Date: Re: NIntegrate-FindRoot acting up in version 5.1
  • Previous by thread: Re: NIntegrate-FindRoot acting up in version 5.1
  • Next by thread: Re: Re: NIntegrate-FindRoot acting up in version 5.1