

Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!


Guidelines: This is a closed book and closed notes exam. No calculator or computer allowed. Clearly explain your answers to each of the question and write your solution neatly. Detail all necessary intermediate steps and clearly identify your final answers (e.g. box them in). Do not forget to put your name and student ID on your test and staple/attach all the pages together.
Write a short Matlab function that takes only one argument n and returns the factorial of n for n ≥ 0 (remember the convention 0! = 1).
Consider the matrix A =
The function f (x) = x^3 + 2x − 3
has a root at x = 1. Construct a fixed-point iteration scheme of the form
x(n+1)^ = g(x(n))
that will converge to this root with a quadratic rate of convergence, given an initial guess sufficiently close to the root.
f (x) = 1 − x + x^2 − x^3 + O(x^4 ).
1 + y in y = 0 up to O(y^4 ) is:
h(y) = 1 + y 2
y^2 8
y^3 16
1 −x 1+x in x = 0 up to O(x^4 ).
Consider the following matlab function Thomas.m that solves a tridiagonal system Ax = b.
function x=Thomas(a,b,c,r)
% Solve for x in A.x=b for A tridiagonal using Thomas algorithm % Inputs: a: subdiagonal of A % b: main diagonal of A % c: super diagonal of A % r: right hand side of the equation % outputs: x: solution
% Forward elimination n=length(b); for j=2:n, factor=a(j)/b(j-1); b(j)=b(j)-factorc(j-1); r(j)=r(j)-factorr(j-1); end
% Backward substitution
x=zeros(n,1); x(n)=r(n)/b(n); for j=n-1:-1:1, x(j)=(r(j)-c(j)*x(j+1))/b(j); end