CE3102: Numerical Analysis for Engineering
Computer Engineering
Semester: II - 2019
This assignment consists of solving the following problem.
Problem A: Let
where
-
Implement a function named
thomas
that solves a linear system of the form$Az = b$ , where$A$ is an invertible tridiagonal matrix of size$m \times m$ and$b, z$ are column vectors of size$m$ . The function receives the matrix$A$ and the vector$b$ as input parameters, and the output parameter is the vector$z$ that solves the system$Az = b$ . -
Implement the finite difference method that solves Problem A. To do this, create a function named
edo2
, whose initial parameters are the functions$p$ ,$q$ , and$f$ , the step size$h$ , the values$a$ ,$b$ of the interval, and the initial values$y_{0}$ ,$y_{n}$ . The output parameters are the vectors$x = [x_0, x_1, ..., x_n]^T$ and$y = [y_0, y_1, ..., y_n]^T$ .Note: The function
edo2
needs to solve a system of linear equations whose coefficient matrix is a tridiagonal matrix. To solve this system, use thethomas
function implemented in Question 1. -
Implement a script to approximate the solution of the problem
To do this, generate an animation in which every 2 seconds a new graph appears representing an approximation of the solution to the differential equation with different values of
The animation should indicate a legend for each graph.