Take the 2-minute tour ×
Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. It's 100% free, no registration required.

How do I plot the following multi case function in wolfram or geogebra?

$$ \begin{eqnarray*} f(x) = \begin{cases} 1, &\text{if }x \text{ is an integer}, \\ 0, &\text{if }x \text{ is not an integer}. \end{cases} \end{eqnarray*} $$

The graph would be dots and underscores?

share|improve this question
1  
Here's a piecewise defined function (but the graph isn't what you want -- I'd like to know how to do that as well): "Piecewise[{{1, x == Floor[x]}}, 0]" Link: wolframalpha.com/input/?i=Piecewise[{{1%2C+x+%3D%3D+Floor[x]}}%2C+0] –  Bill Cook Oct 18 '11 at 13:26
add comment

1 Answer

I can't quite do that with a nice picture, but the reverse works more or less with ceiling(x)-floor(x) and looks like

enter image description here

share|improve this answer
    
I am amused that Alpha claims a numercal root at $x=1.1$ –  Ross Millikan Oct 17 '11 at 20:54
    
This is supposed to be equivalent, but somehow the expected gaps don't show up... –  J. M. Oct 17 '11 at 23:48
add comment

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.