Set 7 Flashcards
What is important about the components of a vector?
That they are all drawn from the same field of values, e.g Reals or Rationals
Give four ways vectors be represented
- A list of values
- A one-dimensional array
- A dictionary (if the vector can be considered to represent a function)
- Visually (using an arrow)
How can a vector be represented in code if the vector is viewed as a function?
A dictionary
What does vector addition achieve?
Translation
What does scalar-vector multiplication achieve?
Scaling
What is another name for dot product?
Scalar product
What is a convex combination of vectors u and v?
αu + βv
such that α , β >= 0
and α + β = 1
What is the scalar product of vectors: A = (a1,a2) and B = (b1,b2)
A.B = a1b1 + a2b2
What is an application of the dot product?
Finding the angle between two vectors
In a convex combination of u and v, what is the significance of α = β = 0.5?
The resultant vector is the midpoint of the position vectors u and v
When might it be appropriate to represent a vector using a dictionary?
If the vector is used to represent a function
What is a set?
A set is an unordered collection of values in which each value occurs at most once
What does proper subset mean? What is its symbol?
- Equality not allowed
- (a set is a subset of itself but not a proper subset of itself)
- ⊂
A\B
Set difference between A and B
What is a finite set?
One whose elements can be counted off by natural numbers up to a particular number
What is the Cartesian product of A and B?
The set of all ordered pairs (a, b) where a is a member of A and b is a member of B.
What can the Cartesian product be used for?
Defining function types
What is a countable set?
A set with the same cardinality as some subset of the natural numbers
What are regular expressions?
Metalanguage for defining all valid strings of a regular language
What is the purpose of regular expressions?
Allow for regular languages to be described in a convenient shorthand notation
What is the RegEx metacharacter for: zero or more
*
What is the RegEx metacharacter for: one or more
+
RegEx : zero or one lots of
?
What are | ? * + called in RegEx?
Metacharacters
Context free languages are a __________ of regular languages
Superset
Why are context-free languages needed? (2*)
- RegEx doesn’t have enough expressive power
- This is because regular languages can be expressed in terms of a finite state machine, and a finite state machine only has finitely many states
What is BNF?
- Backus-Naur form
- A metalanguage for describing the syntax used by a context-free language
General statement in BNF
LHS ::= RHS
What is a function?
- A function is a mapping of values from a domain to a set of values from a co-domain.
- Not all of the co-domains members needs to be outputs.
Notation for “the set difference between sets A and B”
A\B
Set comprehension for all even natural numbers less than 10
{2x | x ∈ ℕ ∧ x<5}
(| means such that, ∧ means AND)
What sorts of strings match {0ⁿ1ⁿ| n ≥ 1}
{ 01, 0011, 000111, 00001111, … }
How can you identify normalised floating point numbers?
Mantissa must begin with 01 or 10
Give two advantages of normalisation of floating point numbers
- It maximises precision for a given number of bits
- It ensures that there is a unique representation of each number, making it simpler to test for equality of numbers
If the exponent of a number is negative, what do you need to do to the mantissa when converting from binary to decimal?
Fill in with 0s if the leftmost bit is a 0, and fill in 1s if its a 1.