5
$\begingroup$

I am new to Mathematica and this is probably a simple question, but I can't figure it out at the moment...

f[x_]:=1/(x-3)

Clearly the vertical asymptote is at x->3, as1/0 is undefined.

I would like some kind of function that's output is simply:

3

I need to know where the function is undefined. Some functions give me:

{{x->3}} and things like that, but I can't work with that.

Any help would be great.

$\endgroup$
3
  • 2
    $\begingroup$ Hi ! Can't you just use Solve on the denominator ? Like this Solve[x-3==0, x] $\endgroup$ – Sektor Sep 5 '14 at 8:36
  • $\begingroup$ You should try to get to grips with Ruled output, this will greatly enhance your Mathematica experience. $\endgroup$ – Yves Klett Sep 5 '14 at 10:00
  • $\begingroup$ To follow up on what Yves said, see this answer to the "pitfalls" question for a nice explanation. $\endgroup$ – Michael E2 Sep 5 '14 at 10:12
7
$\begingroup$

FunctionDomain

In versions 10+, you can use the built-in FunctionDomain:

f[x_]:=1/(x-3);
FunctionDomain[f[x], x]
(* x<3||x>3 *)
Not[%]//FullSimplify
(* x == 3 *)

or, more directly,

Not[FunctionDomain[f[x], x]]//FullSimplify
(* x == 3 *)

To get 3 use

Not[FunctionDomain[f[x], x]]//FullSimplify //Last
(* 3 *)

Further examples:

Not[FunctionDomain[Tan[x], x]]//FullSimplify
(* 1/2 + x/π ∈ Integers *)

Not[FunctionDomain[(x + y)/(x^2 - y^2), {x, y}]]//FullSimplify
(* x^2==y^2 *)

Thanks: @BobHanlon for the comment that Reals is the default domain, and hence, FunctionDomain[f[x], x, Reals is equivalent to FunctionDomain[f[x], x].

For version 9,

Not[Reduce[Abs@f[x] < Infinity, x, Reals]] // FullSimplify // Last
(* 3 *)
$\endgroup$
2
  • $\begingroup$ +1 The default domain is Reals so there is no need to specify the domain. $\endgroup$ – Bob Hanlon Jan 17 '18 at 4:28
  • $\begingroup$ Thank you @Bob. I will revise the post accordingly. $\endgroup$ – kglr Jan 17 '18 at 5:09
1
$\begingroup$

I don't have V10 yet, so I am just going to extend @Sektor.

Let say you have a function with some divergences. I choose here a simple example like

f[x_] = Product[1/(x - a[i]), {i, 3}]

You can get the poles by

Solve[1/f[x] == 0, x]

It works if you have two variables as well like

f[x_, y_] = Product[1/(x + y - a[i]), {i, 3}]
Solve[1/f[x, y] == 0, x]

Now the final answer may depend on how complex your initial function is. You may get an conditional expression or in worst case you may have to go for a numerical solution.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.