Java Number Cruncher: The Java Programmer’s Guide to Numerical Computing (Prentice Hall PTR Oracle Series)
By Ronald Mak
* Publisher: Prentice Hall PTR
* Number Of Pages: 480
* Publication Date: 2002-11-08
* ISBN-10 / ASIN: 0130460419
* ISBN-13 / EAN: 9780130460417
* Binding: Paperback
Summary: Great coverage of numerical computing in Java
Rating: 5
This book is an introduction to numerical computing that is both comprehensive and fun. It is not a textbook on numerical methods or numerical analysis, although it shows many key numerical algorithms all coded up in Java. The book examines these algorithms enough that you get a feel for how they work and why they’re useful, without formally proving why they work. There are also demonstrations of many of the algorithms with interactive graphical programs. Overall I enjoyed this book a great deal. It is not a beginner’s book on Java - you should be a pretty good Java programmer already. Also, you should be at least somewhat mathematically mature for the material past part one. That is, you should have had some Calculus and some Linear Algebra prior to reading the last 3 of the 4 parts of this book. I further describe this book in the context of its table of contents.
Part 1: WHY GOOD COMPUTATIONS GO BAD - Simply copying formulas out of a math or statistics textbook to plug into a program will almost certainly lead to wrong results. The first part of this book covers the pitfalls of basic numerical computation.
Chapter 1 discusses floating-point numbers in general and how they’re different from the real numbers of mathematics. Not understanding these differences, such as the occurrence of roundoff errors, and not obeying some basic laws of algebra can lead to computations that go bad.
Chapter 2 looks at the seemingly benign integer types. They don’t behave entirely as the whole numbers of mathematics do. Arithmetic operations such as addition, subtraction, and multiplication take place not on a number line, but on a clock face.
Chapter 3 examines how Java implements its floating-point types. The chapter examines the IEEE 754 floating-point standard and shows how well Java meets its provisions.
Part 2: ITERATIVE COMPUTATIONS - Computers are certainly good at looping, and many computations are iterative. But loops are where errors can build up and overwhelm the chance for any meaningful results.
Chapter 4 shows that even seemingly innocuous operations, such as summing a list of numbers, can cause trouble. Examples show how running floating-point sums can gradually lose precision and offer some ways to prevent this from happening.
Chapter 5 is about finding the roots of an algebraic equation, which is another way of saying, “Solve for x.” It introduces several iterative algorithms that converge upon solutions: bisection, regula falsi, improved regula falsi, secant, Newton’s, and fixed-point. This chapter also discusses how to decide which algorithm is appropriate.
Chapter 6 poses the question, Given a set of points in a plane, can you construct a smooth curve that passes through all the points, or how about a straight line that passes the closest to all the points? This chapter presents algorithms for polynomial interpolation and linear regression.
Chapter 7 tackles some integration problems from freshman calculus, but it solves them numerically. It introduces two basic algorithms, the trapezoidal algorithm and Simpson’s algorithm.
Chapter 8 is about solving differential equations numerically. It covers several popular algorithms, Euler’s, predictor-corrector, and Runge-Kutta.
Part 3: A MATRIX PACKAGE - This part of the book incrementally develops a practical matrix package. You can then import the classes of this package into any Java application that uses matrices.
Chapter 9 develops the matrix class for the basic operations of addition, subtraction, and multiplication. It also covers subclasses for vectors and square matrices. The chapter’s interactive demo uses graphic transformation matrices to animate a three-dimensional wire-frame cube.
Chapter 10 first reviews the manual procedure you learned in high school to solve systems of linear equations. It then introduces LU decomposition to solve linear systems using matrices. An interactive demo creates polynomial regression functions of any order from 1 through 9, which requires solving a system of “normal” equations.
Chapter 11 uses LU decomposition to compute the inverse of a matrix efficiently and reliably. A demo program tests how well you can invert the dreaded Hilbert matrices, which are notoriously difficult to invert accurately. The chapter also computes determinants and condition numbers of matrices, and it compares different algorithms for solving linear systems.
Part 4: THE JOYS OF COMPUTATION - The final part of this book covers its lighter side of numerical computation.
Chapter 12 covers Java’s BigNumber and BigDecimal classes, which support “arbitrary precision” arithmetic–subject to memory constraints, you can have numbers with as many digits as you like. This chapter explores how these classes can be useful. You compute a large prime number with more than 3,000 digits, and you write functions that can compute values such as the square root of two and e^x to an arbitrary number of digits of precision.
Mathematicians over the centuries have created formulas for computing the value of pi. Enigmatic Indian mathematician Ramanujan devised several very ingenious ones in the early 20th century. An iterative algorithm supposedly can compute more than 2 billion decimal digits of pi. Chapter 13 uses the big number functions from Chapter 12 to test some of these formulas and algorithms.
Chapter 14 is about random number generation. A well-known algorithm generates uniformly distributed random values. It examine algorithms that generate random normally distributed and exponentially distributed random values. The chapter concludes with a Monte Carlo algorithm that uses random numbers to compute the value of pi.
Mathematicians have mulled over prime numbers since nearly prehistoric times. Chapter 15 explores primality testing and investigates formulas that generate prime numbers, and it looks for patterns in the distribution of prime numbers.
Chapter 16 introduces fractals, which are beautiful and intricate shapes that are recursively defined. There are various algorithms for generating different types of fractals, such as Julia sets and the Mandelbrot set. In fact, Newton’s algorithm for finding roots, when applied to the complex plane, can generate a fractal.
Download:
No comments:
Post a Comment