I have to solve the following equation using Mathematica.

$\frac{8 \pi \sqrt{a^2+b^2}\ e^{-a \pi^2}}{b}(b\ \cos b\ \pi^2+a\ \sin b \ \pi^2)\int\limits_0^1 e^{-a\ \pi^2 u^2}\cos b\ \pi^2 u^2 ~du=1$.

For each $ \frac{1}{2}\le a \le 2$, there exists many $b$'s satisfying the equation. I want to find the first or minimum value of $b$ satisfying the above equation. I tried NSolve but it is not working. I tried FindRoot, it's working but I need to guess the root. Since I need many points to make list plot so it is very hard.

  • $\begingroup$ Are you looking for real solutions b? In which range? $\endgroup$ Commented Jul 20, 2018 at 8:38
  • $\begingroup$ There are many $b$s for a fixed valued of $a$ satisfying the equation. I want the minimum value of $b$ corresponding to given value of $a$. Then making list plot. $\endgroup$
    – Shabbir
    Commented Jul 20, 2018 at 9:01

2 Answers 2


In order to guess the location of the zeroes, try the following:

ContourPlot[Log[Abs[a + b - 1]], {a, 1/2, 2}, {b, -1, 1}]

Instead of a + b, type the right hand side of your formula. The main idea is to exaggerate the location of the zeroes by converting them into singularities. Use those locations in FindRoot.



gl = (8 Pi Sqrt[a^2 + b^2 ] Exp[-a Pi^2])/b (b Cos[b Pi^2] + a Sin[b Pi^2]) Integrate[Exp[-a Pi^2 u^2] Cos[b Pi^2 u^2], {u, 0, 1} ] == 1

ContourPlot  [gl // Evaluate, {a, -1/2, 2}, {b, -1, 1},MaxRecursion -> 5, FrameLabel -> {a, b}]

In the plot you can see the possible solutions of your equation. It looks like there are no solutions in the parameter region 1/2<a<2&&-1<b<1 and several solutions in the range -1/2<a<1/2&&-1<b<1!

enter image description here

A minimal solution can be evaluated with NMinimize

NMinimize[{b^2 + a^2, gl, -1/2 <= a <= 1/2}, {a, b}]
(*{0.00758855, {a -> -0.0871123, b -> -2.97896*10^-7}} *)
  • $\begingroup$ Thats simple to draw....I have this figure. My main problem is to find a pair $(a, min(b))$ satisfying the equation and plot it. $\endgroup$
    – Shabbir
    Commented Jul 20, 2018 at 9:16
  • 2
    $\begingroup$ Why didn't you show your efforts? $\endgroup$ Commented Jul 20, 2018 at 9:18
  • $\begingroup$ I dnt know how to write Mathematica commands here? Just copy and paste from Mathematica nb? $\endgroup$
    – Shabbir
    Commented Jul 20, 2018 at 9:25
  • $\begingroup$ Yes, copy and paste into the box. The buttons at the top let you do formatting (the one with a pair of braces { } marks highlighted text as code, the $\alpha\beta$ button in the top right converts Mathematica Greek letters to unicode letters. $\endgroup$
    – SPPearce
    Commented Jul 20, 2018 at 9:31
  • $\begingroup$ For a = 1, you have the value of b that is complex. Is this expected ? Or are you expecting only real values of b ? $\endgroup$
    – Lotus
    Commented Jul 20, 2018 at 9:35

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.