Numerical Mathematics and Computing, 6th Ed. - Sample Mathematica Codes

Numerical Mathematics and Computing
Sixth Edition
Ward Cheney & David Kincaid
Sample Mathematica Codes

In the following table, each line/entry contains the code file name and a brief description. Click on the program name to display the source code, which can be downloaded.
Chapter 1: Introduction
sineplot Plots of partial series for sin(x)
sin Sine series expansion and plot
series Taylor series expansions
Chapter 2: Number Representation and Errors
numbers Examples of numbers in different bases
precision Machine precision and accuracy
Chapter 3: Locating Roots of Equations
bisect Bisection example
newt Newton's method example
newt_sys Newton's method for system of equations
secant Examples associated with Secant
Chapter 4: Interpolation and Numerical Differentiation
newt_interp1 Newton interpolation polynomial example (5 data points)
newt_interp2 Newton interpolation polynomial example (4 data points)
newt_interp_sin Newton interpolation (sin(x) at 10 equidistant ponts)
inv_interp Newton inverse interpolation example
runge_fcn Newton interpolation Runge function
derivative Newton interpolation example 1
Chapter 5: Numerical Integration
error_integral1 Numerical integration: error integral
sine_integral Numerical integration: sine integral
error_integral2 Numerical integration: exp(-x*x)
bernoulli Bernoulli polynomials
Chapter 6: More on Numerical Integration
cos-exp Numerical integration example: cos(2x)/exp(x)
cp6-2-8 Computer Problem 6.2.8
Chapter 7: Systems of Linear Equations
lin_sys1 Linear system first example
lin_sys2 Linear system second example
Chapter 8: More on Systems of Linear Equations
lu_factor LU factorization
char_poly Characteristic polynomial example
null Null space example
timing Timing example
eigen Eigenvalue/eigenvector example
schur Schur form example
svd Singular Value Decomposition example
Chapter 9: Approximation by Spline Functions
cubic_spline1 Cubic spline example 1
cubic_spline2 Cubic spline example 2
bezier Bezier polynomial example
Chapter 10: Ordinary Differential Equations
explicit Explicit solution of an ODE
practial Practial ODE example
ode1 Numerical solution of an ODE
ode2 Numerical solution of an ODE
ode3 Numerical solution of an ODE
ode4 Numerical solution of an ODE
Chapter 11: Systems of Ordinary Differential Equations
ode_sys1 Analytic/numerical solution systems of ODE 1
ode_2nd_order Second order IVP
ode_high_order High order IVP
ode_sys2 Analytic/numerical solution systems of ODE 2
Chapter 12: Smoothing of Data and the Method of Least Squares
ls_fit Linear least squares fit for polynomials
np_ls_fit Least squares fit of a non-polynomial function
cheby Plot of Chebyshev polynomials
p_inv1 Minimal solution using pseudo-inverse of matrices
p_inv2 Find pseudo-inverse in case of loss in rank
Chapter 13: Monte Carlo Methods and Simulation
ran_num_exps Examples using random numbers
Chapter 14: Boundary Value Problems for Ordinary Differential Equations
bvp1 Two-point boundary-value problem example 1
bvp2 Two-point boundary-value problem example 2
Chapter 15: Partial Differential Equations
heat Parabolic PDE: solve heat eqn. & plot
wave Hyperbolic PDE: solve wave eqn. & plot
Chapter 16: Minimization of Functions
min_val1 Minimizing multivariate functions
min_val2 Find local minimum of a function
taylor_series Taylor series in two variables
Chapter 17: Linear Programming
lin_prog1 Maximize subject to inequality constraints
lin_prog2 Minimize subject to inequality constraints
lin_prog3 Minimize subject to equality constraints
lin_prog4 Minimize subject to inequality constraints

Addditional programs can be found at the textbook's anonymous ftp site:

[Home] [Features] [TOC] [Purchase] [Sample Code] [Web] [Manuals] [Errata] [Links]

  Last updated: 25/07/2007