You are on page 1of 4

Program #1:

You are to generate 2 pieces of C++ code:

1) Makemat
2) Gaussian_solver

Makemat

1) User inputs value N = number of rows and columns in the matrix


2) Generate a random matrix A[n][n] and a solution vector soln[n]
3) Ensure ‘A’ is diagonally dominant e.g. set the diagonal to 10*the sum of the absolute values in
each row
4) Multiply A*soln to get b[n]
5) Write a file with N and A[n][n] and b[n]
6) Exit

Gaussian solver

1)Load the file from Makemat and solve them.

2)Compute and display the two norm of the error

Program#2

You are to generate 1 piece of C++ code:

1)LU Decomposition solver

LU Decomposition Solver:

1)Include the Makemat functions from program#1

2)Load the file from Makemat and solve them using UL Decomposition..
Program#3

You are to generate 3 pieces of C++ code:

1)Jacobi method

2)Gauss-seidel method

3) Successive Over-Relaxation (SOR) method

Jacobi method:

1)include the makemat functions from program #1

2) Load the file from Makemat and solve them using Jacobi method

3)display the solution normalized just means you divide the two norm by N

Gauss-seidel method:

1) Load the file from Makemat and solve them using Gauss-seidel method
2) display the solution normalized just means you divide the two norm by N

Successive Over-Relaxation (SOR) method:

1) Load the file from Makemat and solve them using Successive Over-Relaxation (SOR) method
2) display the solution normalized just means you divide the two norm by N

Please, if you have not done so already, please display the makemat matrix A, soln and right side b to
the screen as well as the two norm and the number of iterations.
Program#4

You are to generate 2 pieces of C++ code:

1)Power method

2)Newton’s method

Power method:

1) use the power method to solve the following problem:

-use initial guess to be [1, 1, 1]


| 0, 11, -5 |
|-2, 17, -7|
|-4, 26, -10| sorry for strange looking row by row matrix presentation, BB didnt like
the original.
The solution should be |0.4, 0.6, 1.0| ish

Newton’s method:

1) use the Newton’s method to solve the following problem:

f(x) = x − e^(-x2)
this is e to the -x squared power. you should get something around .653 for your solution.
print x, and f(x) for each iteration
Program#5

You are to generate 2 pieces of C++ code:

1)Bisection method

2)Euler’s method

Bisection method:

1) use Bisection method to solve the following problem:


3x/2 - 6 − sin(2x)/2 = 0 has a unique real root (supposedly between 0 and 5) use bisection
to compute to 3 decimal places of accuracy.

Euler’s method:

use Euler’s method

1) to solve the following problem:


dy/dx = y^2 - x^2 and y0 = -1 and dx = .5 to find the solution at x = 1.5

You might also like