Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

Let's say we'd like to find the critical points of the function $f(x)=\sqrt{x-x^2}$. Finding out where the derivative is 0 is straightforward with Reduce:

f[x_] := Sqrt[x - x^2]
f'[x] == 0
Reduce[%]

which yields:

(1 - 2 x)/(2 Sqrt[x - x^2]) == 0

x == 1/2

To find out where the real values of the derivative do not exist, I look for values of $x$ that make the denominator 0:

Reduce[2 Sqrt[x - x^2] == 0]

which yields:

x == 0 || x == 1

To do this, I manually extracted the denominator expression from the derivative and ran it through Reduce.

My question is, is there a better way to ask Mathematica for values of $x$ where an expression doesn't have a real value? E.g. in this case, I'd like to pass in the expression for the derivative $\frac{1-2x}{2\sqrt{x-x^2}}$, and have it report that at 0 and 1, the real value doesn't exist.

share|improve this question
1  
For even more fun, try it with $x^3\exp(-1/x^2)$ or $x^3\exp(1/x^2)$ :-). –  whuber Mar 2 '12 at 17:31

4 Answers 4

up vote 12 down vote accepted

Slightly more generally than the solution by @Sjoerd, you may look for roots of the reciprocal function - if you are interested in pole-like or root-like singularities:

f[x_] := (1 - 2 x)/(2 Sqrt[x - x^2])

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

(*
  ==> x == 0 || x == 1
*)
share|improve this answer

A simple method is to test for reality directly, as follows

Reduce[f'[x] \[Element] Reals, x, Reals]
0 < x < 1

which does not give you the points where $f^\prime(x) \notin \mathbb{R}$. Alternatively, you can test the denominator directly for reality, as follows

Reduce[Denominator[f'[x]] \[Element] Reals, x, Reals]
0 <= x <= 1

which taken with the previous result clearly shows that at $x = 0,1$, $f^\prime(x) \notin \mathbb{R}$. Explicitly searching for those points by combining the two equations, though, gives an odd result

Reduce[! (f'[x] \[Element] Reals) 
      && (Denominator[f'[x]] \[Element] Reals), x]
Im[x] != 0 && Re[x] == 1/2

despite the results being compatible when the search is expanded to include $x \in \mathbb{C}$

Reduce[f'[x] \[Element] Reals, x]
Reduce[Denominator[f'[x]] \[Element] Reals, x] // LogicalExpand // Simplify
Reduce[!%% && %, x, Reals]
0 < Re[x] < 1 && Im[x] == 0
(Im[x] == 0 && 0 <= Re[x] <= 1) || 2 Re[x] == 1
x == 0 || x == 1

Edit: in case anyone was wondering, looking for the region where $f^\prime(x) \notin \mathbb{R}$ directly

Reduce[! (f'[x] \[Element] Reals), x]

gives the remarkably helpful answer

Im[(1 - 2 x)/Sqrt[x - x^2]] != 0

However, this does better

!Reduce[(f'[x] \[Element] Reals), x] // LogicalExpand // Simplify
Re[x] <= 0 || Re[x] >= 1 || Im[x] != 0
share|improve this answer

Here's one approach, though it possibly answers a slightly different question:

Reduce[-Infinity < f'[x] < Infinity, x]
0 < Re[x] < 1 && Im[x] == 0

or

Reduce[-Infinity < f'[x] < Infinity, x, Reals]
0 < x < 1
share|improve this answer

For expressions involving ratios you could try Denominator

Reduce[Denominator[(1 - 2 x)/(2 Sqrt[x - x^2])] == 0, x]

(*
==> x == 0 || x == 1
*)

I don't know a method that will find all non real valued points/areas in a general case.

share|improve this answer
    
To answer your last question, just ask mma to do it for you. –  rcollyer Mar 2 '12 at 4:32
    
@rcollyer Indeed, I forgot that Reduce allows domain specifications as expressions. –  Sjoerd C. de Vries Mar 2 '12 at 6:52

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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