Services & Resources / Wolfram Forums
MathGroup Archive
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 1996

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

Search the Archive

Re: Solving a numerical integration

  • To: mathgroup at
  • Subject: [mg5476] Re: [mg5440] Solving a numerical integration
  • From: fransm at (Frans Martens)
  • Date: Wed, 11 Dec 1996 03:15:57 -0500
  • Sender: owner-wri-mathgroup at

Pere Llosas wrote:

> I would like to solve an equation of this kind
> NIntegrate[f[n],{n,0,x}]==0    (f[x_]=Sqrt[1+x+x^2...)
> where x is the searched value, and f cannot be integrated 

> analytically.
> NSolve[NIntegrate[f[n],{n,0,x}]==0,x], tries to evaluate
> NIntegrate[f[n],{n,0,x}] before assignin a numerical value to x and
> returns an error.
> How could this calculation be done without having to write a 

> program that searches the root?

The equation NIntegrate[f[n],{n,0,x}]==0 has root x = 0 and the  
NSolve function tries to compute the inverse of the function x |->  
NIntegrate[f[n],{n,0,x}] .

The function FindRoot is more suitable. Here is an example with a  
second root in the neigbourhood of x = 4.8 .

    AccuracyGoal -> 6];
    Jacobian -> f[x]]
  {x -> 4.66231}

>>>>>     The whole above without messages   <<<<<<<<<

There are two precautions:

1)The option AccuracyGoal in NIntegrate is set to 6 because the 

  integral int[x] equals zero for the root x.
2)FindRoot uses the method of Newton-Raphson and setting the option 

  Jacobian prevents the symbolic computation of int'[x] . Note that 

  int'[x] equals f[x]. 

You must have a global idea of the roots of the original equation.

Frans Martens
The Netherlands

  • Prev by Date: Re: FindRoot question
  • Next by Date: UTM-Lat/Long conversion
  • Previous by thread: Solving a numerical integration
  • Next by thread: Re: Re: Solving a numerical integration