The Math 445 final exam will be comprehensive, covering all material presented in lecture and lab (except for the derivation of differential equations from physics presented in lecture). Below is a broad overview but not exhaustive of topics that might be covered on the exam.
You should know how to create vectors and matrices, how to access and set their elements, and how to perform mathematical operations with them. For example, if asked “Write Matlab code that would assign the 3rd and 7th columns of the matrix A
into a matrix variable B
,” you should know that the answer is
B = A(:, [3 7])
Note that correctness and conciseness both count! The above answer is better and will get a better grade than B = [A(:,3), A(:,7)]
, because it is more readable, less error-prone, and generalizes more easily.
Relevant Matlab vocabulary:
zeros
linspace
* \ + - =
You should know the difference between linear algebra and elementwise operations on matrices and vectors. For example, given two 2 x 2 matrices A
and B
, you should be able to compute A * B
and A .* B
by hand. You should also know in what circumstances it's appropriate to use linear algebra operations or elementwise operations.
You should be able to translate a story problem into a system of linear equations and then write Matlab code to solve the system of equations. For example, suppose you have twenty coins worth $1.35 and they're all nickels and dimes. Translate this problem into a system of equations and write the Matlab code that would solve the equations numerically.
A = [1 1 ; 5 10]; b = [20 ; 135]; x = A\b; n = x(1) d = x(2)
or even just
[1 1 ; 5 10] \ [20 ; 135]
You should know
You should know how to write concise Matlab code to evaluate mathematical expressions. In particular, you should know how to evaluate expressions involving sums and products.
For example, write two lines of Matlab code that would evaluate the sum
Answer:
n = 1:10; sum(n./(n+2).^2)
You should be able to write simple Matlab functions to perform specified computations. For example, if asked to write a Matlab function that, given a value of , evaluates
you should respond with
function s = f(N) n=1:N; s = sum(n./(n+2).^2) end
You should know how to use for
loops to perform repeated computations. For example, if asked to write a function that computes the above sum using a for
loop (instead of using the sum
function), you would write
function s = f(N) s = 0; for n = 1:N s = s + n/(n+2)^2 end end
You should know how to get random numbers of various kinds
Each of these random number generators has a matrix version, as well. E.g.
You should know how to write simple if-else
statements such as
x = randn(); if x < 0 fprintf('%d is negative\n', x) elseif x == 0 fprintf('%d is zero\n', x) else fprintf('%d is positive\n', x) end
You should have a good grasp on the mathematics and Matlab programming of the lab material. For example,
You should know how to infer a functional relation given a logarithmic or linear plot
, and which of plot, semilogx, semilogy, and loglog is best for a given relation
.
You should know how to write Matlab functions that do basic computations, like matrix-vector multiplication.
Given a graph of nodes and one-way links between them, you should be able to write a system of equations that governs random walks through the network of links, and then write Matlab code that would calculate the steady-state distribution.
You should know the mathematics behind Newton's method for solving nonlinear equations, how to code it in Matlab, and how to use Matlab's built-in solver fsolve to solve nonlinear equations.
You should know now how to write an anonymous function for a system of first-order differential equations , and how to solve that system of equations numerically using Matlab's ode45. And given a quiver plot of a 2-d differential equation, you should be able to draw an approximate solution of the equation starting from a given initial condition, by tracing out a curve that is everywhere tangent to the arrows.