Assignment [group of three students)
1. Solve the following system of equations with the Gauss elimination method.
2 x1 + x2 − x3 + 4 x4 = 19
− x1 − 2 x2 + x3 + 2 x4 = −3
2 x1 + 4 x2 + 2 x3 + x4 = 25
− x1 + x2 − x3 − 2 x4 = −5
2. Solve the following system of equations using the Gauss-Jordan method.
4 x1 + x2 + 2 x3 = 21
2 x1 − 2 x2 + 2 x3 = 8
x1 − 2 x2 + 4 x3 = 16
3. Carry out the first three iterations of the solution of the following system of equations using
the Gauss-Seidel iterative method. For the first guess of the solution, take the value of all the
unknowns to be zero.
8 x1 + 2 x2 + 3x3 = 51
2 x1 + 5 x2 + x3 = 23
−3x1 + x2 + 6 x3 = 20
4. Apply the Jacobi method to the given system of linear equations; continue performing
iterations until two successive approximations are identical when rounded to three significant
digits.
5. The following data is given:
x 2 4 7 8 11
y 0.5 1 3 11 9
1
Determine the coefficients m and b in the function 𝑦 = 𝑚𝑥+𝑏 that best fit the data. Write the
equation in a linear form and use linear least-squares regression to determine the value of the
coefficients.
6. Given the data
x 1 2 2.5 3 4 5
Computational Methods Assignment/project sub date:08/10/2015 E.C till 5:00LT
F(x) 1 5 7 8 2 1
Fit these data with a cubic spline with natural end conditions, and evaluate the value at x=3.5
5. Use Newton’s interpolating polynomial and cubic spline interpolation to determine y at x =
8 to the best possible accuracy. For the following data.
Project (individual)
1. Write a MATLAB user-defined function that determines the coefficients of a cubic polynomial,
Si ( x) = a + b( x − xi) + c( x − xi )2 + d ( x − xi )3 that best fits a given set of data points. Name the
function y = CubicPolyFit (x, y), where the input arguments x and y are vectors with the
coordinates of the data points, and the output argument y is a four-element vector with the
values of the coefficients a, b, c and d.
2. A new method for solving a nonlinear equation f(x) =0 is proposed. The method is similar to
the bisection method. The solution starts by finding an interval [a, b] that brackets the solution.
The first estimate of the solution is the midpoint between x =a and x = b. Then the interval [a,
b] is divided into four equal sections. The section that contains the root is taken as the new
interval for the next iteration.
Write a MATLAB user-defined function that solves a nonlinear equation with the proposed new
method. Name the function Xs = QuadSecRoot(Fun, a, b), where the output argument Xs is the
solution. The input argument Fun is a name for the function that calculates f(x) for a given x (it is
a dummy name for the function that is imported into QuadSecRoot), a and bare two points that
bracket the root. The iterations should stop when the tolerance, is smaller than 10-6xNs
3. Write a user-defined MATLAB function that solves a system of n linear equations, [a][x] = [b],
with the Gauss-Jordan method. The program should include pivoting in which the pivot row is
switched with the row that has a pivot element with the largest absolute numerical value. For
the function name and arguments use x = GaussJordan (a, b), where a is the matrix of
coefficients, bis the right-hand-side column of constants, and x is the solution.
Computational Methods Assignment/project sub date:08/10/2015 E.C till 5:00LT