There are four separate equations that I need to solve individually for r.

Equation 1

1 - $\frac{8 M e^{-\sqrt{\frac{2 q^2}{M r}}}}{r \bigg(1 + e^{-\sqrt{\frac{2 q^2}{M r}}}\bigg)^2}$ = 0

Equation 2

1 - $\frac{4 M}{r} \frac{1}{\bigg(e^{\sqrt{\frac{ q^2}{M r}}} + e^{-\sqrt{\frac{ q^2}{M r}}} \bigg)}$ = 0

Equation 3

1 - $\frac{2 q^2}{r^2\bigg(-1+e^{\frac{q^2}{M r}}\bigg)}$=0

Equation 4

1 - $\frac{12 q^2 e^{\frac{6 q^2}{M r}}}{r^2 \bigg(-1 + e^{\frac{6 q^2}{M r}}\bigg)^2}$=0

M is mass, so M is positive real number. q is charge, q can be negative. Both M and q will be real numbers.

I tried using solve command in Mathematica. For ex, for solving equation 1, My input is

Solve[1 - (8 M Exp[-Sqrt[(2 q^2)/(M r)]])/(
   r (1 + Exp[-Sqrt[(2 q^2)/(M r)]])^2) == 0, r]

Mathematica is unable to solve this. It is showing message,

Solve::nsmet: This system cannot be solved with the methods available to Solve.

The same is the case with other equations.

I tried other commands also, like, Reduce, NSolve, SolveValues etc, but for these also it is showing same message,for all these equations.

Can anyone suggest any way of solving these equations. It will be very helpful if at least one of these equations get solved.

Thanks in advance!

  • 3
    $\begingroup$ Your best bet is probably to try and solve them numerically. NSolve was in your list, but you'll need to provide numerical values for everything except the variable you're solving for - 'r' based on your Solve example. NSolve may not be your best choice; I believe its main use is for polynomial systems, though it may be able to handle a few other cases. FindRoot is likely to be better though you'll need to supply an initial guess. $\endgroup$
    – user87932
    Jun 11, 2023 at 17:09
  • 1
    $\begingroup$ Do you have a targeted range of values for $M$ and $q$? If so, solving these numerically as @jdp suggests is your best bet. In that targeted range of values you might be able to develop a close-enough approximation that could be used in other software. But if you state your overall objectives, that would help. $\endgroup$
    – JimB
    Jun 11, 2023 at 17:22
  • $\begingroup$ @jdp I have checked with FindRoot also. It also shows same - unable to find with the methods available. $\endgroup$
    – apk
    Jun 12, 2023 at 6:23
  • $\begingroup$ You should discuss with your supervisor. Not every equation can be solved. $\endgroup$
    – yarchik
    Jun 12, 2023 at 7:38
  • $\begingroup$ What numerical values did you use for q and M, and what did you use for your initial guess? $\endgroup$
    – user87932
    Jun 12, 2023 at 16:36

4 Answers 4


I believe there is no closed form expression but with a bit of pen-and-paper maths you can get this into a form where you can easily compute very good numeric approximations. I only looked at the first equation, the others seems in general simiar.

Start with the substitution $s=\sqrt{2q^2/Mr}$ then $r=\frac{2q^2}{Ms^2}$. Plug this into the equation and simplify yields

$$\frac{q^2}{4M^2} = s^2\frac{e^{-s}}{(1+e^{-s})^2}$$

Now note that the right side of the equation does not contain any of the parameters so for any given values of $q$ and $M$ you can compute all possible solutions for $s$ numerically to high accuracy.

  • $\begingroup$ Very clever answer. In your last formula there is a square of the denominator missing: q^2/(4 M^2) == s^2 Exp[-s]/(1 + Exp[-s])^2 $\endgroup$ Jun 12, 2023 at 10:44
  • $\begingroup$ @UlrichNeumann You are right, thanks, corrected. $\endgroup$
    – quarague
    Jun 12, 2023 at 10:58

I don't think there exist general solutions to your equations, but if the value of Sqrt[(2 q^2)/(M r)] happens to be small, you may be able develop the exponential into a series like

Series[E^(-Sqrt[2] y), {y, 0, 1}] (* small y *)

and then get with

Solve[1 - (8*M*(1 - (Sqrt[2]*q)/(Sqrt[M]*Sqrt[r])))/
     ((2 - (Sqrt[2]*q)/(Sqrt[M]*Sqrt[r]))^2*r) == 0, r]

solutions to your first equation.


ContourPlot3D shows ( examplary for the first equation)

ContourPlot3D[1 - (8 M Exp[-Sqrt[(2 q^2)/(M r)]])/(r (1 +Exp[-Sqrt[(2 q^2)/(M r)]])^2) == 0, {r, 0, 5}, {M, 0, 1}, {q,0, 1},AxesLabel -> {r, M, q}]

enter image description here

possible solutions.

  • $\begingroup$ I want an expression for r in terms of M and q. Because that expression for r, I have to use it somewhere else in another expression. $\endgroup$
    – apk
    Jun 12, 2023 at 6:31
  • 1
    $\begingroup$ Plot shows that you've two solutions r for given parameter M,q. Though you might derive two interpolationfunctions from the plotted values. $\endgroup$ Jun 12, 2023 at 6:48
  • $\begingroup$ I didn't understand it. How is it showing two solutions? "Though you might derive two interpolation functions from the plotted values." how to do this ?? $\endgroup$
    – apk
    Jun 12, 2023 at 7:01
  • 2
    $\begingroup$ Assume two planes M=const,q=const the intersection with the surface in the plot shows two points, which give the values of r[M,q] $\endgroup$ Jun 12, 2023 at 7:13

As mentioned in a comment I made, your equations can be rescaled by dividing through by M: q->q/M, r->r/M. After this rescaling, you only have a dependency on q, which I suspect only ranges from -1<=q<=1 for physical reasons. (These equations look like those for a Reissner-Nordstrom black hole.) So, if I only care about solutions in this range for q, I can obtain numerical solutions for the rescaled r using FindRoot, supplying q-values via Table:

     1 - (8  Exp[-Sqrt[(2 q^2)/r]])/(r (1 + 
             Exp[-Sqrt[(2 q^2)/r]])^2) == 0, {r, .5}]}, {q, -1, 1, .1}]

Out[74]= {{-1., 1.43935}, {-0.9, 1.55868}, {-0.8, 1.65889}, {-0.7, 
  1.74331}, {-0.6, 1.81397}, {-0.5, 1.87219}, {-0.4, 1.91888}, {-0.3, 
  1.95465}, {-0.2, 1.97993}, {-0.1, 1.995}, {0., 2.}, {0.1, 
  1.995}, {0.2, 1.97993}, {0.3, 1.95465}, {0.4, 1.91888}, {0.5, 
  1.87219}, {0.6, 1.81397}, {0.7, 1.74331}, {0.8, 1.65889}, {0.9, 
  1.55868}, {1., 1.43935}}

The first value is the rescaled q, the second the rescaled r.

I only did the first equation which you supplied as Mathematica code. It's generally advisable to supply code instead of images etc., since users like myself aren't keen about having to type this stuff in by hand, preferring to copy/paste instead. However, the other equations can be evaluated using a similar technique.


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.