Over and Over Again
Download
Report
Transcript Over and Over Again
PROBLEM 1
Three travelers came to a tavern and ordered a dish of
potatoes. When the landlord brought in the potatoes the men
were asleep. The first of the travelers to wake up ate a third of
the potatoes and went back to sleep without disturbing his
companions. Then another awoke and, not realizing that one of
his companions had already eaten, ate a third of those that he
found, and went back to sleep again. Finally the third man did
the same, eating a third of the potatoes that were there and
going back to sleep. When the landlord came to clean the table
he found 8 potatoes. How many had he prepared?
PROBLEM 2
While three watchman were guarding an orchard a thief slipped
in and stole some apples. On his way out he met the three
watchman one after the other, and to each in turn he gave a half
of the apples he had and two besides. Thus he managed to
escape with one apple. How many had he originally stole?
PROBLEM 3
Three men who had a monkey bought a pile of mangoes. At
night one of the men came to the pile of mangoes while the
others slept and, finding that there was just one more mango
than could be divided exactly by three, tossed the extra mango
to the monkey and took away one third of the remainder. The
he went back to sleep. Presently another of them awoke and
went to the pile of mangoes. He also found just one too many
to be divided evenly by three, so he tossed the extra one to the
monkey, took one third of the remainder, and returned to sleep.
After a while the third rose also, and he too gave one mango to
the monkey and took away the number of whole mangoes which
represented precisely one third of the rest. Next morning the
men got up and went to the pile. Again they found just one too
many, so they gave one to the monkey and divided the rest
evenly. If the men each received seven mangoes, how many
mangoes were in the original pile?
Over and Over Again
PROBLEM 1
x0 Initial Amount
x1 f ( x0 )
2
x0
3
2 2
4
( x0 ) x0
3 3
9
2 4
8
x3 f ( x2 ) f ( f ( f ( x0 ))) ( x0 )
x0
3 9
27
8
We know that x3 8, so then
x0 8.
27
x0 27
x2 f ( x1 ) f ( f ( x0 ))
PROBLEM 2
x0 Initial Amount
x1 f ( x0 )
x0
2
2
x0
2
x
2
x2 f ( x1 ) f ( f ( x0 ))
2 0 3
2
4
x0
3
x 7
x3 f ( x2 ) f ( f ( f ( x0 ))) 4
2 0
2
8 2
x0 7
We know that x3 1, so then
1.
8 2
x0 36
PROBLEM 3
x0 Initial Amount
x1 f ( x0 )
2( x0 1)
3
2( x0 1)
1)
2(2 x0 5)
3
x2 f ( x1 ) f ( f ( x0 ))
3
9
2(2 x0 5)
2(
1)
2(4 x0 19)
9
x3 f ( x2 ) f ( f ( f ( x0 )))
3
27
2(4 x0 19)
We know that x3 22, so then
22.
27
x0 79
2(
Marty Romero, The Accelerated Charter High School
“Ancient Hindu Problems”
Over and Over Again
Iteration
Iterates
Given a function f and an input x0, the
iterates of x0 are the numbers f(x0),
f(f(x0)), f(f(f(x0))), and so on.
x1 = f(x0)
x2 = f(x1) = f(f(x0))
x3 = f(x2) = f(f(f(x0)))
.
.
.
First iterate
Second iterate
Third iterate
The orbit of x0 under the function f is the
list of numbers x0, x1, x2, x3, . . .
f ( x) x
x0 0.1
x1 f ( x0 ) 0.1 0.31623
x2 f ( x1 ) 0.31623 0.56234
.
.
.
Marty Romero, The Accelerated Charter High School
Solve for x:
x3 2 x 1 2 x
Guess and Check:
?
x 1
13 2 1 1 21
1 2 1 2
22
Graphically:
Iteratively:
x
3
2
x
1
If x3 2 x 1 2 x then x
2
Over and Over Again
“Iterative Scheme for √2”
Square Root of 2
Many students learn at an early age an iterative scheme for obtaining a rational approximation for
.
Notice
2 that if x is the actual square root of 2, then x=2/x; the two factors x and 2/x are equal. If x0 is an
underestimate of the square root of 2, then 2/x0 is an overestimate. The average of the underestimate
and the overestimate is certainly a better estimate than at least one of them. Hence we define the
following function f.
1
2
f ( x) x
2
x
It turns out that for any given x0>0, the sequence of iterates x1, x2,… converges to
. For
2 our
example lets choose x0=1. Below we can see the result for the iteration of our function.
n
0
xn
1
xn2
1
1
3
2
2.25
2
3
4
.
.
17
1.416666667
2.00694444444444
12
577
1.414215686
2.00000600730488
408
665857
1.414213562 2.00000600000451
470832
.
.
.
.
.
.
.
Alternate Scheme
The iteration of this function also leads to an approximation for the square root of 2.
f ( x)
(2 x)
(1 x)
Reference: Lecture given by Professor Michael Hoffman, CSULA
Marty Romero, The Accelerated Charter High School
Square Root of 2
Over and Over Again
“Smoothing Transformations”
Candy Passing
A number of students sit in a circle while their teacher gives them candy. Each student initially has an
even number of pieces of candy. When the teacher blows a whistle, each student simultaneously gives
half of his or her candy to the neighbor on the right. Any student who ends up with an odd number of
pieces gets one more piece from the teacher. Investigate what happens after a finite number of iterations
of this transformation.
Penny Pinching
Suppose 2n pennies, where n is an arbitrarily given positive integer, are randomly distributed into several
boxes. Take any two boxes A and B with p and q pennies, respectively. If p≥q you are allowed to remove q
pennies from Box A and put them into Box B, and this action is called an operation. Demonstrate that
regardless of the original distribution of pennies, a finite number of these operations can move all the
pennies into one box.
Reference: Over and Over Again, Gengzhe Chang and Thomas W. Sederberg , Mathematical Association of America
Marty Romero, The Accelerated Charter High School
Over and Over Again
“Iteration Quickies”
“Hailstone Numbers”
To compute a sequence of hailstorm numbers, start by choosing any positive integer you like.
If your number if even, divide by two. If your number is odd, then multiply by 3 and add 1.
x
, if x is even
f ( x) 2
3 x 1, if x is odd
5 16 8 4 2 1
9 28 14 7 22 11 34 17 52 26 13 40 20 10 5 ...
“Splitting Squares”
To compute a sequence by splitting squares, start by choosing any positive integer you like. Then split your
integer into separate digits. Square your digits and sum them up.
16 12 62 37
37 32 7 2 58
58 52 82 89
89 82 92 145
145 12 42 52 42
42 42 22 20
When starting with 16, the sequence eventually ends up
repeating itself. What happens when we use other
numbers?
20 22 02 4
4 42 16
Reference: World of Numbers, Pickover, Clifford A., Oxford University Press
Marty Romero, The Accelerated Charter High School
“Hailstone Numbers”
To compute a sequence of hailstorm numbers, start by
choosing any positive integer you like.
If your number if even, divide by two. If your number is odd, then multiply by 3 and add 1.
x
, if x is even
f ( x) 2
3 x 1, if x is odd
“Splitting Squares”
16 12 62 37
37 32 7 2 58
58 52 82 89
89 82 92 145
145 12 42 52 42
42 42 22 20
20 22 02 4
4 42 16
Linear Systems-Jacobi Iteration
Project: Over and Over
Part 1
Use any method you wish to solve each system each linear system of equations.
2 x y 1
x 2y 5
2 x y 10
3 x 4 y 5
Part 2
Equations like those above are usually good examples for students to solve in order to get adequate
practice in solving systems of equations. However, in the real world systems are usually more
complicated and may contain hundreds of equations. This leads mathematicians to develop more
efficient ways to solve problems. Numerical methods such as Jacobi Iteration and others are used to
solve those complicated systems. Using the first system, below is an outline for this process.
Solve the first equation for x:
2 x y 1 2 x 1 y x
Solve the second equation for y :
1 y
1 y
x
2
2 2
x 2 y 5 2 y 5 x y
5 x
5 x
y
2
2 2
1 y
5 x
y
2 2
2 2
Assuming that we don’t already know the solution to our system, all we have to do is take a guess
at the solution and plug those values into our working equations. Our guess will be (1,1) this will
mean that x0=1 and y0=1. The work is done below.
5 x
5 (1)
1 y
1 (1)
y1 0
2
x1 0
1
2 2
2 2
2 2 2 2
5 x
5 (1)
1 y 1 ( 2 )
y2 1
2
x2 1
05
.
2
2
2
2
2 2 2
2
We now have our working equations :
x
5 x
5 ( 05
. )
1 y2 1 ( 2 )
y3 2
2.75
05
.
2
2
2
2
2 2 2
2
5 x
5 ( 05
. )
1 y
1 ( 2.75 )
y4 3
2.75
x4 3
0875
.
2 2
2
2
2 2 2
2
Your job is to finish this process for two more iterations. What seems to be magically happening?
Look at the algebraic solution you calculated for a hint.
5 x
1 y
y5 4
x5 4
2 2
2 2
5 x
1 y
y6 5
x6 5
2 2
2 2
Part 3
Now that you have some practice under your belt, use the Jacobi Iteration process to do 5
iterations for the second linear system of equations. After you have done the work, check to see
how close these approximations are to the actual solution. If you did more iterations, do you
think the approximations will get closer (will they converge) to the actual solutions?
x3
Part 4
We will use our calculator to speed up the Jacobi Iteration process. This is important because at some
point mathematicians will want computers to do all the work once they have set up the equations.
This is the beauty of numerical analysis, the algebra does not need to be done.
Type this in and hit Enter
Type the second line in and hit Enter, the first
iteration has produced x=1 and y=-2.
Now hit Enter four more times, we now have
The first five iterations.
Keep hitting Enter to see how many iterations it takes for our process to converge to the actual
solution. Use the same technique to check your answers for the second system
Part 5
When we are solving system involving two equations and two unknowns it is easier to just do the
algebra, but as we increase the number of equations and unknowns, numerical methods become
increasingly important. Solve the system below using Jacobi Iteration. Use (1,1,1) as your initial
guess. The actual solution for this system is (-5,-8,-7). Write the first five iterations that your
calculator gives you.
2 x y 2
x 2y z 4
y 2z 6
Extra Credit:
An obvious question that you should be thinking about is whether or not Jacobi Iteration always
works. The answer to this is NO. Your job is to create a consistent two equation two unknown
system of linear equations that Jacobi Iteration does not work for. First solve your system
algebraically then show that the process does not work by listing your iterations.