I am trying to solve this expression in Mathematica with the function NIntegrate:

    NIntegrate[(Abs[Subscript[δ, 1]-0.0675-Subscript[δ, 2]]EllipticE[-((4*0.1516*
    0.1516)/(Subscript[δ, 1]-0.0675-Subscript[δ, 2])^2)])/(7.2*6.3*2π^2*
    8.85418782*10^-12*((Subscript[δ, 1]-0.0675-Subscript[δ, 2])^2+(0.3032)^2)
    Sqrt[(Subscript[δ, 1]-0.0675-Subscript[δ, 2])^2]),{Subscript[δ, 1],
    -3.6,3.6},{Subscript[δ, 2],-3.15,3.15}]

However, when I try to solve it Mathematica first gives me this error:


Numerical integration converging too slowly; suspect one of the following: singularity, value of the integration is 0, highly oscillatory integrand, or WorkingPrecision too small.

And then this one:


The global error of the strategy GlobalAdaptive has increased more than 10000 times. The global error is expected to decrease monotonically after a number of integrand evaluations. Suspect one of the following: the working precision is insufficient for the specified precision goal; the integrand is highly oscillatory or it is not a (piecewise) smooth function; or the true value of the integral is 0. Increasing the value of the GlobalAdaptive option MaxErrorIncreases might lead to a convergent numerical integration. NIntegrate obtained 5.338400038656212*^10 and 2.8453968527047453*^9 for the integral and error estimates.

What should I do to solve these errors? Also are these affecting the output of my expression?

  • $\begingroup$ Using mathematica 10.0.1 on a mac I get 4.47595*10^10 $\endgroup$
    – chris
    Oct 5, 2014 at 19:32
  • $\begingroup$ In your previous question I showed how to write these kind of functions in a much more readable style for posting at the site. Please revisit my answer $\endgroup$ Oct 5, 2014 at 20:05
  • $\begingroup$ Welcome to Mathematica.SE! I suggest the following: 1) As you receive help, try to give it too, by answering questions in your area of expertise. 2) Read the faq! 3) When you see good questions and answers, vote them up by clicking the gray triangles, because the credibility of the system is based on the reputation gained by users sharing their knowledge. Also, please remember to accept the answer, if any, that solves your problem, by clicking the checkmark sign! $\endgroup$ Oct 5, 2014 at 20:08
  • $\begingroup$ @belisarius Should I edit my expression by using functions? $\endgroup$
    – Starior
    Oct 5, 2014 at 20:58
  • $\begingroup$ You should comment on the answers you receive. Also, if they are right, you should upvote/accept. If they are wrong you should explain why $\endgroup$ Oct 26, 2014 at 18:23

1 Answer 1

f[d1_, d2_] = (Abs[
      d1 - 0.0675 - 
       d2] EllipticE[-((4*0.1516*0.1516)/(d1 - 0.0675 - 
            d2)^2)])/(7.2*6.3*2 \[Pi]^2*8.85418782*10^-12*((d1 - 0.0675 - 
          d2)^2 + (0.3032)^2) Sqrt[(d1 - 0.0675 - d2)^2]);

Plot3D[f[d1, d2], {d1, -3.6, 3.6}, {d2, -3.15, 3.15}, ClippingStyle -> None, 
 PlotPoints -> 101, PlotRange -> {0, 5*^10}]

enter image description here

There are discontinuities in the integrand.

  • $\begingroup$ Do these discontinuities affect the output and make these errors? If so, why do they affect the output and how can I fix it? Thanks again. $\endgroup$
    – Starior
    Oct 5, 2014 at 21:17
  • $\begingroup$ @Starior I believe Bob is suggesting that the integral diverges to infinity, which I think it does. Since the integrand seems to be positive, I don't believe there is anything you can do. Could there be an error in your setup? (Note that Abs[d1 - 0.0675 - d2] and Sqrt[(d1 - 0.0675 - d2)^2] cancel each other out. The integral still diverges, of course, but it made me wonder if there was a mistake somewhere.) $\endgroup$
    – Michael E2
    Oct 6, 2014 at 2:33
  • $\begingroup$ @MichaelE2 I couldn't find out which part of the integrand makes it diverges to infinity. Can you tell me which part causes this? $\endgroup$
    – Starior
    Oct 6, 2014 at 7:49
  • $\begingroup$ @Starior, near the line u = (d1 - 0.0675 - d2) = 0, the integrand is asymptotically k EllipticE[ -c / u^2], where k and c are positive constants, and its integral diverges over any region containing u = 0. Alternatively, plot f[d1, d2] (d1 - 0.0675 - d2) and note it has bounded variation, which implies that the function behaves like ~ 1 / (d1 - 0.0675 - d2) near the discontinuity. $\endgroup$
    – Michael E2
    Oct 6, 2014 at 10:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.