I have following the following integral,

$$\int_{-1}^{1} \sqrt{(1-a+0.5(1+2b))\left(\frac{1}{r^{6}-1+i 0^{+}}- (a+2b)\right)}dr= \Pi$$

I want to draw a plot of how $b$ vary when $a$ varies from $0.5$ to $1$. I can't evaluate this integral symbolically due to the singularity. To remove the singularity I can add a small imaginary part to the integration.

$$\int_{-1}^{1} \sqrt{(1-a+0.5(1+2b))\left(\frac{1}{r^{6}-1+i 0^{+}}- (a+2b)\right)}dr= \Pi$$

But even after that, I have the difficulty of finding a way to numerically solve this equation in Mathematica to find $a$ and $b$ values.


1 Answer 1


Maybe so:

f[b_?NumericQ, a_?NumericQ] := With[{ep = 10^-12(*You may change it*)}, 
NIntegrate[Sqrt[(1 - a + 1/2*(1 + 2 b))*(1/(r^6 - (1 + I*ep)) - (a + 2*b))], {r, -1, 1}, 
Method -> "LocalAdaptive"]]

Π = 1/10;(*You may change it*)
ContourPlot[Re[f[b, a]] == Π, {a, 1/2, 1}, {b, -1.2, -0.4},
FrameLabel -> {"a", "b(a)"}, PlotPoints -> 50]

enter image description here

  • $\begingroup$ Thank you this is what I wanted :) $\endgroup$
    – Coderzz
    Aug 4, 2017 at 1:47

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.