11

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?

Peter Mortensen
  • 759
  • 4
  • 7
Nasser
  • 143,286
  • 11
  • 154
  • 359
  • 1
    "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.'s missing motivation Jan 22 '17 at 11:14
  • Related: http://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

1 Answers1

14

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.

Edmund
  • 42,267
  • 3
  • 51
  • 143
  • 1
    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
  • @Mariusz, methinks that function is (for now) limited to elementary functions. – J. M.'s missing motivation Jan 22 '17 at 15:27
  • @Edmund: Very nice! Can this be extended to find the zeros of a more than a single variable? For example ${-2 x - y + 2, x y}$ would produce two points. – Moo Jan 22 '17 at 17:30
  • Using singularityDomain[f_, x_] := ... would address the extension to more variables comment, since FunctionDomain already supports a second argument of the form {x, y}. PolyGamma[1/x] evaluates to PolyGamma[0, 1/x], causing trouble for FunctionDomain. One can use singularityDomain[Hold[PolyGamma[1/x], x] in this case. – Carl Woll Jan 22 '17 at 18:19
  • 2
    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
  • 1
    @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 01:20
  • @MariuszIwaniuk version 11.3 seems to be able to find it now Mathematica graphics and for the second one also Mathematica graphics – Nasser Jul 15 '18 at 22:17
  • I got a chance to try your function more now. It does not actually do what is needed all the time. FunctionDomain gives interval where the function is real. But this does not mean that the other interval is all poles. For example, singularityDomain[Sqrt[x],x] gives x<0, but there is no singularity or poles at each x<0. Actually, excluding +- infinity, there is no singularities at all in the function Sqrt[x]. region x<0 is where the function is not real. But this is not the same as poles. So far, I could not find something as Maple's singular in Mathematica which works for everything. – Nasser Jul 15 '18 at 22:58