When writing a new program for a numerical method, it is common to first write psuedocode using pencil and paper.
When writing pseudocode, we usually need to answer some basic questions, such as:
Pseudocode for a course like ours typically starts with a specification of input, a declaration of output, initialization of parameters, a computational loop (such as a for loop), an output statement, and a STOP command.
Write pseudocode for adding up the values of the entries in \( \mathbf{x} \).
\[ \mathbf{x} = [x_1,x_2,\ldots,x_n] \]
Write pseudocode for adding up the values of the entries in the matrix \( A \) using row sums (add across rows).
\[ A = \begin{bmatrix} a_{11} & a_{12} & \cdots & a_{1n} \\ a_{21} & a_{22} & \cdots & a_{2n} \\ \vdots & \vdots & \ddots & \vdots \\ a_{m1} & a_{m2} & \cdots & a_{mn} \end{bmatrix} \]
Write pseudocode for adding up the values of the entries below the main diagonal in the matrix \( A \), using column sums.
\[ A = \begin{bmatrix} a_{11} & a_{12} & \cdots & a_{1n} \\ a_{21} & a_{22} & \cdots & a_{2n} \\ \vdots & \vdots & \ddots & \vdots \\ a_{m1} & a_{m2} & \cdots & a_{mn} \end{bmatrix} \]
Write pseudocode for adding up the values of the entries above the main diagonal in the matrix \( A \), using column sums.
\[ A = \begin{bmatrix} a_{11} & a_{12} & \cdots & a_{1n} \\ a_{21} & a_{22} & \cdots & a_{2n} \\ \vdots & \vdots & \ddots & \vdots \\ a_{m1} & a_{m2} & \cdots & a_{mn} \end{bmatrix} \]