O'Reilly logo

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Numerical Methods with VBA Programming

Book Description

Numerical Methods with VBA Programming provides a unique and unified treatment of numerical methods and VBA computer programming, topics that naturally support one another within the study of engineering and science. This engaging text incorporates real-world scenarios to motivate technical material, helping students understand and retain difficult and key concepts. Such examples include comparing a two-point boundary value problem to determining when you should leave for the airport to catch a scheduled flight. Numerical examples are accompanied by closed-form solutions to demonstrate their correctness. Within the programming sections, tips are included that go beyond language basics to make programming more accessible for students. A unique section suggest ways in which the starting values for non-linear equations may be estimated. Flow charts for many of the numerical techniques discussed provide general guidance to students without revealing all of the details. Useful appendices provide summaries of Excel and VBA commands, Excel functions accessible in VBA, basics of differentiation, and more!

Table of Contents

  1. Cover Page
  2. Title Page
  3. Copyright Page
  4. Dedication Page
  5. Contents
  6. Preface
  7. Chapter 1 - Introduction
    1. 1.1 Why Numerical Methods?
    2. 1.2 Why Programming?
    3. 1.3 Why Numerical Methods and Programming?
    4. 1.4 Why VBA?
  8. Chapter 2 - Programming Basics: Arithmetic, Input/Output, and All That
    1. 2.1 General Remarks
    2. 2.2 Parts of a Computer Program
    3. 2.3 Opening VBA
    4. 2.4 VBA Statements
    5. 2.5 Input/Output
    6. 2.6 A Simple Program
    7. 2.7 Documentation
    8. 2.8 Running VBA
    9. 2.9 Flowcharts
    10. 2.10 Variable Types
    11. 2.11 Example: The Real Roots of a Quadratic Equation
    12. 2.12 User-Defined Types—Complex Variable Type
    13. 2.13 Debugging
    14. 2.14 File Saving and Security Level
    15. 2.15 A Word of Encouragement
    16. 2.16 Chapter 2 Exercises
  9. Chapter 3 - Errors, Series, and Uncertainty
    1. 3.1 Types of Errors
    2. 3.2 Why Series?
    3. 3.3 Taylor Series
    4. 3.4 Example: The Cosine Function
    5. 3.5 Maclaurin Series
    6. 3.6 An Exponential Example
    7. 3.7 Uncertainty
    8. 3.8 A More Complicated Example
    9. 3.9 Chapter 3 Exercises
  10. Chapter 4 - Decisions and Loops: Which Is Bigger? How Many Times?
    1. 4.1 Why Comparisons?
    2. 4.2 If Statements
    3. 4.3 Else If
    4. 4.4 Boolean Operations
    5. 4.5 Sine Series Program
    6. 4.6 Conditional Loops: The Do While Loop
    7. 4.7 Definite Loops: The For Loop
    8. 4.8 Nested Loops
    9. 4.9 Constant Calculations and Loops
  11. Chapter 5 - Numerical Integration
    1. 5.1 The Basic Idea: Area
    2. 5.2 The Trapezoid Rule
    3. 5.3 Simpson's 1/3 Rule, Something for Nothing
    4. 5.4 Simpson's 3/8 Rule
    5. 5.5 Richardson Extrapolation: A Clever Idea
    6. 5.6 Romberg Integration
    7. 5.7 Integration of Data
    8. 5.8 The Extended Midpoint Rule
    9. 5.9 Chapter 5 Exercises
  12. Chapter 6 - Subprograms and Functions: Useful Specialists
    1. 6.1 Why Subprograms and Functions?
    2. 6.2 Subprogram Form
    3. 6.3 Function Form
    4. 6.4 Example: The Trapezoid Rule
    5. 6.5 Unused Arguments
    6. 6.6 Excel Functions in VBA
    7. 6.7 VBA Functions in Excel
    8. 6.8 Chapter 6 Exercises
  13. Chapter 7 - Roots of Nonlinear Equations: Finding Zero
    1. 7.1 What Is a Root?
    2. 7.2 The Newton-Raphson Method
    3. 7.3 The Secant Rule
    4. 7.4 Estimating Starting Values
    5. 7.5 Two-Equation Newton-Raphson Method
    6. 7.6 General Nonlinear Equation Sets
    7. 7.7 Multiple Equations with the Secant Rule
    8. 7.8 Flowchart: Two Equations with the Secant Rule
    9. 7.9 The Excel Solver
    10. 7.10 Chapter 7 Exercises
  14. Chapter 8 - Ordinary Differential Equations: Take One Step Forward
    1. 8.1 The Basic Idea
    2. 8.2 Example: Vehicle Velocity
    3. 8.3 Application of the Euler Method
    4. 8.4 Other Euler Methods
    5. 8.5 Second-Order Equations
    6. 8.6 The Fourth-Order Runge-Kutta Method
    7. 8.6.1 The Example Again
    8. 8.7 Another Example with Coupled Equations
    9. 8.8 Two-Point Boundary Value Problems
    10. 8.9 A Predictor-Corrector Method
    11. 8.10 The Cash-Karp Runge-Kutta Method
    12. 8.10.1 VBA Program Results
    13. 8.11 Stability
    14. 8.12 Stiff Differential Equations
    15. 8.13 Ordinary Differential Equation Methods and Numerical Integration
    16. 8.14 Program Step Control—Trapping
    17. 8.15 Chapter 8 Exercises
  15. Chapter 9 - Sets of Linear Equations
    1. 9.1 Lots of Linear Equations
    2. 9.2 Gaussian Elimination with Partial Pivoting
    3. 9.3 Gaussian-Seidel Iteration
    4. 9.4 Comparison of Gaussian Elimination and Gaussian-Seidel
    5. 9.5 Matrix Inverses
    6. 9.6 Gaussian-Jordan Method
    7. 9.7 Overdetermined Sets of Linear Equations
    8. 9.8 Excel Inverses and Linear Equation Solutions
    9. 9.9 Chapter 9 Exercises
  16. Chapter 10 - Arrays: Variables with a Family Name
    1. 10.1 One-Dimensional Arrays
    2. 10.2 Example: Grade Averaging
    3. 10.3 Dynamic Dimensioning
    4. 10.4 Example: Sorting an Array
    5. 10.5 Multidimensional Arrays
    6. 10.6 Gaussian Elimination Flowchart
    7. 10.7 Gaussian-Seidel Flowchart
    8. 10.8 Gaussian-Jordan Flowchart
    9. 10.9 Romberg Integration Flowchart
    10. 10.10 Thomas Algorithm Flowchart
    11. 10.11 Chapter 10 Exercises
  17. Chapter 11 - Curve Fitting
    1. 11.1 Introduction
    2. 11.2 Linear Interpolation
    3. 11.3 Lagrange Interpolating Polynomials
    4. 11.4 Linear Regression
    5. 11.5 Polynomial Regression
    6. 11.6 The Power Law
    7. 11.7 The Exponential Fit
    8. 11.8 Multiple Regression
    9. 11.9 Splines
    10. 11.10 Curve Fitting with Excel
    11. 11.11 Chapter 11 Exercises
  18. Chapter 12 - Elliptic Partial Differential Equations
    1. 12.1 Introduction
    2. 12.2 Derivative Forms
    3. 12.3 An Elliptic Partial Differential Equation Example
    4. 12.4 Elliptic Equation Solver Flowchart
    5. 12.5 Solving Elliptic Partial Differential Equations with Excel
    6. 12.6 Derivative Boundary Conditions
    7. 12.7 Chapter 12 Exercises
  19. Appendix A Excel Basics
  20. Appendix B Computer Representation of Numbers
  21. Appendix C VBA Command Summary
    1. C.1 Assignment Statements (Chapter 2)
    2. C.2 Input/Output (Chapter 2)
    3. C.3 Loops and Decisions (Chapter 4)
    4. C.4 Subprograms and Functions (Chapter 6)
    5. C.5 Arrays (Chapter 10)
    6. C.6 Miscellaneous
  22. Appendix D Glossary
  23. Appendix E Numerical Methods with the Casio fx-115MS Calculator
    1. E.1 Solving a Nonlinear Equation
    2. E.2 Solving a Quadratic or Cubic Equation
    3. E.3 Solving Linear Equations
    4. E.4 Numerical Integration
  24. Appendix F Excel Functions in VBA
  25. Appendix G Differentiation Fundamentals
  26. Appendix H Cash-Karp Runge-Kutta VBA Program for Two Ordinary Differential Equations
  27. Bibliography
  28. Index