• This web page describes an activity within the Department of Mathematics at Ohio University, but is not an official university web page.
• If you have difficulty accessing these materials due to visual impairment, please email me at mohlenka@ohio.edu; an alternative format may be available.

# Test Information for MATH 3600-100 (8458), Spring 2018

This document gives information to help you prepare for the tests and final exam by excluding some topics, emphasizing others, and giving sample questions. It is difficulty to make this information comprehensive, especially for bits that are not topics in themselves; if something is not on any list and you are unsure if you should know it, then ask me.

Information is organized by lecture. Topics are split into three categories:

Know forever:
These topics are the most important and should be remembered forever. Consequently, they may appear on any test after they are covered.
Know for a while:
These topics are of mid-importance. Questions on them may appear on the first test after they are covered, but not on any later tests.
Know exist:
These are topics discussed in the lectures and used in the homework, but not subject to the tests. The homework problems on them help develop your skills in general. If you encounter them later in life, you should remember they exist and look them up.

Each sample question appears in the first lecture in which you have learned all the topics to answer it. The course does not cover Lectures 17, 18, 26, 32, and 40, so none of the questions use that material. Some lectures are listed with no questions; the material in those lectures is used in questions listed in later lectures.

Programming topics (e.g. the for loop) are used and tested cumulatively, even if the mathematical topic in which they were taught is not subject to testing.

## Part I: Matlab and Solving Equations

Everything.

### Lecture 2: Matlab Programs

#### Know forever:

Everything. Sample:

1. Write a well-commented Matlab script program to plot the functions $$f(x)=x+\sin(x)$$ and $$g(x)=x^2$$ on the same graph, on the interval $$[1,7]$$.

### Lecture 3: Newton's Method and Loops

#### Know forever:

Everything. Sample:

1. Write a well-commented Matlab function program that calculates the sum of the squares of the first $$n$$ integers.
• For $$f(x) = 4x^2 - 2$$, do 2 iterations of Newton's method, starting with $$x_0=1$$.
• Formulate the residual of your final approximation (but do not simplify).
• Formulate the error of your final approximation (but do not simplify).
• Complete the function program below. Include comments in your code. function y = mytrigsum(x,n) % Computes the sum from k=1 to k=n of k^2 sin(pi k x) % Inputs: % x -- the main variable; could be a vector % n -- the upper limit on the sum % Output: The value of the sum at that x; could be a vector 
• Complete the script program below. Include comments in your code. % Plots the sum from k=1 to k=n of k^2 sin(pi k x) % on the interval [0,3] for n=3 and n=7 on a single graph. % Uses the function mytrigsum to compute the values to plot. 

### Lecture 4: Controlling Error and Conditional Statements

#### Know forever:

Everything. Samples:

1. The sequence of numbers $\cos(1), \cos(2), \dots, \cos(999), \cos(1000)$ has some positive elements and some negative ones. Write a well-commented Matlab script program that calculates the sum of the positive elements.
2. Write a well-commented Matlab function program to do Newton's method for a function $$f$$ until $$|f(x)| \lt tol$$. Let $$f$$, $$f'$$, $$x_0$$ and $$tol$$ be the inputs and the final $$x$$ be the output.

### Lecture 5: The Bisection Method and Locating Roots

#### Know forever:

Bisection method by hand and by program, including error bounds.

1. The function $$f(x)=3x^2-30$$ is continuous and $$f(-3) \lt 0 \lt f(5)$$, so it has a zero on the interval $$[-3,5]$$.
• Perform 3 iterations of the bisection method to narrow down this interval.
• How many iterations will it take before you know the zero within $$10^{-7}$$?
2. Write a well-commented Matlab function program to do $$n$$ steps of the bisection method for a function $$f$$ with starting interval $$[a,b]$$. If $$|f(x)| \gt tol$$ after $$n$$ iterations, print a warning. Let $$f$$, $$a$$, $$b$$, $$n$$, and $$tol$$ be the inputs and the final $$x$$ be the output.

#### Know exist:

Finding multiple roots by searching the interval.

### Lecture 6: Secant Methods

#### Know for a while:

The secant method by hand and by program. Samples:

• For $$f(x) = 4x^2 - 1$$, do 2 iterations of the secant method, starting with $$x_0=0$$ and $$x_1=1$$.
• Formulate the residual and the error of your final approximation.
1. Write a well-commented Matlab function program to do the secant method for a function $$f$$ until $$|f(x)| \lt tol$$. Let $$f$$, $$x_0$$, $$x_1$$, and $$tol$$ be the inputs and the final $$x$$ be the output.

#### Know exist:

The Regula Falsi method.

### Lecture 7: Symbolic Computations

#### Know exist:

Symbolic methods.

## Part II: Linear Algebra

Everything

Everything.

### Lecture 10: Some Facts About Linear Systems

#### Know forever:

Everything. Samples:

1. Write a well-commented Matlab function program that takes an input $$n$$, produces a random $$n \times n$$ matrix $$A$$ and random vector $$\bar{b}$$, solves $$A \bar{x} = \bar{b}$$ (using the built in command) and outputs the norm of the residual.

### Lecture 11: Accuracy, Condition Numbers and Pivoting

#### Know forever:

Samples:

1. What is the condition number of a matrix? How do you find it with Matlab? What are the implications of the condition number when solving a linear system? What is the engineering solution to a problem with a bad condition number?

### Lecture 12: LU Decomposition

#### Know for a while:

LU decomposition, by hand and by program. Samples:

1. Using pivoting if appropriate, find the LU decomposition of $A = { \left[ {\begin{array}{cc} 1 & 2 \\ 3 & 5 \end{array}} \right]} .$
2. Using your LU decomposition, solve $$A\mathbf{x} = \mathbf{b}$$ where $$\mathbf{b} = \left[ {\begin{array}{c} 7 \\ 11 \end{array}} \right]$$.
1. Write a well-commented Matlab function program that solves the linear systems $$A\mathbf{x}_1 = \mathbf{b}_1$$ and $$A\mathbf{x}_2 = \mathbf{b}_2$$ using LU decomposition. Let A, b1, and b2 be the inputs and x1 and x2 be the outputs.
2. Write a well-commented Matlab function program that solves a linear system $$A\mathbf{x} = \mathbf{b}$$ using LU decomposition. Let $$A$$, $$\mathbf{b}$$ and $$tol$$ be the inputs and $$\mathbf{x}$$ the output. If the norm of the residual is not less than $$tol$$, then display a warning.

### Lecture 13: Nonlinear Systems - Newton's Method

#### Know forever:

Everything. Sample:

1. Write a well-commented Matlab script program that will use Newton's method to find a solution to the system of equations \begin{align*} x^3 - 7y^2 +1&=0\\ 5y^3 + x +2z- 2&=0 \\ 5z^3 + x -y^2- 3 &=0 \end{align*} starting from the initial guess $$(x,y,z)=(1,1,1)$$.

### Lecture 14: Eigenvalues and Eigenvectors

#### Know forever:

What Eigenvalues and Eigenvectors are and how to interpret them.

#### Know for a while:

Finding eigenvalues and vectors by hand. Samples:

1. Find the eigenvalues and eigenvectors of the matrix $A = {\left[ {\begin{array}{cc} -2 & 4 \\ 1 & 1 \end{array}} \right]} \;.$

### Lecture 15: An Application of Eigenvectors: Vibrational Modes

#### Know forever:

Springs and vibrations. Samples:

1. Consider a system of two masses attached to each other and fixed walls by springs: Suppose that both masses have mass one ($$m_1=m_2=1$$) but that the spring constants vary from left to right as $$k_1=2$$, $$k_2=3$$, and $$k_3=5$$.
1. Determine the matrix $$A$$ so that the equations for Newton's law of motion for the displacements of the masses are written as $$\ddot{\mathbf{x}} = - A \mathbf{x}$$.
2. Write a well-commented Matlab script program that prints the frequencies of the system.

### Lecture 16: Numerical Methods for Eigenvalues

#### Know for a while:

The power method, by hand and by code. Samples:

1. The matrix $$A = {\left[ {\begin{array}{cc} 4 & -3 \\ 2 & -1 \end{array}} \right]}$$ has eigenvalue 1 with eigenvector $${\left[ {\begin{array}{c} 1 \\ 1 \end{array}} \right]}$$ and eigenvalue 2 with eigenvector $${\left[ {\begin{array}{c} 3 \\ 2 \end{array}} \right]} \,.$$ Perform one iteration of the power method, starting with $$\mathbf{v}=\left[ {\begin{array}{c} 1\\ -1 \end{array}} \right]$$. What approximate eigenvalue and eigenvector did you get? If you kept iterating, what would you get eventually?
2. Write a well-commented Matlab function program to do $$n$$ iterations of the Power Method. Let the matrix $$A$$ and $$n$$ be inputs and let [e v] (the eigenvalue and eigenvector) be the outputs.

#### Know exist:

The inverse power method.

## Part III: Functions and Data

Interpolation.

### Lecture 20: Least Squares Fitting: Noisy Data

#### Know for a while:

Least squares fitting. Samples:

1. Your friend has a data set represented by vectors $$\mathbf{x}$$ and $$\mathbf{y}$$ and is considering using a polynomial interpolation, a spline interpolation, or a least squares approximation.
1. For polynomial interpolation, explain to them:
• what it is,
• how you get it in Matlab, and
• in what situations it is better than the other methods.
2. Do the same for spline interpolation.
3. Do the same for least squares approximation.

### Lecture 21: Integration: Left, Right and Trapezoid Rules

#### Know forever:

The Left, Right, and Trapezoid rules, by hand and by program. Samples:

1. Write a well-commented Matlab function program to do the Trapezoid Rule for integration of a function given by data. Let the inputs be vectors x and y, representing a list of points $$(x_i,y_i)=(x_i,f(x_i))$$. Assume $$x_i \lt x_{i+1}$$ but do not assume the $$x$$ values are evenly spaced.
2. Estimate the integral $$\int_{-3}^{1} x^2 \, dx$$ using $$L_4$$, $$R_4$$, and $$T_4$$. Calculate the exact value and the errors of each of the approximations.

### Lecture 22: Integration: Midpoint and Simpson's Rules

#### Know for a while:

Midpoint and Simpson's rules. Samples:

1. Estimate the integral $$\int_{-3}^{1} x^2 \, dx$$ using $$M_4$$ and $$S_4$$. Calculate the exact value and the errors of each of the approximations.
2. Write a well-commented Matlab function program to do the midpoint method for integration. Let the inputs be the function $$f$$, the endpoints $$a$$, $$b$$ and the number of subintervals $$n$$.
3. Write a well-commented Matlab function program to do Simpson's rule for integration. Let the inputs be the function $$f$$, the endpoints $$a$$, $$b$$ and the number of subintervals $$n$$.

### Lecture 23: Plotting Functions of Two Variables

Plotting in 2D.

#### Know exist:

Constructing triangulations.

### Lecture 24: Double Integrals for Rectangles

#### Know forever:

Approximate integrals based on evaluating at a point or 4 corners. Samples:

1. Write a well-commented Matlab function program to do the four-corners method for integration of a function $$f(x,y)$$ on a rectangle $$a\le x\le b$$, $$c\le y\le d$$ using $$m$$ subintervals in $$x$$ and $$n$$ subintervals in $$y$$. Let the inputs be (f,a,b,c,d,m,n).
2. Write a well-commented Matlab function program to do the center-point method for integration of a function $$f(x,y)$$ on a rectangle $$a\le x\le b$$, $$c\le y\le d$$ using $$m$$ subintervals in $$x$$ and $$n$$ subintervals in $$y$$. Let the inputs be (f,a,b,c,d,m,n). Include comments.
3. Complete the program below. Include comments in your code. function I = mycenterright(f,a,b,c,d,m,n) % Computes an approximate integral of a function of two % variables f(x,y) on a rectangle. % Splits into small rectangles and on each one evaluates f at % the center of the right edge. % % Inputs: % f -- the function % a,b -- define the interval in x, namely a < x < b. % c,d -- define the interval in y, namely c < y < d. % m -- the number of (evenly spaced) intervals to use in x. % n -- the number of (evenly spaced) intervals to use in y. % Output: The approximate value of the integral. 

#### Know exist:

Double Simpson's rule

### Lecture 25: Double Integrals for Non-rectangles

#### Know for a while:

Integration methods using triangles. Samples:

1. Describe and give formulas for 2 methods to approximate double integrals based on triangles.

### Lecture 27: Numerical Differentiation

#### Know forever:

Forward, backward, and central differences for $$f'$$ and central difference for $$f''$$. Samples:

1. Suppose you know $$f(1)=2$$, $$f(3/2)=3$$, $$f(2)=5$$, and $$f(5/2)=4$$. Compute:
• the forward difference approximation of $$f'(1)$$,
• the backward difference approximation of $$f'(3/2)$$,
• the centered difference approximation of $$f'(2)$$, and
• the centered difference approximation of $$f''(2)$$.
2. Complete the program below. Include comments in your code. function df = myderivative(f,a,b,n) % Computes an approximate derivative of f on an interval. % % Uses the forward difference at the first point, % the backward difference at the last point, % and the centered difference at all points in between. % % Inputs: % f -- the function % a,b -- define the interval in x, namely a<=x<=b. % n -- the number of (evenly spaced) points to use in x. % Output: Vector of length n with approximate values of f'(x). 

#### Know exist:

Difference formulas for $$f'''$$ and $$f^{(4)}$$.

### Lecture 28: The Main Sources of Error

#### Know forever:

Everything. Samples:

1. Compare and contrast truncation error and loss-of-precision (also known as loss-of-significance) error. Illustrate each with an example.
2. For the function $$f(x)=x^2$$ you need to find $$f'(5)$$, but you can't remember whether $$f'(x)=2x$$ or $$f'(x)=x^3/3$$. You remember that $f'(5)=\lim_{h\rightarrow 0}\frac{f(5+h)-f(5)}{h} \,,$ so you try: h=10^(-50) ((5+h)^2-5^2)/h which gives the result: ans = 0. Is this the correct answer? Explain what happened and why.
3. Explain what would happen if you ran the following Matlab commands:  format long for i=1:30 x=10^i+pi mypi=x-10^i error=(pi-mypi)/pi end 

## Part IV: Differential Equations

### Lecture 29: Reduction of Higher Order Equations to Systems

#### Know forever:

Everything. Samples:

• Write the initial value problem $\ddot{\theta} + 11 \dot{\theta} + \cos(\theta) = \sin(2t) \quad\text{with}\quad \theta(0) = 5\quad\text{and}\quad\dot{\theta}(0) = 7$ as a system of first-order equations.
• Give all the Matlab commands needed to solve this problem on the interval $$0 \le t \le 3$$.

### Lecture 30: Euler Methods

#### Know forever:

Euler and Modified Euler Methods. Samples:

1. Write a well-commented Matlab function program to do $$n$$ steps of the Euler method for a differential equation $$\dot{\mathbf{x}} = \mathbf{f}(\mathbf{x},t)$$, on the time interval $$[a,b]$$ with $$\mathbf{x}(a) = \mathbf{x}_0$$. Let the first line be: function [T, X] = myeuler(f,x0,a,b,n).
2. Write a well-commented Matlab function program to do $$n$$ steps of the modified Euler method for a differential equation $$\dot{\mathbf{x}} = \mathbf{f}(t,\mathbf{x})$$, on the time interval $$[a,b]$$ with $$\mathbf{x}(a) = \mathbf{x}_0$$. Let the first line be: function [T, X] = mymodeuler(f,x0,a,b,n).

### Lecture 31: Higher Order Methods

#### Know forever:

The concept of order. Samples:

1. In Lecture 31 it is claimed that the Euler method is first order, the modified Euler method is second order, and the Runge-Kutta method in ode45 is fourth order.
• Explain what "order" means in this context.
• Explain why order matters in engineering problems.

#### Know for a while:

RK4 and variable stepsize qualitative description. Samples:

1. Describe RK45. What is the command for it in Matlab?
2. What is variable step size? How is it implemented RK45?

#### Know exist:

RK2 (ODE midpoint) method; RK4 program.

### Lecture 33: ODE Boundary Value Problems and Finite Differences

#### Know forever:

Derive finite difference boundary value equations. Samples:

1. By replacing $$y''$$ with a central difference, derive the finite difference equation for the boundary value problem $y'' = x\quad\text{on $$[1,3]$$} \quad\text{with}\quad y(1) = 2\quad\text{and}\quad y(3) = 5$ using 2 subintervals. Solve the equation and plot the solution.

### Lecture 34: Finite Difference Method -- Nonlinear ODE

#### Know exist:

Relaxation methods.

### Lecture 35: Parabolic PDEs - Explicit Method

#### Know forever:

Derive the explicit method. Samples:

1. Derive the explicit finite difference equations for solving the heat/diffusion equation $$u_t = c u_{xx}$$ on the interval $$x\in [0,L]$$ with boundary conditions $$u(0,t) = a$$, $$u(L,t) = b$$, and $$u(x,0) = f(x)$$.

### Lecture 36: Solution Instability for the Explicit Method

#### Know forever:

Describe instability. Samples:

1. When and why does the explicit finite difference method for the heat/diffusion equation become unstable?

### Lecture 37: Implicit Methods

#### Know forever:

Derive implicit method. Samples:

1. Derive the implicit finite difference equations for solving the heat/diffusion equation $$u_t = c u_{xx}$$.
2. Compare and contrast the explicit and implicit methods. Which would you recommend, and why?

#### Know for a while:

Describe Crank-Nicolson. Samples:

1. For the heat/diffusion equation $$u_t = c u_{xx}$$ we learned an explicit method, an implicit method, and (in less detail) the Crank-Nicholson method.
• Compare and contrast the explicit and implicit methods. Which would you recommend, and why?
• What is the Crank-Nicholson method? Would you recommend it over the other two? Why?

#### Know exist:

Derivation of Crank-Nicolson.

### Lecture 38: Insulated Boundary Conditions

#### Know forever:

Incorporate insulating boundary conditions. Samples:

• Derive the explicit finite difference equations for solving the heat/diffusion equation $$u_t = c u_{xx}$$ on the interval $$x\in [0,L]$$ with boundary conditions $$u(0,t) = a$$, $$u(L,t) = b$$, and $$u(x,0) = f(x)$$.
• Explain how to incorporate an insulated boundary at $$x=L$$.
• By replacing $$y''$$ with a central difference, derive the finite difference equation for the boundary value problem $y'' = x\quad\text{on $$[1,3]$$} \quad\text{with}\quad y(1) = 2\quad\text{and}\quad y(3) = 5$ using 2 subintervals. Solve the equation and plot the solution.
• Change the boundary condition $$y(3) = 5$$ to the insulated condition $$y'(3)=0$$. Derive the new equations, solve them, and plot the solution.

### Lecture 39: Finite Difference Method for Elliptic PDEs

#### Know forever:

Derive finite difference equations. Samples:

• Set up the finite difference equations for the BVP: $$u_{xx} + u_{yy} = f(x,y)$$, on the rectangle $$0 \le x \le a$$ and $$0 \le y \le b$$, with $$u =0$$ on all the boundaries. Explain how the difference equations could be solved as a linear system.
• Explain how to incorporate an insulated boundary at $$x=a$$.

### Lecture 41: Finite Elements

#### Know forever:

What a finite element is.

### Lecture 42: Determining Internal Node Values

#### Know forever:

At a high level, how finite elements are used. Samples:

1. A finite element solution to a differential equation in two dimensions is of the form $U(x,y) = \sum_{j=1}^n C_j \Phi_j(x,y) \,.$
• Explain what the $$\Phi_j$$ are and how you construct/ find/ solve for them.
• Explain what the $$C_j$$ are and how you construct/ find/ solve for them.

#### Know exist:

Formulas.

Martin J. Mohlenkamp