Renormalize files
This commit is contained in:
@ -1,49 +1,49 @@
|
||||
Strings and languages:
|
||||
- An alphabet is a finite set of symbols, such as {1,2,3} or {0,1}
|
||||
- A string is an alphabet $\sum$ is a finite sequence of symblols from $\sum$, for example 010010 and 10010101 are strings over the alphabet {0,1}
|
||||
- A languge is a set of strings
|
||||
- L1 = {00, 01, 10, 11}
|
||||
- L2 = {a^n | n is an integer non-negative}
|
||||
Notation: a to the power of n just means a repeated n times
|
||||
|
||||
Examples
|
||||
$L_8 = \{a^m b^n | m,n \in \mathbb{z}^{nonneg}\}$
|
||||
|
||||
So valid strings would be
|
||||
aaabbb, aaabbbb, ab, abb
|
||||
|
||||
$L_9 = \{a^n b^n | n \in \mathbb{z}^{nonneg}\}$
|
||||
|
||||
So valid strings would be
|
||||
aabb, ab, aaaabbbb, aaaaaabbbbbb
|
||||
|
||||
|
||||
$L_{11} = \{w \in \{a, b\}^* | \text{The number of "a"s is equal to the number of "b"s}\}$
|
||||
This would include everything that L9 includes, but allows for the alphabet can be out of order
|
||||
|
||||
You can also written this as
|
||||
$L_{11} = \{w \in \{a, b\}^* | n_a(w) = n_b(w)\}$
|
||||
|
||||
|
||||
You can extend the repetition notation (exponent) to include multiple symbols by wrapping it in parentheses
|
||||
|
||||
Example:
|
||||
$L_{12} = \{(ab)^n | n \in \mathbb{z}^{nonneg}\}$
|
||||
|
||||
This means we need to be careful as
|
||||
$L_{13} = \{ab^n | n \in \mathbb{z}^{nonneg}\}$
|
||||
is different, as L12 is asking for repetition of ab, while L13 is assigning a prefix of a and repetition of b
|
||||
|
||||
$L_{14} = \{a^i b^j c^k | i,j,k \in \mathbb{z}^{nonneg}, j = 2i + 3k\}$
|
||||
|
||||
So this means that for any number of "a"s and "c"s, the number of "b"s is predetermined if you have selected your "a"s and "c"s
|
||||
|
||||
Intro to functions and relations
|
||||
|
||||
Informally, a function (f) descrives an input output situation (A -> B)
|
||||
For every input element a in A, there is exactly one ouput element b in B
|
||||
|
||||
f maps a to b
|
||||
|
||||
A is the domain of f
|
||||
Strings and languages:
|
||||
- An alphabet is a finite set of symbols, such as {1,2,3} or {0,1}
|
||||
- A string is an alphabet $\sum$ is a finite sequence of symblols from $\sum$, for example 010010 and 10010101 are strings over the alphabet {0,1}
|
||||
- A languge is a set of strings
|
||||
- L1 = {00, 01, 10, 11}
|
||||
- L2 = {a^n | n is an integer non-negative}
|
||||
Notation: a to the power of n just means a repeated n times
|
||||
|
||||
Examples
|
||||
$L_8 = \{a^m b^n | m,n \in \mathbb{z}^{nonneg}\}$
|
||||
|
||||
So valid strings would be
|
||||
aaabbb, aaabbbb, ab, abb
|
||||
|
||||
$L_9 = \{a^n b^n | n \in \mathbb{z}^{nonneg}\}$
|
||||
|
||||
So valid strings would be
|
||||
aabb, ab, aaaabbbb, aaaaaabbbbbb
|
||||
|
||||
|
||||
$L_{11} = \{w \in \{a, b\}^* | \text{The number of "a"s is equal to the number of "b"s}\}$
|
||||
This would include everything that L9 includes, but allows for the alphabet can be out of order
|
||||
|
||||
You can also written this as
|
||||
$L_{11} = \{w \in \{a, b\}^* | n_a(w) = n_b(w)\}$
|
||||
|
||||
|
||||
You can extend the repetition notation (exponent) to include multiple symbols by wrapping it in parentheses
|
||||
|
||||
Example:
|
||||
$L_{12} = \{(ab)^n | n \in \mathbb{z}^{nonneg}\}$
|
||||
|
||||
This means we need to be careful as
|
||||
$L_{13} = \{ab^n | n \in \mathbb{z}^{nonneg}\}$
|
||||
is different, as L12 is asking for repetition of ab, while L13 is assigning a prefix of a and repetition of b
|
||||
|
||||
$L_{14} = \{a^i b^j c^k | i,j,k \in \mathbb{z}^{nonneg}, j = 2i + 3k\}$
|
||||
|
||||
So this means that for any number of "a"s and "c"s, the number of "b"s is predetermined if you have selected your "a"s and "c"s
|
||||
|
||||
Intro to functions and relations
|
||||
|
||||
Informally, a function (f) descrives an input output situation (A -> B)
|
||||
For every input element a in A, there is exactly one ouput element b in B
|
||||
|
||||
f maps a to b
|
||||
|
||||
A is the domain of f
|
||||
B is the co-domain of f
|
@ -1,52 +1,52 @@
|
||||
Lecture Topic: Functions
|
||||
|
||||
For every input element $a \in A$ there is exactly one output element $b \in B$
|
||||
|
||||
Jargon:
|
||||
- f maps a to b
|
||||
- the image of a under f is b
|
||||
|
||||
functions are one-to-one (or injective):
|
||||
$\forall x,y \in A, x \neq y \rightarrow f(x) \neq f(y)$
|
||||
or in other terms
|
||||
$\forall x,y \in A, x = y \rightarrow f(x) = f(y)$
|
||||
|
||||
Example:
|
||||
$f(x) = x^2$ is not one to one
|
||||
|
||||
Proof by counter example:
|
||||
$x = -1$ and $y = 1$ are two integers in the domain that $x=y$ but $f(-1)$ and $f(1)$ are both equal to 1, so it is not one to one
|
||||
|
||||
To prove a function is one to one, it is a little more tricky, and needs to be general, for example:
|
||||
|
||||
Let x and y be any arbitrary elements of the domain where f(x) = f(y)
|
||||
So it follows that x and y are equal (x = y)
|
||||
|
||||
Example for a real function: $g(x) = 3x - 11$
|
||||
Real Numbers
|
||||
Let x and y be any real number such that $g(x) = g(y)$. We will show that $x = y$
|
||||
Since we know that g(x) = g(y), it means that $3x - 11 = 3y - 11$
|
||||
Add 11 to both sides: $\therefore 3x = 3y$
|
||||
Divide both sides by 3: $\therefore x = y$
|
||||
|
||||
Important to note: The definition (domain and co-domain) can change if a function is one to one, for example the square function on all integers vs all positive integers
|
||||
|
||||
To prove that a function A -> B is onto:
|
||||
- Let be represent and arbitrary element in the co-domain B
|
||||
- We want to find an element a in the domain and show that f(a) = b
|
||||
|
||||
Example:
|
||||
Real Numbers, $f(x) = 5x + 2$ is onto
|
||||
|
||||
Proof: Let b be any arbitrary real number (we want to find a real number a and show that f(a) = b)
|
||||
|
||||
A through process might follow that, I want a value a such that f(a) = b, I want $5a + 2 = b$, then $5a = b - 2$, then $a = \frac{b - 2}{5}$
|
||||
|
||||
So, let $a = \frac{b - 2}{5}$ , which is a real number. Then plug this back into the function
|
||||
$f(a) = f(\frac{b - 2}{5}$) (Substitution)
|
||||
$= 5\frac{b-2}{5}+2$ (Definition of f)
|
||||
$= (b-2) +2)$ (Algebra)
|
||||
$=b$ (Algebra)
|
||||
|
||||
Beginning of proving a function is not onto:
|
||||
Lecture Topic: Functions
|
||||
|
||||
For every input element $a \in A$ there is exactly one output element $b \in B$
|
||||
|
||||
Jargon:
|
||||
- f maps a to b
|
||||
- the image of a under f is b
|
||||
|
||||
functions are one-to-one (or injective):
|
||||
$\forall x,y \in A, x \neq y \rightarrow f(x) \neq f(y)$
|
||||
or in other terms
|
||||
$\forall x,y \in A, x = y \rightarrow f(x) = f(y)$
|
||||
|
||||
Example:
|
||||
$f(x) = x^2$ is not one to one
|
||||
|
||||
Proof by counter example:
|
||||
$x = -1$ and $y = 1$ are two integers in the domain that $x=y$ but $f(-1)$ and $f(1)$ are both equal to 1, so it is not one to one
|
||||
|
||||
To prove a function is one to one, it is a little more tricky, and needs to be general, for example:
|
||||
|
||||
Let x and y be any arbitrary elements of the domain where f(x) = f(y)
|
||||
So it follows that x and y are equal (x = y)
|
||||
|
||||
Example for a real function: $g(x) = 3x - 11$
|
||||
Real Numbers
|
||||
Let x and y be any real number such that $g(x) = g(y)$. We will show that $x = y$
|
||||
Since we know that g(x) = g(y), it means that $3x - 11 = 3y - 11$
|
||||
Add 11 to both sides: $\therefore 3x = 3y$
|
||||
Divide both sides by 3: $\therefore x = y$
|
||||
|
||||
Important to note: The definition (domain and co-domain) can change if a function is one to one, for example the square function on all integers vs all positive integers
|
||||
|
||||
To prove that a function A -> B is onto:
|
||||
- Let be represent and arbitrary element in the co-domain B
|
||||
- We want to find an element a in the domain and show that f(a) = b
|
||||
|
||||
Example:
|
||||
Real Numbers, $f(x) = 5x + 2$ is onto
|
||||
|
||||
Proof: Let b be any arbitrary real number (we want to find a real number a and show that f(a) = b)
|
||||
|
||||
A through process might follow that, I want a value a such that f(a) = b, I want $5a + 2 = b$, then $5a = b - 2$, then $a = \frac{b - 2}{5}$
|
||||
|
||||
So, let $a = \frac{b - 2}{5}$ , which is a real number. Then plug this back into the function
|
||||
$f(a) = f(\frac{b - 2}{5}$) (Substitution)
|
||||
$= 5\frac{b-2}{5}+2$ (Definition of f)
|
||||
$= (b-2) +2)$ (Algebra)
|
||||
$=b$ (Algebra)
|
||||
|
||||
Beginning of proving a function is not onto:
|
||||
Find some specific co-domain element b and show that there is no domain element that could map to b
|
@ -1,61 +1,61 @@
|
||||
Lecture Topic: Functions & Relations
|
||||
|
||||
When a function is onto, it means that the entire co-domain of a function is the range of the function
|
||||
|
||||
Proving a function is not onto:
|
||||
|
||||
Just prove for any element b in the co-domain B and show that b cannot be equal to f(a) for any a in the domain.
|
||||
|
||||
Example: $g: \mathbb{R} \rightarrow \mathbb{R}, g(x) = x^2 + 10$ is not onto
|
||||
|
||||
Proof:
|
||||
For example, choose the element $-1$ from the co-domain $\mathbb{R}$
|
||||
Consider any domain element $a$
|
||||
The function will square $a$, and $a^2 \geq 0$ (because no squares are negative reals)
|
||||
Then $a^2 + 10 \geq 10$, so this means that $-1$ is not in the co-domain
|
||||
$\therefore$ The function is not onto
|
||||
|
||||
You can also use a proof by contradiction by saying that:
|
||||
$g(a) = -1$
|
||||
$\therefore a^2 + 10 = -1$
|
||||
$\therefore a^2 = -11$
|
||||
Squares of a real number cannot be negative, so the function is not onto
|
||||
|
||||
A function is not always numbers:
|
||||
|
||||
Example: Favourite UNB Course : S -> C
|
||||
Where S is all students and C is all courses
|
||||
|
||||
What would have to be true for this to be one to one or onto?:
|
||||
- One to one:
|
||||
- Onto:
|
||||
|
||||
# Relations:
|
||||
A binary relation R on two sets A and B is a subset of $A \times B$
|
||||
- e.g. S = all students, C = all students, s is any given student, c is any given course
|
||||
- Relation: HasTaken: for (s, c) s has taken c
|
||||
- Relation Aplus: for (s,c) s got A+ in c
|
||||
|
||||
A relation can be between the same set, for example the set of A = {John, Jane, Bill, Sue, Mary, Betty}, we can define a relation that is the relationship between who loves who $A \times A$
|
||||
- e.g. (John, Jane)
|
||||
|
||||
A binary relation $R \subseteq A \times A$ is also called an equivalence relation if the following conditions hold:
|
||||
- reflexive: $\forall a \in A, (a,a) \in R$
|
||||
- symmetric: $\forall a,b \in A, (a,b) \in R \rightarrow (b,a) \in R$
|
||||
- transitive: $\forall a,b,c \in A, [(a,b) \in R \wedge (b,c) \in R] \rightarrow (a,c) \in R$
|
||||
|
||||
Example:
|
||||
|
||||
$G = \{(x,y) | x \in \mathbb{R}, y \in \mathbb{R}, x > y\}$
|
||||
|
||||
Is G reflexive? (Is is true that every real number is relation to itself)
|
||||
No, because we can show that $(5,5) \notin \mathbb{R}$ because $5 \ngtr 5$
|
||||
|
||||
Is G symmetric? (Is it the case that whenever $(a,b) \in G, (b,a)$ will also be in G)
|
||||
No, for example $(10,3) \in G$ because $10 > 3$ but $(3, 10) \notin G$ because $3 \ngtr 10$
|
||||
|
||||
Is G transitive? (Is it true that whenever (a,b) and (b,c) are in G, (a,c) will also be in G)
|
||||
Yes, let a,b,c be any real numbers where $(a,b) \in G$ and $(b,c) \in G$
|
||||
Since $(a,b) \in G$, we know that $a > b$
|
||||
Since $(b,c) \in G$, we know that $b > c$
|
||||
Lecture Topic: Functions & Relations
|
||||
|
||||
When a function is onto, it means that the entire co-domain of a function is the range of the function
|
||||
|
||||
Proving a function is not onto:
|
||||
|
||||
Just prove for any element b in the co-domain B and show that b cannot be equal to f(a) for any a in the domain.
|
||||
|
||||
Example: $g: \mathbb{R} \rightarrow \mathbb{R}, g(x) = x^2 + 10$ is not onto
|
||||
|
||||
Proof:
|
||||
For example, choose the element $-1$ from the co-domain $\mathbb{R}$
|
||||
Consider any domain element $a$
|
||||
The function will square $a$, and $a^2 \geq 0$ (because no squares are negative reals)
|
||||
Then $a^2 + 10 \geq 10$, so this means that $-1$ is not in the co-domain
|
||||
$\therefore$ The function is not onto
|
||||
|
||||
You can also use a proof by contradiction by saying that:
|
||||
$g(a) = -1$
|
||||
$\therefore a^2 + 10 = -1$
|
||||
$\therefore a^2 = -11$
|
||||
Squares of a real number cannot be negative, so the function is not onto
|
||||
|
||||
A function is not always numbers:
|
||||
|
||||
Example: Favourite UNB Course : S -> C
|
||||
Where S is all students and C is all courses
|
||||
|
||||
What would have to be true for this to be one to one or onto?:
|
||||
- One to one:
|
||||
- Onto:
|
||||
|
||||
# Relations:
|
||||
A binary relation R on two sets A and B is a subset of $A \times B$
|
||||
- e.g. S = all students, C = all students, s is any given student, c is any given course
|
||||
- Relation: HasTaken: for (s, c) s has taken c
|
||||
- Relation Aplus: for (s,c) s got A+ in c
|
||||
|
||||
A relation can be between the same set, for example the set of A = {John, Jane, Bill, Sue, Mary, Betty}, we can define a relation that is the relationship between who loves who $A \times A$
|
||||
- e.g. (John, Jane)
|
||||
|
||||
A binary relation $R \subseteq A \times A$ is also called an equivalence relation if the following conditions hold:
|
||||
- reflexive: $\forall a \in A, (a,a) \in R$
|
||||
- symmetric: $\forall a,b \in A, (a,b) \in R \rightarrow (b,a) \in R$
|
||||
- transitive: $\forall a,b,c \in A, [(a,b) \in R \wedge (b,c) \in R] \rightarrow (a,c) \in R$
|
||||
|
||||
Example:
|
||||
|
||||
$G = \{(x,y) | x \in \mathbb{R}, y \in \mathbb{R}, x > y\}$
|
||||
|
||||
Is G reflexive? (Is is true that every real number is relation to itself)
|
||||
No, because we can show that $(5,5) \notin \mathbb{R}$ because $5 \ngtr 5$
|
||||
|
||||
Is G symmetric? (Is it the case that whenever $(a,b) \in G, (b,a)$ will also be in G)
|
||||
No, for example $(10,3) \in G$ because $10 > 3$ but $(3, 10) \notin G$ because $3 \ngtr 10$
|
||||
|
||||
Is G transitive? (Is it true that whenever (a,b) and (b,c) are in G, (a,c) will also be in G)
|
||||
Yes, let a,b,c be any real numbers where $(a,b) \in G$ and $(b,c) \in G$
|
||||
Since $(a,b) \in G$, we know that $a > b$
|
||||
Since $(b,c) \in G$, we know that $b > c$
|
||||
Then $a > b > c$, so that means that $a > c$, so also $(a,c) \in G$
|
@ -1,76 +1,76 @@
|
||||
Lecture Topic: Relation examples
|
||||
|
||||
# Relation Example 1
|
||||
$R = \{(i,j) | i \in \mathbb{Z}, j \in \mathbb{Z}, i-j =5n \text{ for some integer n}\}$
|
||||
e.g $(22,7) \in R$ because $22-7 = 5(3)$
|
||||
e.g $(7,22) \in R$ because $7-22 = -15 = 5(-3)$
|
||||
e.g $(22,9) \notin R$ because $22-9 = 13$, which is not a multiple of 5
|
||||
|
||||
Reflexive? Yes
|
||||
For every integer a, $a-a = 0 = 5(0)$
|
||||
Therefor $(a,a) \in R$ for every integer a
|
||||
|
||||
Symmetric? Yes
|
||||
Let a, b be any integer, such that (a,b) is in the relation (can we prove that (b,a) is in relation as well?)
|
||||
|
||||
Since (a,b) is in the relation, $a-b = 5n$, so, $b-a = -5(n) = 5(-n)$
|
||||
Note: $(b-a) = -(a-b)$
|
||||
|
||||
Transitive? Yes
|
||||
Let a,b,c be any integers such that $(a,b) \in R$ and $(b,c) \in R$
|
||||
Can we prove that $(a,c) \in R$ ?
|
||||
|
||||
Since $(a,b) \in R$, we know $a-b=5n$ for some $n \in \mathbb{Z}$
|
||||
Since $(b,c) \in R$, we know $b-c=5p$ for some $n \in \mathbb{Z}$
|
||||
|
||||
Now, $(a-c) = (a-b) + (b-c) = 5n + 5p = 5(np)$
|
||||
Therefore, $(a-c) \in R$
|
||||
Note: This is an integer because it is the sum of integers
|
||||
|
||||
# Relation Example 2
|
||||
$R = \{(i,j) | i \in \mathbb{R}, j \in \mathbb{R}, i + 2 > j\}$
|
||||
|
||||
Examples:
|
||||
- $(5,2) \in R$ because $(5+2) > 2$
|
||||
- $(3,4) \in R$ because $(3+2) > 4$
|
||||
- $(0,7) \notin R$ because $(0+2) \ngtr 7$
|
||||
|
||||
Reflexive? Yes
|
||||
Symmetric? No
|
||||
Transitive? No
|
||||
|
||||
Proof: We need to find real numbers where $a,b,c$ where $(a,b) \in R$ and $(b,c) \in R$ but $(a,c) \notin R$
|
||||
|
||||
For example, a = 1, b = 2, c = 3
|
||||
$(1,2) \in R$ because $1+2 > 2$
|
||||
$(2,3) \in R$ because $2+2 > 3$
|
||||
|
||||
But $(1,3) \notin R$ because $(1+2) \ngtr 3$
|
||||
$\therefore$ R is not transitive
|
||||
|
||||
# Equivalence relations
|
||||
Equivalence relations have all three of these properties
|
||||
Any equivalence relation R on a set A induces a partition of A
|
||||
- Splits A into equivalence classes
|
||||
- Each class contains elements that are related to themselves and to each other, but to nothing outside the class
|
||||
|
||||
So, for the above relation:
|
||||
$$R = \{(i,j) | i \in \mathbb{Z}, j \in \mathbb{Z}, i-j =5n \text{ for some integer n}\}$$
|
||||
This forms an equivalence relation
|
||||
|
||||
So for the set of all integers, this forms 5 equivalence classes:
|
||||
- $..., 0, 5, 10, ...$
|
||||
- $..., 1, 6, 11, ...$
|
||||
- $..., 2, 7, 12, ...$
|
||||
- $..., 3, 8, 13, ...$
|
||||
- $..., 4, 9, 14, ...$
|
||||
|
||||
## Example
|
||||
$A = \{-3, -2, -1, 0, 1, 2, 3\}$
|
||||
$R = \{(i,j) | i \in \mathbb{A}, j \in \mathbb{A}, i^2 = j^2\}$
|
||||
|
||||
So the equivalence classes induced by this relation:
|
||||
- -3, 3
|
||||
- -2, 2
|
||||
- -1, 1
|
||||
Lecture Topic: Relation examples
|
||||
|
||||
# Relation Example 1
|
||||
$R = \{(i,j) | i \in \mathbb{Z}, j \in \mathbb{Z}, i-j =5n \text{ for some integer n}\}$
|
||||
e.g $(22,7) \in R$ because $22-7 = 5(3)$
|
||||
e.g $(7,22) \in R$ because $7-22 = -15 = 5(-3)$
|
||||
e.g $(22,9) \notin R$ because $22-9 = 13$, which is not a multiple of 5
|
||||
|
||||
Reflexive? Yes
|
||||
For every integer a, $a-a = 0 = 5(0)$
|
||||
Therefor $(a,a) \in R$ for every integer a
|
||||
|
||||
Symmetric? Yes
|
||||
Let a, b be any integer, such that (a,b) is in the relation (can we prove that (b,a) is in relation as well?)
|
||||
|
||||
Since (a,b) is in the relation, $a-b = 5n$, so, $b-a = -5(n) = 5(-n)$
|
||||
Note: $(b-a) = -(a-b)$
|
||||
|
||||
Transitive? Yes
|
||||
Let a,b,c be any integers such that $(a,b) \in R$ and $(b,c) \in R$
|
||||
Can we prove that $(a,c) \in R$ ?
|
||||
|
||||
Since $(a,b) \in R$, we know $a-b=5n$ for some $n \in \mathbb{Z}$
|
||||
Since $(b,c) \in R$, we know $b-c=5p$ for some $n \in \mathbb{Z}$
|
||||
|
||||
Now, $(a-c) = (a-b) + (b-c) = 5n + 5p = 5(np)$
|
||||
Therefore, $(a-c) \in R$
|
||||
Note: This is an integer because it is the sum of integers
|
||||
|
||||
# Relation Example 2
|
||||
$R = \{(i,j) | i \in \mathbb{R}, j \in \mathbb{R}, i + 2 > j\}$
|
||||
|
||||
Examples:
|
||||
- $(5,2) \in R$ because $(5+2) > 2$
|
||||
- $(3,4) \in R$ because $(3+2) > 4$
|
||||
- $(0,7) \notin R$ because $(0+2) \ngtr 7$
|
||||
|
||||
Reflexive? Yes
|
||||
Symmetric? No
|
||||
Transitive? No
|
||||
|
||||
Proof: We need to find real numbers where $a,b,c$ where $(a,b) \in R$ and $(b,c) \in R$ but $(a,c) \notin R$
|
||||
|
||||
For example, a = 1, b = 2, c = 3
|
||||
$(1,2) \in R$ because $1+2 > 2$
|
||||
$(2,3) \in R$ because $2+2 > 3$
|
||||
|
||||
But $(1,3) \notin R$ because $(1+2) \ngtr 3$
|
||||
$\therefore$ R is not transitive
|
||||
|
||||
# Equivalence relations
|
||||
Equivalence relations have all three of these properties
|
||||
Any equivalence relation R on a set A induces a partition of A
|
||||
- Splits A into equivalence classes
|
||||
- Each class contains elements that are related to themselves and to each other, but to nothing outside the class
|
||||
|
||||
So, for the above relation:
|
||||
$$R = \{(i,j) | i \in \mathbb{Z}, j \in \mathbb{Z}, i-j =5n \text{ for some integer n}\}$$
|
||||
This forms an equivalence relation
|
||||
|
||||
So for the set of all integers, this forms 5 equivalence classes:
|
||||
- $..., 0, 5, 10, ...$
|
||||
- $..., 1, 6, 11, ...$
|
||||
- $..., 2, 7, 12, ...$
|
||||
- $..., 3, 8, 13, ...$
|
||||
- $..., 4, 9, 14, ...$
|
||||
|
||||
## Example
|
||||
$A = \{-3, -2, -1, 0, 1, 2, 3\}$
|
||||
$R = \{(i,j) | i \in \mathbb{A}, j \in \mathbb{A}, i^2 = j^2\}$
|
||||
|
||||
So the equivalence classes induced by this relation:
|
||||
- -3, 3
|
||||
- -2, 2
|
||||
- -1, 1
|
||||
- 0
|
@ -1,52 +1,52 @@
|
||||
Lecture Topic:
|
||||
|
||||
# Equivalence Classes
|
||||
You can represent equivalence classes by writing each one as a set:
|
||||
$$C_0 = \{..., -10, -5, 0, 5, 10, 15, ...\} \text{ or } \{5p | p \in \mathbb{Z}\}$$
|
||||
$$C_0 = \{..., -9, -4, 1, 6, 11, 16, ...\} \text{ or } \{5p + 1| p \in \mathbb{Z}\}$$
|
||||
$$\text{and so on...}$$
|
||||
# Graphs
|
||||
Definitions:
|
||||
- For each *vertex* v, the **degree** of v is the number of edges incident on v
|
||||
- A *path* is a **sequence** of vertices connected by edges
|
||||
- A *cycle* is a path that **starts and ends** at the same vertex
|
||||
- A *simple path* is a path that has **no repeated** vertices
|
||||
- A *connected graph* contains a path between **every pair** of vertices
|
||||
- A *disconnected graph* is the opposite (look at slides for real def)
|
||||
|
||||
# Regular Languages
|
||||
A class of languages that can be processed by simple computers called **finite automata**
|
||||
|
||||
## Simple Example of a finite automaton
|
||||
Vending machine/toll booth gate
|
||||
Requires 25 cents or more to be deposited (gives no change)
|
||||
|
||||
Takes as input, 5 cent, 10 cent, 25 cent coins
|
||||
Uses **states** to remember how much has been deposited so far
|
||||
|
||||
States:
|
||||
- q_0 : 0 cents deposited (START STATE)
|
||||
- q_5 : 5 cents
|
||||
- q_10 : 10 cents
|
||||
- q_15 : 15 cents
|
||||
- q_20 : 20 cents
|
||||
- q_25 : 25 cents (ACCEPT STATE)
|
||||
|
||||
We represent the input as a **string** of symbols.
|
||||
- n = nickel
|
||||
- d = dime
|
||||
- q = quarter
|
||||
Examples:
|
||||
- ddn
|
||||
- ndd
|
||||
- dnd
|
||||
- q
|
||||
Not accepted examples:
|
||||
- nd
|
||||
- d
|
||||
- $\epsilon$
|
||||
## State Diagram
|
||||
(not really possible without an image in obsidian)
|
||||
|
||||
# Finite Automata
|
||||
Lecture Topic:
|
||||
|
||||
# Equivalence Classes
|
||||
You can represent equivalence classes by writing each one as a set:
|
||||
$$C_0 = \{..., -10, -5, 0, 5, 10, 15, ...\} \text{ or } \{5p | p \in \mathbb{Z}\}$$
|
||||
$$C_0 = \{..., -9, -4, 1, 6, 11, 16, ...\} \text{ or } \{5p + 1| p \in \mathbb{Z}\}$$
|
||||
$$\text{and so on...}$$
|
||||
# Graphs
|
||||
Definitions:
|
||||
- For each *vertex* v, the **degree** of v is the number of edges incident on v
|
||||
- A *path* is a **sequence** of vertices connected by edges
|
||||
- A *cycle* is a path that **starts and ends** at the same vertex
|
||||
- A *simple path* is a path that has **no repeated** vertices
|
||||
- A *connected graph* contains a path between **every pair** of vertices
|
||||
- A *disconnected graph* is the opposite (look at slides for real def)
|
||||
|
||||
# Regular Languages
|
||||
A class of languages that can be processed by simple computers called **finite automata**
|
||||
|
||||
## Simple Example of a finite automaton
|
||||
Vending machine/toll booth gate
|
||||
Requires 25 cents or more to be deposited (gives no change)
|
||||
|
||||
Takes as input, 5 cent, 10 cent, 25 cent coins
|
||||
Uses **states** to remember how much has been deposited so far
|
||||
|
||||
States:
|
||||
- q_0 : 0 cents deposited (START STATE)
|
||||
- q_5 : 5 cents
|
||||
- q_10 : 10 cents
|
||||
- q_15 : 15 cents
|
||||
- q_20 : 20 cents
|
||||
- q_25 : 25 cents (ACCEPT STATE)
|
||||
|
||||
We represent the input as a **string** of symbols.
|
||||
- n = nickel
|
||||
- d = dime
|
||||
- q = quarter
|
||||
Examples:
|
||||
- ddn
|
||||
- ndd
|
||||
- dnd
|
||||
- q
|
||||
Not accepted examples:
|
||||
- nd
|
||||
- d
|
||||
- $\epsilon$
|
||||
## State Diagram
|
||||
(not really possible without an image in obsidian)
|
||||
|
||||
# Finite Automata
|
||||
(look at slides, didn't catch it)
|
@ -1,85 +1,85 @@
|
||||
# Finite Automata
|
||||
Simple machines that take in strings (sequences of symbols) as input and recognize whether or note each input string satisfies some condition(s)
|
||||
|
||||
Finite automata use states to keep track of important information about symbols
|
||||
|
||||
## Mathematical definition of a finite automaton
|
||||
$M = (Q, \sum, \delta, q, F)$
|
||||
- $Q$ is a finite set of states
|
||||
- $\sum$ is a finite set of input symbols called the input alphabet
|
||||
- $\delta$ is the transition function
|
||||
- Takes every pair consisting of a state and an input smbol and returns the next state, this tells us everything we need to know about what the machine does in one computation step
|
||||
- $q \in Q$ is the start state
|
||||
- $F \subseteq Q$ is the set of accept states
|
||||
|
||||
## Acceptance by a finite automaton
|
||||
Let M be a finite automaton
|
||||
Let $w = w_1, w_2, ..., w_n$ be n input string over \sum
|
||||
As input string w is process by $M$, define the sequence of visited states $r_0, r_1, ..., r_n$ as follows:
|
||||
- $r_0 = q$
|
||||
- $\forall i = 0,1, ... n-1, r_{i+1} = \delta(r_i, w_{i+1})$
|
||||
If $r_n \in F$ then $M$ accepts $w$, otherwise $M$ rejects $w$
|
||||
|
||||
Note: The empty string $\epsilon$ has length $0$, it is accepted by $M$ if any only if the start state is an accept state
|
||||
|
||||
For a given finite automaton $M$, the set of stings accepted by $M$ is the language of $M$ and is denoted $L(M)$
|
||||
|
||||
A language $A$ is called regular if there exists a finite automaton $M$ such that $A = L(M)$
|
||||
|
||||
## Example of finite automata
|
||||
A finite automation $M_1$ that accepts
|
||||
$$\{w \in \{0,1\}^* \ | \ n_1(w) \geq 2\}$$
|
||||
(State diagram on board)
|
||||
A is the start sate and C is the accept state
|
||||
A -> B (On 1)
|
||||
B -> C (On 1)
|
||||
A -> A (On 0)
|
||||
B -> B (On 0)
|
||||
C -> C (On 0, 1)
|
||||
|
||||
A: we have seen no ones yet
|
||||
B: we have seen exactly one 1
|
||||
C: we have seen two ore more 1's
|
||||
|
||||
## Example 2 of finite automata
|
||||
A finite automation $M_2$ that accepts
|
||||
$$\{w \in \{0,1\}^* \ | \ n_1(w) = 2\}$$
|
||||
(State diagram on board)
|
||||
A is the start state and C is the accept state
|
||||
A -> B (On 1)
|
||||
B -> C (On 1)
|
||||
C -> D (On 1)
|
||||
A -> A (On 0)
|
||||
B -> B (On 0)
|
||||
C -> C (On 0)
|
||||
D -> D (On 0, 1)
|
||||
|
||||
Note: D is an example of a dead state, in which you cannot escape after
|
||||
|
||||
## Example 3 of finite automata
|
||||
A finite automation $M_3$ that accepts
|
||||
$$\{w \in \{a,b\}^* \ | \ \text{w starts with abb}\}$$
|
||||
(State diagram on board)
|
||||
A is the start state and D is the accept state
|
||||
A -> B (On a)
|
||||
B -> C (On b)
|
||||
C -> D (On b)
|
||||
D -> D (On a, b)
|
||||
A -> X (On b)
|
||||
B -> X (On a)
|
||||
C -> X (On a)
|
||||
X -> X (On a ,b)
|
||||
|
||||
## Example 4 of finite automata
|
||||
A finite automation $M_4$ that accepts
|
||||
(Didn't catch the definition)
|
||||
$$\{w \in \{0,1\}^* \ | \ n_1(w) = 2\}$$
|
||||
(State diagram on board)
|
||||
A is the start state and D is the accept state
|
||||
|
||||
(state transitions would go here)
|
||||
|
||||
A: the most recent symbol was 1 or we have seen no symbols
|
||||
B: the last symbol was 0, but we have noon seen 010 yet
|
||||
C: the last two symbols were 01, but we have not seen 010
|
||||
# Finite Automata
|
||||
Simple machines that take in strings (sequences of symbols) as input and recognize whether or note each input string satisfies some condition(s)
|
||||
|
||||
Finite automata use states to keep track of important information about symbols
|
||||
|
||||
## Mathematical definition of a finite automaton
|
||||
$M = (Q, \sum, \delta, q, F)$
|
||||
- $Q$ is a finite set of states
|
||||
- $\sum$ is a finite set of input symbols called the input alphabet
|
||||
- $\delta$ is the transition function
|
||||
- Takes every pair consisting of a state and an input smbol and returns the next state, this tells us everything we need to know about what the machine does in one computation step
|
||||
- $q \in Q$ is the start state
|
||||
- $F \subseteq Q$ is the set of accept states
|
||||
|
||||
## Acceptance by a finite automaton
|
||||
Let M be a finite automaton
|
||||
Let $w = w_1, w_2, ..., w_n$ be n input string over \sum
|
||||
As input string w is process by $M$, define the sequence of visited states $r_0, r_1, ..., r_n$ as follows:
|
||||
- $r_0 = q$
|
||||
- $\forall i = 0,1, ... n-1, r_{i+1} = \delta(r_i, w_{i+1})$
|
||||
If $r_n \in F$ then $M$ accepts $w$, otherwise $M$ rejects $w$
|
||||
|
||||
Note: The empty string $\epsilon$ has length $0$, it is accepted by $M$ if any only if the start state is an accept state
|
||||
|
||||
For a given finite automaton $M$, the set of stings accepted by $M$ is the language of $M$ and is denoted $L(M)$
|
||||
|
||||
A language $A$ is called regular if there exists a finite automaton $M$ such that $A = L(M)$
|
||||
|
||||
## Example of finite automata
|
||||
A finite automation $M_1$ that accepts
|
||||
$$\{w \in \{0,1\}^* \ | \ n_1(w) \geq 2\}$$
|
||||
(State diagram on board)
|
||||
A is the start sate and C is the accept state
|
||||
A -> B (On 1)
|
||||
B -> C (On 1)
|
||||
A -> A (On 0)
|
||||
B -> B (On 0)
|
||||
C -> C (On 0, 1)
|
||||
|
||||
A: we have seen no ones yet
|
||||
B: we have seen exactly one 1
|
||||
C: we have seen two ore more 1's
|
||||
|
||||
## Example 2 of finite automata
|
||||
A finite automation $M_2$ that accepts
|
||||
$$\{w \in \{0,1\}^* \ | \ n_1(w) = 2\}$$
|
||||
(State diagram on board)
|
||||
A is the start state and C is the accept state
|
||||
A -> B (On 1)
|
||||
B -> C (On 1)
|
||||
C -> D (On 1)
|
||||
A -> A (On 0)
|
||||
B -> B (On 0)
|
||||
C -> C (On 0)
|
||||
D -> D (On 0, 1)
|
||||
|
||||
Note: D is an example of a dead state, in which you cannot escape after
|
||||
|
||||
## Example 3 of finite automata
|
||||
A finite automation $M_3$ that accepts
|
||||
$$\{w \in \{a,b\}^* \ | \ \text{w starts with abb}\}$$
|
||||
(State diagram on board)
|
||||
A is the start state and D is the accept state
|
||||
A -> B (On a)
|
||||
B -> C (On b)
|
||||
C -> D (On b)
|
||||
D -> D (On a, b)
|
||||
A -> X (On b)
|
||||
B -> X (On a)
|
||||
C -> X (On a)
|
||||
X -> X (On a ,b)
|
||||
|
||||
## Example 4 of finite automata
|
||||
A finite automation $M_4$ that accepts
|
||||
(Didn't catch the definition)
|
||||
$$\{w \in \{0,1\}^* \ | \ n_1(w) = 2\}$$
|
||||
(State diagram on board)
|
||||
A is the start state and D is the accept state
|
||||
|
||||
(state transitions would go here)
|
||||
|
||||
A: the most recent symbol was 1 or we have seen no symbols
|
||||
B: the last symbol was 0, but we have noon seen 010 yet
|
||||
C: the last two symbols were 01, but we have not seen 010
|
||||
D: we have seen the pattern 010
|
@ -1,3 +1,3 @@
|
||||
Lecture Topic: More Finite Automata
|
||||
# Examples
|
||||
Lots of example of finite automata, easier to look at posted slides
|
||||
Lecture Topic: More Finite Automata
|
||||
# Examples
|
||||
Lots of example of finite automata, easier to look at posted slides
|
||||
|
@ -1,3 +1,3 @@
|
||||
Lecture Topic: More FAs
|
||||
|
||||
Lecture Topic: More FAs
|
||||
|
||||
This lecture we also tried to determine the language from a visual example of a finite automata
|
@ -1,15 +1,15 @@
|
||||
Lecture Topic: Non-determinism
|
||||
|
||||
# So Far
|
||||
All of the finite automata have been deterministic. This means that for any combination of state and input symbol there is exactly one transition defined
|
||||
|
||||
There are advantages to this
|
||||
- Easier to trace a string through the finite automata
|
||||
Also some disadvantages
|
||||
- Can make it harder to design
|
||||
|
||||
Example on whiteboard
|
||||
|
||||
In a non-deterministic finite automata (NFA), there are different paths, or choices you can make, so there can be more than one, or no transition defined for a given state.
|
||||
|
||||
Lecture Topic: Non-determinism
|
||||
|
||||
# So Far
|
||||
All of the finite automata have been deterministic. This means that for any combination of state and input symbol there is exactly one transition defined
|
||||
|
||||
There are advantages to this
|
||||
- Easier to trace a string through the finite automata
|
||||
Also some disadvantages
|
||||
- Can make it harder to design
|
||||
|
||||
Example on whiteboard
|
||||
|
||||
In a non-deterministic finite automata (NFA), there are different paths, or choices you can make, so there can be more than one, or no transition defined for a given state.
|
||||
|
||||
To verify a string in a NFA, you need to follow each "choice" until a string completes, (ie, for two transitions defined, fork and check both paths)
|
@ -1,11 +1,11 @@
|
||||
Lecture Topic: More NFA
|
||||
|
||||
Design a state diagram for an NFA that accepts
|
||||
$$L = \{w \in \{a,b,c\}^* | \text{w starts with abc, ends with aab, and contains the substring bb}\}$$
|
||||
So, the first three states must be connecting a, b and c
|
||||
|
||||
(D) -a, b, c> (D)
|
||||
(F) -a, b, c> (F)
|
||||
(A) -a> (B) -b> (C) -c> (D) -b> (E) -b> (F) -a> (G) -a> (H) -b> ((I))
|
||||
|
||||
Lecture Topic: More NFA
|
||||
|
||||
Design a state diagram for an NFA that accepts
|
||||
$$L = \{w \in \{a,b,c\}^* | \text{w starts with abc, ends with aab, and contains the substring bb}\}$$
|
||||
So, the first three states must be connecting a, b and c
|
||||
|
||||
(D) -a, b, c> (D)
|
||||
(F) -a, b, c> (F)
|
||||
(A) -a> (B) -b> (C) -c> (D) -b> (E) -b> (F) -a> (G) -a> (H) -b> ((I))
|
||||
|
||||
It's important that on D and F, that b is allowed to loop, as if it did not, some valid strings would not be accepted, as it would only allow for two bs in the middle
|
@ -1,2 +1,2 @@
|
||||
Lecture Topics: NFA examples
|
||||
|
||||
Lecture Topics: NFA examples
|
||||
|
||||
|
@ -1,17 +1,17 @@
|
||||
Lecture Topic: Proofs
|
||||
|
||||
For any DFA, we already have an NFA, it just not happen to use any characteristics of NFAs like epsilon transitions or more/less than 1 transition per symbol per state
|
||||
|
||||
Suppose we have an NFA N that accepts language L
|
||||
We can construct a DFA D that accepts the same language
|
||||
* The DFA keeps track of all the possible states the NFA could be in after seeing any sequence of input symbols
|
||||
Example in slides
|
||||
|
||||
Reminder: Any language that can be accepted by a FA is called a regular language
|
||||
|
||||
Let A and B languages, we define the regular operations, union, concatenation and star
|
||||
Union: Is all the strings that are in either of the languages A or B
|
||||
Concatenation: All the strings that can be formed by the concatenation of A and B
|
||||
Star: Any sequence of strings formed from any combination strings in a language A
|
||||
|
||||
Lecture Topic: Proofs
|
||||
|
||||
For any DFA, we already have an NFA, it just not happen to use any characteristics of NFAs like epsilon transitions or more/less than 1 transition per symbol per state
|
||||
|
||||
Suppose we have an NFA N that accepts language L
|
||||
We can construct a DFA D that accepts the same language
|
||||
* The DFA keeps track of all the possible states the NFA could be in after seeing any sequence of input symbols
|
||||
Example in slides
|
||||
|
||||
Reminder: Any language that can be accepted by a FA is called a regular language
|
||||
|
||||
Let A and B languages, we define the regular operations, union, concatenation and star
|
||||
Union: Is all the strings that are in either of the languages A or B
|
||||
Concatenation: All the strings that can be formed by the concatenation of A and B
|
||||
Star: Any sequence of strings formed from any combination strings in a language A
|
||||
|
||||
Examples in slides
|
@ -1,3 +1,3 @@
|
||||
Lecture Topic: NFA to DFA proof, Regex Intro
|
||||
|
||||
Lecture Topic: NFA to DFA proof, Regex Intro
|
||||
|
||||
Look at posted notes
|
@ -1,98 +1,98 @@
|
||||
Lecture Topic: API Design
|
||||
Special In person Lecture
|
||||
|
||||
# Web Services VS Web API
|
||||
Network and Reusable
|
||||
- Not libraries in the same app domain
|
||||
- note one off custom integration
|
||||
Two Broad categories
|
||||
- Heavyweight, WS-* SOAP, WSDL
|
||||
- Lightweight - HTTP, simple XML, or likely JSON
|
||||
|
||||
# REST
|
||||
- Stateless - reduces complexity/ambiguity and improves scalability
|
||||
- No need to re-hydrate endpoints for new server state information
|
||||
- Representations used for manipulation - create, update, etc
|
||||
- Identifies in request example.com/api/contact/7
|
||||
- Standard HTTP verbs
|
||||
- POST, GET, etc
|
||||
- Proper response codes
|
||||
- i.e, 200 for success, 400 for missing, 500 for server issue
|
||||
|
||||
# HTTP Verb Debate
|
||||
Easy to classify:
|
||||
Request/query should be GET
|
||||
Delete should be DELETE
|
||||
|
||||
More Debate:
|
||||
Creates should be POST
|
||||
Update can be PUT or PATCH but you should implement PATCH
|
||||
|
||||
HTTP Method Responce Codes
|
||||
|
||||
| HTTP VERB | CRUD | ENTIRE COLLECTION <br>e.g. /customers/ | SPECIFIC ITEM <br>e.g. /customers/{id} |
|
||||
| --------- | -------------- | ----------------- | ------------- |
|
||||
| POST | Create | 201 | 404, 409 |
|
||||
| GET | Read | 200 | 200, 404 |
|
||||
| PUT | Update/Replace | 405 | 200, 204, 404 |
|
||||
| PATCH | Update/Modify | 405 | 200, 204, 404 |
|
||||
| DELETE | Delete | 405 | 200, 404 |
|
||||
# Some Libraries and Payloads
|
||||
- Custom JSON
|
||||
- OData
|
||||
- Started by Microsoft open source project, now OASIS
|
||||
- not strictly REST
|
||||
- JSON format standard for v4.0
|
||||
- Discoverability - Service and metadata document
|
||||
- Json:api
|
||||
- JSON first
|
||||
- Very verbose - but better than XML
|
||||
- Hypermedia as the engine of application state (HATEOAS)
|
||||
|
||||
# Public, Partner, or Private APIs
|
||||
Public:
|
||||
- Exposed to the internet, can be paid or require verification
|
||||
- Documentation
|
||||
Partner:
|
||||
- More for internal usage between organisations
|
||||
- Still need good documentation
|
||||
Private:
|
||||
- Mostly for yourself, but can often become one of the other category
|
||||
- Not worrying about breaking data formats or changing routes
|
||||
- Documentation not required
|
||||
|
||||
# Who are you building for
|
||||
- Apps, IoT
|
||||
- Other Sites
|
||||
- Things not thought of yet
|
||||
Try to think what it will be called from (smartphone, script, desktop application, other services)
|
||||
|
||||
# Table Stakes
|
||||
## Authentication
|
||||
Maybe try and use 3rd party libraries to handle authentication (OAuth)
|
||||
|
||||
Think about what your service will be called from, think tokens for service/script APIs or token/username password authentication for desktop apps or smartphone applications
|
||||
|
||||
## Analytics/Metrics
|
||||
You need to know what people are asking for and creating to know what to build in the future
|
||||
- Performance Degradation - Rate Limiting
|
||||
- Monetisation - See what people are asking for and limits on free vs should be paid users
|
||||
|
||||
# Good Problems and Unintended Uses
|
||||
Good problems:
|
||||
- Large client
|
||||
- Super popular app
|
||||
Unintended uses
|
||||
- Internal API sold to a customer - Business people selling what was an internal API and now are being required to support the internal API
|
||||
- Reporting/Analytics
|
||||
- Bulk data export - How do you get 100 records, 1000 records
|
||||
|
||||
Should think about when you should using something other than a REST API, if the requirements grow past what a REST API can reasonably support
|
||||
|
||||
# Living Documentation
|
||||
Postman - getpostman.com
|
||||
OpenAPI/Swagger
|
||||
Hootsuite's API as an example (link)
|
||||
|
||||
# Recommendations
|
||||
Lecture Topic: API Design
|
||||
Special In person Lecture
|
||||
|
||||
# Web Services VS Web API
|
||||
Network and Reusable
|
||||
- Not libraries in the same app domain
|
||||
- note one off custom integration
|
||||
Two Broad categories
|
||||
- Heavyweight, WS-* SOAP, WSDL
|
||||
- Lightweight - HTTP, simple XML, or likely JSON
|
||||
|
||||
# REST
|
||||
- Stateless - reduces complexity/ambiguity and improves scalability
|
||||
- No need to re-hydrate endpoints for new server state information
|
||||
- Representations used for manipulation - create, update, etc
|
||||
- Identifies in request example.com/api/contact/7
|
||||
- Standard HTTP verbs
|
||||
- POST, GET, etc
|
||||
- Proper response codes
|
||||
- i.e, 200 for success, 400 for missing, 500 for server issue
|
||||
|
||||
# HTTP Verb Debate
|
||||
Easy to classify:
|
||||
Request/query should be GET
|
||||
Delete should be DELETE
|
||||
|
||||
More Debate:
|
||||
Creates should be POST
|
||||
Update can be PUT or PATCH but you should implement PATCH
|
||||
|
||||
HTTP Method Responce Codes
|
||||
|
||||
| HTTP VERB | CRUD | ENTIRE COLLECTION <br>e.g. /customers/ | SPECIFIC ITEM <br>e.g. /customers/{id} |
|
||||
| --------- | -------------- | ----------------- | ------------- |
|
||||
| POST | Create | 201 | 404, 409 |
|
||||
| GET | Read | 200 | 200, 404 |
|
||||
| PUT | Update/Replace | 405 | 200, 204, 404 |
|
||||
| PATCH | Update/Modify | 405 | 200, 204, 404 |
|
||||
| DELETE | Delete | 405 | 200, 404 |
|
||||
# Some Libraries and Payloads
|
||||
- Custom JSON
|
||||
- OData
|
||||
- Started by Microsoft open source project, now OASIS
|
||||
- not strictly REST
|
||||
- JSON format standard for v4.0
|
||||
- Discoverability - Service and metadata document
|
||||
- Json:api
|
||||
- JSON first
|
||||
- Very verbose - but better than XML
|
||||
- Hypermedia as the engine of application state (HATEOAS)
|
||||
|
||||
# Public, Partner, or Private APIs
|
||||
Public:
|
||||
- Exposed to the internet, can be paid or require verification
|
||||
- Documentation
|
||||
Partner:
|
||||
- More for internal usage between organisations
|
||||
- Still need good documentation
|
||||
Private:
|
||||
- Mostly for yourself, but can often become one of the other category
|
||||
- Not worrying about breaking data formats or changing routes
|
||||
- Documentation not required
|
||||
|
||||
# Who are you building for
|
||||
- Apps, IoT
|
||||
- Other Sites
|
||||
- Things not thought of yet
|
||||
Try to think what it will be called from (smartphone, script, desktop application, other services)
|
||||
|
||||
# Table Stakes
|
||||
## Authentication
|
||||
Maybe try and use 3rd party libraries to handle authentication (OAuth)
|
||||
|
||||
Think about what your service will be called from, think tokens for service/script APIs or token/username password authentication for desktop apps or smartphone applications
|
||||
|
||||
## Analytics/Metrics
|
||||
You need to know what people are asking for and creating to know what to build in the future
|
||||
- Performance Degradation - Rate Limiting
|
||||
- Monetisation - See what people are asking for and limits on free vs should be paid users
|
||||
|
||||
# Good Problems and Unintended Uses
|
||||
Good problems:
|
||||
- Large client
|
||||
- Super popular app
|
||||
Unintended uses
|
||||
- Internal API sold to a customer - Business people selling what was an internal API and now are being required to support the internal API
|
||||
- Reporting/Analytics
|
||||
- Bulk data export - How do you get 100 records, 1000 records
|
||||
|
||||
Should think about when you should using something other than a REST API, if the requirements grow past what a REST API can reasonably support
|
||||
|
||||
# Living Documentation
|
||||
Postman - getpostman.com
|
||||
OpenAPI/Swagger
|
||||
Hootsuite's API as an example (link)
|
||||
|
||||
# Recommendations
|
||||
APIs - A strategy guide
|
@ -1,3 +1,3 @@
|
||||
Lecture Topic: SQL Injection
|
||||
Special guest lecture
|
||||
|
||||
Lecture Topic: SQL Injection
|
||||
Special guest lecture
|
||||
|
||||
|
@ -1,59 +1,59 @@
|
||||
Lecture Topic: Bandwidth and Data Rate
|
||||
|
||||
Analog: x(t)
|
||||
Discrete: x(n)
|
||||
Digital: from formula, range / set, bit sequence
|
||||
|
||||
Bandwidth:
|
||||
$x(t) = \sum^{\infty}_{k=-\infty}A_k cos(2\pi f_k + \phi_k)$
|
||||
|
||||
Fourier series
|
||||
|
||||
|
||||
Shannon Theorem:
|
||||
For a Gaussian channel the data rate that can be achieved over a channel of a given bandwidth satisfies
|
||||
|
||||
$R \leq B_w log_2(1+\frac{S}{N}) \triangleq C$
|
||||
|
||||
R = Achievable data rate (bps)
|
||||
$B_w$ = Channel bandwidth in Hz
|
||||
S/N = Signal to noise ratio (SNR)
|
||||
S = Signal power, N = noise power
|
||||
|
||||
Internet Architecture:
|
||||
- Network Edge
|
||||
- End systems: Host apps, not only computers and mobile devices but also wearables, sensors and large servers
|
||||
- Access Networks: (Last hop, last mile), Connect end systems to the first router (aka edge router)
|
||||
- Network Core:
|
||||
- Packet switches: Routers, link layer switches
|
||||
|
||||
A hierarchical look at A network of network:
|
||||
- Hosts connect to the internet via access ISPs, residential, cooperate ISPs, university ISPs, cellular data ISPs.
|
||||
- Access ISPs in turn are interconnected through regional ISPs and tier 1 ISPs
|
||||
|
||||
(Diagram in slides)
|
||||
|
||||
Internet Access and Physical Media:
|
||||
- Wired
|
||||
- Dial up
|
||||
- DSL
|
||||
- Cable
|
||||
- Fibre Optics
|
||||
- Ethernet
|
||||
- Wireless
|
||||
- WiFi
|
||||
- Cellular
|
||||
- Satellite
|
||||
|
||||
Wired media: EM waves are guided along a solid medium (twisted pair copper, coaxial cable, fibre optics)
|
||||
Wireless media: EM waves propagate through the air (Different electromagnetic spectrum/frequency bands)
|
||||
|
||||
Dial-Up:
|
||||
Use existing telephony infrastructure
|
||||
- Low Speed (56k)
|
||||
- Can't use phone and internet at the same time (not always present)
|
||||
- Modems modulate and demodulate data over phone lines
|
||||
|
||||
DSL:
|
||||
Digital Subscriber Line
|
||||
Lecture Topic: Bandwidth and Data Rate
|
||||
|
||||
Analog: x(t)
|
||||
Discrete: x(n)
|
||||
Digital: from formula, range / set, bit sequence
|
||||
|
||||
Bandwidth:
|
||||
$x(t) = \sum^{\infty}_{k=-\infty}A_k cos(2\pi f_k + \phi_k)$
|
||||
|
||||
Fourier series
|
||||
|
||||
|
||||
Shannon Theorem:
|
||||
For a Gaussian channel the data rate that can be achieved over a channel of a given bandwidth satisfies
|
||||
|
||||
$R \leq B_w log_2(1+\frac{S}{N}) \triangleq C$
|
||||
|
||||
R = Achievable data rate (bps)
|
||||
$B_w$ = Channel bandwidth in Hz
|
||||
S/N = Signal to noise ratio (SNR)
|
||||
S = Signal power, N = noise power
|
||||
|
||||
Internet Architecture:
|
||||
- Network Edge
|
||||
- End systems: Host apps, not only computers and mobile devices but also wearables, sensors and large servers
|
||||
- Access Networks: (Last hop, last mile), Connect end systems to the first router (aka edge router)
|
||||
- Network Core:
|
||||
- Packet switches: Routers, link layer switches
|
||||
|
||||
A hierarchical look at A network of network:
|
||||
- Hosts connect to the internet via access ISPs, residential, cooperate ISPs, university ISPs, cellular data ISPs.
|
||||
- Access ISPs in turn are interconnected through regional ISPs and tier 1 ISPs
|
||||
|
||||
(Diagram in slides)
|
||||
|
||||
Internet Access and Physical Media:
|
||||
- Wired
|
||||
- Dial up
|
||||
- DSL
|
||||
- Cable
|
||||
- Fibre Optics
|
||||
- Ethernet
|
||||
- Wireless
|
||||
- WiFi
|
||||
- Cellular
|
||||
- Satellite
|
||||
|
||||
Wired media: EM waves are guided along a solid medium (twisted pair copper, coaxial cable, fibre optics)
|
||||
Wireless media: EM waves propagate through the air (Different electromagnetic spectrum/frequency bands)
|
||||
|
||||
Dial-Up:
|
||||
Use existing telephony infrastructure
|
||||
- Low Speed (56k)
|
||||
- Can't use phone and internet at the same time (not always present)
|
||||
- Modems modulate and demodulate data over phone lines
|
||||
|
||||
DSL:
|
||||
Digital Subscriber Line
|
||||
(Slides went fast)
|
@ -1,53 +1,53 @@
|
||||
Lecture Topic: Network Edge & Internet Access Technologies
|
||||
|
||||
Bandwidth and Data Rate recap:
|
||||
The data rate cannot exceed the capacity of the bandwidth of a given channel, this is where the formula $R \leq B_w log_2(1+\frac{S}{N}) \triangleq C$ comes from
|
||||
|
||||
Doubling the data rate means that you need a bandwidth that has at least as much capacity to handle the new data rate
|
||||
|
||||
Internet Access Technologies:
|
||||
- DSL:
|
||||
- Using Frequency Division Multiplexing (FDM) it caries digital data through phone lines
|
||||
- Example: Voice 0-4 kHz, Upstream 4-50 kHz, Downstream 50 kHz-1 MHz
|
||||
- Twisted Pair Cable Wire:
|
||||
- Constitute a fine antenna
|
||||
- Cancel out cross talk and produce less radiation
|
||||
- A number of pairs are bundled together in a cable
|
||||
- Used in telephone systems, unheralded twisted pair (UTP) for local area networks, computer networks within a building (Ethernet)
|
||||
- Data Rate: 10Mbps - 10Gbps
|
||||
- Cable:
|
||||
- Use cable TV companies existing cable infrastructure
|
||||
- Hybrid fibre coaxial (HFC) access network
|
||||
- Coaxial cables are shared to reach individual homes
|
||||
- Fibre optics connect neighbourhood level junctions to CMTS
|
||||
- Asymmetric 40Mbps - 1.2Gbps downstream, 30Mbps - 100Mbps upstream
|
||||
- Data/TV are transmitted at different frequencies over shared cable
|
||||
- At the home, splits the signals into TV and Internet signals
|
||||
- Coaxial Cable
|
||||
- More complex structure
|
||||
- Better performance
|
||||
- Excellent noise immunity because cable is very shielded
|
||||
- Can span longer distances
|
||||
- Bandwidth is close to 1 Ghz
|
||||
- Data rates are higher than other technologies, 100s Mbps per channel
|
||||
- Fibre to the home (FTTH)
|
||||
- Optical network terminal in individual homes (ONT)
|
||||
- Optical line terminal in central office (OLT)
|
||||
- Fibre optic cables are similar to coax cables (lots of layers)
|
||||
- Class core with higher index of refraction than the outer glass
|
||||
- Light propagates through glass core
|
||||
- Thin plastic jacket to protect glass cladding
|
||||
- Fibres are typically grouped in bundles protected by an outer sheath
|
||||
- The outer layer keeps the light inside, not leaking any energy by reflecting the signal off an outer sheath
|
||||
- Has a few excellent features:
|
||||
- Very low signal attenuation up to 100km
|
||||
- Immune to electromagnetic interference
|
||||
- Larger bandwidth, support data rate up to 10s or 100s of Gbps
|
||||
- Hard to tap
|
||||
|
||||
Network Core:
|
||||
- How is data moved through a network of links and packet switches?
|
||||
- There are two fundamental approaches
|
||||
- Circuit switching
|
||||
- Packet switching
|
||||
Lecture Topic: Network Edge & Internet Access Technologies
|
||||
|
||||
Bandwidth and Data Rate recap:
|
||||
The data rate cannot exceed the capacity of the bandwidth of a given channel, this is where the formula $R \leq B_w log_2(1+\frac{S}{N}) \triangleq C$ comes from
|
||||
|
||||
Doubling the data rate means that you need a bandwidth that has at least as much capacity to handle the new data rate
|
||||
|
||||
Internet Access Technologies:
|
||||
- DSL:
|
||||
- Using Frequency Division Multiplexing (FDM) it caries digital data through phone lines
|
||||
- Example: Voice 0-4 kHz, Upstream 4-50 kHz, Downstream 50 kHz-1 MHz
|
||||
- Twisted Pair Cable Wire:
|
||||
- Constitute a fine antenna
|
||||
- Cancel out cross talk and produce less radiation
|
||||
- A number of pairs are bundled together in a cable
|
||||
- Used in telephone systems, unheralded twisted pair (UTP) for local area networks, computer networks within a building (Ethernet)
|
||||
- Data Rate: 10Mbps - 10Gbps
|
||||
- Cable:
|
||||
- Use cable TV companies existing cable infrastructure
|
||||
- Hybrid fibre coaxial (HFC) access network
|
||||
- Coaxial cables are shared to reach individual homes
|
||||
- Fibre optics connect neighbourhood level junctions to CMTS
|
||||
- Asymmetric 40Mbps - 1.2Gbps downstream, 30Mbps - 100Mbps upstream
|
||||
- Data/TV are transmitted at different frequencies over shared cable
|
||||
- At the home, splits the signals into TV and Internet signals
|
||||
- Coaxial Cable
|
||||
- More complex structure
|
||||
- Better performance
|
||||
- Excellent noise immunity because cable is very shielded
|
||||
- Can span longer distances
|
||||
- Bandwidth is close to 1 Ghz
|
||||
- Data rates are higher than other technologies, 100s Mbps per channel
|
||||
- Fibre to the home (FTTH)
|
||||
- Optical network terminal in individual homes (ONT)
|
||||
- Optical line terminal in central office (OLT)
|
||||
- Fibre optic cables are similar to coax cables (lots of layers)
|
||||
- Class core with higher index of refraction than the outer glass
|
||||
- Light propagates through glass core
|
||||
- Thin plastic jacket to protect glass cladding
|
||||
- Fibres are typically grouped in bundles protected by an outer sheath
|
||||
- The outer layer keeps the light inside, not leaking any energy by reflecting the signal off an outer sheath
|
||||
- Has a few excellent features:
|
||||
- Very low signal attenuation up to 100km
|
||||
- Immune to electromagnetic interference
|
||||
- Larger bandwidth, support data rate up to 10s or 100s of Gbps
|
||||
- Hard to tap
|
||||
|
||||
Network Core:
|
||||
- How is data moved through a network of links and packet switches?
|
||||
- There are two fundamental approaches
|
||||
- Circuit switching
|
||||
- Packet switching
|
||||
-
|
@ -1,42 +1,42 @@
|
||||
Lecture Topic: Network Core
|
||||
|
||||
Resource Sharing with circuit switching:
|
||||
- Network resources divided into pieces allocated to connections
|
||||
- Frequency division multiplexing (FDM). Dividing over bandwidth, and each end user gets a portion of the bandwidth for the entire portion of time.
|
||||
- Time division multiplexing (TDM). Dividing over time, and each end user gets the full bandwidth for a portion of allocated time. Similar to round robin.
|
||||
|
||||
Table of some information of cellular network technologies:
|
||||
CS: Circuit Switching
|
||||
|
||||
1G (FDMA)
|
||||
2G (TDMA) (GSM/CS)
|
||||
3G (CDMA) (CS/PS)
|
||||
4G (PS)
|
||||
5G (millimeter wave)
|
||||
|
||||
With circuit switching you can guarantee a certain level of performance, while with packet switching there is no/less of a guarantee of performance, which is why circuit switching was important for mobile networks as emergency calls need a certain level of performance to be guaranteed.
|
||||
|
||||
Packet Switching:
|
||||
- Internet is based on packet switching
|
||||
- ARPANET was the first packet-switched network and is an ancestor of the internet
|
||||
- A sending host breaks a message into packets (numbered sequentially) and sends them into the network one by one
|
||||
- Packets are transmitted individually through the network and reassembled at the receiving host to recover the original message
|
||||
|
||||
Packet switching is a very adaptive to changing network conditions. Due to packet chunking, packets in transit can be routed through different routes depending on the used bandwidth of other nodes on the network, and this can occur between two packets of the same chunk of data. This is because packets are numbered and are reordered at the destination.
|
||||
|
||||
A packet follows a path:
|
||||
- First hop router: This is the first router that inspects the packet and forwards it to the next hop
|
||||
- Then next router does the same, and so on
|
||||
- The packets eventually arrives at the destination and are decoded
|
||||
|
||||
Packets follow a protocol called "store and forward"
|
||||
|
||||
Resource sharing with packet switching:
|
||||
- Is very easy, as you can just send all packets over a link, according to different priorities
|
||||
|
||||
Multiplexing comparison:
|
||||
- With circuit switching, if you allocate bandwidth to two services, it may end up unused and wasted, as the format of data is fixed and if service A is not using any traffic service B cannot use that other bandwidth
|
||||
- Statistical multiplexing: Packet switching is on demand, so no bandwidth is explicitly allocated, and bandwidth is dynamically allocated based on current network usage
|
||||
|
||||
There are some downsides to packet switching to be aware of however:
|
||||
Lecture Topic: Network Core
|
||||
|
||||
Resource Sharing with circuit switching:
|
||||
- Network resources divided into pieces allocated to connections
|
||||
- Frequency division multiplexing (FDM). Dividing over bandwidth, and each end user gets a portion of the bandwidth for the entire portion of time.
|
||||
- Time division multiplexing (TDM). Dividing over time, and each end user gets the full bandwidth for a portion of allocated time. Similar to round robin.
|
||||
|
||||
Table of some information of cellular network technologies:
|
||||
CS: Circuit Switching
|
||||
|
||||
1G (FDMA)
|
||||
2G (TDMA) (GSM/CS)
|
||||
3G (CDMA) (CS/PS)
|
||||
4G (PS)
|
||||
5G (millimeter wave)
|
||||
|
||||
With circuit switching you can guarantee a certain level of performance, while with packet switching there is no/less of a guarantee of performance, which is why circuit switching was important for mobile networks as emergency calls need a certain level of performance to be guaranteed.
|
||||
|
||||
Packet Switching:
|
||||
- Internet is based on packet switching
|
||||
- ARPANET was the first packet-switched network and is an ancestor of the internet
|
||||
- A sending host breaks a message into packets (numbered sequentially) and sends them into the network one by one
|
||||
- Packets are transmitted individually through the network and reassembled at the receiving host to recover the original message
|
||||
|
||||
Packet switching is a very adaptive to changing network conditions. Due to packet chunking, packets in transit can be routed through different routes depending on the used bandwidth of other nodes on the network, and this can occur between two packets of the same chunk of data. This is because packets are numbered and are reordered at the destination.
|
||||
|
||||
A packet follows a path:
|
||||
- First hop router: This is the first router that inspects the packet and forwards it to the next hop
|
||||
- Then next router does the same, and so on
|
||||
- The packets eventually arrives at the destination and are decoded
|
||||
|
||||
Packets follow a protocol called "store and forward"
|
||||
|
||||
Resource sharing with packet switching:
|
||||
- Is very easy, as you can just send all packets over a link, according to different priorities
|
||||
|
||||
Multiplexing comparison:
|
||||
- With circuit switching, if you allocate bandwidth to two services, it may end up unused and wasted, as the format of data is fixed and if service A is not using any traffic service B cannot use that other bandwidth
|
||||
- Statistical multiplexing: Packet switching is on demand, so no bandwidth is explicitly allocated, and bandwidth is dynamically allocated based on current network usage
|
||||
|
||||
There are some downsides to packet switching to be aware of however:
|
||||
- In next lecture
|
@ -1,56 +1,56 @@
|
||||
Lecture Topic: Packet Switching Performance
|
||||
# Packet Switching
|
||||
## Congestion
|
||||
A relevant example is air plane ticket overbooking. If an air plane has a capacity of 100 seats, and the probability of of a passenger showing up to their flight is 80%, then you can overbook ticket sales due to the probability of passengers not showing up
|
||||
- If 110 tickets are sold, the probability of more than 100 passengers is 0.0058%
|
||||
- If 115 tickets are sold, the probability goes up to 1.94%
|
||||
- If 120 tickets are sold, the probability is 15.17%
|
||||
- If 130 tickets are sold, the probability is 78.12%
|
||||
|
||||
## Performance
|
||||
Throughput: Rate (bits/time) at which bits are transferred between sender/receiver
|
||||
- Instantaneous: Receiving rate at any instant of time
|
||||
- Average: Receiving rate over a longer period of time
|
||||
|
||||
How fast a node (host or router) is transmitting depends on
|
||||
1. How fast the sender is sending
|
||||
2. How fast the link is transmitting
|
||||
|
||||
End-to-end throughput is constrained by rate of bottleneck link (the link of the minimum rate on an end-to-end path). The weakest link in the chain (of nodes) determines the throughput of the entire link.
|
||||
|
||||
## Delay and Loss
|
||||
Packets queue in a router buffer (Store and Forward)
|
||||
- They are delayed while waiting in the buffer for it's turn
|
||||
- Slowed down while the queue keeps growing (congestion)
|
||||
- Dropped (lost) if no free space in a full buffer
|
||||
|
||||
There is four sources of nodal delay:
|
||||
1. Node processing: Decoding the incoming electronic signal and accounting for distortion (e.g. wireless signal distortion), and verifying the correctness of the packet, and determining the output link. Usually very small ($10^{-6}$ secs)
|
||||
2. Queuing: Time waiting at the output link for transmission. Amount depends on the congestion of the network.
|
||||
3. Transmission: $L/R$, L = Packet length, R = Link bandwidth
|
||||
4. Propagation: $m/s$ m = Physical distance of link (e.g. 100m wire), s = propagation speed of link (e.g. speed of electricity)
|
||||
|
||||
The entire delay is the sum of all of these figures
|
||||
|
||||
### Measuring queuing delay
|
||||
Traffic intensity is a measure of congestion.
|
||||
$$ \frac{L \times a}{R} $$
|
||||
a: Average packet arrive rate (packets/s)
|
||||
L: Packet length/size (bits/packet)
|
||||
R: Link bandwidth/rate (bps)
|
||||
|
||||
If this figure is 0, the delay on average is very small
|
||||
If this figure is 1, the delay is large
|
||||
If this figure is > 1, then more work arriving than serviced (severe congestion)
|
||||
|
||||
Note: There is a field called traffic engineering, and an important rule for this field is to not let the traffic intensity exceed 1.
|
||||
|
||||
## Example: Delay
|
||||
Consider only transmission delay and propagation delay. S sends 1 packet of length L to D over a single link of rate R and distance m. s is the speed of the link
|
||||
|
||||
L = 1 kb
|
||||
R = 100 kb/s
|
||||
m = 100 km
|
||||
s = $2\times10^8$ m/s
|
||||
|
||||
Lecture Topic: Packet Switching Performance
|
||||
# Packet Switching
|
||||
## Congestion
|
||||
A relevant example is air plane ticket overbooking. If an air plane has a capacity of 100 seats, and the probability of of a passenger showing up to their flight is 80%, then you can overbook ticket sales due to the probability of passengers not showing up
|
||||
- If 110 tickets are sold, the probability of more than 100 passengers is 0.0058%
|
||||
- If 115 tickets are sold, the probability goes up to 1.94%
|
||||
- If 120 tickets are sold, the probability is 15.17%
|
||||
- If 130 tickets are sold, the probability is 78.12%
|
||||
|
||||
## Performance
|
||||
Throughput: Rate (bits/time) at which bits are transferred between sender/receiver
|
||||
- Instantaneous: Receiving rate at any instant of time
|
||||
- Average: Receiving rate over a longer period of time
|
||||
|
||||
How fast a node (host or router) is transmitting depends on
|
||||
1. How fast the sender is sending
|
||||
2. How fast the link is transmitting
|
||||
|
||||
End-to-end throughput is constrained by rate of bottleneck link (the link of the minimum rate on an end-to-end path). The weakest link in the chain (of nodes) determines the throughput of the entire link.
|
||||
|
||||
## Delay and Loss
|
||||
Packets queue in a router buffer (Store and Forward)
|
||||
- They are delayed while waiting in the buffer for it's turn
|
||||
- Slowed down while the queue keeps growing (congestion)
|
||||
- Dropped (lost) if no free space in a full buffer
|
||||
|
||||
There is four sources of nodal delay:
|
||||
1. Node processing: Decoding the incoming electronic signal and accounting for distortion (e.g. wireless signal distortion), and verifying the correctness of the packet, and determining the output link. Usually very small ($10^{-6}$ secs)
|
||||
2. Queuing: Time waiting at the output link for transmission. Amount depends on the congestion of the network.
|
||||
3. Transmission: $L/R$, L = Packet length, R = Link bandwidth
|
||||
4. Propagation: $m/s$ m = Physical distance of link (e.g. 100m wire), s = propagation speed of link (e.g. speed of electricity)
|
||||
|
||||
The entire delay is the sum of all of these figures
|
||||
|
||||
### Measuring queuing delay
|
||||
Traffic intensity is a measure of congestion.
|
||||
$$ \frac{L \times a}{R} $$
|
||||
a: Average packet arrive rate (packets/s)
|
||||
L: Packet length/size (bits/packet)
|
||||
R: Link bandwidth/rate (bps)
|
||||
|
||||
If this figure is 0, the delay on average is very small
|
||||
If this figure is 1, the delay is large
|
||||
If this figure is > 1, then more work arriving than serviced (severe congestion)
|
||||
|
||||
Note: There is a field called traffic engineering, and an important rule for this field is to not let the traffic intensity exceed 1.
|
||||
|
||||
## Example: Delay
|
||||
Consider only transmission delay and propagation delay. S sends 1 packet of length L to D over a single link of rate R and distance m. s is the speed of the link
|
||||
|
||||
L = 1 kb
|
||||
R = 100 kb/s
|
||||
m = 100 km
|
||||
s = $2\times10^8$ m/s
|
||||
|
||||
$d_{prop} = m/s = 10^5/(2\times 10^8) = 5 \times 10^{-4}$
|
@ -1,61 +1,61 @@
|
||||
Lecture Topic: Delay and Internet Layering
|
||||
|
||||
# Single Packet over Same Rate Links
|
||||
If each node has the same rate, and you consider only transmission delay, what is the end to end delay to send one packet of length L?
|
||||
|
||||
# 4 Packets over 2 Same Rate Links
|
||||
$d_{trans} = (L/R) = \tau$
|
||||
$d_{e2e} = 5\tau$
|
||||
Visual in slides
|
||||
|
||||
Two phases:
|
||||
- Phase 1 has transmitted P-1 packets out
|
||||
- Phase 2 has 1 Packet left
|
||||
$$(P + N) \times \tau = d_{e2e}$$
|
||||
|
||||
# 4 Packets over 2 Links of different rates
|
||||
$$d_{e2e} \approx \frac{\text{Total package size}}{\text{E2E throughput}}$$
|
||||
So, estimating
|
||||
$d_{e2e} \approx \frac{4 \times L}{R} = 4\tau$
|
||||
while the real end to end delay is $5\tau$
|
||||
|
||||
# Internet Layering
|
||||
Also called TCP/IP model
|
||||
## Layers (inverse order due to markdown)
|
||||
1. Application
|
||||
2. Transport
|
||||
3. Network
|
||||
4. Link
|
||||
5. Physical
|
||||
## Applications
|
||||
- SMTP
|
||||
- HTTP
|
||||
- DNS
|
||||
## Transport
|
||||
- UDP
|
||||
- TCP
|
||||
## Network
|
||||
- IP
|
||||
- Routing protocols
|
||||
## Link
|
||||
- Ethernet
|
||||
- WiFi
|
||||
## Physical
|
||||
- Moving individual bits from one node to the next
|
||||
|
||||
Terms:
|
||||
- Router (Operates on network layer)
|
||||
- Switch (Operates on link layer)
|
||||
- Modem (Modulation, converting mediums and modes)
|
||||
- Access Point (WiFi access)
|
||||
|
||||
## Protocols
|
||||
Define how peers communicate and exchange information over the network including rules, procedures, and message formats
|
||||
|
||||
Application layer protocols:
|
||||
- Web server to web client (HTTP)
|
||||
|
||||
(More examples for each layer in slides)
|
||||
|
||||
### Encapsulation
|
||||
Lecture Topic: Delay and Internet Layering
|
||||
|
||||
# Single Packet over Same Rate Links
|
||||
If each node has the same rate, and you consider only transmission delay, what is the end to end delay to send one packet of length L?
|
||||
|
||||
# 4 Packets over 2 Same Rate Links
|
||||
$d_{trans} = (L/R) = \tau$
|
||||
$d_{e2e} = 5\tau$
|
||||
Visual in slides
|
||||
|
||||
Two phases:
|
||||
- Phase 1 has transmitted P-1 packets out
|
||||
- Phase 2 has 1 Packet left
|
||||
$$(P + N) \times \tau = d_{e2e}$$
|
||||
|
||||
# 4 Packets over 2 Links of different rates
|
||||
$$d_{e2e} \approx \frac{\text{Total package size}}{\text{E2E throughput}}$$
|
||||
So, estimating
|
||||
$d_{e2e} \approx \frac{4 \times L}{R} = 4\tau$
|
||||
while the real end to end delay is $5\tau$
|
||||
|
||||
# Internet Layering
|
||||
Also called TCP/IP model
|
||||
## Layers (inverse order due to markdown)
|
||||
1. Application
|
||||
2. Transport
|
||||
3. Network
|
||||
4. Link
|
||||
5. Physical
|
||||
## Applications
|
||||
- SMTP
|
||||
- HTTP
|
||||
- DNS
|
||||
## Transport
|
||||
- UDP
|
||||
- TCP
|
||||
## Network
|
||||
- IP
|
||||
- Routing protocols
|
||||
## Link
|
||||
- Ethernet
|
||||
- WiFi
|
||||
## Physical
|
||||
- Moving individual bits from one node to the next
|
||||
|
||||
Terms:
|
||||
- Router (Operates on network layer)
|
||||
- Switch (Operates on link layer)
|
||||
- Modem (Modulation, converting mediums and modes)
|
||||
- Access Point (WiFi access)
|
||||
|
||||
## Protocols
|
||||
Define how peers communicate and exchange information over the network including rules, procedures, and message formats
|
||||
|
||||
Application layer protocols:
|
||||
- Web server to web client (HTTP)
|
||||
|
||||
(More examples for each layer in slides)
|
||||
|
||||
### Encapsulation
|
||||
Messages get passed down between each layer, and information gets appended to the header that gets delivered as the payload
|
@ -1,34 +1,34 @@
|
||||
Lecture Topic: Web Protocols
|
||||
# Encapsulation/Decapsulation
|
||||
Each layer of a network adds a header, that encapsulates the rest of the data
|
||||
When a packet is decapsulated, each layer strips away its header after it is done processing
|
||||
|
||||
# Network Applications
|
||||
Applications are *distributed* since they involve multiple end systems that exchange dat which each other
|
||||
|
||||
## Application Architectures
|
||||
Dictates how applications interact on a network
|
||||
- Client/Server architecture
|
||||
- Server: An always on host which services requests from many other hosts
|
||||
- Data is often stored on the server
|
||||
- Data centers can be used to create powerful virtual servers
|
||||
- Clients: Connect through to the server
|
||||
- Peer to peer architecture
|
||||
- No always on server
|
||||
- Arbitrary end systems directly communicate
|
||||
- Peers request service from other peers and provide service in return to other peers
|
||||
- Self scalability: New peers bring new service capacity as well as new service demands
|
||||
- Peers are intermittently connected and change IP addresses (complex management)
|
||||
- Examples include BitTorrent (P2P file sharing)
|
||||
|
||||
# Basics of Web and HTTP
|
||||
Invented by Tim Burners-Lee
|
||||
Client Server model
|
||||
- Client is a web browser that requests and receives, and then displays web objects
|
||||
- Server is a web server that sends objects in response to
|
||||
|
||||
## HTTP Request Structure
|
||||
Diagram in slides (Just info from Wikipedia)
|
||||
|
||||
## HTTP Responses
|
||||
Lecture Topic: Web Protocols
|
||||
# Encapsulation/Decapsulation
|
||||
Each layer of a network adds a header, that encapsulates the rest of the data
|
||||
When a packet is decapsulated, each layer strips away its header after it is done processing
|
||||
|
||||
# Network Applications
|
||||
Applications are *distributed* since they involve multiple end systems that exchange dat which each other
|
||||
|
||||
## Application Architectures
|
||||
Dictates how applications interact on a network
|
||||
- Client/Server architecture
|
||||
- Server: An always on host which services requests from many other hosts
|
||||
- Data is often stored on the server
|
||||
- Data centers can be used to create powerful virtual servers
|
||||
- Clients: Connect through to the server
|
||||
- Peer to peer architecture
|
||||
- No always on server
|
||||
- Arbitrary end systems directly communicate
|
||||
- Peers request service from other peers and provide service in return to other peers
|
||||
- Self scalability: New peers bring new service capacity as well as new service demands
|
||||
- Peers are intermittently connected and change IP addresses (complex management)
|
||||
- Examples include BitTorrent (P2P file sharing)
|
||||
|
||||
# Basics of Web and HTTP
|
||||
Invented by Tim Burners-Lee
|
||||
Client Server model
|
||||
- Client is a web browser that requests and receives, and then displays web objects
|
||||
- Server is a web server that sends objects in response to
|
||||
|
||||
## HTTP Request Structure
|
||||
Diagram in slides (Just info from Wikipedia)
|
||||
|
||||
## HTTP Responses
|
||||
List found in slides (just info from Wikipedia)
|
@ -1,17 +1,17 @@
|
||||
Lecture Topic: HTTP
|
||||
|
||||
# Conditional Get
|
||||
## Last-Modified
|
||||
You can check the Last-Modified header to only get contents if the contents are newer than the contents of the cache
|
||||
## ETag
|
||||
Use the hash of an object to check for modification to solve cache invalidation problem
|
||||
|
||||
## TCP and HTTP
|
||||
HTTP runs on top of TCP
|
||||
- Client initiates TCP request to server
|
||||
- Server accepts TCP connection
|
||||
- Clint confirms request
|
||||
- Three way handshake
|
||||
|
||||
## Non-persistent HTTP
|
||||
RTT = Round trip time
|
||||
Lecture Topic: HTTP
|
||||
|
||||
# Conditional Get
|
||||
## Last-Modified
|
||||
You can check the Last-Modified header to only get contents if the contents are newer than the contents of the cache
|
||||
## ETag
|
||||
Use the hash of an object to check for modification to solve cache invalidation problem
|
||||
|
||||
## TCP and HTTP
|
||||
HTTP runs on top of TCP
|
||||
- Client initiates TCP request to server
|
||||
- Server accepts TCP connection
|
||||
- Clint confirms request
|
||||
- Three way handshake
|
||||
|
||||
## Non-persistent HTTP
|
||||
RTT = Round trip time
|
||||
|
@ -1,26 +1,26 @@
|
||||
Lecture Topic: Advanced HTTP
|
||||
|
||||
# HTTP2
|
||||
Goal is to reduce latency, but keep the same methods, status codes, and header fields. Changes how data is formatted and transmitted between clients
|
||||
- Prioritises transmission of requested objects, and give a request a weight to each request to indicate priority
|
||||
- Server pushes additional objects to client, by sending multiple responses to a single client request, before receiving explicit
|
||||
- Head of line blocking
|
||||
- Before in HTTP 1.1 the request are blocked by large requests, as objects are delivered in sequence, and a workaround is to setup multiple TCP connections to request many objects at once
|
||||
- In version 2, objects are divided into *frames* and frame transmission is interleaved in a round robin fashion
|
||||
|
||||
# HTTP3
|
||||
Improved performance even further by using streaming, by using the "QUIC" protocol over a bare UDP connection
|
||||
|
||||
# HTML Versions
|
||||
- HTML 1.0 Is written by Tim Berners-Lee
|
||||
- HTML 1,2,3,4, 4.01 published in in 1999
|
||||
- XHTML is an extensible version of HTML, based on XML
|
||||
- HTML5
|
||||
- New elements, section for documents, figure for content flow, video, audio, canvas for multimedia
|
||||
- New APIs to prompt users, like alert(), confirm(), prompt(), and printing with print()
|
||||
HTML is a markup language that uses tags
|
||||
|
||||
(list and explanation of common html tags)
|
||||
|
||||
# CSS
|
||||
Lecture Topic: Advanced HTTP
|
||||
|
||||
# HTTP2
|
||||
Goal is to reduce latency, but keep the same methods, status codes, and header fields. Changes how data is formatted and transmitted between clients
|
||||
- Prioritises transmission of requested objects, and give a request a weight to each request to indicate priority
|
||||
- Server pushes additional objects to client, by sending multiple responses to a single client request, before receiving explicit
|
||||
- Head of line blocking
|
||||
- Before in HTTP 1.1 the request are blocked by large requests, as objects are delivered in sequence, and a workaround is to setup multiple TCP connections to request many objects at once
|
||||
- In version 2, objects are divided into *frames* and frame transmission is interleaved in a round robin fashion
|
||||
|
||||
# HTTP3
|
||||
Improved performance even further by using streaming, by using the "QUIC" protocol over a bare UDP connection
|
||||
|
||||
# HTML Versions
|
||||
- HTML 1.0 Is written by Tim Berners-Lee
|
||||
- HTML 1,2,3,4, 4.01 published in in 1999
|
||||
- XHTML is an extensible version of HTML, based on XML
|
||||
- HTML5
|
||||
- New elements, section for documents, figure for content flow, video, audio, canvas for multimedia
|
||||
- New APIs to prompt users, like alert(), confirm(), prompt(), and printing with print()
|
||||
HTML is a markup language that uses tags
|
||||
|
||||
(list and explanation of common html tags)
|
||||
|
||||
# CSS
|
||||
CSS defines the visual style of a document
|
@ -1,3 +1,3 @@
|
||||
Lecture Topic: File Distribution
|
||||
|
||||
Lecture Topic: File Distribution
|
||||
|
||||
Studying for test in CS2333, view info on slides
|
@ -1,7 +1,7 @@
|
||||
Lecture Topic: P2P and File sharing, DNS
|
||||
|
||||
BitTorrent uses the rarest first algorithm to distribute chunks
|
||||
|
||||
Sending chunks uses the tit-for-tat algorithm to evaluate neighbours for sending chunks
|
||||
|
||||
Lecture Topic: P2P and File sharing, DNS
|
||||
|
||||
BitTorrent uses the rarest first algorithm to distribute chunks
|
||||
|
||||
Sending chunks uses the tit-for-tat algorithm to evaluate neighbours for sending chunks
|
||||
|
||||
DNS is a distributed database implemented in a hierarchy of name-servers
|
@ -1 +1 @@
|
||||
Lecture Topic: DNS
|
||||
Lecture Topic: DNS
|
||||
|
@ -1,16 +1,16 @@
|
||||
Lecture Topic: Transport Layer overview
|
||||
|
||||
Socket information is a tuple, port number is important
|
||||
|
||||
# Transport Layer
|
||||
## UDP
|
||||
Connectionless transport protocol, no handshake, each segment is handled independently from others
|
||||
|
||||
UDP segment is very simple: an 8 byte header and a payload.
|
||||
It has a source port, destination port, length and checksum
|
||||
|
||||
The checksum in UDP is only for detection, not correction
|
||||
|
||||
As messages are transported through layers, they acquire new headers that wrap the existing packet
|
||||
|
||||
Lecture Topic: Transport Layer overview
|
||||
|
||||
Socket information is a tuple, port number is important
|
||||
|
||||
# Transport Layer
|
||||
## UDP
|
||||
Connectionless transport protocol, no handshake, each segment is handled independently from others
|
||||
|
||||
UDP segment is very simple: an 8 byte header and a payload.
|
||||
It has a source port, destination port, length and checksum
|
||||
|
||||
The checksum in UDP is only for detection, not correction
|
||||
|
||||
As messages are transported through layers, they acquire new headers that wrap the existing packet
|
||||
|
||||
Checksum in UDP is actually optional but is required in TCP and IPv4
|
@ -1,5 +1,5 @@
|
||||
Lecture Topic: UDP and Reliable Data Transfer
|
||||
|
||||
Uses 1's compliment sum to do check-summing (info in slides)
|
||||
|
||||
Lecture Topic: UDP and Reliable Data Transfer
|
||||
|
||||
Uses 1's compliment sum to do check-summing (info in slides)
|
||||
|
||||
You use a system where you can imply the NACK request in packets, for example in TCP, NACKs are implied
|
@ -1,4 +1,4 @@
|
||||
Lecture Topic: Reliable Data Transfer and TCP
|
||||
|
||||
Look at utilisation slides from notes, has formulas
|
||||
|
||||
Lecture Topic: Reliable Data Transfer and TCP
|
||||
|
||||
Look at utilisation slides from notes, has formulas
|
||||
|
||||
|
@ -1,3 +1,3 @@
|
||||
Lecture Topic: TCP and TCP connection management
|
||||
|
||||
Lecture Topic: TCP and TCP connection management
|
||||
|
||||
Look at slides
|
@ -1,22 +1,22 @@
|
||||
Lecture Topic: Midterm Review and TCP
|
||||
# Midterm
|
||||
## Format:
|
||||
- Multiple Choice questions
|
||||
- 5 MCQ, 5 Short and Numerical Questions (ish)
|
||||
- Concept and numerical questions
|
||||
- No formula sheet, no unit table, need to memorise
|
||||
## Delivery:
|
||||
- Closed book, calculators needed
|
||||
- Monday Feb 26th
|
||||
- ITD 414 (even student number)
|
||||
- ITD 415 (odd student number)
|
||||
## Coverage:
|
||||
All material up to today
|
||||
- Chapter 1 - 3
|
||||
Preparation Material
|
||||
- Lecture Slides
|
||||
- Review Exam
|
||||
|
||||
## Review:
|
||||
Went over review slides, going too fast to take notes
|
||||
|
||||
Lecture Topic: Midterm Review and TCP
|
||||
# Midterm
|
||||
## Format:
|
||||
- Multiple Choice questions
|
||||
- 5 MCQ, 5 Short and Numerical Questions (ish)
|
||||
- Concept and numerical questions
|
||||
- No formula sheet, no unit table, need to memorise
|
||||
## Delivery:
|
||||
- Closed book, calculators needed
|
||||
- Monday Feb 26th
|
||||
- ITD 414 (even student number)
|
||||
- ITD 415 (odd student number)
|
||||
## Coverage:
|
||||
All material up to today
|
||||
- Chapter 1 - 3
|
||||
Preparation Material
|
||||
- Lecture Slides
|
||||
- Review Exam
|
||||
|
||||
## Review:
|
||||
Went over review slides, going too fast to take notes
|
||||
|
||||
|
@ -1,13 +1,13 @@
|
||||
Exam Review
|
||||
3 Hour Closed Book
|
||||
Calculator allowed and needed
|
||||
Q1 - Multiple Choice Questions (10 points)
|
||||
Q2-Q8 - Numerical and discussion questions (45 points)
|
||||
Prep Resources:
|
||||
Practice Test
|
||||
Slides
|
||||
Past Work
|
||||
Textbook
|
||||
|
||||
What will be on the exam is on review slides
|
||||
|
||||
Exam Review
|
||||
3 Hour Closed Book
|
||||
Calculator allowed and needed
|
||||
Q1 - Multiple Choice Questions (10 points)
|
||||
Q2-Q8 - Numerical and discussion questions (45 points)
|
||||
Prep Resources:
|
||||
Practice Test
|
||||
Slides
|
||||
Past Work
|
||||
Textbook
|
||||
|
||||
What will be on the exam is on review slides
|
||||
|
||||
|
@ -1,104 +1,104 @@
|
||||
CS4983: Senior Technical Report
|
||||
- Typically offered in Fall, Winter and Summer
|
||||
- 2 credit hour course
|
||||
- Counted as technical electives
|
||||
- Counts as 2 credit hours towards English writing requirement
|
||||
- Meant to be a critical analysis of some appropriate topic, a required component of a report that will be suitable literature survey, including a significant bibliography
|
||||
- 70-80 Hours typically
|
||||
- Same as CS4997, need to find a supervisor
|
||||
- Deliverables:
|
||||
- One page proposal
|
||||
- Two progress reports
|
||||
- The report, generally 10-20 pages
|
||||
- Seminar, normally 15 minutes plus 5 minutes for questions
|
||||
CS4997: Honors Thesis
|
||||
- Typically offered in Fall and Winter as an 8th month course, or a Summer course in 4 months
|
||||
- 4 Credit Hour
|
||||
- Technical electives for BCS students
|
||||
- 4 Credit hours towards 12 credit hour courses that have significant English writing component
|
||||
- Required for a BCS Honors
|
||||
- 5 out of 7 must be 3rd Year
|
||||
- 2 of Those must be 4th Year or higher
|
||||
- With a grade of B in this course
|
||||
- Cumulative GPA of 3.0, 3.5 for a First Class Honors
|
||||
- Good for students who wish to pursue graduate studies as it provides credits towards your graduate required credits
|
||||
- Original Research, under supervision and writing a thesis that summarizes the work completed
|
||||
- Typically 140-160 person-hours on CS4997
|
||||
- Responsible for selecting a thesis topic and obtaining agreement of a CS professor to act as supervisor, you may also work with an external supervisor but you will require an internal CS supervisor
|
||||
- Can *possibly* be done in group of two
|
||||
- Deliverables:
|
||||
- One page proposal, due early in the course, including an initial bibliography
|
||||
- A plan, break down your proposal into segments and phases, with an estimated amount of time for each phase
|
||||
- Two progress reports, due throughout the course
|
||||
- A thesis draft, which can range from and outline and a sample chapter to a preliminary version of the entire thesis
|
||||
- A thesis, generally expected to be 15-25 pages
|
||||
- A seminar, normally 20 minutes, plus 5 for questions
|
||||
CS4999: Directed Studies in Computer Science
|
||||
- Pursue directed studies in specific areas and topics related to Computer Science
|
||||
- More like a regular course than others, as more regular meetings with professor but still very much directed learning, and the course might only have one or two students in it
|
||||
- The students/prof will work out a plan/schedule, there can be assignments, tests, etc., but it needs to be approved
|
||||
- Recent Topics:
|
||||
- Intro to Mixed Reality
|
||||
- Advanced Video Game Development
|
||||
- Advanced Algorithmic Techniques
|
||||
- Introduction to Kubernetes
|
||||
|
||||
Some recent topics for CS4983 and CS4997
|
||||
- Ease of robot sociability in teleoperation
|
||||
- Exploration how representation robot teleoperator performance with health indicators can affect teleoperator behavior and experience
|
||||
- the story of my robot life
|
||||
- Infant cry detection on edge devices
|
||||
- An exploration of monolingual English definition with GPT2 and GPT3 models
|
||||
- Societal impacts of language models
|
||||
|
||||
## Gaia Info:
|
||||
Their project is "Magnetic Resonance on Networks"
|
||||
Says very important for graduate school
|
||||
Can look into getting work into journals
|
||||
|
||||
How they started with their report was asking profs about work they needed done, and got the project assigned to them
|
||||
|
||||
4th Year Parallelism course by Aubaniel is good apparently.
|
||||
|
||||
## Topics that are of interest to Profs
|
||||
Connor Wilson interested in computer science education or in credibility technology (believability of tech)
|
||||
Dr. Francis Palma related to software engineering and software quality:
|
||||
- Prioritizing issues in Agile Software Development
|
||||
- Do Readability in change-proneness of software systems relate?
|
||||
- Are poorly designed software systems more prone to design flaws/bugs
|
||||
Shadi:
|
||||
- Future proofing computer science education
|
||||
- Is generative AI reshaping the computer science job market
|
||||
|
||||
## Other Info
|
||||
There is a coordinator in the summer and winter, Michael Fleming and David Bremner respectively.
|
||||
|
||||
Designed to explore opportunities to explore some computer science topic that interests you, at a greater level than what you would see in a regular class.
|
||||
|
||||
All of these would involve making arrangements with faculty who would be willing to supervise your project.
|
||||
|
||||
## Finding a project
|
||||
In some cases, you might have a fully formed idea and you would need to find a faculty member to supervise this
|
||||
|
||||
In other cases a faculty member will have a well defined project and is looking for a student to complete it
|
||||
|
||||
In some cases, a student might have a general idea, and will meet with supervisors and will try to turn it into a more specific plan
|
||||
|
||||
Students and supervisors will meet regularly to provide guidance but it is expected that students will be able to work independently
|
||||
|
||||
## How to find a supervisor
|
||||
- Talk to profs you know
|
||||
- Go to the faculty and staff link on the UNB website, and find faculty members that have research interests that line up with yours
|
||||
- Attend Bits and Bites presentations
|
||||
|
||||
## My potential ideas
|
||||
Needs to be somewhat novel it seems:
|
||||
Concurrent Systems
|
||||
Operating Systems
|
||||
Scheduling
|
||||
Graphics
|
||||
|
||||
|
||||
4983 and 4999 might be better for those who are not interested in doing graduate school
|
||||
|
||||
CS4983: Senior Technical Report
|
||||
- Typically offered in Fall, Winter and Summer
|
||||
- 2 credit hour course
|
||||
- Counted as technical electives
|
||||
- Counts as 2 credit hours towards English writing requirement
|
||||
- Meant to be a critical analysis of some appropriate topic, a required component of a report that will be suitable literature survey, including a significant bibliography
|
||||
- 70-80 Hours typically
|
||||
- Same as CS4997, need to find a supervisor
|
||||
- Deliverables:
|
||||
- One page proposal
|
||||
- Two progress reports
|
||||
- The report, generally 10-20 pages
|
||||
- Seminar, normally 15 minutes plus 5 minutes for questions
|
||||
CS4997: Honors Thesis
|
||||
- Typically offered in Fall and Winter as an 8th month course, or a Summer course in 4 months
|
||||
- 4 Credit Hour
|
||||
- Technical electives for BCS students
|
||||
- 4 Credit hours towards 12 credit hour courses that have significant English writing component
|
||||
- Required for a BCS Honors
|
||||
- 5 out of 7 must be 3rd Year
|
||||
- 2 of Those must be 4th Year or higher
|
||||
- With a grade of B in this course
|
||||
- Cumulative GPA of 3.0, 3.5 for a First Class Honors
|
||||
- Good for students who wish to pursue graduate studies as it provides credits towards your graduate required credits
|
||||
- Original Research, under supervision and writing a thesis that summarizes the work completed
|
||||
- Typically 140-160 person-hours on CS4997
|
||||
- Responsible for selecting a thesis topic and obtaining agreement of a CS professor to act as supervisor, you may also work with an external supervisor but you will require an internal CS supervisor
|
||||
- Can *possibly* be done in group of two
|
||||
- Deliverables:
|
||||
- One page proposal, due early in the course, including an initial bibliography
|
||||
- A plan, break down your proposal into segments and phases, with an estimated amount of time for each phase
|
||||
- Two progress reports, due throughout the course
|
||||
- A thesis draft, which can range from and outline and a sample chapter to a preliminary version of the entire thesis
|
||||
- A thesis, generally expected to be 15-25 pages
|
||||
- A seminar, normally 20 minutes, plus 5 for questions
|
||||
CS4999: Directed Studies in Computer Science
|
||||
- Pursue directed studies in specific areas and topics related to Computer Science
|
||||
- More like a regular course than others, as more regular meetings with professor but still very much directed learning, and the course might only have one or two students in it
|
||||
- The students/prof will work out a plan/schedule, there can be assignments, tests, etc., but it needs to be approved
|
||||
- Recent Topics:
|
||||
- Intro to Mixed Reality
|
||||
- Advanced Video Game Development
|
||||
- Advanced Algorithmic Techniques
|
||||
- Introduction to Kubernetes
|
||||
|
||||
Some recent topics for CS4983 and CS4997
|
||||
- Ease of robot sociability in teleoperation
|
||||
- Exploration how representation robot teleoperator performance with health indicators can affect teleoperator behavior and experience
|
||||
- the story of my robot life
|
||||
- Infant cry detection on edge devices
|
||||
- An exploration of monolingual English definition with GPT2 and GPT3 models
|
||||
- Societal impacts of language models
|
||||
|
||||
## Gaia Info:
|
||||
Their project is "Magnetic Resonance on Networks"
|
||||
Says very important for graduate school
|
||||
Can look into getting work into journals
|
||||
|
||||
How they started with their report was asking profs about work they needed done, and got the project assigned to them
|
||||
|
||||
4th Year Parallelism course by Aubaniel is good apparently.
|
||||
|
||||
## Topics that are of interest to Profs
|
||||
Connor Wilson interested in computer science education or in credibility technology (believability of tech)
|
||||
Dr. Francis Palma related to software engineering and software quality:
|
||||
- Prioritizing issues in Agile Software Development
|
||||
- Do Readability in change-proneness of software systems relate?
|
||||
- Are poorly designed software systems more prone to design flaws/bugs
|
||||
Shadi:
|
||||
- Future proofing computer science education
|
||||
- Is generative AI reshaping the computer science job market
|
||||
|
||||
## Other Info
|
||||
There is a coordinator in the summer and winter, Michael Fleming and David Bremner respectively.
|
||||
|
||||
Designed to explore opportunities to explore some computer science topic that interests you, at a greater level than what you would see in a regular class.
|
||||
|
||||
All of these would involve making arrangements with faculty who would be willing to supervise your project.
|
||||
|
||||
## Finding a project
|
||||
In some cases, you might have a fully formed idea and you would need to find a faculty member to supervise this
|
||||
|
||||
In other cases a faculty member will have a well defined project and is looking for a student to complete it
|
||||
|
||||
In some cases, a student might have a general idea, and will meet with supervisors and will try to turn it into a more specific plan
|
||||
|
||||
Students and supervisors will meet regularly to provide guidance but it is expected that students will be able to work independently
|
||||
|
||||
## How to find a supervisor
|
||||
- Talk to profs you know
|
||||
- Go to the faculty and staff link on the UNB website, and find faculty members that have research interests that line up with yours
|
||||
- Attend Bits and Bites presentations
|
||||
|
||||
## My potential ideas
|
||||
Needs to be somewhat novel it seems:
|
||||
Concurrent Systems
|
||||
Operating Systems
|
||||
Scheduling
|
||||
Graphics
|
||||
|
||||
|
||||
4983 and 4999 might be better for those who are not interested in doing graduate school
|
||||
|
||||
4999 is more about taking your understanding of something to the next level, think OS III after taking OS I & II.
|
@ -1,66 +1,66 @@
|
||||
Lecture Topic: Probability
|
||||
|
||||
Experiment: An act where the outcome is subject to uncertainty
|
||||
|
||||
Sample space: The set of all possible outcomes of an experiment
|
||||
Example:
|
||||
- Flip a coin: $S = \{H, T\}$
|
||||
- Throw a dice: $S = \{1, 2, 3, 4, 5, 6\}$
|
||||
|
||||
Events: An event is a collection (subset) of outcomes contained in the sample space S
|
||||
$$
|
||||
S =
|
||||
\begin{Bmatrix}
|
||||
1,1 & 1,2 & 1,3 & 1,4 & 1,5 & 1,6 \\
|
||||
2,1 & 2,2 & 2,3 & 2,4 & 2,5 & 2,6 \\
|
||||
3,1 & 3,2 & 3,3 & 3,4 & 3,5 & 3,6 \\
|
||||
4,1 & 4,2 & 4,3 & 4,4 & 4,5 & 4,6 \\
|
||||
5,1 & 5,2 & 5,3 & 5,4 & 5,5 & 5,6 \\
|
||||
6,1 & 6,2 & 6,3 & 6,4 & 6,5 & 6,6
|
||||
\end{Bmatrix}
|
||||
$$
|
||||
A = First and second elements are the same
|
||||
$A = \{(1,1) \ (2,2) \ (3,3) \ (4,4) \ (5,5) \ (6,6)\}$
|
||||
|
||||
Union: Union of two events, A and B, ($A \cup B$)
|
||||
|
||||
Compliment: The compliment of an event A, is the set of all outcomes in S that are not in A
|
||||
|
||||
Mutually Exclusive Events: When and B have no common outcomes, they are said to be mutually exclusive or disjoint events, i.e. $P=(A \cap B) = 0$
|
||||
|
||||
Axiom:
|
||||
1. For event A, P(A) >= 0
|
||||
2. P(S) = 1
|
||||
3. (Need to look at slides to correct)
|
||||
(a) If $A_1, A_2 ... A_k$ is a finite collection of mutually exclusive events then: $$P(A_1 \cup A_2 \cup ... \cup A_k) = \sum^{\infty}_{i=1} P(A_i) $$
|
||||
(b) If $A_1, A_2 ... A_k$ is a finite collection of mutually exclusive events then: $$P(A_1 \cup A_2 \cup ... \cup A_k) = \sum^{\infty}_{i=1} P(A_i) $$
|
||||
Proposition:
|
||||
1. For event A, P(A) = 1 - P(A')
|
||||
2. If and and B are mutually exclusive then $P(A \cap B) = 0$
|
||||
|
||||
Permutation: Any ordered sequence of k objects taken from a set of n distinct objects is called a permutation of size k of the objects. The number of permutations of size k that can be constructed from n objects is denoted by $P_{k,n}$ and calculated by:
|
||||
$$
|
||||
P_{k,n} = \frac{n!}{(n-k)!}
|
||||
$$
|
||||
|
||||
Combination: Given a set of n, any unordered sub-set of k of the objects is called a combination. The set of combinations of size k that can be formed from n distinct objected will be denoted by $C_{k,n}$ and calculated by:
|
||||
$$
|
||||
C_{k,n} = \frac{n!}{k!(n-k)!} = \begin{pmatrix}n \\ k \end{pmatrix}
|
||||
$$
|
||||
|
||||
(NEED TO REVIEW THIS)
|
||||
|
||||
Example: S = {1, 2, 3, 4, 5}
|
||||
$A_1$ = {1,2,3}, $A_2$ = {2,3,5}, $A_3$ = {2,3,1}
|
||||
|
||||
Permutation:
|
||||
5! = 120
|
||||
(5-3)! = 2! = 2
|
||||
120 / 2 = 60
|
||||
|
||||
Combination:
|
||||
5!/2!3! = 60/6 = 10
|
||||
0! = 1
|
||||
5 out of 5
|
||||
5!/(5-5)! = 120/1 = 120
|
||||
|
||||
Lecture Topic: Probability
|
||||
|
||||
Experiment: An act where the outcome is subject to uncertainty
|
||||
|
||||
Sample space: The set of all possible outcomes of an experiment
|
||||
Example:
|
||||
- Flip a coin: $S = \{H, T\}$
|
||||
- Throw a dice: $S = \{1, 2, 3, 4, 5, 6\}$
|
||||
|
||||
Events: An event is a collection (subset) of outcomes contained in the sample space S
|
||||
$$
|
||||
S =
|
||||
\begin{Bmatrix}
|
||||
1,1 & 1,2 & 1,3 & 1,4 & 1,5 & 1,6 \\
|
||||
2,1 & 2,2 & 2,3 & 2,4 & 2,5 & 2,6 \\
|
||||
3,1 & 3,2 & 3,3 & 3,4 & 3,5 & 3,6 \\
|
||||
4,1 & 4,2 & 4,3 & 4,4 & 4,5 & 4,6 \\
|
||||
5,1 & 5,2 & 5,3 & 5,4 & 5,5 & 5,6 \\
|
||||
6,1 & 6,2 & 6,3 & 6,4 & 6,5 & 6,6
|
||||
\end{Bmatrix}
|
||||
$$
|
||||
A = First and second elements are the same
|
||||
$A = \{(1,1) \ (2,2) \ (3,3) \ (4,4) \ (5,5) \ (6,6)\}$
|
||||
|
||||
Union: Union of two events, A and B, ($A \cup B$)
|
||||
|
||||
Compliment: The compliment of an event A, is the set of all outcomes in S that are not in A
|
||||
|
||||
Mutually Exclusive Events: When and B have no common outcomes, they are said to be mutually exclusive or disjoint events, i.e. $P=(A \cap B) = 0$
|
||||
|
||||
Axiom:
|
||||
1. For event A, P(A) >= 0
|
||||
2. P(S) = 1
|
||||
3. (Need to look at slides to correct)
|
||||
(a) If $A_1, A_2 ... A_k$ is a finite collection of mutually exclusive events then: $$P(A_1 \cup A_2 \cup ... \cup A_k) = \sum^{\infty}_{i=1} P(A_i) $$
|
||||
(b) If $A_1, A_2 ... A_k$ is a finite collection of mutually exclusive events then: $$P(A_1 \cup A_2 \cup ... \cup A_k) = \sum^{\infty}_{i=1} P(A_i) $$
|
||||
Proposition:
|
||||
1. For event A, P(A) = 1 - P(A')
|
||||
2. If and and B are mutually exclusive then $P(A \cap B) = 0$
|
||||
|
||||
Permutation: Any ordered sequence of k objects taken from a set of n distinct objects is called a permutation of size k of the objects. The number of permutations of size k that can be constructed from n objects is denoted by $P_{k,n}$ and calculated by:
|
||||
$$
|
||||
P_{k,n} = \frac{n!}{(n-k)!}
|
||||
$$
|
||||
|
||||
Combination: Given a set of n, any unordered sub-set of k of the objects is called a combination. The set of combinations of size k that can be formed from n distinct objected will be denoted by $C_{k,n}$ and calculated by:
|
||||
$$
|
||||
C_{k,n} = \frac{n!}{k!(n-k)!} = \begin{pmatrix}n \\ k \end{pmatrix}
|
||||
$$
|
||||
|
||||
(NEED TO REVIEW THIS)
|
||||
|
||||
Example: S = {1, 2, 3, 4, 5}
|
||||
$A_1$ = {1,2,3}, $A_2$ = {2,3,5}, $A_3$ = {2,3,1}
|
||||
|
||||
Permutation:
|
||||
5! = 120
|
||||
(5-3)! = 2! = 2
|
||||
120 / 2 = 60
|
||||
|
||||
Combination:
|
||||
5!/2!3! = 60/6 = 10
|
||||
0! = 1
|
||||
5 out of 5
|
||||
5!/(5-5)! = 120/1 = 120
|
||||
|
||||
|
@ -1,2 +1,2 @@
|
||||
Lecture Topic:
|
||||
|
||||
Lecture Topic:
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
Lecture Topic: Conditional Probability
|
||||
|
||||
\| (vertical bar) = "given that"
|
||||
e.g. P(A|B) = probability of A given that B
|
||||
# Question 3
|
||||
Lecture Topic: Conditional Probability
|
||||
|
||||
\| (vertical bar) = "given that"
|
||||
e.g. P(A|B) = probability of A given that B
|
||||
# Question 3
|
||||
|
@ -1,17 +1,17 @@
|
||||
Lecture Topic: Random Variable
|
||||
|
||||
Random Variable: Variable with a probability attributed to it
|
||||
Regular Variable: Variable that is more intrinsic, like height
|
||||
Discrete Variable: Variable where each possible value is a finite set or is an infinite set where each element is it's own distinct element, eg first element, second element etc.
|
||||
|
||||
Probability Mass Function (pmf): The pmf of a discrete rv is defined for every number x by p(x) = P(X=x)
|
||||
|
||||
Mass function criteria:
|
||||
- All probabilities have to been between 0 and 1
|
||||
- The total probabilities have to equal 1
|
||||
|
||||
Expected Value: The summation of the value and the probability of x over the entire set
|
||||
Var?: Variance calculate the expected value but square the variable, then subtract the squared expected value
|
||||
|
||||
|
||||
|
||||
Lecture Topic: Random Variable
|
||||
|
||||
Random Variable: Variable with a probability attributed to it
|
||||
Regular Variable: Variable that is more intrinsic, like height
|
||||
Discrete Variable: Variable where each possible value is a finite set or is an infinite set where each element is it's own distinct element, eg first element, second element etc.
|
||||
|
||||
Probability Mass Function (pmf): The pmf of a discrete rv is defined for every number x by p(x) = P(X=x)
|
||||
|
||||
Mass function criteria:
|
||||
- All probabilities have to been between 0 and 1
|
||||
- The total probabilities have to equal 1
|
||||
|
||||
Expected Value: The summation of the value and the probability of x over the entire set
|
||||
Var?: Variance calculate the expected value but square the variable, then subtract the squared expected value
|
||||
|
||||
|
||||
|
||||
|
@ -1,24 +1,24 @@
|
||||
Lecture Topic: Binomial Distribution
|
||||
|
||||
# Requirements of Binomial Experiments
|
||||
- (n) independent trials
|
||||
- Possible outcomes: success (S) and failure (F)
|
||||
- Success probability (p)
|
||||
|
||||
## Formula
|
||||
The pmf of binomial rv $X$ depends on two parameters $n$ and $p$. We denote the pmf by $b(x; n,p)$
|
||||
$$b(x;n,p) = \{
|
||||
\begin{pmatrix}
|
||||
n \\
|
||||
p \\
|
||||
\end{pmatrix}
|
||||
p^x(1-p)^{n-x}
|
||||
\}$$
|
||||
$x = 0, 1, 2, ..., n$
|
||||
|
||||
If X ~ b(x; n,p), then
|
||||
1. E(X) = np
|
||||
2. V(X) = np(1-p)
|
||||
|
||||
# Examples
|
||||
Lecture Topic: Binomial Distribution
|
||||
|
||||
# Requirements of Binomial Experiments
|
||||
- (n) independent trials
|
||||
- Possible outcomes: success (S) and failure (F)
|
||||
- Success probability (p)
|
||||
|
||||
## Formula
|
||||
The pmf of binomial rv $X$ depends on two parameters $n$ and $p$. We denote the pmf by $b(x; n,p)$
|
||||
$$b(x;n,p) = \{
|
||||
\begin{pmatrix}
|
||||
n \\
|
||||
p \\
|
||||
\end{pmatrix}
|
||||
p^x(1-p)^{n-x}
|
||||
\}$$
|
||||
$x = 0, 1, 2, ..., n$
|
||||
|
||||
If X ~ b(x; n,p), then
|
||||
1. E(X) = np
|
||||
2. V(X) = np(1-p)
|
||||
|
||||
# Examples
|
||||
Examples in posted pdf
|
@ -1,5 +1,5 @@
|
||||
Lecture Topic: Poisson
|
||||
|
||||
Was too interested in configuring neovim, lmao
|
||||
|
||||
Lecture Topic: Poisson
|
||||
|
||||
Was too interested in configuring neovim, lmao
|
||||
|
||||
Look at slides for info, this one seemed important
|
@ -1,3 +1,3 @@
|
||||
Lecture Topic:
|
||||
|
||||
Lecture Topic:
|
||||
|
||||
Listened to lecturer and didn't take notes
|
@ -1,9 +1,9 @@
|
||||
Lecture Topic: Continious r.v
|
||||
|
||||
Midterm Review session by math learning center
|
||||
Midterm review will be on feb 16, friday
|
||||
|
||||
For evaluating the probability of a distribution of a continious random variable X, you need to integrate the probability
|
||||
|
||||
The probability of a function from - infinity to + infinity must equal 1
|
||||
|
||||
Lecture Topic: Continious r.v
|
||||
|
||||
Midterm Review session by math learning center
|
||||
Midterm review will be on feb 16, friday
|
||||
|
||||
For evaluating the probability of a distribution of a continious random variable X, you need to integrate the probability
|
||||
|
||||
The probability of a function from - infinity to + infinity must equal 1
|
||||
|
||||
|
@ -1,8 +1,8 @@
|
||||
Lecture Topic: Some Questions
|
||||
Lecture will be short as lecturer needs to leave at 10:00
|
||||
|
||||
First thing to do is to convert x to Z, for solving a standard deviation problem
|
||||
|
||||
$$Z = \frac{x-\mu}{\delta}$$
|
||||
|
||||
Lecture Topic: Some Questions
|
||||
Lecture will be short as lecturer needs to leave at 10:00
|
||||
|
||||
First thing to do is to convert x to Z, for solving a standard deviation problem
|
||||
|
||||
$$Z = \frac{x-\mu}{\delta}$$
|
||||
|
||||
Mean is 0 and variance is 1 is the conditions for normal distribution (?) Something standard deviation must be 1 (?) Look into
|
@ -1 +1 @@
|
||||
Lecture Topic: Binomial Distribution
|
||||
Lecture Topic: Binomial Distribution
|
||||
|
@ -1,36 +1,36 @@
|
||||
Lecture Topic: Midterm Review 1
|
||||
|
||||
Will be Wednesday, Feb 21, 2024
|
||||
Covers Lectures 1-13, Chapters 1-3
|
||||
All multiple choice, 18-20 Questions for 50 mins, 16-17 as it is 45 minutes
|
||||
45 Minutes, Show up early
|
||||
Choose closest answer if answer does not line up
|
||||
YOU NEED A CALCULATOR FOR THIS
|
||||
|
||||
For your formula sheet, you can put anything on it, 1 regular size sheet (11x8.5), both sides are allowed to be written on.
|
||||
|
||||
Questions from base theorem will likely take longer than others, so look for questions that are easier to solve first
|
||||
|
||||
## Basic Statistics
|
||||
Mean - $\frac{\sum x}{n}$
|
||||
Median - Middle Most value, even is the average of two middle values
|
||||
Mode - Most frequent value
|
||||
Quartile
|
||||
- Q1 - 25%, In between 0 and median
|
||||
- Q2 = Median
|
||||
- Q3 = 75% In Between median and 100
|
||||
- Q4 = 100%
|
||||
|
||||
## Variance
|
||||
IQR - Inter quartile range - Q3 - Q1
|
||||
Variance
|
||||
- $\frac{1}{n-1} \sum (x_i - x)^2$ or $\frac{\sum(x_i - x)^2}{n-1}$
|
||||
- $\frac{1}{n-1} \sum (x_i^2) - nx^2$ Ask about this, didn't quite catch on board
|
||||
- must be positive
|
||||
std deviation - Square root of variance, $\sqrt{V(x)}$
|
||||
Upper and lower fence - Outlier limits
|
||||
- UF = Q3 + 15 IQR Ask about this, could have been 1 times 5, board was messy
|
||||
- LF = Q1- 15 IQR Ask about this, could have been 1 times 5, board was messy
|
||||
Z score - $\frac{x - \mu}{\sigma}$
|
||||
Coefficient of variation / CV = $\frac{\mu}{\sigma} * 100$
|
||||
Lecture Topic: Midterm Review 1
|
||||
|
||||
Will be Wednesday, Feb 21, 2024
|
||||
Covers Lectures 1-13, Chapters 1-3
|
||||
All multiple choice, 18-20 Questions for 50 mins, 16-17 as it is 45 minutes
|
||||
45 Minutes, Show up early
|
||||
Choose closest answer if answer does not line up
|
||||
YOU NEED A CALCULATOR FOR THIS
|
||||
|
||||
For your formula sheet, you can put anything on it, 1 regular size sheet (11x8.5), both sides are allowed to be written on.
|
||||
|
||||
Questions from base theorem will likely take longer than others, so look for questions that are easier to solve first
|
||||
|
||||
## Basic Statistics
|
||||
Mean - $\frac{\sum x}{n}$
|
||||
Median - Middle Most value, even is the average of two middle values
|
||||
Mode - Most frequent value
|
||||
Quartile
|
||||
- Q1 - 25%, In between 0 and median
|
||||
- Q2 = Median
|
||||
- Q3 = 75% In Between median and 100
|
||||
- Q4 = 100%
|
||||
|
||||
## Variance
|
||||
IQR - Inter quartile range - Q3 - Q1
|
||||
Variance
|
||||
- $\frac{1}{n-1} \sum (x_i - x)^2$ or $\frac{\sum(x_i - x)^2}{n-1}$
|
||||
- $\frac{1}{n-1} \sum (x_i^2) - nx^2$ Ask about this, didn't quite catch on board
|
||||
- must be positive
|
||||
std deviation - Square root of variance, $\sqrt{V(x)}$
|
||||
Upper and lower fence - Outlier limits
|
||||
- UF = Q3 + 15 IQR Ask about this, could have been 1 times 5, board was messy
|
||||
- LF = Q1- 15 IQR Ask about this, could have been 1 times 5, board was messy
|
||||
Z score - $\frac{x - \mu}{\sigma}$
|
||||
Coefficient of variation / CV = $\frac{\mu}{\sigma} * 100$
|
||||
If sigma is not know, replace with S, sample standard deviation
|
@ -1,3 +1,3 @@
|
||||
Lecture Topic: Exam Review 2
|
||||
|
||||
Lecture Topic: Exam Review 2
|
||||
|
||||
Things to study, distribution, total probability theory
|
@ -1,14 +1,14 @@
|
||||
Exam Review:
|
||||
Calculator Required
|
||||
Formula Sheet, 1 page, 2 sided
|
||||
Statistical Tables provided
|
||||
Everything is multiple choice
|
||||
Put scantron sheet in booklet when returning
|
||||
Everything can be on the exam, including regression analysis
|
||||
Class Wednesday is optional question session
|
||||
36-40 Questions expected, stuff after confidence interval may have many multiple choice per question
|
||||
|
||||
When solving a normal distribution problem we convert X to Z
|
||||
We do this by subtracting X by mu over sigma
|
||||
|
||||
Exam Review:
|
||||
Calculator Required
|
||||
Formula Sheet, 1 page, 2 sided
|
||||
Statistical Tables provided
|
||||
Everything is multiple choice
|
||||
Put scantron sheet in booklet when returning
|
||||
Everything can be on the exam, including regression analysis
|
||||
Class Wednesday is optional question session
|
||||
36-40 Questions expected, stuff after confidence interval may have many multiple choice per question
|
||||
|
||||
When solving a normal distribution problem we convert X to Z
|
||||
We do this by subtracting X by mu over sigma
|
||||
|
||||
He basically just went over lecture slides again
|
Reference in New Issue
Block a user