7
$\begingroup$

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?

  • 2
    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: http://www.wolframalpha.com/input/?i=Piecewise[{{1%2C+x+%3D%3D+Floor[x]}}%2C+0]2011-10-18

1 Answers 1

1

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

  • 0
    [This](http://www.wolframalpha.com/input/?i=plot+Boole%5BNot%5BIntegerQ%5Bx%5D%5D%5D+for+x+from+-7+to+7) is supposed to be equivalent, but somehow the expected gaps don't show up...2011-10-17