# Is there a built-in function which detects singularities in a function?

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

Examples

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.

• Possible duplicate: mathematica.stackexchange.com/q/58926/131? Sep 10 '14 at 18:49
• The reference covers only my example g. Sep 10 '14 at 19:05
• I agree with Hintze. This is not a duplicate of 58326 Sep 10 '14 at 19:07
• If you really mean to restrict your question to built-in functions, I am not aware of such a function. Sep 10 '14 at 19:08
• 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?
– Jens
Sep 10 '14 at 19:14

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.

Edit

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},
TrueQ@SumConvergence[
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.

• Thanks. Will study it in detail. Short question: what does the apostrophe in func' mean? Sep 11 '14 at 6:24
• ': Derivative funny though, the online help does returns nothing for '. Sep 11 '14 at 6:34
• @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 *) Sep 11 '14 at 6:42
• @Yves: oh, stupid me. Didn't I know that since school times ;-) Sep 11 '14 at 6:43
• @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. Sep 11 '14 at 7:44

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

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

TableForm[
compare /@ {Sin, Tan, f, g, h},
{None, {"Function", "RealDomain", "ComplexDomain",
"analyticityCondition", "singularCondition", "RealRange"}},
TableSpacing -> {3, 3}] • 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).
– Jens
Sep 11 '14 at 19:38
• @Jens I certainly would use your (updated) definitions. Hopefully, in V11 or later we see something like "AnalyticQ", "HarmonicQ" etc.
– eldo
Sep 11 '14 at 20:11

Try this:

https://reference.wolframcloud.com/language/ref/FunctionSingularities.html

For instance:

FunctionSingularities[Tan[x], x]


or

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