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
.
a
andb
always real? Are the parameters in the functions symbolic, or are they all numerical? I assumea
ing[x]
isn't the same as the interval boundarya
? I.e., are you looking for numerical or symbolic solutions? $\endgroup$ – Jens Sep 10 '14 at 19:14