You are on page 1of 8

PASS

MOCK EXAM
FOR PRACTICE ONLY
Course: ECOR 2606 ABC Numerical Methods

Facilitator: Connor Brackley

th

Dates and locations of mock exam take-up: Thursday October 16 2014, 6:00 PM 9:00 PM
UC 282

It is most beneficial to you to write this mock midterm UNDER EXAM CONDITIONS. This means:
Complete the midterm in 1.5 hour(s).
Keep your notes and textbook closed.
Attempt every question.
After the time limit, go back over your work with a different colour or on a separate piece of paper and
try to do the questions you are unsure of. Record your ideas in the margins to remind yourself of what
you were thinking when you take it up at PASS.
The purpose of this mock exam is to give you practice answering questions in a timed setting and to
help you to gauge which aspects of the course content you know well and which are in need of further
development and review. Use this mock exam as a learning tool in preparing for the actual exam.

Come to the PASS session with your mock exam complete. There, you can work with other

Often, there is not enough time to review the entire exam in the PASS session. Decide which
questions you most want to review the Facilitator may ask students to vote on which
questions they want to discuss.

Facilitators do not bring copies of the mock exam to the session. Please print out and complete
the exam before you attend.

Facilitators do not produce or distribute an answer key for mock exams. Facilitators help
students to work together to compare and assess the answers they have. If you are not able to
attend the PASS session, you can work alone or with others in the class.
Good Luck writing the Mock Midterm!!

DISCLAIMER: PASS handouts are designed as a study aid only for use in PASS workshops. Handouts may
contain errors, intentional or otherwise. It is up to the student to verify the information contained within.
PLEASE NOTE: THIS HANDOUT IS NOT TO BE DISTRIBUTED.

Name: First _____________________ Last ________________________

Student Number ____________________

Question 1
Consider the function:
! ! = ! ! 8! ! + 30
Suppose you wanted to plot this graph between -2 and 7.
i) Write the MATLAB code to plot this graph using the plot function (not fplot); write the necessary code to do
so include a grid and figure number. (3 Marks)

Once this code run the following graph should be outputted

ECOR 2606 ABC Mock Midterm 2014

Page: 2

ii) If you were using the fzero function to find all of the roots you would have to pass in an interval for each of
the 3 roots, these intervals would be (1.5 Marks):
X1 = fzero(f, [ ])
X2 = fzero(f, [ ])
X3 = fzero(f, [ ])
iii) If you wanted to avoid graphing the function, show the code you could use to find the 3 roots without
knowing the intervals? (1 Mark)

iv) Show you understanding of the Newton Raphson search method to complete the following table. Estimate
the root of the function using an initial guess of 6. (13 Marks).
Xi

f(xi)

f(xi)

Xr

Eaprox

Not relevant

ECOR 2606 ABC Mock Midterm 2014

Page: 3

One of the less desirable aspects of the Newton Raphson search is the requirement to find the derivative. This
would prove difficult on the following problem.
Consider the following problem relating to fluid flow through pipes.
1
!

= 4 log!" !" ! 0.4

v) Given Re = 2700, write the MATLAB code to find f which is between 0.005 and 0.01. Output the results in a
message. (3 Marks)
The first 2 lines are given as:
Re = 27000
g = @(f) 4 * log10(Re * sqrt(f)) - 0.4

vi) Suppose you were performing the bisection search to look for an answer between the same limits. What
would be your first guess (xr)? (2 Marks)

vii) What would be your maximum error if 20 iterations of the bisection method were performed? (1 Mark)

Page: 4

Question 2

x
x

x
x

Consider a flat piece of cardboard with

length of L and a width of W. You want to
cut along the dotted lines removing 4
squares of dimensions (x by x). Once the
squares are removed you can fold the
piece into a box of volume V.

i) Write a function in which the user can enter the length and width of a piece of cardboard and the function
will output the x that will maximize the volume (using fminbnd), and the corresponding volume. Assume W
will always be smaller than L. (8 Marks)

function [ x V ] = maxVolume( W, L)
% MAXVOLUME returns the cutting dimensions and maximum volume of a box
%Inputs: W the width of a piece of carboard
%
L the length of a piece of cardboard
%Outputs: x the dimension x
%
V The maximum Value

End

ECOR 2606 ABC Mock Midterm 2014

Page: 5

ii) Show your understanding of the Golden Section to find the minimum of the function: (12 Marks)

! ! = ! ! + 3! + 4

XL

XU

-3

X2

X1

f(X2)

f(X1)

iii) What would be your best guess for the x position of your minimum? (1 mark)

iv) What is the maximum error of this answer? (1 mark)

ECOR 2606 ABC Mock Midterm 2014

Page: 6

Question 3
i) Consider the following set of linear equations:
7! + 5! 3! = 16
3! 5! + 2! = 8
5! + 3! 7! = 0

solve the set of linear equations and ensure you are solving them using the Gaussian Elimination method (with
row pivoting). (15 Marks)

X _______________ Y _______________ Z _________________
ECOR 2606 ABC Mock Midterm 2014

Page: 7

ii) Note one issue with the Gaussian method when pivoting is not utilized (1 Mark)

iii) Suppose you had the coefficients of the unknown variables (x, y, z) stored in a square matrix A, and the
constants on the right hand side stored in a column matrix B. Show 2 ways you could obtain the answer using
MATLAB. (2 Marks)

Page: 8