1. Find the roots of the polynomial y = x3 - 3x2 + 2x using the command roots.
2. Evaluate the function
for x = -2 to x = -1 in steps of 0.1.
3. Debug the code which is supposed to set up the function f(x) = x3 cos(x + 1) on the grid x = 0 to 3 in steps of 0.1 and give the value of the function at x = 2 and x = 3.
4. Use the bisection method to determine the zero of the function f(x) = 2x2 - x3 + sinx between one and three. You will need to enter the codes bisect.m, mbisect.m and func.m. The code bisect.m does not need modification: however you need to change func.m to evaluate the function f(x) at a point x (again remember to use the dots in the correct place). You also need to change mbisect.m to reflect the fact that we are seeking a zero of the function defined in func.m in the range 1 to 3.
5. Using the Newton–Raphson method calculate the roots of the functions f(x) = xcosx - sinx and g(x) = (x3 - x)sinx. These should be done as two separate calculations. You will need to write two MATLAB functions for each case to evaluate the function and its derivative. These should be called func.m and func prime.m so that they can be called from Newton Raphson.m (alternatively you could change the line in Newton Raphson.m to reflect that you are using different function names).
6. Using the command roots calculate the solutions of the equations
x3 + x2 + x + 1 = 0 and - 2x + x5 + x2 = 4.
Here you need to be careful that the coefficients of the polynomials are entered correctly as vectors.
7. Perform these calculations both by hand and using MATLAB:
8. Calculate the product AB and BA for a variety of two-by-two matrices. Attempt to work out which matrices of the general form
commute with matrices of the form
(that is, which matrices does AB = BA hold for?). Verify that your answer is correct by trying some examples; the more obscure the numbers you use the more unlikely your result is not a fluke.
9. Show that for all square matrices A, the matrices B = A+AT and C = A - AT are symmetric and anti-symmetric respectively.
10. Solve the linear system of equations
x + y + 2z = 1
x - y - 3z = 0
-2x - 5y + z = 4.
11. Given the matrices
A , B and C .
Calculate where possible A + B, AC, CB, (A - B)C and AC - BC. (using MATLAB)
12. Calculate the quantities
(i) (ii) . using MATLAB .