I am looking for function in Mathematica, which finds all singularities in an expression. To keep it simple, the variable is only one, say x.

So given expression 1/x, it will return $\infty$ and given x*y + 1/(x*y) it will return $x=0,x=\infty,x=-\infty$. Similar to Maple's singular function. "The singular function will return non-removable as well as removable singularities"

Here are some examples:

     singular((c - (a + b + 1)*x)/(x*(1 - x)),x);
          {x = 0}, {x = 1}


         {x = 0}


          {x = 1}, {x = 1/2}

The expression will always have the variable $x$ in it. It can be rational or not, and it can be basically any valid expression in x. If no singularities exist, then it returns nothing.

I looked, and not able to find this function in Mathematica.

The question is: What would be the closest thing in Mathematica to the above Maple function? This is not exactly like finding poles, since the expression does not have to be rational polynomials. I know any implementation of this function will end up using Solve at the end?

  • 1
    $\begingroup$ "This is not exactly like finding poles, since the expression does not have to be rational polynomials." - meromorphic functions in general can have poles, not just rational functions. For instance, here's how to see the poles of $\tan$: Reduce[1/Tan[z] == 0, z]. That strategy will not work for $\exp(1/x)$ and elliptic functions, to use some examples. $\endgroup$ – J. M.'s ennui Jan 22 '17 at 11:14
  • $\begingroup$ Related: mathematica.stackexchange.com/q/109839/1871 Your question is more general and harder of course. $\endgroup$ – xzczd Jan 22 '17 at 11:16
  • $\begingroup$ @xzczd thank you, yes I saw that one and also saw this finding-poles-of-a-function but they are specific to one form of expression. If the function is known to be rational polynomials in it, it is easy, but Maple singular function works for any expression. $\endgroup$ – Nasser Jan 22 '17 at 11:21
  • $\begingroup$ But the question marked as duplicate to this, do not give the singularities like the solution given below does. May be the title of the question is similar, but the answers there did not do what I wanted. $\endgroup$ – Nasser Jan 23 '17 at 12:44

Singularities will occur outside the domain of the function. You could use FunctionDomain to get the domain and then negate it (Not).


singularityDomain[f_, x_Symbol] := Reduce[! FunctionDomain[f, x]]


singularityDomain[(c - (a + b + 1)*x)/(x*(1 - x)), x]
x == 1 || x == 0
singularityDomain[Exp[1/x], x]
x == 0
singularityDomain[2*x/((x - 1)*(2*x - 1)), x]
x == 1/2 || x == 1
singularityDomain[Log[x]/(x^2 - 1), x]
x == 1 || x <= 0

It is easy to select the list of isolated singularities from here.

Hope this helps.

  • 1
    $\begingroup$ singularityDomain[PolyGamma[1/x], x] -> MMA can't Find :P $\endgroup$ – Mariusz Iwaniuk Jan 22 '17 at 14:09
  • $\begingroup$ @MariuszIwaniuk Interesting. Perhaps you should report to WRI. $\endgroup$ – Edmund Jan 22 '17 at 14:14
  • $\begingroup$ singularityDomain[QPolyGamma[x, 1], x] -> next example.You write to WRI :P $\endgroup$ – Mariusz Iwaniuk Jan 22 '17 at 14:19
  • 2
    $\begingroup$ Possible refinement: singularityDomain[f_, x_] := Module[{res = FunctionDomain[f, x]}, Reduce[! res] /; ! MatchQ[res, _FunctionDomain] ] so that Reduce errors aren't produced when FunctionDomain is unable to find a result. $\endgroup$ – Carl Woll Jan 22 '17 at 18:23
  • 1
    $\begingroup$ @Moo Yes, it can be extended for more than one variable. Since FunctionDomain can take additional variables then change x_Symbol to x : _Symbol | {_Symbol ..}. Then singularityDomain[1/(y (2 x - y) (z - 7)), {x, y, z}] gives x == y/2 || y == 0 || z == 7. $\endgroup$ – Edmund Jan 23 '17 at 1:20

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