2.Linear regression using python and matrix alg

Sets are central to mathematics. Math is based on sets and how you can structure them. There are theories of sets, like set algebras, but here we are just concerned with how sets are defined, and what operations we can do on them.

We denote a set with a capital letter, like $A$. Unless else is stated a set is unordered. A set can be infinite or finite in size. The size of a set $A$ we denote $|A|$. When we are concerned with elements of a set we normally write these within curly braces. For example the finite set $$ A = \{1,2,3\} $$ Since unordered we have that the given set $A$ is the same as $$ \{3,1,2\} $$ We do not have duplicate elements in a set. When some element is used from the set, it is replaced, unless else is stated. A set is not well typed, that is elements in a set can be of different types. For example $$ B = \{1,a,+\} $$ A set can contain other sets, for example $$ C = \{1,a,\{1,2,3\}\} $$ We distinguish between the element 1 and the set $\{1\}$. We have the empty set denoted as $\emptyset$. That is $$ \emptyset = \{\} $$

Though it is a relation we introduce it here, the belongs to relation. We denote it $\in$. So we have $x \in A$ means that $x$ is in the set $A$. This relation is often used as a loop condition, in this way it can be seen as a way of extracting and binding the element. Thus we can build set comprehensions. For example given $$ A = \{1,2,3\} $$ we can construct $$ B = \{2,4,6\} $$ with the following comprehension $$ \{x \in A : 2 \cdot x \} $$

We define interval. Given a set $A$, a closed interval from $a$ to $b$ is denoted $$ [a,b] = \{ x \in A | a \leq x \leq b \} $$ An open interval is denoted and given as $$ (a,b) = \{x \in A | a \lt x \lt b \} $$ We have two where the one side is open and the other is closed, one is given as $$ (a,b] = \{ x \in A | a \lt x \leq b \} $$ The other vice versa.

We have a list of special sets in math. These are

- The set of natural numbers denoted $\mathbb{N}$. These are positive whole numbers: $$ \mathbb{N} = \{0,1,2,\dots\} $$ It is a bit tricky whether 0 is included. But often it is assumed that 0 is.
- The set of whole numbers denoted $\mathbb{Z}$. These are positive and negative natural numbers, eg $$ \mathbb{Z} = \{0,\pm 1, \pm 2, \dots \} $$
- The set of fractions denoted $\mathbb{Q}$. These are any fraction where both top and bottom are in $\mathbb{Z}$, but where the bottom is not $0$. That is $$ \mathbb{Q} = \{ a / b | a \in \mathbb{Z} \land b \in \mathbb{Z} \setminus \{0\} \} $$ Here the $\setminus$ operator means subtracting the right set from the left. We will look into this operator later.
- The set of real numbers denoted $\mathbb{R}$. These are seen as any finite or infinite decimal number. We can write this somewhat formally as $$ \mathbb{R} = \{ a.b | a,b \in \mathbb{Z} \} $$
- The set of complex numbers denoted $\mathbb{C}$. These are given as $$ \mathbb{C} = \{ a + bi | a,b \in \mathbb{R} \} $$ Here $i$ is seen as the imaginary unit satisfying $i^2 = -1$.

Note that these special sets contains each other in a bottom up approach. That is any fraction is also a real number.

CommentsGuest Name:Comment: