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

Numerical Mathematics and Computing
Seventh 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: Mathematical Preliminaries and Floating-Point Representation
sineplot Plots of partial series for sin(x)
sin Sine series expansion and plot
series Taylor series expansions
numbers Examples of numbers in different bases
precision Machine precision and accuracy
Chapter 2: Linear Systems
lin_sys1 Linear system first example
lin_sys2 Linear system second example
Chapter 3: Nonlinear 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
cos-exp Numerical integration example: cos(2x)/exp(x)
cp6-2-8 Computer Problem 6.2.8
Chapter 6: Spline Functions
cubic_spline1 Cubic spline Example 1
cubic_spline2 Cubic spline Example 2
bezier Bezier polynomial example
Chapter 7: Initial Value Problems
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
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 8: More on Linear Systems
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 Least Squares Methods and Fourier Series
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 10: Monte Carlo Methods and Simulation
ran_num_exps Examples using random numbers
Chapter 11: Initial Value Problems
bvp1 Two-point boundary-value problem Example 1
bvp2 Two-point boundary-value problem Example 2
Chapter 12: Partial Differential Equations
heat Parabolic PDE: solve heat eqn. & plot
wave Hyperbolic PDE: solve wave eqn. & plot
Chapter 13: Minimization of Functions
min_val1 Minimizing multivariate functions
min_val2 Find local minimum of a function
taylor_series Taylor series in two variables
Chapter 14: Linear Programming Problems
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:

ftp://ftp.ma.utexas.edu/pub/cheney-kincaid/


[Home] [Features] [TOC] [Purchase] [ Codes] [Web] [Manuals] [Errata] [Links]

  Last updated: 15 July 2012