0% found this document useful (0 votes)
67 views

Midterm: Mathematics For Engineers (W2021)

This document is a midterm exam for an engineering mathematics course covering material from weeks 1-6. It contains 4 questions assessing the student's knowledge of debugging MATLAB code, writing MATLAB functions, explaining concepts like the colon operator and Gauss elimination, and applying Newton's divided differences to fit a polynomial to data and estimate values. Students must submit their responses digitally by the due date and complete their own work without cheating or plagiarism.

Uploaded by

sppppp
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
67 views

Midterm: Mathematics For Engineers (W2021)

This document is a midterm exam for an engineering mathematics course covering material from weeks 1-6. It contains 4 questions assessing the student's knowledge of debugging MATLAB code, writing MATLAB functions, explaining concepts like the colon operator and Gauss elimination, and applying Newton's divided differences to fit a polynomial to data and estimate values. Students must submit their responses digitally by the due date and complete their own work without cheating or plagiarism.

Uploaded by

sppppp
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 5

MAT 8400 – Mathematics for Engineers (W2021)

MAT 8400
Mathematics for Engineers (W2021)

Midterm

STUDENT NAME: ________________________________

This midterm covers material from Weeks 1 – 6.

NOTE: You must submit your midterm digitally on Brightspace  Activities  Assignments  Midterm.

You may complete your midterm on lined or blank paper. Make sure to write clearly. Illegible work may result
in a lower grade.

Each student is responsible for completing their own midterm. Cheating, including
plagiarism from online sources, and collaboration with peers, will not be tolerated. If
you have any questions about what constitutes plagiarism, consult Algonquin’s
Plagiarism Policy (AA20) and Policy on Academic Dishonesty and Discipline (AA18).

The midterm is out of a total of 65 points.

1
MAT 8400 – Mathematics for Engineers (W2021)

1. The M-file method.m was submitted for verification. You have


been tasked with debugging the code. (15 points)
In your own words, answer the following questions:
a) What is the purpose of this M-file?
b) Does the M-file work as intended? If not, why not? Which line(s)
of code are incorrect?
c) What do you suggest should be done to fix and/or improve the
M-file?

Figure 1: Source code for method.m.

2
MAT 8400 – Mathematics for Engineers (W2021)

2. Write a sufficiently-commented MATLAB function that accomplishes


the following task (15 points):

• Returns the output argument out.


• Accepts the argument list containing row vectors a and b, and
a character choice from the Command Window.
• Checks to ensure that a and b are row vectors of the same
length. If not, the code prints an error message and quits.
• Checks to ensure that choice is equal to either a, s, or m. If
not, the code prints an error message and quits.
• If choice is equal to a, set out as the result of a + b.
• If choice is equal to s, then set out as the result of a – b.
• If choice is equal to m, then set out as the result of a x b.

3
MAT 8400 – Mathematics for Engineers (W2021)

3. Answer the following questions in your own words. Do not copy


content from the lecture notes or other resources. (Each question is
worth 5 points.)
a. What is the purpose of the colon operator in MATLAB? Why is
it useful?
b. Compare and contrast the two types of M-files discussed in
the lectures.
c. Explain the assumptions of Naïve Gauss Elimination in detail.
d. Compare and contrast the different error tolerances that
could be used when performing the Newton-Raphson method.
Which error tolerance is typically used? Why?

4
MAT 8400 – Mathematics for Engineers (W2021)

4. Use Newton’s Divided Differences to fit a third-order polynomial to


the following set of data:

Table 1: Data Set for Newton’s Divided Differences

x y

0 0

1 2

3 5

5 1

Then, use the third-order polynomial to estimate the true value


at x = 1.5.

Do the calculations by hand. Show all of your work.

(15 points)

You might also like