http://www.math.grin.edu/~rebelsky/Courses/397/98S/students.html
http://www.math.grin.edu/~rebelsky/Glimmer/programmer.html
http://www.math.grin.edu/~sherwood/Presentation.html
/** Build a simple interest rate table. The ith position in the table gives the value after 2^i years. */ public static double[] rateTable(int years, int rate) { // The number of positions to fill in int positions = log_2(years); // Our new rate table. Note we're trading a little extra // space and one extra computation for a simpler comparison. double[] rates = new double[positions+1]; rates[0] = rate; // Fill it in for (int i = 1; i < positions; ++i) rates[i] = rates[i-1]*rates[i-1]; // That's it return rates; } // rateTable
Disclaimer Often, these pages were created "on the fly" with little, if any, proofreading. Any or all of the information on the pages may be incorrect. Please contact me if you notice errors.
Source text last modified Mon Nov 10 08:53:15 1997.
This page generated on Mon Nov 10 10:12:58 1997 by SiteWeaver.
Contact our webmaster at rebelsky@math.grin.edu