These notes for Scientific Computing is primarily for Math majors and supposes no previous knowledge of numerical analysis or methods. This course consists of both numerical methods and computational physics. The numerical methods content includes standard topics such as IEEE arithmetic, root finding, linear algebra, interpolation and least-squares, integration, differentiation, and differential equations. The physics content includes nonlinear dynamical systems with the pendulum as a model, and computational fluid dynamics with a focus on the steady two-dimensional flow past either a rectangle or a circle.
Numerical Methods
The first part of this course consists of a concise introduction to numerical methods. We begin by learning how numbers are represented in the computer using the IEEE standard, and how this can result in round-off errors in numerical computations. We will then learn some fundamental numerical methods and their associated MATLAB functions. The numerical methods included are those used for root finding, integration, solving differential equations, solving systems of equations, finite difference methods, and interpolation.
IEEE Arithmetic
Definitions
The real line is continuous, while computer numbers are discrete. We learn here how numbers are represented in the computer, and how this can lead to round-off errors. A number can be represented in the computer as a signed or unsigned integer, or as a real (floating point) number. We introduce the following definitions:
Typically, scientific computing in MATLAB is in double precision using 8-byte real numbers. Single precision may be used infrequently in large problems to conserve memory. Integers may also be used infrequently in special situations. Since double precision is the default-and what will be used in this class-we will focus here on its representation.
Adaptive integration
The useful MATLAB function quad.m performs numerical integration using adaptive Simpson quadrature. The idea is to let the computation itself decide on the grid size required to achieve a certain level of accuracy. Moreover, the grid size need not be the same over the entire region of integration.
Differential Equations
We now discuss the numerical solution of ordinary differential equations. We will include the initial value problem and the boundary value problem.
Partial pivoting
When performing Gaussian elimination, the diagonal element that one uses during the elimination procedure is called the pivot. To obtain the correct multiple, one uses the pivot as the divisor to the elements below the pivot. Gaussian elimination in this form will fail if the pivot is zero. In this situation, a row interchange must be performed.
Even if the pivot is not identically zero, a small value can result in big round-off errors. For very large matrices, one can easily lose all accuracy in the solution. To avoid these round-off errors arising from small pivots, row interchanges are made, and this technique is called partial pivoting (partial pivoting is in contrast to complete pivoting, where both rows and columns are interchanged). We will illustrate by example the LU decomposition using partial pivoting.