Part IV: The Joys of Computation

   

  
Java Number Cruncher: The Java Programmer's Guide to Numerical Computing
By Ronald  Mak

Table of Contents


Numerical computation isn't all work and no play. The final part of this book covers its lighter side. However, "light" doesn't mean "frivolous"?athere's useful material in these last chapters, too!

Chapter 12 covers Java's BigNumber and BigDecimal classes, which support "arbitrary precision" arithmetic?asubject to memory constraints, we can have numbers with as many digits as we like. This chapter explores how these classes can be useful. We compute a large prime number with more than 3,000 digits, and we write functions that can compute values such as graphics/roottwo.gif and e x to an arbitrary number of digits of precision.

Mathematicians over the centuries have created formulas for computing the value of p . 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 p . In Chapter 13, we use 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. We examine algorithms that generate random normally distributed and exponentially distributed random values. We conclude with a Monte Carlo algorithm that uses random numbers to compute the value of p .

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.

The final chapter, 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, which we saw in Chapter 5, when applied to the complex plane, can generate a fractal.


   
Top
 


Java Number Cruncher. The Java Programmer's Guide to Numerical Computing
Java Number Cruncher: The Java Programmers Guide to Numerical Computing
ISBN: 0130460419
EAN: 2147483647
Year: 2001
Pages: 141
Authors: Ronald Mak

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net