P2 T1 L1 - Number Systems Flashcards
What are natural numbers? (3 points)
Mathematical symbol?
- A positive whole number
- Usually consist of 0, 1, 2, 3, 4, 5, 6, 7, 8, 9
- This is known as base 10 as there are 10 different digits
The mathematical symbol for natural numbers is ℕ or N so you might see this represented as:
ℕ = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, …}
What are integer numbers? (2 points)
Mathematical symbol?
- A whole number which can be positive or negative
- 0 included in the subset
The mathematical symbol for integer numbers is ℤ
or Z so you might see this represented as:
ℤ = {…, -3, -2, -1, 0, 1, 2, 3, …}
In theory you can have an infinite range, in practice some languages limit the range you can store (e.g. in VB you can store -247483648 to 2147483647)
What are rational numbers? (3 points)
Mathematical symbol?
- A number which can be expressed as a fraction (also known as a quotient) or a ratio of integers
- Can be positive or negative
- Fractions are made up of two integers with the value being the ratio between the two. Ratio can be expressed as a fraction or a decimal equivalent
E.g.
0.5 = 1/2
- 0.75 = (−6)/8
1. 0 = 5/5
The mathematical symbol for Rational numbers is ℚ or Q so you might see this represented as:
ℚ = {…, - 0.3, -0.2, -0.1, 0.1, 0.2 …}
What are irrational numbers? (1 point)
- Any number which cannot be represented as a ratio of integers because the decimal equivalent would go on forever without a repeating pattern
E.g. π
In decimal form this number is infinite so has to be truncated to 3.14 (or slightly longer for accuracy)
Some square roots and cube roots are irrational numbers
If a number is terminating or repeating, it must be rational;
If it is both nonterminating and nonrepeating, the number is irrational.
What are real numbers? (4 points)
Mathematical symbol?
- Any positive or negative value which does or does not have a fractional part
- Natural numbers/Integers, rational and irrational numbers are all real numbers
- The fractional part can be any length, this means that the number can be as accurate as needed
- Can be used to measure continuously or infinitely changing values.
The mathematical symbol for real numbers is ℝ or R so you might see this represented as:
ℝ = {…, 0.122, 0.123, 0.124 …}
What are ordinal numbers? (1 point).
- Used to identify the position of something in a list E.g. 1st, 2nd, 3rd
Often used with Cardinal numbers which are used to identify the size of something e.g. size of a list = 20
Can be used with data structures like lists, queues, stacks and arrays.
In Java you might use an array and use different methods to access the values in the array