Java Number Cruncher: The Java Programmer's Guide to Numerical Computing (Prentice Hall Professional Oracle Series)

Java Number Cruncher: The Java Programmer's Guide to Numerical Computing (Prentice Hall Professional Oracle Series)
Authors
Ronald Mak
ISBN
0130460419
Published
08 Nov 2002
Purchase online
amazon.com

This book introduces Java programmers to numerical computing. It contains clear, non-theoretical explanations of practical numerical algorithms, including safely summing numbers, finding roots of equations, interpolation and approximation, numerical integration and differentiation, and matrix operations, including solving sets of simultaneous equations. Many of the programs are applets that take advantage of Java's interactive graphics capabilities.

Page 2 of 2
  1. Editorial Reviews
  2. Customer Reviews

Customer Reviews

calvinnme said
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.

student said
The book doesn't teach you Java. It is assumed that you already know Java.
doesn't cover all of Numerical calculus and not all of mathematical proofs but great if you are looking study practical programming with Java.

I recommend this book only if you know Java and have basic numerical knowledge.

Siong Jong Hang said
I have got hold of this book just recently. This is an excellent book on numerical computing using Java that covers many important aspects in numerical computing. I have been writing numerical methods in Java back in graduate school as well as in my professional career for mission critical programs. I must say this book has addressed many issues that must be taken into account such as machine epsilon, choices of numerical methods for different problems, limitations and precautions in using different data types, etc in Java in which if taken for granted, would produce disastrous results.

Ronald Mak has taken the trouble to explain IEEE floating point standards in a fun and easy-to-understand manner.

Another thing about this book that is worthy of a mention is its great OO programming styles. Codes are also well commented and reader friendly. Overall, it is a great source to learn not just on how to program numerical methods in Java but how to write good OO programs.

The only two bad things I could say about this book is that I should have gotten of this book much earlier and if only Amazon allows a Six Stars rating.

Riccardo Audano said
As the author says, last time I looked Java still had the +, -, /, * and % mathematical operators.. though most programmers end up forgetting it lost as they are in the boring, vulgar and repetitive coding of boiler-plate "enterprise" (read "sell sell sell") applications. This book does a very good job of introducing a Java programmer to one of the most fun and interesting powers that Java can offer ... that is playing with numbers and exploring the world of mathematics. Forget (at least for a little while) Servlets, JSP, EJB, and database massaging... and give a look to how you can use your JDK to study functions, solve differential equations, integrals, system of equations, discover prime numbers and admire the beauty of fractals. The treatment of the various subjects is done is sufficient detail to be clear and sound, but without burderdening the reader
with detail and depth best left for more specialized and hard-core texts that the curious reader can explore after this one. Refreshing.



Jason Menard said
At one time or another, most of us will likely have to write code performing some amount of numerical computation beyond simple integer arithmetic. As many of us are neither mathematicians nor intimately familiar with the bit gymnastics our machines must perform in order to manipulate numbers, we can get ourselves into trouble if we're not careful. Luckily, "Java Number Cruncher" comes to the rescue.

This book is an introduction to numerical computing using Java providing "non-theoretical explanations of practical numerical algorithms." While this sounds like heady stuff, freshman level calculus should be sufficient to get the most out of this text.

The first three chapters are amazingly useful, and worth the price of admission alone. Mak does a fine job explaining in simple terms the pitfalls of even routine integer and floating-point calculations, and how to mitigate these problems. Along the way the reader learns the details of how Java represents numbers and why good math goes bad. The remainder of the book covers iterative computations, matrix operations, and several "fun" topics, including fractals and random number generation.

The author conveys his excitement for the subject in an easy-to-read, easy-to-understand manner. Examples in Java clearly demonstrate the topics covered. Some may not like that the complete source is in-line with the text, but this is subjective. Overall, I found this book educational, interesting, and quite enjoyable to read.

You might also like...

Comments

Contribute

Why not write for us? Or you could submit an event or a user group in your area. Alternatively just tell us what you think!

Our tools

We've got automatic conversion tools to convert C# to VB.NET, VB.NET to C#. Also you can compress javascript and compress css and generate sql connection strings.

“There's no test like production” - Anon