I am working on a write-up and want to say that a variable is a positive integer (including zero). Would this be said as "variable is in the set of all nonnegative integers"? Maybe there is a different notation I should be using? In the event that I do want to use set notation, how would I write it in symbols?
Asked
Active
Viewed 134 times
2
-
1I'd just say "the variable is a non-negative integer". (Note: $0$ is not a positive number. Positive means strictly greater than $0$) There's no point is specifically saying "variable is in the set of all nonnegative integers" as every object is an element of the set that describes it. It's enough to just say "variable is non-negative integer". If you wont notation $x\in {n\in \mathbb Z| n \ge 0}$ is fine but there is also the notation $\mathbb Z^+$ which conventionally (and maybe confusedly) includes $0$. There's also $\mathbb N \cup {0}$. – fleablood Nov 28 '22 at 01:40
2 Answers
2
Saying that a variable is a nonnegative integer does include $0$. Sometimes people define the set of natural numbers $\mathbb{N}$ so that $0 \in \mathbb{N}$, though it is usually explicitly stated.
In set builder notation, you could denote the set of nonnegative integers with $$\{x\in\mathbb{Z} \mid x \ge0\}$$

Scene
- 1,566
2
You could say $x\in\mathbb{N}$ or $x\in\mathbb{Z^+}$. $\mathbb{N}$ is the set of natural numbers and $\mathbb{Z^+}$ is the set of positive integers, which are essentially the same thing.

Kamal Saleh
- 6,497
-
1Another common notation is $\mathbb{Z}^{\geq 0}$, which solves the ambiguity in both $\mathbb{N}$ and $\mathbb{Z}^+$ of whether you take them to mean “positive” or “strictly positive”. – Peter LeFanu Lumsdaine Nov 28 '22 at 10:25
-
2The OP said he wants to include 0. He doesn’t just want positive integers. – bubba Nov 28 '22 at 10:29
-
@PeterLeFanuLumsdaine never saw that one before. The more you know. – Kamal Saleh Nov 28 '22 at 15:41