# MACM 316 – Computing Assignment 2

MACM 316 – Computing Assignment 2

Submission Instructions: You must upload one .pdf file in Crowdmark that consists of two
pages: page 1 is your report which should fit all discussions, data and figures into a single page;
and page 2 is a listing of your code. The deadline is 11:00pm on the due date. The actual due
time is set to 11:05pm and if Crowdmark indicates that you submitted late, you will be assigned a
grade of 0 on this assignment. Your TA has emailed you a Crowdmark link that you should save
❼ Please review the Guidelines for Assignments carefully.
❼ Acknowledge any collaborations or assistance from colleagues/TAs/instructor.
❼ If you have any questions about Matlab or aspects of this assignment, then you are strongly
encouraged to attend tutorials and drop-in workshops.
Computing Assignment – Explorations in Root-Finding
In this assignment, you will study the roots of the nonlinear equation
f(x) = cos(x) + 1
1 + e2x
both theoretically and numerically.
(a) Plot f(x) on the interval x ∈ [ 15, 15] and describe the overall behaviour of the function as
well as the number and location of its roots. Use the “zoom” feature of Matlab’s plotting
window (or change the axis limits) in order to ensure that you are identifying all roots – you
may have to increase your plotting point density in order to see sufficient detail!
(b) Consider what happens to the function for large |x| by computing these two limits of the
exponential part of f(x):
lim x→−∞
11 + e2xand lim x→+∞ 11 + e2x
Use these results to determine two simpler “limit functions” that approximate the two halves
of f(x):
❼ for x < 0, f (x) approximates f for large and negative values of x, ❼ for x > 0, f+(x) approximates f for large and positive values of x.
Plot f±(x) on their corresponding intervals along with the original function f(x). Then,
derive analytically the exact values for all roots of f (x) (for x < 0) and f+(x) (for x > 0).
Add these roots to your plot and comment on how they relate to the zeroes of f(x).

(c) Use the Bisection Method to determine the smallest positive root of f(x) (call it x∗
) to within
an absolute tolerance of 10 6
. You are welcome to use the bisect2.m code from class, and
choose an initial bracket motivated by your plot from part (b). Compare your solution x∗
to
the smallest root of f+(x) (call it x+) that you determined analytically in (b). How well does
x+ approximate the actual root x∗?
(d) Next, use Bisection to approximate the first negative root of f(x) (the one that’s smallest
in magnitude). Explain how you decide on an appropriate initial interval that brackets the
root. How does your solution compare with the corresponding root of f (x)?
(e) Finally, consider the following fixed point iteration
xk+1 = g(xk) = arccos  1
1 + e2x 
and show that finding a fixed point of g(x) is equivalent to finding a root of f(x) = 0. Use
the code fixedpt.m to try to approximate the same negative root as in part (d) using an
initial guess of x0 = 3. Can you explain why your iteration behaves as it does?
Hint: Plot the fixed-point function and think convergence!

• QQ：99515681
• 邮箱：99515681@qq.com
• 工作时间：8:00-23:00
• 微信：codehelp