# Does Mathematica have a function to find all singularities of an expression? [duplicate]

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}

and

singular(exp(1/x),x);
{x = 0}

and

singular(2*x/((x-1)*(2*x-1)),x);
{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?

## marked as duplicate by Jens, corey979, Artes, Feyre, MarcoBJan 23 '17 at 9:11

• "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. – J. M. will be back soon Jan 22 '17 at 11:14
• Related: mathematica.stackexchange.com/q/109839/1871 Your question is more general and harder of course. – xzczd Jan 22 '17 at 11:16
• @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. – Nasser Jan 22 '17 at 11:21
• 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. – 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).

With

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

Then

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.

• singularityDomain[PolyGamma[1/x], x] -> MMA can't Find :P – Mariusz Iwaniuk Jan 22 '17 at 14:09
• @MariuszIwaniuk Interesting. Perhaps you should report to WRI. – Edmund Jan 22 '17 at 14:14
• singularityDomain[QPolyGamma[x, 1], x] -> next example.You write to WRI :P – Mariusz Iwaniuk Jan 22 '17 at 14:19
• 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. – Carl Woll Jan 22 '17 at 18:23
• @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. – Edmund Jan 23 '17 at 1:20