Numerical Mathematics and Computing, 5th Ed. - Matlab Codes

# Numerical Mathematics and Computing Fifth Edition Ward Cheney & David KincaidSample Matlab Codes

In the following table, each line/entry contains the name of the computer file, the page number where it can be found in the textbook, and a brief description. Click on the program name to display the source code, which can be downloaded.
 Chapter 1: Introduction sineplot.m 20 Graph of Taylor series partial sums for sin(x) (invoking s1.m, s2.m, s3.m) sqrt_approx.m 27 Variable precision arithmetic for approximation Chapter 2: Number Representation and Errors format.m 51-52 Numbers in different formats accuracy.m 81 Numbers with different accuracy Chapter 3: Locating Roots of Equations fcn_roots.m 98 Roots of functions or polynomials (invoking G.m) poly_roots1.m 108 Roots of a cubic polynomial newton_sys.m 114 Example of Newton's method for solving a nonlinear system gauss_newton.m 114-115 Newton's method for solving nonlinear systems (invoking Fcn.m) fractal.m 115,124 Fractal basins of attraction (CPb. 3.2.27) poly_roots2.m 128 Roots of a fifth degree polynomial Chapter 4: Interpolation and Numerical Differentiation newtn_int_poly.m 155 Newton interpolation polynomial equidistant pts inverse_interp.m 156-157 Inverse Newton interpolation polynomial example runge_fcn.m 171 Polynomial interpolation for the Runge function Chapter 5: Numerical Integration num_int1.m 202 Numerical integration of exp(-x*x) (invoking f1.m) num_int2.m 208 Numerical integration of sin(x)/x (invoking f2.m) Chapter 6: More on Numerical Integration num_int3.m 242 Numerical intergratin of cos(2*x)/exp(x) (invoking f3.m) cpb6_2_8.m 260 Computer Problem 6.2.8: Numerical intergration example cpb6_2_9.m 260 Computer Problem 6.2.9: Difficult Numerical intergration Chapter 7: Systems of Linear Equations gauss_elim1.m 265-266 Gaussian elimination to solve linear systems gauss_elim2.m 289 Gaussian elimination to solve linear systems Chapter 8: More on Systems of Linear Equations ldl.m 323-324 LDL Factorization lu_fact.m 328 LU Factorization eig.m 358 Eigenvalue Example null.m 358 Null Space Example timing.m 359 Timing eigenvalue computation sng_val_decomp.m 367 Singular value decompositon of a matrix cpb8_3_1d.m 371 Computer Problem 8.3.1d mod_power.m 375 Modified Power Method small_eig.m 376-377 Small eigenvalue inv_power.m 377-378 Inverse Power Methods shift_inv_power.m 379 Shifted Inverse Power Mehtod Chapter 9: Approximation by Spline Functions spline_sin_plot.m 406 Plot of a cubic spline curve for sin(x) spline_plot.m 408 Plot of a cubic spline curve Chapter 10: Ordinary Differential Equations euler.m 449-450 Euler's method for solving an ODE (invoking f.m) rk_ode23.m 463 Runge-Kutta method for solving an IVP (invoking ode23file1.m) rkf_ode45.m 475-476 Runge-Kutta Fehlberg method for solving an IVP (invoking ode45file1.m) Chapter 11: Systems of Ordinary Differential Equations rk2_ode23.m 494 Runge-Kutta method for systems of ODEs (invoking ode23file2.m) rkf2_ode45.m 503 Runge-Kutta-Fehlberg method for systems of ODEs (invoking ode45file2.m) Chapter 12: Smoothing of Data and the Method of Least Squares ls_fit.m 523 Linear least squares fit for polynomials np_ls_fit.m 525-526 Least squares fit for a non-polynomial function p_inv1.m 552 Minimal solution using pseudoin of matrices p_inv2.m 554 Find pseudoinverse in case of loss in rank Chapter 13: Monte Carlo Methods and Simulation rand.m 560,563 Examples using random numbers Chapter 14: Boundary Value Problems for Ordinary Differential Equations bvp.m 608 Two-point boundary-value problem example (invoking bvpfcn.m, bvpbc.m) Chapter 15: Partial Differential Equations heat.m 623-625 Heat Equation (invoking pdexlpde.m, pdexlic.m, pdexlbc.m) par.m 625-626 Parabolic Equation (PDEDEMO5) wave.m 635 Wave Equation (PDEDEMO6) poisson.m 646 Poisson Equation (PDEDEMO1) fast.m 646 Fast Equation (PDEDEMO8) helm.m 646-647 Helmholtz Equation (PDEDEMO2) Chapter 16: Minimization of Functions fmin1.m 657 Minimizing multivariate functions fmin2.m 658 Find local minimum of a function Chapter 17: Linear Programming lin_prog1.m 694 Maximize subject to inequality constraints lin_prog2.m 698 Minimize subject to inequality constraints lin_prog3.m 713 Minimize subject to equality constraints lin_prog4.m 715 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] [Sample Code] [Web] [Manuals] [Errata] [Links]

 Last updated: 5/20/2003