Update
This commit is contained in:
parent
099fca51b7
commit
860b62cc6a
10 changed files with 2197 additions and 1746 deletions
23
number.md
23
number.md
|
@ -12,6 +12,8 @@ Humans first started to use positive natural numbers, i.e. 1, 2, 3 ..., so as to
|
|||
|
||||
Basically **anything can be encoded as a number** which makes numbers a universal abstract "medium" -- we can exploit this in both mathematics and programming. Ways of encoding [information](information.md) in numbers may vary, for a mathematician it is natural to see any number as a multiset of its [prime](prime.md) factors (e.g. 12 = 2 * 2 * 3, the three numbers are inherently embedded within number 12) that may carry a message, a programmer will probably rather encode the message in [binary](binary.md) and then interpret the 1s and 0s as a number in direct representation, i.e. he will embed the information in the digits. You can probably come up with many more ways.
|
||||
|
||||
**[Order](order.md)** is an important concept related to numbers, we usually want to be able to compare numbers so apart from other operations such as addition and multiplication we also define the comparison operation. However note that not every order is total, i.e. some numbers may be incomparable (consider e.g. complex numbers).
|
||||
|
||||
Here are some [fun](fun.md) facts about numbers:
|
||||
|
||||
- Some people associate numbers with colors, though what color each number has seems to be completely subjective. See [synesthesia](synesthesia.md).
|
||||
|
@ -173,23 +175,25 @@ TODO: what is the best number? maybe top 10? would 10 be in top 10?
|
|||
|
||||
## Numbers In Programming/Computers
|
||||
|
||||
While mathematicians work mostly with infinite number sets and all kind of "weird" hypothetical numbers like hyperreals and transcendentals, [programmers](programming.md) still mostly work with "normal", practical numbers and have to limit themselves to finite number sets because, of course, computers have limited memory and can only store limited number of numeric values -- computers typically work with [modulo](mod.md) arithmetic with some high power of two modulo, e.g. 2^32 or 2^64, which is a [good enough](good_enough.md) approximation of an infinite number set. Mathematicians are as precise with numbers as possible as they're interested in structures and patterns that numbers form, programmers just want to use numbers to solve problems, so they mostly use [approximations](approximation.md) where they can -- for example programmers normally approximate [real numbers](real_number.md) with [floating point](float.md) numbers that are really just a subset of rational numbers. This isn't really a problem though, computers can comfortably work with numbers large and precise enough for solving any practical problem -- a slight annoyance is that one has to be careful about such things as [underflows](underflow.md) and [overflows](overflow.md) (i.e. a value wrapping around from lowest to highest value and vice versa), limited and sometimes non-uniform precision resulting in [error](error.md) accumulation, unlinearization of linear systems and so on. Programmers also don't care about strictly respecting some properties that certain number sets must mathematically have, for example integers along with addition are mathematically a [group](group.md), however signed integers in [two's complement](twos_complement.md) aren't a group because the lowest value doesn't have an inverse element (e.g. on 8 bits the lowest value is -128 and highest 127, the lowest value is missing its partner). Programmers also allow "special" values to be parts of their number sets, especially e.g. with the common IEEE [floating point](float.md) types we see values like plus/minus [infinity](infinity.md), [negative zero](negative_zero.md) or [NaN](nan.md) ("not a number") which also break some mathematical properties and creates situations like having a number that says it's not a number, but again this really doesn't play much of a role in practical problems. Numbers in computers are represented in [binary](binary.md) and programmers themselves often prefer to write numbers in binary, hexadecimal or octal representation -- they also often meet powers of two rather than powers of ten or primes or other similar limits (for example the data type limits are typically limited by some power of two). Famously programmers start counting from 0 (they go as far as using the term "zeroth") while mathematicians rather tend to start at 1. Just as mathematicians have different sets of numbers, programmers have an analogy in numeric [data types](data_type.md) -- a data type defines a set of values and operations that can be performed with them. The following are some of the common data types and representations of numbers in computers:
|
||||
While mathematicians work mostly with infinite number sets and all kind of "weird" hypothetical numbers like hyperreals and transcendentals, [programmers](programming.md) still mostly work with "normal", practical numbers and have to limit themselves to finite number sets because, of course, computers have limited memory and can only store limited number of numeric values -- computers typically work with [modulo](mod.md) arithmetic with some high power of two modulo, e.g. 2^32 or 2^64, which is a [good enough](good_enough.md) approximation of an infinite number set. Mathematicians are as precise with numbers as possible as they're interested in structures and patterns that numbers form, programmers just want to use numbers to solve problems, so they mostly use [approximations](approximation.md) where they can -- for example programmers normally approximate [real numbers](real_number.md) with [floating point](float.md) numbers that are really just a subset of rational numbers. This isn't really a problem though, computers can comfortably work with numbers large and precise enough for solving any practical problem -- a slight annoyance is that one has to be careful about such things as [underflows](underflow.md) and [overflows](overflow.md) (i.e. a value wrapping around from lowest to highest value and vice versa), limited and sometimes non-uniform precision resulting in [error](error.md) accumulation, unlinearization of linear systems and so on. Programmers also don't care about strictly respecting some properties that certain number sets must mathematically have, for example integers along with addition are mathematically a [group](group.md), however signed integers in [two's complement](twos_complement.md) aren't a group because the lowest value doesn't have an inverse element (e.g. on 8 bits the lowest value is -128 and highest 127, the lowest value is missing its partner). Programmers also allow "special" values to be parts of their number sets, especially e.g. with the common IEEE [floating point](float.md) types we see values like plus/minus [infinity](infinity.md), [negative zero](negative_zero.md) or [NaN](nan.md) ("not a number") which also break some mathematical properties and creates situations like having a number that says it's not a number, but again this really doesn't play much of a role in practical problems. Numbers in computers are represented in [binary](binary.md) and programmers themselves often prefer to write numbers in binary, hexadecimal or octal representation -- they also often meet powers of two rather than powers of ten or primes or other similar limits (for example the data type limits are typically limited by some power of two). There also comes up the question of specific number encoding, for example direct representation, sign-magnitude, [two's complement](twos_complement.md), [endianness](byte_sex.md) and so on. Famously programmers start counting from 0 (they go as far as using the term "zeroth") while mathematicians rather tend to start at 1. Just as mathematicians have different sets of numbers, programmers have an analogy in numeric [data types](data_type.md) -- a data type defines a set of values and operations that can be performed with them. The following are some of the common data types and representations of numbers in computers:
|
||||
|
||||
- **numeric**: Anything considered a number. In very high level languages there may be just one generic "number" type that can store any kind of number, automatically choosing best representation for it etc.
|
||||
- **unsigned**: Don't allow negative values -- this is sufficient in many cases, simpler to implement and can offer higher range in the positive direction.
|
||||
- **signed**: Allow also negative values which brings up the issue of what representation to use -- nowadays the most common is [two's complement](twos_complement.md).
|
||||
- **[unsigned](unsigned.md)**: Don't allow negative values -- this is sufficient in many cases, simpler to implement and can offer higher range in the positive direction.
|
||||
- **[signed](signed.md)**: Allow also negative values which brings up the issue of what representation to use -- nowadays the most common is [two's complement](twos_complement.md).
|
||||
- **fixed size**: Most common, each number takes some fixed size in memory, expressed in [bits](bit.md) or [bytes](byte.md) -- this of course determines the maximum number of values and so for example the minimum and maximum storable number.
|
||||
- **8bit**: Can store 256 value (e.g. integers from 0 to 255 or -128 to 127).
|
||||
- **16bit**: Can store 65536 values.
|
||||
- **32bit**: Can store 4294967296 values.
|
||||
- **arbitrary size**: Can store arbitrarily high/low and/or precise value, take variable amount of memory depending on how much is needed, used only in very specialized cases, may be considerably slower.
|
||||
- **integer**: Integer values, most common, usually using direct or [two's complement](twos_complement.md) representation.
|
||||
- ...
|
||||
- **[arbitrary size](arbitrary_size_int.md)**: Can store arbitrarily high/low and/or precise value, take variable amount of memory depending on how much is needed, used only in very specialized cases, may be considerably slower.
|
||||
- **[integer](int.md)**: Integer values, most common, usually using direct or [two's complement](twos_complement.md) representation.
|
||||
- **fractional**: Have higher precision than integers, allow storing fractions, are often used to [approximate](approximation.md) real numbers.
|
||||
- **[fixed point](fixed_point.md)**: Are represented by a number with radix point in fixed place, have uniform precision.
|
||||
- **[floating point](float.md)**: Have movable radix point which is more [complicated](bloat.md) but allows for representing both very high and very small values due to non-uniform precision.
|
||||
- **[complex](complex_number.md)**: Analogous to mathematical complex numbers.
|
||||
- **[quaternion](quaternion.md)**: Analogous to mathematical quaternions.
|
||||
- **symbolic**: Used in some specialized mathematical software to perform symbolic computation, i.e. computation done in a human-like way, by manipulating symbols without using concrete values that would have to resort to approximation.
|
||||
- ...
|
||||
|
||||
## Notable Numbers
|
||||
|
||||
|
@ -207,11 +211,14 @@ Here is a table of some notable numbers, mostly important in math and programmin
|
|||
| |1.616255... * 10^-35 | | Planck length in meters, smallest "length" in Universe |
|
||||
| one eight | 0.125 | 2^-3 | |
|
||||
| one fourth | 0.25 | 2^-2 | |
|
||||
| one third | 0.333333... | ...1313132 (5-adic) | |
|
||||
| one half | 0.5 | 2^-1 | |
|
||||
| [one](one.md) | 1 | 2^0, 0!, 0.999... | NOT a prime |
|
||||
| [square root](sqrt.md) of two | 1.414213... | 2^(1/2) | irrational, diagonal of unit square, important in geom. |
|
||||
|phi ([golden ratio](golden_ratio.md))| 1.618033... | (1 + sqrt(5)) / 2 | irrational, visually pleasant ratio, divine proportion |
|
||||
| supergolden ratio | 1.465571... | solve(x^3 - x^2 - 1 = 0) | similar to golden ratio, bit more difficult to compute |
|
||||
|phi ([golden ratio](golden_ratio.md))| 1.618033... | (1 + sqrt(5)) / 2, solve(x^2 - x - 1 = 0)| irrational, visually pleasant ratio, divine proportion |
|
||||
| [two](two.md) | 2 | 2^1, 0b000010 | prime |
|
||||
| [silver ratio](silver_ratio.md) | 2.414213... | 1 + sqrt(2), solve(x^2 - 2 * x - 1 = 0) | similar to golden ratio |
|
||||
| [e](e.md) (Euler's number) | 2.718281... | | base of natural [logarithm](log.md) |
|
||||
| [three](three.md) | 3 | 2^2 - 1 | prime, max. unsigned number with 2 bits |
|
||||
| [pi](pi.md) | 3.141592... | | circle circumference to its diameter, irrational |
|
||||
|
@ -267,7 +274,9 @@ Here is a table of some notable numbers, mostly important in math and programmin
|
|||
| |18446744073709551615 | 2^64 - 1 | maximum unsigned number storable with 64 bits |
|
||||
| |18446744073709551616 | 2^64 | number of values storable with 64 bits |
|
||||
| | 3.402823... * 10^38 | | largest number storable in IEEE-754 32 binary float |
|
||||
| | 10^80 | | approx. number of atoms in observable universe |
|
||||
| [googol](googol.md) | 10^100 | | often used big number |
|
||||
| [asankhyeya](asankhyeya.md) | 10^140 | | religious number, often used in [Buddhism](buddhism.md) |
|
||||
| | 4.65... * 10^185 | | approx. number of Planck volumes in observable universe |
|
||||
| |1.797693... * 10^308 | | largest number storable in IEEE-754 64 binary float |
|
||||
| [googolplex](googolplex.md) | 10^(10^100) | 10^googol | another large number, number of genders in 21st century |
|
||||
|
@ -278,5 +287,3 @@ Here is a table of some notable numbers, mostly important in math and programmin
|
|||
| [i](i.md) (imaginary unit) | | j * k | part of complex numbers and quaternions |
|
||||
| [j](j.md) | | k * i | one of quaternion units |
|
||||
| [k](k.md) | | i * j | one of quaternion units |
|
||||
|
||||
TODO: add some p-adic
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue