# Today I Learned

Some of the things I've learned every day since Oct 10, 2016

## 98: Top Type, Bottom Type

January 21, 2017

Posted by on Given a type system, the **top type** is the type which contains every possible value in that type system, making every other type a subtype of .

By contrast, the **bottom type** is the type which contains no values, making every other type a supertype of .

## 97: The Archimedean Property of the Reals

January 20, 2017

Posted by on has the **Archimedean property**, which states that for any positive there exists an such that

.

Intuitively, this means that contains neither infinitely large nor infinitesimally small numbers. (The property would not hold if was infinite, or if was infinitesimal.)

#### Proof:

Finding an such that is equivalent to finding one such that . If there is no such , this means that for all and thus the number is an upper bound on . However, has no upper bound, so this is a contradiction, meaning such an must exist.

## 96: Euler’s Theorem (Number Theory)

January 20, 2017

Posted by on **Euler’s Theorem** is a sort of extension of Fermat’s Little Theorem. One way of stating Fermat’s is that where is prime and is any integer,

,

whereas Euler’s Theorem makes the more general statement that if are simply two *coprime* integers and is Euler’s totient function,

.

The reason Fermat’s is a valid special case of Euler’s is because when is prime, .

[The congruence in the statement of Euler’s theorem is actually equivalent (‘if and only if’) to being coprime.]

## 95: Static Variables and Methods (Java)

January 19, 2017

Posted by on In the Java programming language, both variables and methods within a class can be **static** or non-static. For a variable or method to be static means that it can be accessed without referencing an *instance* of the containing class.

If something is non-static, for example a method belonging to a class , one must use an instance of to call :

whereas if was static, it could simply be called with reference to the class itself:

Static methods can be called with reference to class instances, but this is generally considered poor form.

## 94: The Liskov Substitution Principle

January 18, 2017

Posted by on The **Liskov Substitution Principle** makes the intuitive generalization that if are types and ( is a subtype of ), then in a program with this type system, objects from can be substituted with objects from without certain properties of the program being affected.

## 93: Subtypes (Programming)

January 16, 2017

Posted by on Let be data types in the type system of a programming language. To say that is a **subtype** of , often written , means that objects of type can be used where objects of type are expected. That is, is a more specific version of in some sense. (Equivalently, is said to be a *supertype* of .)

Subtyping forms a reflexive and transitive relation on a given set of types.

An (non-technical) example would be , where is the type of penguins, is that of flightless birds, and is that of birds. A penguin is acceptable where a bird or even a flightless bird is expected, but conversely not any bird will do when a penguin is expected.

## 92: Order (Groups)

January 16, 2017

Posted by on The **order** of a group , often denoted , is the cardinality of its underlying set. If the order is finite, then is called a finite group, and likewise for infinite order.

An example of a group with finite order would be the dihedral group for some . An example of one with infinite order would be the group of together with addition.

## 91: Categorical Distribution (Probability)

January 14, 2017

Posted by on A **categorical distribution** is one which describes a random variable which can take possible values, the probability of each possible outcome being known. For instance, the Bernoulli distribution is a special case of the categorical distribution, where (one outcome being ‘success’, the other ‘failure’). The distribution of the outcomes of rolling a (not necessarily fair) 6-sided die would also be an example, with .

## 90: The Standard (Unit) Simplex

January 11, 2017

Posted by on The **standard -simplex**, sometimes** **denoted , is the -simplex in with its vertices at the ‘unit’ points

.

For example, is the point in , is the line segment from to in , and so on. A formal description is

.

One possible interpretation of is as the set of possible probability distributions of a categorical distribution on variables.

## 89: Functors

January 10, 2017

Posted by on In category theory, a **functor** is a map between categories consisting of two components:

- a map from the objects of to those of
- a map from each morphism in to a morphism in .

This map must preserve the identity morphisms and composition. That is, it must satisfy the following properties:

- for objects in

Functors can be thought of as kinds of homomorphisms between categories. With functors as arrows, categories can then form a category called , the category of categories.

## Recent Comments