Contents

1 Approximate Numbers
1.1 Sources of errors in numerical calculations
1.2 Absolute and relative errors
1.3 Representation of numbers
1.4 Significant digits
1.5 Errors of elementary operations
1.5.1 Error of a sum
1.5.2 Error of a difference
1.5.3 Error of a product
1.5.4 Error of a quotient
References

2 Basic Programming Techniques
2.1 Programming concepts
2.2 Functions and parameters
2.3 Passing arguments to Python functions
2.4 Passing arguments to C/C++ functions
2.5 Arrays in Python
2.6 Dynamic array allocation in C/C++
2.7 Basic matrix operations
References

3 Elements of Scientific Graphics
3.1 The Tkinter package
3.2 The Canvas widget
3.2.1 Commonly used Canvas items
3.2.2 Methods for updating Canvas widgets
3.3 Simple Tkinter applications
3.4 Plotting functions of one variable
3.5 The graphics library graphlib.py
3.5.1 Auxiliary functions
3.5.2 Routines for plotting functions
3.5.3 Simple 3D rendering routines
3.5.4 Histograms
3.6 Creating plots in C++ using the library graphlib.py
References

4 Sorting and Indexing
4.1 Introduction
4.2 Bubble sort
4.3 Insertion sort
4.4 Quicksort
4.5 Indexing and ranking
4.6 Implementations in C/C++
4.7 Problems
References

5 Evaluation of Functions
5.1 Evaluation of polynomials by Horner's scheme
5.2 Evaluation of analytic functions
5.3 Continued fractions
5.4 Orthogonal polynomials
5.5 Spherical harmonics. Associated Legendre functions
5.6 Spherical Bessel functions
5.7 Implementations in C/C++
5.8 Problems
References

6 Algebraic and Transcendental Equations
6.1 Root separation
6.2 Bisection method
6.3 Method of false position
6.4 Method of successive approximations
6.5 Newton's method
6.6 Secant method
6.7 Birge-Vieta method
6.8 Newton's method for systems of nonlinear equations
6.9 Implementations in C/C++
6.10 Problems
References

7 Systems of Linear Equations
7.1 Introduction
7.2 Gaussian elimination with backward substitution
7.3 Gauss-Jordan elimination
7.4 LU factorization
7.5 Inversion of triangular matrices
7.6 Cholesky factorization
7.7 Tridiagonal systems of linear equations
7.8 Block tridiagonal systems of linear equations
7.9 Complex matrix equations
7.10 Jacobi and Gauss-Seidel iterative methods
7.11 Implementations in C/C++
7.12 Problems
References

8 Eigenvalue problems
8.1 Introduction
8.2 Diagonalization of matrices by similarity transformations
8.3 Jacobi method
8.4 Generalized eigenvalue problems for symmetric matrices
8.5 Implementations in C/C++
8.6 Problems
References
9 Modeling of Tabulated Functions
9.1 Interpolation and regression
9.2 Lagrange interpolation polynomial
9.3 Neville's interpolation method
9.4 Cubic spline interpolation
9.5 Linear regression
9.6 Multilinear regression models
9.7 Nonlinear regression. The Levenberg-Marquardt method
9.8 Implementations in C/C++
9.9 Problems
References

10 Integration of Functions
10.1 Introduction
10.2 Trapezoidal Rule; A Heuristic Approach
10.3 The Newton-Cotes Quadrature Formulas
10.4 Trapezoidal Rule
10.5 Simpson's Rule
10.6 Adaptive Quadrature Methods
10.7 Romberg's Method
10.8 Improper Integrals: Open Formulas
10.9 Midpoint Rule
10.10 Gaussian Quadratures
10.11 Multidimensional integration
10.12 Adaptive multidimensional integration
10.13 Implementations in C/C++
10.14 Problems
References

11 Monte Carlo Method
11.1 Introduction
11.2 Integration of functions
11.3 Importance sampling
11.4 Multidimensional integrals
11.5 Generation of random numbers
11.6 Implementations in C/C++
11.7 Problems
References

12 Ordinary Differential Equations
12.1 Introduction
12.2 Taylor series method
12.3 Euler's method
12.4 Runge-Kutta methods
12.5 Adaptive step size control
12.6 Methods for second-order ODEs
12.7 Numerov's method
12.8 Shooting methods for two-point problems
12.9 Finite-difference methods for linear two-point problems
12.10 Implementations in C/C++
12.11 Problems
References

13 Partial Differential Equations
13.1 Introduction
13.2 Boundary-value problems for elliptic differential equations
13.3 Initial-value problems for parabolic differential equations
13.3.1 Explicit finite-difference method
13.3.2 von Neumann stability analysis
13.3.3 Implicit finite-difference method
13.3.4 Crank-Nicolson method
13.3.5 Spatially variable diffusion coefficient
13.4 Time-dependent Schrödinger equation
13.5 Initial-value problems for hyperbolic differential equations
13.6 Implementations in C/C++
13.7 Problems
References

A Dynamic array allocation in C/C++

B Basic operations with vectors and matrices

C Embedding Python in C/C++
References

D The numerical libraries numxlib.py and numxlib.h

E The graphics library graphlib.py based on Tkinter

F The C++ interface to the graphics library graphlib.py

G List of programs by chapter

Index