代写DSA2102 Essential Data Analytics Tools: Numerical Computation

- 首页 >> Python编程

DSA2102 Essential Data Analytics Tools: Numerical Computation

Semester 2, AY 2023/2024

Homework 1

1. [6 points] Assuming that we are working in a machine where only 3 bits are allocated for storing the mantissa. Suppose the Rounding to Nearest Rule is used in this machine, i.e. (1.00111)2 × 23 will be stored as (1.010)2 × 23.

Compute (a) 7/4 + 4/1, (b) 7/4 × 4/1

In each computation, solve the problem

(i) exactly

(ii) using the three-digit rounding arithmetic

(iii) compute the absolute errors in part (ii)

2. [10 points] Assume n ≥ 3. Suppose A ∈ R n×n is an upper triangular matrix and B ∈ R n×n is a matrix of the following form:

Here, '∗' means the entry is non-zero, and empty space means the entry is zero. (Note: B has n + 2 nonzero entries in total, distributed at the diagonal, bottom left and upper right corner.)

What is the time complexity (in the worst case scenario, i.e. all ‘*’ are nonzero and no omission can be done) for an efficient algorithm to compute C = AB? You are not required to write the exact pseudocode. However, you should explain your solution clearly and try to find the most efficient algorithm.

3. [6 points] Let u, v and w be three n-dimensional column vectors. We would like to compute r = uvTw, which is also an n-dimensional vector. Justify your answer on which of the following sequence of computation is better:

(uvT)w or u(vTw)?

4. [8 points] An object falling vertically through the air is subjected to viscous resistance as well as to the force of gravity. Assume that an object with mass m is dropped from a height s0 and that the height of the object after t seconds is

where g = 32.17 ft/s2 and k = 0.1 lb-s/ft represents the coefficient of air resistance. Suppose s0 = 400 ft and m = 0.2 lb. Find, to within 0.01 second (error < 0.005), the time this object takes to hit the ground.

Solve the problem using bisection method:

(a) Write down the equation in the form f(t) = 0 that you need to solve to obtain the solution t.

(b) Justify your choice of the starting interval. Run bisection method using python (with the code provided in lecture) to find the solution.

5. [10 points] Consider the equation x 3−2x 2−13x+30 = 0, with root r = 3. Add the term cx to both sides and divide by c to obtain the fixed point equation

g(x) = x.

(a) For what values of c is the fixed point iteration locally convergent to r = 3?

(b) For what value of c will fixed point iteration converge fastest?

6. [10 points] Use Gaussian elimination with scaled partial pivoting to solve the linear system represented by the augmented matrix:

Write down the row labels and the augmented matrix after elimination without unnecessary changes of matrix entries. When row swapping is necessary, you should just change the row labels instead.


站长地图