Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2004
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*November
*December
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2004

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

Search the Archive

NIntegrate with singular endpoints

  • To: mathgroup at smc.vnet.net
  • Subject: [mg45390] NIntegrate with singular endpoints
  • From: Goyder Dr HGD <h.g.d.goyder at cranfield.ac.uk>
  • Date: Tue, 6 Jan 2004 04:16:46 -0500 (EST)
  • Sender: owner-wri-mathgroup at wolfram.com

I wish to integrate numerically a function which is integrable but has
singularities at the endpoints. 

Help states that "NIntegrate tests for singularities at the end points of
the integration range"  so I am optimistic that Mathematica can deal with my
integral.

However, the following happens. 

I start by defining my integrand where I have Rationalized all my numbers so
that everything is defined exactly

In[1]:=
a = {48397463/62999302, 73182719/200515778, 20053837/72775587, \
70325974/50617151, 72672481/359982590}; 

In[2]:=

b = {26714619/25510582, 26714619/12755291, 245850922/78256779, \
122925461/26085593, 491701844/78256779}; 

In[3]:=

integrand = Product[(1 - z/E^(I*b[[n]]))^(a[[n]] - 1), {n, Length[a]}]; 

In[4]:=

(* I try integrating between the first and second singularity *)

NIntegrate[integrand, {z, E^(I*b[[1]]), E^(I*b[[2]])}]

Out[4]=
-2.28889+1.16263 \[ImaginaryI]

In[5]:=

(* This works so I am pleased. I move on to a second integral *)

NIntegrate[integrand, {z, E^(I*b[[1]]), E^(I*b[[3]])}]

\!\(Power::"infy" \(\(:\)\(\ \)\) "
    Infinite expression \!\(1\/\((\(\(\[LeftSkeleton] 28
\[RightSkeleton]\)\) \
+ \(\(\(\(\[LeftSkeleton] 29 \[RightSkeleton]\)\)\\ \
\[ImaginaryI]\)\))\)\^\(52721750/72775587\)\) encountered."\)

\!\(NIntegrate::"rnderr" \(\(:\)\(\ \)\) "Numerical approximation 
      has caused \!\({
    z}\) to take the value \!\({\(\(-1.`\)\) + \(\(7.817936619907544`*^-17\\
\
\[ImaginaryI]\)\)}\) where the integrand is singular."\)

Out[5]=
\!\(NIntegrate[integrand, {z, \[ExponentialE]\^\(\[ImaginaryI]\ b?1?\), \
\[ExponentialE]\^\(\[ImaginaryI]\ b?3?\)}]\)

In[6]:=

(* This does not work. So I try making the integrand a numerical value *)

NIntegrate[N[integrand], {z, E^(I*b[[1]]), E^(I*b[[3]])}]

\!\(Power::"infy" \(\(:\)\(\ \)\) "
    Infinite expression \!\(1\/\((\(\(\[LeftSkeleton] 28
\[RightSkeleton]\)\) \
+ \(\(\(\(\[LeftSkeleton] 29 \[RightSkeleton]\)\)\\ \
\[ImaginaryI]\)\))\)\^\(52721750/72775587\)\) encountered."\)

\!\(NIntegrate::"rnderr" \(\(:\)\(\ \)\) "Numerical approximation 
      has caused \!\({
    z}\) to take the value \!\({\(\(-1.`\)\) + \(\(7.817936619907544`*^-17\\
\
\[ImaginaryI]\)\)}\) where the integrand is singular."\)

Out[6]=
\!\(NIntegrate[N[integrand], {
    z, \[ExponentialE]\^\(\[ImaginaryI]\ 
        b?1?\), \[ExponentialE]\^\(\[ImaginaryI]\ b?3?\)}]\)

In[7]:=

(* This does not work. So I try making the end points numerical *)

NIntegrate[integrand, {z, N[E^(I*b[[1]])], N[E^(I*b[[3]])]}]

\!\(NIntegrate::"ncvb" \(\(:\)\(\ \)\) "NIntegrate failed to converge to 
      prescribed accuracy after \!\(7\) recursive bisections in \!\(z\) near
\
\!\(z\) = \!\(\(\(-1.`\)\) + \(\(1.2250406712299894`*^-16\\
\[ImaginaryI]\)\)\
\)."\)

Out[7]=
-2.46651-2.71438 \[ImaginaryI]

In[8]:=

(* This begins to show promise so I increase the number of bisections *)

NIntegrate[integrand, {z, N[E^(I*b[[1]])], N[E^(I*b[[3]])]},MaxRecursion ->
10
]

Out[8]=
-2.46651-2.71438 \[ImaginaryI]

In[9]:=
(* This works, I am pleased, so now I go back to my first 
  example and check out my method *)

NIntegrate[integrand, {z, N[E^(I*b[[1]])], N[E^(I*b[[2]])]},MaxRecursion ->
\
10]

\!\(Power::"infy" \(\(:\)\(\ \)\) "
    Infinite expression \!\(1\/\((\(\(0.` \[InvisibleSpace]\)\) + \(\(0.`\\
\
\[ImaginaryI]\)\))\)\^\(14601839/62999302\)\) encountered."\)

NIntegrate::rnderr: Numerical approximation has caused {z} to take the value
\
{0.5\[InvisibleSpace]+0.866025 \[ImaginaryI]} where the integrand is
singular.

Out[9]=
\!\(NIntegrate[integrand, {z, 
    N[\[ExponentialE]\^\(\[ImaginaryI]\ b?1?\)], N[\[ExponentialE]\^\(\
\[ImaginaryI]\ b?2?\)]}, MaxRecursion \[Rule] 10]\)

In[10]:=

(* This fails. It worked without the refinements and now it fails with \
refinements. I attempt a third integral *)

NIntegrate[integrand, {z, N[E^(I*b[[1]])], N[E^(I*b[[
      5]])]},MaxRecursion -> 10]


NIntegrate::slwcon: Numerical integration converging too slowly; suspect one
\
of the following: singularity, value of the integration being 0, oscillatory
\
integrand, or insufficient WorkingPrecision. If your integrand is
oscillatory \
try using the option Method->Oscillatory in NIntegrate.

Out[10]=
1.08293\[InvisibleSpace]-2.77243 \[ImaginaryI]

(* This may have worked but I have a new problem. I am clearly just
tinkering \
around and need help. *)


How do you do a numerical integration with singularities at the end ponts?
    
Thanks for any help

Hugh Goyder

-- 
This message has been scanned for viruses and
dangerous content by the Cranfield MailScanner, and is
believed to be clean.


  • Prev by Date: Re: Compile
  • Next by Date: RE: Mathematica exports curves in pieces to Illustrator
  • Previous by thread: Combinatorica book out
  • Next by thread: Draw a specific contour curve in dashed line