[SOLVED] matlabECS130 Homework Assignment #2

$25

File Name: matlabECS130_Homework_Assignment_#2.zip
File Size: 329.7 KB

5/5 - (1 vote)

ECS130 Homework Assignment #2 Due: 4:00pm, Feburary 3, 2017 1. A real symmetric matrix A = AT is positive definite if any of the following equivalent condi-

tions hold:

  • The quadratic form xT Ax > 0 for all nonzero vectors x.
  • All determinants formed from submatrices of any order centered on the diagonal of A are positive.
  • All eigenvalues of A are positive.
  • There is a lower triangular matrix L such that A = LLT , called Cholesky decomposition

    of A.
    As you can see, the best way to check the positive definiteness is with Cholesky decomposition.

    (a) Let n = 3 and write the formulas for computing the entries lij of L for a given 3 3 symmetric positive definite matrix A.

    (b) Use the observations in (a) to derive formulas to compute the Cholesky decomposition for an n n symmetric positive definite (spd) matrix A.

    (c) Program your formulas to compute the Cholesky decomposition of an n n spd matrix

    A. Check the correctness of your program by comparing with MATLABs built-in function

    cholfor the matrices A = (aij) with aij = 1 with n = 3,4,5. i+j 1

2. Read section 2.9, and present your error analysis for the two computed solutions x =

1.01 and x 2 = 20.97 of the linear system of equations

999 998 1997

1

1.01 18.99
1000 999 x= 1999 .

  1. Assume you have a base-2 computer that stores floating-point numbers using a 6 bit normal- ized mantissa and a 4 bit exponent, and a sign bit for each.

    (a) For this machine, what is machine precision?
    (b) What is the smallest positive normalized number that can be represented in this machine?

  2. Consider the following program
    x = 1;delta = 1 / 2^(53);for j = 1 : 2^(20),
    x = x + delta;end

    By mathematical reasoning, what is the expected final value of x? Use your knowledge of floating-point arithemtic to predict what it actually is. Verify by running the program and explain the result.

  3. Using mathematical reasoning, we know that for any positive number x, 2x is a number greater than x. Is this true of floating-point numbers? Run the following program and explain your result
    x = 1;twox = 2*x;k = 0;while (twox > x)

1

x = twox;twox = 2*x;k = k + 1;

end

  1. The polynomial p1(x) = (x 1)6 has the value zero at x = 1 and is positive elsewhere. The expanded form of the polynomial

    p2(x) = x6 65 + 154 203 + 152 6x + 1,
    is mathematically equivalent. Plot p1(x) and p2(x) for 101 equally spaced points in the interval

    [0.995, 1.005]. Explain the plots. (you should evaluate the polynomial p2(x) by Horners rule).

  2. (a) Write a MATLAB function that computes the two roots of a quadratic polynomial

    q(x) = x2 + bx + c with good precision.
    (b) Compare your computed results with MATLABs built-in function roots([a b c]) for

    the following set of data:

    1) b=56,c=1 2) b=108,c=1.

2

Reviews

There are no reviews yet.

Only logged in customers who have purchased this product may leave a review.

Shopping Cart
[SOLVED] matlabECS130 Homework Assignment #2
$25