Что такое set of integer
Перейти к содержимому

Что такое set of integer

  • автор:

Common Number Sets

There are sets of numbers that are used so often they have special names and symbols:

The whole numbers from 1 upwards. (Or from 0 upwards in some fields of mathematics). Read More ->

The whole numbers , negative whole numbers <. -3,-2,-1>and zero . So the set is

(Z is from the German «Zahlen» meaning numbers, because I is used for the set of imaginary numbers). Read More ->

The numbers you can make by dividing one integer by another (but not dividing by zero). In other words fractions. Read More ->

Examples: 3/2 (=1.5), 8/4 (=2), 136/100 (=1.36), -1/1000 (=-0.001)

Q is for «quotient» (because R is used for the set of real numbers): the result of dividing one number by another. It comes from the Italian «Quoziente».

Any real number that is not a Rational Number. Read More ->

Any number that is a solution to a polynomial equation with rational coefficients.

Includes all Rational Numbers, and some Irrational Numbers. Read More ->

Any number that is not an Algebraic Number

Examples of transcendental numbers include π and e. Read More ->

Any value on the number line:

  • Can be positive, negative or zero.
  • Can be Rational or Irrational.
  • Can be Algebraic or Transcendental.
  • Can have infinite digits, such as 13 = 0.333.

They are called «Real» numbers because they are not Imaginary Numbers. Read More ->

Numbers that when squared give a negative result.

If you square a real number you always get a positive, or zero, result. For example 2×2=4, and (-2)×(-2)=4 also, so «imaginary» numbers can seem impossible, but they are still useful!

Examples: √(-9) (=3i), 6i, -5.2i

The «unit» imaginary numbers is √(-1) (the square root of minus one), and its symbol is i, or sometimes j.

A combination of a real and an imaginary number in the form a + bi, where a and b are real, and i is imaginary.

The values a and b can be zero, so the set of real numbers and the set of imaginary numbers are subsets of the set of complex numbers.

Examples: 1 + i, 2 — 6i, -5.2i, 4

Illustration

Natural numbers are a subset of Integers

Integers are a subset of Rational Numbers

Rational Numbers are a subset of the Real Numbers

Combinations of Real and Imaginary numbers make up the Complex Numbers.

Number Sets In Use

Here are some algebraic equations, and the number set needed to solve them:

Equation Solution Number Set Symbol
x − 3 = 0 x = 3 Natural Numbers
x + 7 = 0 x = −7 Integers
4x − 1 = 0 x = ¼ Rational Numbers
x 2 − 2 = 0 x = ±√2 Real Numbers
x 2 + 1 = 0 x = ±√(−1) Complex Numbers

Other Sets

We can take an existing set symbol and place in the top right corner:

  • a little + to mean positive, or
  • a little * to mean non zero, like this:
Set of positive integers
Set of nonzero integers
etc

Real Numbers

The set of real numbers is represented by the letter R. Every number (except complex numbers) is contained in the set of real numbers. When the general term «number» is used, it refers to a real number. All of the following types or numbers can also be thought of as real numbers.

Integers

The set of integers is represented by the letter Z. An integer is any number in the infinite set,

Z = (. -3, -2, -1, 0, 1, 2, 3, . >

Integers are sometimes split into 3 subsets, Z + , Z — and 0. Z + is the set of all positive integers (1, 2, 3, . ), while Z — is the set of all negative integers (. -3, -2, -1). Zero is not included in either of these sets . Z nonneg is the set of all positive integers including 0, while Z nonpos is the set of all negative integers including 0.

Natural Numbers

The set of natural numbers is represented by the letter N. This set is equivalent to the previously defined set, Z + . So a natural number is a positive integer.

Whole Numbers

The set of whole numbers is represented by the letter W. This set is equvalent to the previously defined set, Z nonneg . So a whole number is a member of the set of positive integers (or natural numbers) or zero.

Rational Numbers

The set of rational numbers is represented by the letter Q. A rational number is any number that can be written as a ratio of two integers. The set of rational numbers contains the set of integers since any integer can be written as a fraction with a denominator of 1. A rational number can have several different fractional representations. For example, 1/2 is equivalent to 2/4 or 132/264. In decimal representation, rational numbers take the form of repeating decimals. Some examples of rational numbers are:

Irrational Numbers

The set of irrational numbers is represented by the letter I. Any real number that is not rational is irrational. These are numbers that can be written as decimals, but not as fractions. They are non-repeating, non-terminating decimals. Some examples of irrational numbers are:

Note: Any root that is not a perfect root is an irrational number. So any roots such as the following examples, are irrational.

COURSE HOMEPAGES
MATH 1036
MATH 1037
FACULTY HOMEPAGES
Alex Karassev
Ted Chase

The set of the integers

The integers are made up of positive numbers, negative numbers and zero. The positive numbers are like the naturals, but with a «plus» before: $$+1, +2, +3, +4, \ldots$$. Nevertheless, the «plus» of the positive numbers does not need to be be written. On the other hand, the negative numbers are like the naturals but with a «minus» before: $$-1, -2, -3, -4,\ldots$$ The number zero is special, because it is the only one that has neither a plus nor a minus, showing that it is neither positive nor negative.

For example, the following numbers are integers: $$3, -76, 0, 15, -22.$$

Although they may seem a bit strange, the negative numbers are used every day.

For example, someone gets into an elevator on the ground floor. Nevertheless, he does not want to go up, rather he wants to go down because that is where the parking is. Then he pushes the button for the floor $$-1$$, the floor beneath the ground floor. If he had pushed the button for the first floor, he would have gone to the first floor: and this is not what he wanted!

The integers can be drawn on a line as follows:

  1. A line is drawn and it is divided into equal segments.
  2. The zero is drawn.
  3. The positive numbers are drawn on the right of the zero in order: first $$1$$, then $$2, 3$$, etc.
  4. The negative numbers are drawn on the left of the zero as follows: first $$-1$$, then $$-2$$, $$-3$$, etc.

In the following drawing you can see an example of the integers from $$-5$$ to $$5$$ drawn on a line:

It is said that an integer is smaller than another one if when we draw it, it is placed on its left. In the previous drawing, we can see, for example, that: $$-2$$ is smaller than $$4$$, that $$-5$$ is smaller than $$-1$$, and that $$0$$ is smaller than $$3$$. To write this we will use the following symbol: $$

  • Combined operations
  • Operations with integers

Что такое set of integer

Class SetOfIntegerSyntax is an abstract base class providing the common implementation of all attributes whose value is a set of nonnegative integers. This includes attributes whose value is a single range of integers and attributes whose value is a set of ranges of integers. You can construct an instance of SetOfIntegerSyntax by giving it in «string form.» The string consists of zero or more comma-separated integer groups. Each integer group consists of either one integer, two integers separated by a hyphen ( — ), or two integers separated by a colon ( : ). Each integer consists of one or more decimal digits ( 0 through 9 ). Whitespace characters cannot appear within an integer but are otherwise ignored. For example: «» , «1» , «5-10» , «1:2, 4» . You can also construct an instance of SetOfIntegerSyntax by giving it in «array form.» Array form consists of an array of zero or more integer groups where each integer group is a length-1 or length-2 array of int s; for example, int[0][] , int[][]<> , int[][]> , int[][],> . In both string form and array form, each successive integer group gives a range of integers to be included in the set. The first integer in each group gives the lower bound of the range; the second integer in each group gives the upper bound of the range; if there is only one integer in the group, the upper bound is the same as the lower bound. If the upper bound is less than the lower bound, it denotes a null range (no values). If the upper bound is equal to the lower bound, it denotes a range consisting of a single value. If the upper bound is greater than the lower bound, it denotes a range consisting of more than one value. The ranges may appear in any order and are allowed to overlap. The union of all the ranges gives the set’s contents. Once a SetOfIntegerSyntax instance is constructed, its value is immutable. The SetOfIntegerSyntax object’s value is actually stored in » canonical array form.» This is the same as array form, except there are no null ranges; the members of the set are represented in as few ranges as possible (i.e., overlapping ranges are coalesced); the ranges appear in ascending order; and each range is always represented as a length-two array of int s in the form . An empty set is represented as a zero-length array. Class SetOfIntegerSyntax has operations to return the set’s members in canonical array form, to test whether a given integer is a member of the set, and to iterate through the members of the set.

Constructor Summary

Constructors

Modifier Constructor and Description
protected SetOfIntegerSyntax(int member)

Construct a new set-of-integer attribute containing a single integer.
Construct a new set-of-integer attribute with the given members in array form.
Construct a new set-of-integer attribute containing a single range of integers.
Construct a new set-of-integer attribute with the given members in string form.

Method Summary

Methods

Modifier and Type Method and Description
boolean contains(int x)

Determine if this set-of-integer attribute contains the given value.
Determine if this set-of-integer attribute contains the given integer attribute’s value.
Returns whether this set-of-integer attribute is equivalent to the passed in object.
Obtain this set-of-integer attribute’s members in canonical array form.
Returns a hash code value for this set-of-integer attribute.

Determine the smallest integer in this set-of-integer attribute that is greater than the given value.

Returns a string value corresponding to this set-of-integer attribute.

Methods inherited from class java.lang.Object

Constructor Detail

SetOfIntegerSyntax
protected SetOfIntegerSyntax(String members)

Construct a new set-of-integer attribute with the given members in string form.

SetOfIntegerSyntax
protected SetOfIntegerSyntax(int[][] members)

Construct a new set-of-integer attribute with the given members in array form.

SetOfIntegerSyntax
protected SetOfIntegerSyntax(int member)

Construct a new set-of-integer attribute containing a single integer.

SetOfIntegerSyntax
protected SetOfIntegerSyntax(int lowerBound, int upperBound)

Construct a new set-of-integer attribute containing a single range of integers. If the lower bound is greater than the upper bound (a null range), an empty set is constructed.

Method Detail

getMembers
public int[][] getMembers()

Obtain this set-of-integer attribute’s members in canonical array form. The returned array is «safe;» the client may alter it without affecting this set-of-integer attribute.

contains
public boolean contains(int x)

Determine if this set-of-integer attribute contains the given value.

contains
public boolean contains(IntegerSyntax attribute)

Determine if this set-of-integer attribute contains the given integer attribute’s value.

next
public int next(int x)

Determine the smallest integer in this set-of-integer attribute that is greater than the given value. If there are no integers in this set-of-integer attribute greater than the given value, -1 is returned. (Since a set-of-integer attribute can only contain nonnegative values, -1 will never appear in the set.) You can use the next() method to iterate through the integer values in a set-of-integer attribute in ascending order, like this:

SetOfIntegerSyntax attribute = . . .; int i = -1; while ((i = attribute.next (i)) != -1)

equals
public boolean equals(Object object)

  1. object is not null.
  2. object is an instance of class SetOfIntegerSyntax.
  3. This set-of-integer attribute’s members and object ‘s members are the same.

hashCode
public int hashCode()

Returns a hash code value for this set-of-integer attribute. The hash code is the sum of the lower and upper bounds of the ranges in the canonical array form, or 0 for an empty set.

toString
public String toString()

Returns a string value corresponding to this set-of-integer attribute. The string value is a zero-length string if this set is empty. Otherwise, the string value is a comma-separated list of the ranges in the canonical array form, where each range is represented as » i » if the lower bound equals the upper bound or » i — j » otherwise.

Java™ Platform
Standard Ed. 7

Submit a bug or feature
For further API reference and developer documentation, see Java SE Documentation. That documentation contains more detailed, developer-targeted descriptions, with conceptual overviews, definitions of terms, workarounds, and working code examples.
Copyright © 1993, 2020, Oracle and/or its affiliates. All rights reserved. Use is subject to license terms. Also see the documentation redistribution policy.

Добавить комментарий

Ваш адрес email не будет опубликован. Обязательные поля помечены *