Homework
Numerical Methods
David Mayerich
Scalable Tissue Imaging and Modeling (STIM) Laboratory
Department of Electrical and Computer Engineering
Cullen College of Engineering
University of Houston
David Mayerich
STIM Laboratory, University of Houston

Homework 1
Real and Complex Sets
Hilbert Spaces
Linear Algebra
Taylor Series
David Mayerich
STIM Laboratory, University of Houston
Calculate \(y=z^2z^*\) where \(z = (2+3i)\)
David Mayerich
STIM Laboratory, University of Houston
Sets and Hilbert Spaces
-
Describe the Hilbert space of \(\mathbf{y} = \mathbf{ABx}\) if \(\mathbf{A}\in \mathbb{R}^{5\times 4}\) and \(\mathbf{x}\in\mathbb{C}^{7}\)
David Mayerich
STIM Laboratory, University of Houston
Calculate \(\langle \mathbf{x}, \mathbf{y} \rangle\)
David Mayerich
STIM Laboratory, University of Houston
Gaussian Elimination
-
Solve the following linear system:
David Mayerich
STIM Laboratory, University of Houston
Taylor Series
-
Calculate a 4th-order Maclaurin series to approximate \(f(x) = e^x \cos{x^2}\)
David Mayerich
STIM Laboratory, University of Houston
Homework 2
Data Types
Promotions
Heap Allocation
David Mayerich
STIM Laboratory, University of Houston
Promotions
-
What are the register contents after the following allocations?
David Mayerich
STIM Laboratory, University of Houston
//...
unsigned char a = 200;
unsigned char b = 2;
unsigned int c = 128;
unsigned int w = c % 7
unsigned int x = a + c;
unsigned int y = (unsigned char)(a + c);
unsigned int z = a * b;
//...w = 2x = 328y = 328 % 256 = 72z = 400 // why not 144?Heap Allocation
-
Allocate space for the following arrays in the GEMM operation:
David Mayerich
STIM Laboratory, University of Houston
given the function signature:
void sgemm(int m, int n, int k, float alpha, float* A, float* B, float beta, float* C)float* A = (float*) malloc(m * k * sizeof(float));
float* B = (float*) malloc(k * n * sizeof(float));
float* C = (float*) malloc(m * n * sizeof(float));Homework 3
Maclaurin Series
Error Terms
Approximating Complex Functions
David Mayerich
STIM Laboratory, University of Houston
Complexity Analysis
-
Calculate the computational complexity of the following algorithms:
David Mayerich
STIM Laboratory, University of Houston
Synthetic Division
-
Use Horner's algorithm to calculate \(p(x)\) and \(p'(x)\)
David Mayerich
STIM Laboratory, University of Houston
Homework 4
Series Expansions
Truncation Error
Relative Error
David Mayerich
STIM Laboratory, University of Houston
Truncation Error in Series
-
Calculate the relative error in the first 3 terms of the following expansion for \(\pi\)
David Mayerich
STIM Laboratory, University of Houston
Radiocarbon Dating
-
You are developing a new radiocarbon dating method. Your test sample is an Egyptian papyrus document that has been officially dated at \(2560\) BCE. Your method estimates the date as \(2830\) BCE. What is the relative error of your method (in percent), assuming that the official date is correct?
David Mayerich
STIM Laboratory, University of Houston
Relative error requires a ratio scale.
The time scale in this case is relative to the date that the papyrus was created.
The dating method is measuring how much time has passed since the manuscript was created.
Homework 5
Signed and Unsigned Integers
Memory Addressing
Overflow
Floating Point
David Mayerich
STIM Laboratory, University of Houston
Signed Integers
-
What is the smallest value that can be represented with a 5-bit signed integer using two's complement?
-
Convert from positive to negative:
-
perform a NOT operation on the positive number
-
add 1
-
-
Reverse that to convert to positive:
David Mayerich
STIM Laboratory, University of Houston
Nintendo Memory
-
A Nintendo Entertainment System (NES) used a pixel processing unit (PPU) with 246 bytes of addressable sprite memory that could be used to process motion on the screen. How many bits were required to address this memory space?
David Mayerich
STIM Laboratory, University of Houston
\(3\) bits can address \(2^3 = 8\) locations
\(7\) bits can address \(2^7 = 128\) locations
\(8\) bits can address \(2^8 = 256\) locations
This is why machines like the NES are often called \(8\)-bit systems
NeoGeo Memory
-
The NeoGeo had \(64\) kilobytes (kB) of main VRAM. How many bits were required to address this memory space?
David Mayerich
STIM Laboratory, University of Houston
\(15\) bits can address \(2^{15}=32768\) locations
\(16\) bits can address \(2^{16}=65536\) locations
-
The SI standard defines a kilobyte (kB) as \(1000\) bytes
-
The JEDEC standard defined a kilobyte as \(2^{10} = 1024\) bytes
-
Since the power-of-two standard is still used in semiconductor manufacture, it is now generally referred to as a kibibyte (KiB)
Donkey Kong
-
The number of seconds given to complete each level \(L\) in the video game Donkey Kong is \(s=\text{min}(10L+40, 80)\). Why has nobody gotten past level 22?
David Mayerich
STIM Laboratory, University of Houston
Level 22 would allow the player \(s=\text{min}(260, 80) = 80\), right?
What if the calculation used \(8\)-bit integers?
Floating Point
-
Convert the following \(8\)-bit floating point values to decimal assuming the following format with a bias of \(7\):
David Mayerich
STIM Laboratory, University of Houston
sign
exponent
mantissa
Homework
By STIM Laboratory
Homework
- 65