MathGroup Archive 2004

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

Search the Archive

Re: Re: Integrate vs NIntegrate

  • To: mathgroup at smc.vnet.net
  • Subject: [mg46901] Re: [mg46877] Re: Integrate vs NIntegrate
  • From: "Reza Malek-Madani" <research at usna.edu>
  • Date: Sun, 14 Mar 2004 03:24:23 -0500 (EST)
  • Sender: owner-wri-mathgroup at wolfram.com

This worked for me on Mathematica 4.2:

f = D[1/(1 + (1 + (a - b)^2)), a];
h[a_] := NIntegrate[f*b*(1 - b)^2, {b, 0, 1}];
FindRoot[h[a] == 0, {a, 0, 1}]

Output:

{a -> 0.397861}

Reza




-------------------------------------------------------------------------
Reza Malek-Madani, Director of Research and Scholarship
Research Office, MS 10m,   Nimitz Room 17     

589 McNair Road                    
U.S. Naval Academy             
Annapolis MD 21402-5031
     
Phone: 410-293-2504 (FAX -2507), DSN: 281-2504
Email: research at usna.edu

--------------------------------------------------------------------------
>>> "Curt Fischer" <crf3 at po.cwru.edu> 03/12/04 11:39 PM >>>
Mukhtar Bekkali wrote:
> I am confused why NIntegrate misbehaves on such a simple function as
> mine.
>
> Here is what I have:
>
> In:
>
> f=D[1/(1+(1+(a-b)^2)),a];
> g=Integrate[f*b*(1-b)^2,{b,0,1},Assumptions->0<a<1];
> FindRoot[g==0,{a,0,1}]
>
> Out:
>
> a->0.397207
>
> However, since Integrate takes long, I tried to use NIntegrate
> instead and this is what I get
>
> In:
>
> f=D[1/(1+(1+(a-b)^2)),a];
> g:=NIntegrate[f*b*(1-b)^2,{b,0,1}];
> FindRoot[g==0,{a,0,1}]
>
> Out:
>
> a->1
>
> or, FindRoot+NIntegrate give me the upper boundary of a.  If I
> abandon the secant method and turn to Newton, i.e. use
> FindRoot[g==0,{a,0.5}] instead then I get the message that Jacobian is
> singular at a=0.5 and get no solution.  Perturbing the starting value
> of a does not help.
>
> What is going on here?

My guess is that NIntegrate does not do problems with symbolic
parameters,
and yet you are trying to make it calculate the integral of an
expression
involving a, with no numerical value for a defined.

-- 
Curt Fischer






> PS.  Is there a way to get M5 to tackle the problem where:
> (1) I define some function f[x]:=NIntegrate[g[x,y],{y,0,1}], then
> (2) take the derivative of f[x] with respect to x, say h[x]:=f'[x]
> and then (3) Use FindRoot to find x such that h[x]==0



  • Prev by Date: Re: Re: Re: Creating a symmetric matrix
  • Next by Date: Re: NDSolve and time-delayed equations?
  • Previous by thread: Re: Integrate vs NIntegrate
  • Next by thread: Re: Re: Integrate vs NIntegrate