Java™ Number Cruncher: The Java Programmer's Guide to Numerical Computing

Book description

  • Non-theoretical explanations of practical numerical algorithms

  • Algorithms in action with animated, interactive graphical Java programs and applets

  • Computational errors and how to remove them from your code

Understand "computer math" and get the numbers you expect, reliably.

In Java Number Cruncher, author Ronald Mak explains how to spot-and how to avoid-the subtle programming miscues that can cause vexing calculation errors in your applications. An authority on mapping pure math to computer math, he explains how to use the often-overlooked computational features of Java, and does so in a clear, non-theoretical style.

Without getting lost in mathematical detail, you'll learn practical numerical algorithms for safely summing numbers, finding roots of equations, interpolation and approximation, numerical integration, solving differential equations, matrix operations, and solving sets of simultaneous equations. You'll also enjoy intriguing topics such as searching for patterns in prime numbers, generating random numbers, computing thousands of digits of pi, and creating intricately beautiful fractal images.

Java Number Cruncher includes:

  • Practical information all Java programmers should know

  • Popular computational algorithms in Java-without excessive mathematical theory

  • Interactive graphical programs that bring the algorithms to life on the computer screen

  • Rounding errors, the pitfalls of integer arithmetic, Java's implementation of the IEEE 754 floating-point standard, and more

This book is useful to all Java programmers, especially for those who want to learn about numerical computation, and for developers of scientific, financial, and data analysis applications.

Table of contents

  1. Copyright
    1. Dedication
  2. Preface
  3. How to Download the Source Code
  4. I. Why Good Computations Go Bad
    1. 1. Floating-Point Numbers Are Not Real!
      1. 1.1. Roundoff Errors
      2. 1.2. Error Explosion
      3. 1.3. Real Numbers versus Floating-Point Numbers
      4. 1.4. Precision and Accuracy
      5. 1.5. Disobeying the Laws of Algebra
      6. 1.6. And What about Those Integers?
      7. References
        1. Bibliography
    2. 2. How Wholesome Are the Integers?
      1. 2.1. The Integer Types and Operations
      2. 2.2. Signed Magnitude versus Two's-Complement
      3. 2.3. Whole Numbers versus Integer Numbers
      4. 2.4. Wrapper Classes
      5. 2.5. Integer Division and Remainder
      6. 2.6. Integer Exponentiation
      7. References
        1. Bibliography
    3. 3. The Floating-Point Standard
      1. 3.1. The Floating-Point Formats
        1. Normalized Number
        2. Denormalized Number
      2. 3.2. Denormalized Numbers
      3. 3.3. Decomposing Floating-Point Numbers
      4. 3.4. The Floating-Point Operations
      5. 3.5. ±0, ±∞, and NaN
      6. 3.6. No Exceptions!
      7. 3.7. Another Look at Roundoff Errors
      8. 3.8. Strict or Nonstrict Floating-Point Arithmetic
      9. 3.9. The Machine Epsilon ∊
      10. 3.10. Error Analysis
      11. References
        1. Bibliography
  5. II. Iterative Computations
    1. 4. Summing Lists of Numbers
      1. 4.1. A Summing Mystery—the Magnitude Problem
      2. 4.2. The Kahan Summation Algorithm
      3. 4.3. Summing Numbers in a Random Order
      4. 4.4. Summing Addends with Different Signs
      5. 4.5. Insightful Computing
      6. 4.6. Summation Summary
      7. References
        1. Bibliography
    2. 5. Finding Roots
      1. 5.1. Analytical versus Computer Solutions
      2. 5.2. The Functions
      3. 5.3. The Bisection Algorithm
      4. 5.4. The Regula Falsi Algorithm
      5. 5.5. The Improved Regula Falsi Algorithm
      6. 5.6. The Secant Algorithm
      7. 5.7. Newton's Algorithm
      8. 5.8. Fixed-Point Iteration
      9. 5.9. Double Trouble with Multiple Roots
      10. 5.10. Comparing the Root-Finder Algorithms
      11. References
        1. Bibliography
    3. 6. Interpolation and Approximation
      1. 6.1. The Power Form versus the Newton Form
      2. 6.2. Polynomial Interpolation Functions
      3. 6.3. Divided Differences
      4. 6.4. Constructing the Interpolation Function
      5. 6.5. Least-Squares Linear Regression
      6. 6.6. Constructing the Regression Line
      7. References
        1. Bibliography
    4. 7. Numerical Integration
      1. 7.1. Back to Basics
      2. 7.2. The Trapezoidal Algorithm
      3. 7.3. Simpson's Algorithm
      4. References
        1. Bibliography
    5. 8. Solving Differential Equations Numerically
      1. 8.1. Back to Basics
      2. 8.2. A Differential Equation Class
      3. 8.3. Euler's Algorithm
      4. 8.4. A Predictor-Corrector Algorithm
      5. 8.5. The Fourth-Order Runge-Kutta Algorithm
      6. References
        1. Bibliography
  6. III. A Matrix Package
    1. 9. Basic Matrix Operations
      1. 9.1. Matrix
      2. 9.2. Square Matrix
      3. 9.3. Identity Matrix
      4. 9.4. Row Vector
      5. 9.5. Column Vector
      6. 9.6. Graphic Transformation Matrices
      7. 9.7. A Tumbling Cube in 3-D Space
      8. References
        1. Bibliography
    2. 10. Solving Systems of Linear Equations
      1. 10.1. The Gaussian Elimination Algorithm
      2. 10.2. Problems with Gaussian Elimination
      3. 10.3. Partial Pivoting
      4. 10.4. Scaling
      5. 10.5. LU Decomposition
      6. 10.6. Iterative Improvement
      7. 10.7. A Class for Solving Systems of Linear Equations
      8. 10.8. A Program to Test LU Decomposition
      9. 10.9. Polynomial Regression
      10. References
        1. Bibliography
    3. 11. Matrix Inversion, Determinants, and Condition Numbers
      1. 11.1. The Determinant
      2. 11.2. The Inverse
      3. 11.3. The Norm and the Condition Number
      4. 11.4. The Invertible Matrix Class
      5. 11.5. Hilbert Matrices
      6. 11.6. Comparing Solution Algorithms
      7. References
        1. Bibliography
  7. IV. The Joys of Computation
    1. 12. Big Numbers
      1. 12.1. Big Integers
      2. 12.2. A Very Large Prime Number
      3. 12.3. Big Integers and Cryptography
      4. 12.4. Big Decimal Numbers
      5. 12.5. Big Decimal Functions
      6. References
        1. Bibliography
    2. 13. Computing π
      1. 13.1. Estimates of π and Ramanujan's Formulas
      2. 13.2. Arctangent Formulas That Generate π
      3. 13.3. Generating Billions of Digits
      4. References
        1. Bibliography
    3. 14. Generating Random Numbers
      1. 14.1. Pseudorandom Numbers
      2. 14.2. Uniformly Distributed Random Numbers
      3. 14.3. Normally Distributed Random Numbers
      4. 14.4. Exponentially Distributed Random Numbers
      5. 14.5. Monte Carlo, Buffon's Needle, and π
      6. References
        1. Bibliography
    4. 15. Prime Numbers
      1. 15.1. The Sieve of Eratosthenes and Factoring
      2. 15.2. Congruences and Modulo Arithmetic
      3. 15.3. The Lucas Test
      4. 15.4. The Miller-Rabin Test
      5. 15.5. A Combined Primality Tester
      6. 15.6. Generating Prime Numbers
      7. 15.7. Prime Number Patterns
      8. References
        1. Bibliography
    5. 16. Fractals
      1. 16.1. Fixed-Point Iteration and Orbits
      2. 16.2. Bifurcation and the Real Function f(x) = x2 + c
      3. 16.3. Julia Sets and the Complex Function f(z) = z2 + c
      4. 16.4. Newton's Algorithm in the Complex Plane
      5. 16.5. The Mandelbrot Set
      6. References
        1. Bibliography

Product information

  • Title: Java™ Number Cruncher: The Java Programmer's Guide to Numerical Computing
  • Author(s): Ronald Mak
  • Release date: October 2002
  • Publisher(s): Pearson
  • ISBN: 0130460419