Types of Numbers
whole numbers
natural numbers
positive, whole numbers
0 1 2 3integers
positive or nevative whole numbers
-2 -1 0 1 2
real numbers
rational numbers
division of integers are not necessarily whole numbers.
1.5, 2.3irrational numbers
divisions with an infinite number of decimal places (pi, square-root of 2, ...)
3.14...
multiples
prime numbers
A natural number greater than 1 that is not a product of two smaller natural numbers
See https://en.wikipedia.org/wiki/List_of_prime_numbers2 3 5 7 11 13 17 19 23 29 31 37 41 43 47 53 59 ... # 1 is not a prime numberdef is_prime(num): if num < 2: return False return all(num % i != 0 for i in range(2, num - 1)) def earliest_divisible_prime(num): for i in range(2, num - 1): if num % i == 0: return i def prime_numbers_until(num): for i in range(2, num - 1): if all(i % ii != 0 for ii in range(2, i - 1)): print(i)composite numbers
numbers that can be made by multiplying two prime numbers together.
(All positive whole numbers that are not prime numbers)4 6
complex numbers
You may use a single-number to represent a 2D point. While normally you would use it's cartesian coordinates,
(1, 2)
, you can also describe it as1 + 2i
. The 2i is entirely unecessary, but a convenience for more complicated equations.# (y) # | # 3 # 2 o # 1 # 0 1 2 3 -- (x) o = (1 + 2i)The value of i is an imaginary number (one that cannot possibly exist), whose only defining attribute is
i^2 == -1
. This is a convenience used in electrical engineering, and calculating rotations.
- multiplication by i indicates a rotation of 90*
- i^2 is a rotation of 180*
- i^4 is a rotation of 360*
- the concept of i was created to describe how a squared real number is always positive.
Quaternions
Expands upon the idea of a complex number (within a 2D space) so that it is represented in 3D. 3x new variables are introduced - i, j, and k.
quaternion = w + xi + yj + zk
Properties of the new variablesi^2 = -1 j^2 = -1 k^2 = -1 # NOTE: # the order in which these variables are multiplied # affects whether the outcome is postive or negative. ij = k ji = -k jk = i kj = -i ki = j ik = -j
- When no rotation has been performed, w is 1.0.
1.0 + 0.0i + 0.0j + 0.0k
- Until i is 1, w is inversely proportional
1.0 + 0.0i + 0.0j + 0.0k 0.5 + 0.5i + 0.0j + 0.0k 0.0 + 1.0i + 0.0j + 0.0k
- Beyond i as 1 (or -1), the relationship between i and w becomes more complicated. Think of it as a projection, and seriously watch this video: https://www.youtube.com/watch?v=d4EgbgTm0Bg
- 26:00 overview of axes
- 28.00 visual representation of relationship between i and w (where the numbers really come from).
- Note that j/k are not affected whatsoever.
The values multiplied against j/k are inversely proportional.0.0 + 0.0i - 1.0j + 0.0k 0.0 + 0.0i + 1.0j + 0.0k 0.0 + 0.0i + 0.0j + 1.0k 0.0 + 0.0i + 0.0j - 1.0k
https://www.youtube.com/watch?v=a_lb0MRkuz0 https://www.youtube.com/watch?v=jlskQDR8-bY https://www.youtube.com/watch?v=d4EgbgTm0Bg