This may help you understand better how to use Mathematica. You can watch the movie many times until you master it.
Link to the 1st GCD movie: (For Lab 4)
http://www.ithaca.edu/dani/classes/Experimentation/GCD1.wmv
Link to the 2nd GCD movie: (For Lab 4)
http://www.ithaca.edu/dani/classes/Experimentation/GCD2.wmv
Link to Survey
Link to Fibonacci 1 movie: (Mathematica) For Lab 5
http://www.ithaca.edu/dani/classes/Experimentation/Fib1.mp4
Link to movie that teaches radians and degrees: (GeoGebra) For Lab 5
http://www.ithaca.edu/dani/classes/Experimentation/radeg.mp4
Wednesday, February 18, 2009
Wednesday, February 11, 2009
Exploring the Euclidean Algorithm with spread sheets
If you want a break from Mathematica and yet want to play with the Euclidean Algorithm consider this simple method:
Step 1. Open a spread sheet and in cells A1 B1 and C1 write the numbers:
8 5 1
Step 2: In cells A2 B2 and C2 write the formulas:
=B1 =IF(B1<>0,MOD(A1,B1),0) =IF(B3<>0,C2+1,C2)
step 3: paste the cells down.
Explore what happened and what do the numbers mean and try to write clearly and coherently.
Here is a link to a google spread sheet that does the same thing:
http://spreadsheets.google.com/pub?key=plH_QusMInOaC0BTFUNzxEw
Step 1. Open a spread sheet and in cells A1 B1 and C1 write the numbers:
8 5 1
Step 2: In cells A2 B2 and C2 write the formulas:
=B1 =IF(B1<>0,MOD(A1,B1),0) =IF(B3<>0,C2+1,C2)
step 3: paste the cells down.
Explore what happened and what do the numbers mean and try to write clearly and coherently.
Here is a link to a google spread sheet that does the same thing:
http://spreadsheets.google.com/pub?key=plH_QusMInOaC0BTFUNzxEw
Activity for future teachers and everyone else also
The Euclidean Algorithm that we explore in the lab has wonderful application to teaching and for those of you who will be teachers can be very valuable and useful.
The language of Mathematica in this unit is a bit complicated but do not get discouraged by this and here we will share some other approaches to the same idea.
You can use some of these approaches in your writings.
Imagine that you are a computer or a kind of machine that "eats" pairs of numbers (a,b) then a>=b and produces a new pair of numbers but immediately "eats" the new pair
unless one of the new numbers is 0.
The rules that the machine obeys are:
1. The machine stops "eating" when one of the numbers is 0.
2. If the machine tries to "eat" the pair (a,b) where a>=b>0 the new pair will be (b,c) where c is the remainder when dividing a by b.
Example:
(8,5) ---> (5,3) ----> (3,2) ---> (2,1) ---> (1,0). Note that 1=GCD(8,5) and it took five steps to reach the answer
This can be seen as a kind of game and one thing you can do is think how to design a lesson plan or an activity around it. For example dividing the numbers from 1 to 100 to families according to the number of steps.
Also how can we use a spread sheet to create this list.
The language of Mathematica in this unit is a bit complicated but do not get discouraged by this and here we will share some other approaches to the same idea.
You can use some of these approaches in your writings.
Imagine that you are a computer or a kind of machine that "eats" pairs of numbers (a,b) then a>=b and produces a new pair of numbers but immediately "eats" the new pair
unless one of the new numbers is 0.
The rules that the machine obeys are:
1. The machine stops "eating" when one of the numbers is 0.
2. If the machine tries to "eat" the pair (a,b) where a>=b>0 the new pair will be (b,c) where c is the remainder when dividing a by b.
Example:
(8,5) ---> (5,3) ----> (3,2) ---> (2,1) ---> (1,0). Note that 1=GCD(8,5) and it took five steps to reach the answer
This can be seen as a kind of game and one thing you can do is think how to design a lesson plan or an activity around it. For example dividing the numbers from 1 to 100 to families according to the number of steps.
Also how can we use a spread sheet to create this list.
Simplification of the second loop.
Paste the following code into Mathematica and run it
Clear[a, b, div, remainder, oldremainder, counter, num];
a = 8; b = 5; u = a
If[b > a, {a = b, b = u}]; num = 0; div = a; remainder = b; While[
remainder > 0, {Print[div], oldremainder = remainder,
remainder = Mod[div, remainder], div = oldremainder, num++}];
Print["The Greatest common divisor is " , div];
Print["The Euclidean algorithm required ", num, " steps"]
Note that in this case you got the numbers:
13
8
5
3
2
The Greatest common divisor is 1
The Euclidean algorithm required 4 steps
Try to understand the program and change the numbers to play with it.
Clear[a, b, div, remainder, oldremainder, counter, num];
a = 8; b = 5; u = a
If[b > a, {a = b, b = u}]; num = 0; div = a; remainder = b; While[
remainder > 0, {Print[div], oldremainder = remainder,
remainder = Mod[div, remainder], div = oldremainder, num++}];
Print["The Greatest common divisor is " , div];
Print["The Euclidean algorithm required ", num, " steps"]
Note that in this case you got the numbers:
13
8
5
3
2
The Greatest common divisor is 1
The Euclidean algorithm required 4 steps
Try to understand the program and change the numbers to play with it.
The While Loop
In Lab 3 we see the first loop which is called the While Loop:
Clear[n,counter];
n=0;counter=0;
While[n<10,{If[EvenQ[n]==True,counter++],Print["The number is ",n,"."] };n++];
Print["The number of even numbers is ",counter,". We looked at the first ",n," numbers."]
Output:
The number is 0.
The number is 1.
The number is 2.
The number is 3.
The number is 4.
The number is 5.
The number is 6.
The number is 7.
The number is 8.
The number is 9.
The number of even numbers is 5. We looked at the first 10 numbers.
Counter and n are just variable named and counter++ and n++ means to add one to their value. You could have written also counter=counter+1 and n=n+1 which may be clearer. "While" is just the English meaning "While I live I breath..."
I modified the program slightly as follows: instead of EvenQ[n]==True I wrote Mod[n,2]==0 (this means; The remainder when I divide n by 2 is 0 which really means that n is even)
Clear[n, counter];
n = 0; counter = 0;
While[n < 10, {If[Mod[n, 2] == 0, counter=counter+1],
Print["The number is ", n, "."] }; n = n + 1];
Print["The number of even numbers is ", counter, ". We looked at the \
first ", n, " numbers."]
Play with it a little more and try different things.
Clear[n,counter];
n=0;counter=0;
While[n<10,{If[EvenQ[n]==True,counter++],Print["The number is ",n,"."] };n++];
Print["The number of even numbers is ",counter,". We looked at the first ",n," numbers."]
Output:
The number is 0.
The number is 1.
The number is 2.
The number is 3.
The number is 4.
The number is 5.
The number is 6.
The number is 7.
The number is 8.
The number is 9.
The number of even numbers is 5. We looked at the first 10 numbers.
Counter and n are just variable named and counter++ and n++ means to add one to their value. You could have written also counter=counter+1 and n=n+1 which may be clearer. "While" is just the English meaning "While I live I breath..."
I modified the program slightly as follows: instead of EvenQ[n]==True I wrote Mod[n,2]==0 (this means; The remainder when I divide n by 2 is 0 which really means that n is even)
Clear[n, counter];
n = 0; counter = 0;
While[n < 10, {If[Mod[n, 2] == 0, counter=counter+1],
Print["The number is ", n, "."] }; n = n + 1];
Print["The number of even numbers is ", counter, ". We looked at the \
first ", n, " numbers."]
Play with it a little more and try different things.
A Blog for our class
Folks,
We meet so little and time is so precious and short so i decided to use other means to communicate with you and one of them is the Blog. What I expect is really devotion to this class and to everything else you do. It is just basically being honest because deeply inside we all want to grow and learn but there may be a lot of interference and dust. However I am also aware how much pressure many of you face, having to juggle work, college, relationship.... What helps me is the choice to believe the EVERTHING works out for the good. This being said, let us turn to the Math.
Math is essentially fun like life and music. Look at these two Mathematica programs that Jasper (a young teenager for Ithaca send me). He just played with Mathematica for a while and found these programs. I will also try to connect between then and the loops:
Program 1:
Table[TreePlot[
Flatten[Table[{i -> 2 i + j - 1}, {j, 2}, {i, 2^n - 1}]],
Center], {n, 2, 7}]
In the comments to this blog you can write comments about this program and play with it for a while. What do the some of the numbers means? You may say that the "largest" tree is of "Depth" 7. How can you make it deeper for example. Did you notice how the table command worked?
Here is another program Jasper sent me:
Paste it into Mathematica and see the amazing results. Note that this program uses the Do loop that is also used in lab 3 and will help you understand it:
Do[Print[
"You gave me " <> RandomChoice[WordData[All, "Noun"]] <> "."
], {5}]
Print["And I gave you Love."]
The output will be different each time. Here is what happened for me:
You gave me Julia Ward Howe.
You gave me Felis onca.
You gave me professional golfer.
You gave me utility man.
You gave me Jamaica sorrel.
And I gave you Love.
Can you explain in the comments the meaning of this program? Note that <> means means to join two strings (words) together and WordData is a kind of ordered dictionary bank that is embedded in Mathematica.
By the way David just emailed me and wrote"...I tell them that we have an entire semester to learn mathematica and latex. It is not expected to master it after 3 weeks. They'll get there."
I thought it is a good thing to share
We meet so little and time is so precious and short so i decided to use other means to communicate with you and one of them is the Blog. What I expect is really devotion to this class and to everything else you do. It is just basically being honest because deeply inside we all want to grow and learn but there may be a lot of interference and dust. However I am also aware how much pressure many of you face, having to juggle work, college, relationship.... What helps me is the choice to believe the EVERTHING works out for the good. This being said, let us turn to the Math.
Math is essentially fun like life and music. Look at these two Mathematica programs that Jasper (a young teenager for Ithaca send me). He just played with Mathematica for a while and found these programs. I will also try to connect between then and the loops:
Program 1:
Table[TreePlot[
Flatten[Table[{i -> 2 i + j - 1}, {j, 2}, {i, 2^n - 1}]],
Center], {n, 2, 7}]
In the comments to this blog you can write comments about this program and play with it for a while. What do the some of the numbers means? You may say that the "largest" tree is of "Depth" 7. How can you make it deeper for example. Did you notice how the table command worked?
Here is another program Jasper sent me:
Paste it into Mathematica and see the amazing results. Note that this program uses the Do loop that is also used in lab 3 and will help you understand it:
Do[Print[
"You gave me " <> RandomChoice[WordData[All, "Noun"]] <> "."
], {5}]
Print["And I gave you Love."]
The output will be different each time. Here is what happened for me:
You gave me Julia Ward Howe.
You gave me Felis onca.
You gave me professional golfer.
You gave me utility man.
You gave me Jamaica sorrel.
And I gave you Love.
Can you explain in the comments the meaning of this program? Note that <> means means to join two strings (words) together and WordData is a kind of ordered dictionary bank that is embedded in Mathematica.
By the way David just emailed me and wrote"...I tell them that we have an entire semester to learn mathematica and latex. It is not expected to master it after 3 weeks. They'll get there."
I thought it is a good thing to share
Subscribe to:
Posts (Atom)