You are on page 1of 3

Numerical Methods – Exercises (1+)2 - 2024

to be handed in on Friday 23 Feb – Upload on brightspace!

Part I – for in the tutorial

1. Solve the equations AX = B by Gauss=Jordan elimination, where

( ) ( )
2 0 −1 0 1 0
A= 0 1 2 0
and B= 0 0
−1 2 0 1 0 1
0 0 1 −2 0 0

2. Determine the coefficients of the polynomial y = a 0+ a1 x+ a2 x 2 +a3 x 3 that passes


through the points (0,7), (1,11.5), (3,31) and (4,2).

3. Solve the tridiagonal equations AX = B using Doolittle’s decomposition method, where

( ) ()
6 2 2 0 0 2
−1 7 2 0 0 −3
A= 0 −2 8 2 0 and B= 4
0 0 3 7 −2 −3
0 0 0 3 5 1

( ) ( )
3
−1 2 0 1 3
4. Let A= 0 1 3 and B= 3 −1 2
−2 2 −4 −2 2 −4

( )
1 1
0
2 4
3 4 9
Knowing that A−1= determine B−1
10 10 20
1 1 3
− −
10 5 20

5. Invert the triangular matrices

( ) ( )
2 4 3 2 0 0
A= 0 6 5 and B= 3 4 0
0 0 2 4 5 6
6. Determine the condition number for the following system system using the row-sum
norm. Do not normalize the system:

( )
1 4 9 16 25
4 9 16 25 36
A= 9 16 25 36 49
16 25 36 49 64
25 36 49 64 81

Now repeat this, but scale the matrix by making the maximum element in each row equal to
one.

7. Write a program for solving AX = b using the Gauss-Seidel method using the function
gaussSeidel (see Kiusalaas). Input should consist of the matrix A and the vector B. Test the
program with

Note that A is not diagonally dominant, but this does not necessarily preclude convergence,

Part II: to be handed in.

8. i) Solve the tridiagonal system A x = b, using LU decomposition

( ) ( )
0.8 −0.4 0 41
A= −0.4 0.8 −0.4 and b= 25
0 −0.4 0.8 105

ii) Determine the inverse of the matrix A

9. Use the Gauss-Seidel method (a) without relaxation and (b) with relaxation (λ=1.2) to
solve the following system to a tolerance ε=5%. If necessary, rearrange the equations to
achieve convergence.
2 x 1−6 x 2−x 3 = −38
−3 x1 −x2 +7 x 3 = −30
−8 x 1+ x 2−2 x 3 = −20

10. To calculate the spatial coordinates of a planet, we have to solve the following function:

f (x) = x−1−0.5 sin x

Determine the lowest order Taylor expansion resulting in a maximum error of 0.0015 on the
interval [0,π].

11-13: These are exercises to get acquainted with ChatGPT, a language model nased on
Artificial Intelligence. ChatGPT is quite a powerful AI system, able to do a lot of the work
that you should have to do yourself. To get an idea of what ChatGPT can do, please do the
following exercise.

Make an account on https://chat.openai.com/ to start using the ChatGPT system. Get used to
the system by asking some questions.

Now find the solution of exercises 8,9 and 10 using ChatGPT. In each case answer whether
the answer is correct, and if not, explain why the answer is not correct. Are the answers
always the same?

You might also like