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 can 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? (Set theory)
- 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.
Advantages of fixed point binary numbers
- More representable numbers, as numbers don’t need to be normalised
- Maximum precision for the given number of bits
- Can be simpler, and faster, to work with
Give three advantages of floating point numbers
- Can represent a much larger range of numbers
- The trade-off between range and precision can be tailored to the context the system is being used in
- Additional non-numeric values can be represented using the unnormalised range (e.g. NaN, infinity)
What is meant by the precision of a binary number?
The maximum number of significant digits that can be represented in a number format.
When the result of an arithmetic operation is a real number (e.g. pi), what options are there for storing it in binary?
- Rounding to the nearest representable value
- Truncating
What is absolute error?
The difference between the actual value and the nearest representable value
(always positive)
What is relative error?
The absolute error ÷ the actual value
(could be given as 0.05, 1/20 or 5%)
When does overflow occur?
When a number is too large to be represented using the available number of bits
When does underflow occur?
When a number is too small to be represented using the available number of bits
What is a bitmapped graphic made of?
A grid of pixels
What is a pixel?
- Pixel is short for picture element
- It is the smallest addressable area of an image
What is colour depth?
The number of bits used to represent the colour of a single pixel in a bitmap image
What determines the minimum colour depth?
The number of different colours that need to be used in an image
What is the image size in pixels?
(image width in pixels) * (image height in pixels)
What is the image resolution measured in?
dots per inch (ppi)
How do you calculate image file size? (ignoring metadata)
file size
= (image size in pixels) x colour depth
= (image width in pixels) x (image height in pixels) x colour depth
Give five examples of metadata for a bitmap image
- Image width in pixels
- Image height in pixels
- Colour depth
- File format
- Geographical location of creation
How are vector graphics stored?
- Images are described using a list of objects.
- The properties of each object in the vector graphic image are also stored as a list
Give five examples of properties of objects in a vector graphic image
- Coordinates of object
- Shape
- Border colour
- Fill colour
- Border thickness
Give three advantages of vector graphics
- Vectors can be enlarged without distortion, whereas bitmapped graphics can look pixelated when the size changes
- In general, vector graphics tend to result in smaller file sizes. Especially when they are composed of relatively simple geometric shapes
- It is much simpler to create and edit parts of vector graphic images as each object in a vector graphic can be adapted independently by accessing its set of attributes
What is the advantage of bitmapped graphics?
- Can represent images with complex textures
- Can represent images with lots of variation in colour
- Can represent images that are not composed of regular shapes
- Photographs are naturally represented as bitmaps because of the way they are captured by a digital camera.
What are vector graphics mostly used for?
Logos
What does MIDI stand for?
Musical Instrument Digital Interface
Describe what MIDI is and what its purpose is
- MIDI is a technical standard that describes
1. A protocol
2. Digital interface
3. Standard set of connectors - MIDI allows for a wide range of electronic musical instruments to communicate with each other so as to manipulate music
Describe the use of event messages in MIDI. Include examples of event messages.
Event messages are a list of instructions that specify how the music should be played. For example
- Note on / note off
- Pitch
- Volume
- Instrument
- Vibrato
Give three advantages of using MIDI files for representing music
- A MIDI file provides a more compact representation of sound, often leading to MIDI files using far less storage than an equivalent sampled recording.
- The performance data can be easily manipulated (e.g. duration of a note can be changed, or even an entire instrument)
- No information about a note is lost through sampling
Difference between analogue data and digital data
- Analogue data is continuously variable, there are no limits to the values that the data can take
- Digital data is discrete, meaning that it can only take particular values.
Where do ADCs get the analogue signal from?
Analogue sensors
Most common use for a DAC?
Converting a digital audio signal to an analogue audio signal
Why are files compressed?
- To reduce their size
- Smaller files can be transferred faster between storage devices or over the internet
What is lossy compression?
- When the file is compressed, there is loss of information from the original version.
- When decompressed, the file will be lower quality than the original
Name two methods of lossless compression
- Run length encoding
- Dictionary-based compression
How does run length encoding work?
RLE reduces the size of a file by removing repeated information and replacing it with one occurrence of the repeated information followed by the number of times it is to be repeated
When are RLE and dictionary-based compression most effective?
On files that contain a lot of repeated data
True or False: relative error is always given as positive
True (in this A-level)
What is sampling rate measured in?
Hertz
What does Nyquist’s theorem state?
The sampling rate must be at least double the highest frequency present in the signal
What is the advantage of lossless compression?
The size of a file can be reduced without decreasing its quality (there is no loss of information)
What is the key difference between lossy and lossless compression?
Lossy : original data cannot be recovered. lossy compression cannot be reversed
Lossless : original data can be fully recovered. lossless compression can be reversed
Describe how dictionary-based compression could be used on a paragraph of text
- Each word in the text is allocated a shorter code
- The paragraph is then represented as a sequence of these codes
- The dictionary containing the repeated data is appended to the file
What is a bit?
- The fundamental unit of information
- A bit is either 0 or 1
If the actual number is A, but B is stored, what is the absolute error?
|A-B|
absolute error is positive
Describe the principles of operation of an ADC
- Analogue signal is sampled at regular time intervals
- Amplitude of signal at each sample point measured
- Measurement is coded into a fixed number of bits
How are logic gates used in a half-adder?
XOR for S(um)
AND for C(arry)
What are S
, C_in
and C_out
in a full adder?
-
S
is the sum -
C_in
is the carry from the previous calculation -
C_out
is the carry that is going to be passed to the next calculation
Inputs for an edge-triggered D-type Flip-flop
D and a clock signal
Outputs for Edge-triggered D-type Flip-flop
Q and not Q
What is the purpose of the clock in an Edge-triggered D-type Flip-flop?
- To determine when to store and update Q to be the state of the data signal (D). This happens at a rising edge (0 –> 1) of the clock signal
- To synchronise the operation of a group of flip-flops
How does Q change in an Edge-triggered D-type Flip-flop?
- On the rising edge of the clock signal, Q and not Q are updated to hold D and not D respectively
- Output Q only takes on a new value if the value at D has changed at the point of a clock pulse
How can an Edge-triggered D-type Flip-flop be used?
As a memory unit
What is the name of the sequential circuit with a Data and Clock input that can be used as a memory unit?
Edge-triggered D-type flip-flop
What is a function?
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.
What is the domain?
The set from which the function’s input values are chosen
What is the co-domain?
The set from which the function’s output values are chosen. Not all of the co-domains members needs to be outputs.