Assignment 1 - Summer2021

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 1

Assignment 1

Numerical Methods

Answer the following questions.

1. [10 points] Find the binary representation of 11.47 using IEEE 754 standard 32-bit floating point
number presentation. Find the relative error if chopping is used.
2. [10 points] Prove ∑∞𝑖=𝑡 2
−𝑖
= 21−𝑡 and show the upper bound for relative error on rounding is
2−𝑡 when 𝑡 is the number of bits used to represent the mantissa in IEEE 754 standard.
2
3. [20 points] Consider the following function 𝑓(𝑥) = 𝑒 −3𝑥 .
a. Find the 2nd order Taylor approximation around 𝑥 = 1.
b. Also find the 2nd order Taylor approximation around 𝑥 = 0. Note: The Taylor series or
polynomial approximation around reference point 0 is called the Maclaurin series
approximation.
c. Use OCTAVE to plot the 𝑓(𝑥) and the both the Taylor series for −2 ≤ 𝑥 ≤ 2. Each
should be in different colors and the axis, labels, and title of the plot should printed
appropriately.
d. Compute the mean and standard deviation of the errors in approximation (for −2 ≤
𝑥 ≤ 2) for both Taylor series.
4. Copy the code to the editor, save the script as animate_plot.m and then run the script from the
command window:

clc
x = 1:0.001:2;
y = sin(2*pi*x);
figure
hold on
axis([1 2 -1 1])
for i=1:numel(x)
plot(x(i),y(i),'.','Color','b')
drawnow
end

Submission instruction:

Solve problems 1-3 by hand, take images and paste them in a word doc. For problems 3(c) and (d) paste
the codes, the plot in the doc and write down results.

Convert the doc to a pdf and upload to assignment submission page in google classroom.

The filename must follow the format: your_id-assign1.pdf


(For example, if your id is 177007007 then the file name should be 177007007-assign1.pdf)

You might also like