Given a function f[x] and a region M in the complex x-plane, how can I find singularities of f in this region, i.e., issue a command to Mathematica which returns the type of singularity and its parameters?

Let me be more specific

  1. discontinuities (jumps)

  2. poles

  3. branch points


f[x_] := Sin[x] Sign[Cos[x]]
g[x_] := 1/(a - x)^2
h[x_] := Sqrt[x + b]  

EDIT 11.09.14
The restriction to real x in my first version of the text was not a good idea. I have changed it.

  • $\begingroup$ Possible duplicate: mathematica.stackexchange.com/q/58926/131? $\endgroup$
    – Yves Klett
    Sep 10, 2014 at 18:49
  • 1
    $\begingroup$ The reference covers only my example g. $\endgroup$ Sep 10, 2014 at 19:05
  • $\begingroup$ I agree with Hintze. This is not a duplicate of 58326 $\endgroup$
    – m_goldberg
    Sep 10, 2014 at 19:07
  • 1
    $\begingroup$ If you really mean to restrict your question to built-in functions, I am not aware of such a function. $\endgroup$
    – m_goldberg
    Sep 10, 2014 at 19:08
  • $\begingroup$ Are a and b always real? Are the parameters in the functions symbolic, or are they all numerical? I assume a in g[x] isn't the same as the interval boundary a? I.e., are you looking for numerical or symbolic solutions? $\endgroup$
    – Jens
    Sep 10, 2014 at 19:14

3 Answers 3


I don't think there's a general function built in that can deal with all possible cases. But Reduce is quite powerful. Here is a function that seems to work for the last two examples given:

singularCondition[func_, variable_] := 
 Reduce[1/func[variable] == 0 || 
   1/func'[variable] == 0, variable, Reals]

singularCondition[h, x]

(* ==> x == -b *)

singularCondition[g, x]

(* ==> x == a *)

singularCondition[f, x]

==> False

The last case doesn't detect a singularity for f[x], so jumps will require more work.

I added the restriction to the real domain because the question explicitly specifies an interval on the real line. This condition could also be removed.

The problem is that singularities could occur in arbitrarily high derivatives, too. And that's not so easy to check with my approach.


The following approach does a little better with a discontinuous function, in that it at least gives you an indication that something is preventing the function from being analytic:

analyticityCondition[func_, variable_] := Module[{n, c},
    x^n Simplify[SeriesCoefficient[func[variable], {variable, c, n}], 
      n >= 0], n]

analyticityCondition[h, x]

(* ==> False *)

analyticityCondition[g, x]

(* ==> False *)

analyticityCondition[f, x]

(* ==> False *)

analyticityCondition[Sin, x]

(* ==> True *)

This works by asking for the Taylor expansion of the given function around a generic origin c, and then invoking SumConvergence to see if the coefficients of that expansion for non-negative powers indeed yield a convergent sum. A negative result for the test TrueQ could mean either that Mathematica wasn't able to deal with the expansion, or the sum has a finite radius of convergence (which means there is some singularity). Only if you get the result True can you be sure that the function has no singularities.

So I would use this analyticity test first, and if it returns False you can apply the earlier function singularityCondition to find where things go wrong. Then if this step finds nothing, you still know that a singularity could nevertheless be hiding somewhere (as in the case of f[x]).

The function analyticityCondition can also detect the existence of singularities in higher derivatives:

k[x_] := Abs[x]^2

analyticityCondition[k, x]

(* ==> False *)

This is a differentiable function, but not analytic at 0.

  • $\begingroup$ Thanks. Will study it in detail. Short question: what does the apostrophe in func' mean? $\endgroup$ Sep 11, 2014 at 6:24
  • $\begingroup$ ': Derivative funny though, the online help does returns nothing for '. $\endgroup$
    – Yves Klett
    Sep 11, 2014 at 6:34
  • $\begingroup$ @Jens: very good idea, in priciple. But here are some more examples: analyticityCondition[#, x] & /@ {# &, Sin, Exp, Log[1 + #] &, Tan, Sqrt, Floor, Sign, Gamma[1 + #] &, Zeta[2 + #] &, Erf} (* all return False except the first three *) $\endgroup$ Sep 11, 2014 at 6:42
  • $\begingroup$ @Yves: oh, stupid me. Didn't I know that since school times ;-) $\endgroup$ Sep 11, 2014 at 6:43
  • $\begingroup$ @Jens: I don't understand the local parameter c. It has the meaning of the point x0 around which Series makes the Expansion. But it has no values assigned!? If I drop it from the Parameter list, your function ceases to work correctly. Please explain. $\endgroup$ Sep 11, 2014 at 7:44

It might be interesting for you to compare @Jens' answer with FunctionDomain (new in V10):

compare[fun_] := {
  FunctionDomain[fun[x], x, Reals],
  FunctionDomain[fun[x], x, Complexes],
  analyticityCondition[fun, x],
  singularCondition[fun, x]}

 compare /@ {Sin, Tan, f, g, h},
 TableHeadings ->
  {None, {"Function", "RealDomain", "ComplexDomain",
    "analyticityCondition", "singularCondition", "RealRange"}},
 TableSpacing -> {3, 3}]

enter image description here

  • $\begingroup$ Clearly FunctionDomain can yield True for non-analytic functions, such as the third one (or anything with singularities in higher derivatives). But it does detect the Tan singularities (as does my answer). $\endgroup$
    – Jens
    Sep 11, 2014 at 19:38
  • 1
    $\begingroup$ @Jens I certainly would use your (updated) definitions. Hopefully, in V11 or later we see something like "AnalyticQ", "HarmonicQ" etc. $\endgroup$
    – eldo
    Sep 11, 2014 at 20:11

Try this:


For instance:

FunctionSingularities[Tan[x], x]


FunctionSingularities[ArcTan[x^y], {x, y}, Complexes]

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.