NonNegativeIntegers

NonNegativeIntegers

represents the domain of non-negative integers, as in xNonNegativeIntegers.

Details

  • xNonNegativeIntegers evaluates immediately if x is a numeric quantity.
  • Simplify[exprNonNegativeIntegers,assum] can be used to try to determine whether an expression is a non-negative integer under the given assumptions.
  • (x1|x2|)NonNegativeIntegers and {x1,x2,}NonNegativeIntegers test whether all xi are non-negative integers.
  • NonNegativeIntegers is output in StandardForm or TraditionalForm as TemplateBox[{}, NonNegativeIntegers]. This typeset form can be input using nnints.

Examples

open allclose all

Basic Examples  (3)

Seven is a non-negative integer:

If is an integer, is a non-negative integer:

Find non-negative integer solutions of a Pell equation:

Scope  (6)

Test domain membership of a numeric expression:

Make domain membership assumptions:

Specify the default domain over which a function should work:

Solve an optimization problem over the non-negative integers:

Test whether several numbers are non-negative integers:

If any number is explicitly not a non-negative integer, the result is False:

TraditionalForm formatting:

Applications  (1)

Testing membership in the non-negative integers is a fast way to verify non-negativity of a large list:

Properties & Relations  (3)

Membership in NonNegativeIntegers is equivalent to membership in Integers and non-negativity:

NonNegativeIntegers is contained in NonNegativeReals and NonNegativeRationals:

NonNegativeIntegers is disjoint from NegativeIntegers:

It intersects NonPositiveIntegers:

Introduced in 2019
 (12.0)