QC > Math > chanusa > 213 > Worksheets SyllabusScheduleWorksheets213  
Worksheets
Math with Mathematica – Fall 2009

NOTE! Refresh your browser to get updates!

Note: .nb is the extension for Mathematica notebooks.

Online Course Evaluations
For completion by Friday, December 11, 2009.

  • Please fill out the online course evaluation. This will help me improve my teaching. I especially appreciate thoughtful comments left in the short answer part of the survey. The deadline for submitting your evaluation online is December 11th. I will not have access to your comments until January, long after your grades are submitted, so feel free to be honest.

Bonus Point Opportunity
You will receive five homework bonus points if you email me the following assignment by Wednesday, December 15:

  • I would like you to write a letter to the students entering in the next Mathematics with Mathematica class I teach. This will be a letter which explains to them what they should expect from the coming semester. You should explain what it means to "use Mathematica to do mathematics" in your own words, and add some sort of anecdote about something you learned in class this semester. I'm sure you have had the opportunity to explain to your friends or family what you learn in this class, and this will give you a chance to organize those thoughts. The letters should be about a full-page long; I plan to read two or three letters to incoming students the next time I teach the class. I appreciate the time you will put into such a request, so thank you in advance.

Final Project
Due in class on Thursday, December 3, 2009.

  • This project is to be completed in full working order for class on Thursday, December 3.
  • Your project will consist of:
  1. A well-organized Mathematica file. This includes:
  2. A title, your name and contact information, and a one-paragraph abstract detailing the main points that your project covers.
  3. The rest of the file should contain numbered section headings to break down the file for readability. You should include a section for at least:
    • Introduction / Background: Give some background information about why you are completing your project, what your problem statement is, and any obscure Mathematica commands you use in your file. There should also be a run down of what is covered where in the upcoming sections.
    • Main Work: Present your code in a clear and logical way which explains how you are using Mathematica to approach your problem. Make sure to comment each group of Mathematica commands does so that someone else (classmates!) can understand your code.
    • Discussion / Conclusion: The conclusions you can draw from the work you have done. You can include a discussion about useful commands that you learned and/or about the hardest aspect of your project.
  4. As before, you should include only code related to the finished product. (Any scratch work should be kept in your own personal copy of your work).
  5. Make sure that the file runs without problems when "Evaluate Notebook" is run from a newly-opened session of Mathematica.
  6. There will be no additional writeup required for this project.
  7. You may find this project template useful.
On Thursday, December 3, bring in two paper copies of your file. You will participate in a peer review day, during which time you will investigate a few (not all) of your classmates' projects. You will make constructive comments about others' work and receive comments about what you can do to improve your project.

Armed with this feedback, you will then bring a revised version of your project to class on Tuesday, December 8. On that day, we will decide upon a presentation schedule for Tuesday 12/8, Thursday 12/10, and our final exam time (Wednesday 12/16 from 1:45-3:45). You are expected to be present for each presentation day; if you are not present, it will negatively affect your own presentation score!!! Each student will be expected to give a 12–15 minute presentation. I expect your presentation to include:

  • A demo of your file. (Show off what you have gotten Mathematica to do.)
  • A recap of the key points that you have addressed.
  • Being open to questions from me and the audience.

Groupwork: Impartial Games
For completion in class on Thursday, November 12, 2009.

  • The last topic of the semester is impartial games. The goal of this groupwork is for you to become comfortable with the concept of an impartial game and to understand how to play a few examples of impartial games. The next homework assignment will be on implementing impartial games in Mathematica.
Get into a group of 2–4 people, and start to work on the following tasks.
  • Start to learn about impartial games by reading pages 97-98 of the book. This introduces "Welter's Game" and discusses what an impartial game is. Answer Exercise 8.2 in your group (you don't have to turn it in). If you are still unclear about the definition of impartial game, the Wikipedia page might help.
     
  • Now take 15 minutes to play Welter's game to get a feel for how it works and develop some sort of strategy to win. Keep the following questions in mind when you're playing.
    • Each player in the group should get a chance to be player 1 and player 2. (Do you see any difference in being player 1 versus player 2?)
    • Answer Exercise 8.1. What classifies being in a good position versus being in a bad position? Make sure everyone in the group understands the difference.
    • Now read to the bottom of page 99. The function ReplaceList finds all instances of a pattern and applies the given rule in each case. Do you understand how the authors are representing Welter's game using a list? And do you understand how the authors are using ReplaceList to generate all available moves? If you have any questions, ask Prof. Chris before going on.

  • Now skip to the bottom of page 104, where the game of "Cram" is presented.
    • Take turns playing this game with two people.
    • Determine what positions are good positions and bad positions.
    • Can you start to figure out some sort of strategy to win this game?

  • Now let's investigate how we can use Mathematica to play these games.
    • Before we get into the theory, let's see these games in action.
    • Visit the website created on Programming Games with Mathematica by Cowen and Dickau. Download the files named "GamesEngine", "Welter", and this file: Cram.nb, a modified version of the first file on the aforementioned site.
    • Evaluate the notebook "GamesEngine", which includes all the commands you need to play games that you create and is the "brains" behind the game playing.
    • Next, evaluate the notebook "Welter". This file will play Welter's Game for you automatically. Try it out. You'll see that running the game multiple times on the same board
    • If you wish to introduce some randomness into the playing of the game (to model randomly choosing good positions), replace the command PlayTheGame with RandomPlayTheGame.
    • Last, evaluate the notebook "Cram". This file will play Cram for you automatically. Try it out.
    • Why do these files actually play the games? They use an algorithm called the Sprague-Grundy algorithm. Read the discussion on pages 100-101. This algorithm is implemented in Mathematica using the functions Mex and Grundy.
    • When implementing your own impartial two-player game in Mathematica, you can use all the structure provided by GamesEngine; all that you need to change is the set of valid moves specific to that game.

  • There are many other impartial two-person games. The following exercises are suggested for those of you who would like to try to implement one for your final project.
    • A simple game that you can practice programming is called "Scoring".
    • Rules: Two players take turns moving one token from the left of a board to the right of the board. At each turn, a player can move the token 1, 2, or 3 spaces to the right. The person to move the token to the rightmost space wins.
    • Visit Cut-the-knot's page on Scoring to get a good feel for the game.
    • Take turns playing this game with boards of different sizes. What positions are good positions, and what positions are bad positions?
    • Depending on the number of squares on the board (call it n), it is either possible for the first player to ensure that she wins or for the second player to ensure that she wins. Which values of n imply which cases?
    • How would you create a set of valid moves specific to this game that you can use to implement it in Mathematica?

  • Another impartial two-person game is given on page 113: "Multiple Elimination".
    • Take turns playing this game with two people.
    • Determine what positions are good positions and bad positions.
    • Can you start to figure out some sort of strategy to win this game?

  • Go back to page 110, and try "Nim" if you have time.

Mini-project
Due in class on Thursday, November 5, 2009.

  • Your project topic is due in class on Thursday, October 15. I will come around to each student individually to discuss it to make sure it is not too easy or too complicated.
  • You are expected to work on your project inside and outside class.
  • This mini-project is to be completed in full working order for class on Thursday, November 5.
  • Your project will consist of:
  1. A well-organized Mathematica file. This includes:
    • A title, your name and contact information, and brief description of the project including what the file does.
    • Comments detailing what each group of Mathematica commands does so that someone else (classmates!) can understand your code.
    • No code unrelated to the finished product. (Any scratch work should be kept in your own personal copy of your work)
    • Making sure that the file runs without problems when "Evaluate Notebook" is run from a newly-opened session of Mathematica.
  2. A two-page writeup related to your project. This includes
    • The problem statement that you approached (this might be different from what you submitted).
    • The methods in which you have used Mathematica to solve your problem.
    • The conclusions you can draw from the work you have done. You should include a discussion about useful commands that you learned and/or about the hardest aspect of your project.
On Thursday, November 5, bring in three paper copies of this writeup, typed and written in good English. You will participate in a peer review day, during which time you will investigate a few (not all) of your classmates' projects. You will make constructive comments about others' work and receive comments about what you can do to improve your project.

Armed with this feedback, you will then bring a revised version of your project (file and writeup) in to class on Tuesday, November 10. You will distribute copies of your writeup to all your classmates and you will give a three-to-five minute presentation. I expect your presentation to include:

  • A demo of your file. (Show off what you have gotten Mathematica to do.)
  • A recap of the key points in your writeup.
  • Being open to questions from me and the audience.

Homework 4
Due via Blackboard on Friday, October 22, 2009.

  • Download the homework file 213HW4.
  • Modify the file with your solutions and upload via Blackboard by the deadline.

Quiz Review

  • Quiz Review (.nb) Clarifies topics that are included on the Quiz on October 8, 2009.

Homework 3
Due via Blackboard on Wednesday, October 7, 2009.

  • Download the homework file 213HW3.
  • Modify the file with your solutions and upload via Blackboard by the deadline.

On Wolfram Seminars, watch "Got Manipulate?", Seminar S27.

Homework 2
Due via Blackboard on Friday, September 25, 2009.

  • Download the homework file 213HW2.
  • Modify the file with your solutions and upload via Blackboard by the deadline.

Assignment for September 15, 2009

  • For those of you finished with Homework 1, I am asking you to learn about some of the more visually pleasing things Mathematica can do. After going through some of these topics, please email me at chanusa at qc.cuny.edu with the most interesting pieces you have learned about Manipulate. Also include in this message what I ask for with respect to the Demonstrations Center.
  • Learn about Manipulate: http://teachers.sduhsd.k12.ca.us/abrown/Conferences/CMC2007/ExamplesByStudents.pdf
    • Go to page 4 about Manipulate and try out the suggested examples.
    • If you are interested, try out page 5 to see how to incorporate graphics and modify them dynamically using Manipulate.
  • Learn more about Manipulate: http://reference.wolfram.com/mathematica/tutorial/IntroductionToManipulate.html
    • Skim through this page by Wolfram to see what piques your interest. Try to replicate and enhance a number of the most interesting examples of what you are seeing.
  • Go to the Demonstrations Project and browse the projects. You will be the advance scouts to find the most interesting and most doable projects. Email me the results of your search:
    • Click the "Download Source Code Notebook" link below the picture of the project to be able to interact with the project on your computer.
    • Find one or more projects that really catch your eye as amazing.
    • Find one or more projects that look interesting and probably doable by yourself given enough time learning.
    • (These might have some overlap!)
  • What about this: http://blog.wolfram.com/2009/09/03/a-new-slant-in-mathematica/#more-1896

Homework 1
Due via Blackboard on Wednesday, September 16, 2009.

  • Download the homework file 213HW1.
  • Modify the file with your solutions and upload via Blackboard by the deadline.

Week 1 Files

  • Lab Notes (.nb) Discusses background material about working with Mathematica.
  • Introduction to Mathematica (.nb) Addresses Getting Familiar, Cells, Commands, Symbolic manipluations, defining functions, and plotting pictures.

Homework 0
Due before class on Thursday, September 3, 2009

  • Thoroughly read the class web page including the syllabus and schedule. This should answer all the questions that you may have about the class.
  • Go to the class Discussion Board. Introduce yourself on the "Class Introductions" thread.
  • Watch the Hands-on start to Mathematica, Parts 1 and 2 (Takes 40 minutes)
  • Email me at chanusa@qc.cuny.edu with
    (a) Your name
    (b) The email address where you are best contacted. [For clarifications and contact during the semester
    (c) An explanation about the difference between =, ==, and := in Mathematica. (Watch the hands-on start parts 1 and 2 to find out)
  • Make sure you have a copy of the book for Thursday and that you have access to a copy of Mathematica outside of class for next Tuesday's homework.

Back to the Math with Mathematica Home Page.
Christopher HanusaQueens CollegeMathematics Department.