# Iteration All Over Again

#### Tom Walters

Abstract: Iteration, the act of repeating a process over and over again, takes on new significance because of the TI ans key. Ten examples with applications from basic math to calculus are discussed.

1) Division by repeated subtraction is hardly a new idea, but it is an excellent place for beginners to start learning the power of answer key iteration. As a simple example, let's divide 50 by 15. Start by typing 50 on the TI-81 or TI-82 screen and pressing the enter key. The calculator remembers this as its last answer, and if we now type ans - 15 and press enter, the response is 35. Repeatedly pressing the enter key gives 20, 5, -10, ... . The calculator is obviously subtracting 15 from each previous answer and returning the result. We see that we can subtract 15 three times and have a remainder of 5 without going negative. This is not a very efficient way to do division, but the ability to repeat a complicated process by pressing one key will pay dividends later on.

2) When we pick a number and enter it using the enter key we sometimes refer to that number as a "seed." Students should be encouraged to seed the calculator with any number at all and then iterate it under an operation using the ans key. For example, press 3 and enter it, then type ans. If we repeatedly hit the enter key we get the sequence 9, 81, 6561, ... . The result quickly grows past the capacity of the calculator. Choosing ans after entering 3 produces an entirely different sequence converging on one.

Students can pick seeds, then operations, and then iterate. They should, on occasion, be asked to verbalize or write about their observations. Experiment with both positive and negative real numbers and a range of functions including trig and reciprocals. You can't hurt this machine with numbers.

3) As we all know, simple interest is found by the formula in a straightforward fashion , but the problem becomes much more interesting when we let the interest compound, that is, we when let the interest accumulate along with the principal. We will keep it simple here, using 10% paid yearly on \$100, so we start with 100 enter. Now we set up our recursion formula, 1.1 ans, and as we repeatedly hit enter we see the amount on deposit on the dates interest is paid.

Let's modify the situation and make it 12% paid monthly (I said we would try to keep it simple) and deposit \$20 each month to add to the balance. Again, start with \$100 enter. Now 1.01 ans + 20 gives us our monthly balance as we iterate.

4) This same idea works for what is called unconstrained or exponential growth of populations. It only seems that our money never grows in the same way that a population of mosquitoes, but it does, at least on paper. Start with a population, say a town with 50,000 inhabitants. Pick a growth rate, say 3% per year. Now it's 50,000 enter, 1.03 ans, and each time we iterate with the enter key we get the next year's population. The spreadsheet table below shows the population for the first eight years.

 Time 0 1 2 3 4 5 6 7 8 Population 50000 51500 53045 54636 56275 57964 59703 61494 63339

5) Our next two examples will evolve out of a common situation, the fantasy of winning the million dollar lottery. If the state lottery actually gives you \$50,000 in cash and then pays out \$50,000 once a year on the anniversary of the big day for nineteen more years, how much money do the lottery officials actually have to deposit at a fixed rate to cover the payments?

Our first attempt will be an experiment. Pick a reasonable number, say \$600,000 and enter it. If we assume 10% annual interest then try 1.10 ans - 50,000 as the function to iterate. In this recursively defined expression we are saying that the amount on deposit in any year will be last year's value increased by 10% with \$50,000 subtracted. The object is to start with just enough to end up with amount zero after nineteen payments.. The hardest thing about this procedure is that we must count carefully while we press the enter key nineteen times. Clearly the \$600,000 estimate is too much so let's drop it to \$400,000 and repeat the procedure. This guess was better, but too low, and students (not us) can zero in on a solution to any desired degree of accuracy.

6) This next experiment is an improvement over the last method, and, in its own way, is quite elegant. We will simply work backward. From a recursive point of view

if , then

That is, if we want the final amount to be zero, then we should try 0 enter, and then enter ( ans + 50,000) / 1.1, and nineteen enters later we will have built back up to \$418,246, the required amount. We can see that it actually costs less than half of the million dollar prize to finance it, even after adding on the initial payment.

7) An old method for finding square roots is based on the following argument. If we want the square root of the number N let's make a guess of R, it really doesn't have to be close. If R is too small then N/R is too big and conversely, so why not average R and N/R. It will be a better approximation: Root New = .5 ( Root Old + N / Root Old). Let's try an example by finding the square root of 40, I think it's about five. We start with 5 enter, then .5 ( ans + 40 / ans ) and four iterations of enter gives us an approximation of 6.32455532. The speed of convergence is startling the first few times you see it. Try a horrible guess for the square root of 40, say 75, and you still get there very quickly. I don't want to hear that the square root key will do the job much more easily; we are on to something very interesting here.

8) This last example is actually a special case of a powerful method for finding the roots of equations. It is known as Newton's Method, after the co-inventor of calculus, and, when it is used carefully, it converges on roots of equations very quickly. Start by approximating a root of a function F, we will call our guess R and enter it Then we punch in as we iterate with the enter key we see the sequence converge on the root. It is actually not even necessary to type in the function and its derivative if you first enter the function in the y= menu, say as y1. Again we choose an approximate root and enter it. Next punch in , hit the enter key, and off we go toward the root. Newton's Method is temperamental for some functions in some intervals so we have to be careful.

9) As our penultimate example we will do something on the TI-82 which was impossible ( I think) on the TI-81. Using only answer key iteration we can generate the terms of the Fibonacci sequence 1,1,2,3,5,8,13,. . . , where each term is the sum of the previous two. This 700 year old sequence turns up in a variety of places in the study of growth patterns. Its recursive definition is where and . Because it requires two previous levels of information to calculate a present value, the information will not fit on the TI-81 line. However, on the TI-82 the colon button allows us to put multiple instructions on one line. We will store 1 in alpha A and 1 in alpha B and then type A + B sto T : B sto A : T sto B and iterating with the enter key generates the Fibonacci numbers.

10) This list of iteration "schemes" is certainly not complete. It is intended to promote interest, curiosity, and experimentation by students and teachers. For our last exercise we will return to the study of population and consider a more realistic model. This one looks at constrained growth, assuming that environments have carrying capacities which tend to slow down growth rates as these capacities are approached. This is known as the logistic model and has the basic form In this form P is taken to be a fraction of the possible population . K is a growth factor, typically , but feel free to experiment.

Take a starting population of .2, that is, 20% of the carrying capacity, and enter it. Now we pick 2 for K and type in 2 ans ( 1 - ans ) and watch as the population converges to 0.5. Did you expect this stability? Experiment and you will find that the starting population is not important. This value of K leads to a fixed point of 0.5. As K climbs, the function displays an incredibly sensitive dependence on the initial value of K. We find populations which cycle between two values, or four values, and finally, as K creeps toward 4, we find the onset of chaos. This chaotic behavior of a disarmingly simple quadratic function is a topic of current research in mathematics.

Iteration of such simple quadratics using complex numbers is what generates the infinitely refined Mandelbrot Set and its associated Julia Sets, objects of breathtaking beauty and equally breathtaking mathematical complexity.

Woodrow Wilson Leadership Program in Mathematics lpt@www.woodrow.org
The Woodrow Wilson National Fellowship Foundation webmaster@woodrow.org
CN 5281, Princeton NJ 08543-5281 Tel:(609)452-7007 Fax:(609)452-0066