| Info
 |  | 
 
 An exploration of the ideas behind computer 
 programming, including function calls, 
 object oriented programming, data structures,
 and lots of other cool stuff.
 The Mathematica language is quite versatile, 
 allowing for a variety of programming styles - 
 and its easy to draw lots of pretty pictures.
 This course (or any of the similar ones 
 offered each fall in languages like Java, 
 Perl, or C++) serves as a foundation for 
 further work in computer science or any related field. 
The parenthesis so common in both computer science 
and mathematics should perhaps be inserted into the title
of this course so reads "An Intro to Programming (with Mathematica)"
rather than "An Intro to (Programming with Mathematica)". 
In other words, my intention is to have the focus of 
the course on programming - what it is, 
how it works, why one might want to do it, and so on - rather
than Mathematica itself.  However, programming
isn't a subject that is easily studied in the abstract;
instead, you need to climb in and get your hands dirty
by actually doing it - which is exactly what we're going to do. 
Depending on your level of math comfort, I expect
that many of you will find the textbook intimidating;
the author uses calculus and other higher math freely,
and is writing prose generally aimed at a mathematically
literate audience. It is my intention, however, to 
extract out the parts related to the goals of this course,
without requiring the calculus bits.
So you shouldn't need an extensive math background.
However, you will need to be able read and explore mathematical
ideas, including being able to learn new notations
and syntax - but then, all programming languages 
require that, really. 
Grading will be based on weekly assignments, 
a final project, and two take home tests
along the way, as well as a class participation grade.
I plan to drop the lowest of those five scores
and average the other four for your final grade. 
This webpage will continue to change throughout the semester
as assignments and resources are added.
 | 
 | 
| Tentative Syllabus
 
 
 date             week                      topic
 ---------------------------------------------------------------------------
 Sep        3     0
       7,   9     1                         intro
      14,  16     2                         functions, ...
      21,  23     3                         variables, operators, ...
      28,  30     4                         control flow
 Oct   5,   7     5   mid-term grades       I/O
      12,  14     6                         practice
           21,    7   Hendrick's days       sorting
      26,  28     8                         computability
  Nov  2,   4     9                         databases
       9,  11    10                         object oriented programming
      16,  18    11                         lists and recursion
      23              Thanksgiving          functional programmin
      29,   2    12                          
 Dec   7         13
 == details ================================================================
 week  topic                                                     textbook
---------------------------------------------------------------------------
I) intro
  1    a) general "how-to" for using the mathematica system       chap 1
       b) general intro to programming                             and my notes
  
II) programming notions
 *2    functions, programs, subroutines, comments (API), debug    chap  2
  3    atoms, operators, boolean expressions, variables, lists     and my notes
  4    conditionals and loops                                      .
  5    I/O Import, Export                                          .
  6    practice; packages                                          .
III) classic CS ideas
  7    sorting                                                    chap  6
  8    computability                                              chap 12
  9    databases                                                  chap 13
IV) styles of programming
 10    object oriented programm  (Java, C++)                      chap 14
 11    lists and recursion       (Lisp)                           chap  9
 12    functional programming    (Haskell)                        chap 11
 13    we'll see
 | 
| Assignments
 
for Tues September 7
  
    Send me (mahoney@marlboro.edu)
        an email telling me you're registering for this class.Try out Mathematica on one of the lab machines.
      In particular, browse through the online Help system, and
 
	Be ready to bring any questions up in class.read the "Tour",look at "Getting Started", especially "Working with Notebooks",start working through "A Practical Introduction..." in "The Mathematica Book".
      If you have access to the text, 
      browse the first chapter in the text; I'll talk more about
      the computer science background in class.for Tues September 14
  
    Read chapter 1 in "Feynman Lectures on Computation", in Sci 217Read (and explore any topics that catch your attention)
     the "Computer" entry in the wikipedia at en.wikipedia.org/wiki/Computer.Read the "Tutorial" (23 screens) in Mathematica's Help menu.Read James Kelly's "Getting Started" Mathematica notebook.
    Skip the parts that feel too mathematical, but do look at 
    and work through at least the
    "Using a notebook interface", "Help!", "Input conventions", 
    and "Using functions" sections.Do the following exercises in Mathematica; most
        are from the Getting Started notebook.
	
	  Express the number of seconds in a year in hexadecimal form.  [Hint: use Help to find functions which manipulate bases and note that hexadecimal form describes a number represented in base 16.]Display the first 20 powers of 2, i.e. {2, 4, 8, ...}.Revelation 13.18: "Let him that hath understanding count the number of the beast, for it is the number of a man and his number is 666."  Show that the sum of the squares of the first seven primes is the beast number.
	  (Hint: see the Prime and Total functions.) Create a notebook which presents a simple problem in your field of interest, or perhaps reproduces some recent lecture you heard, or some section of a textbook.  Your notebook should have title, author information, sections, text presenting the problem and some background information, and references if appropriate.  If you already possess enough Mathematica tools, include the solution also.Explain in English what this Mathematica expression says.
!(a && b) == (!a || !b) /. {a -> True, b -> False}for Tues September 21This is a practice programming week: time to dive in.
 
    Do the exercises 
      in the 
      hiddenTurtle.nb notebook.Write, document, and test an isEven[] function that returns True for
      an even number, and False for and odd one.
      I'm not quite sure where your skills are at this point, 
      so I'm going to suggest several posssible programming projects.
      Pick at least one (preferably two) to try out.  
      Whichever ones you look at,
      organize your thinking by answering these questions first.
      
	So here are some possible problems.  If something else similar
      is bubbling in the back of your head that you'd rather try, 
      or these seem beyond you, talk to me about doing something else instead.
      The point is to pick some kind of numeric search or puzzle or game 
      that can be done as a text input/ouput thing, or as a drawing thing
      in the Turtle world.How can I break this problem into smaller pieces?What kinds of data (number, strings, lists, ...) do 
	    I need to pass around for these pieces?Does Mathematica have any built in functions
	    that might help?How do I want to display the answer?What do I need to ask the user? 
	Perfect numbers ... we did this in class.A "magic square" is a rectangular grid of numbers whose 
	  rows, columns, and diagonals add up to the same number.  
	  Can you write a program to find one?  More than one?  
	  How big are they?Rearrange 1..9 to find fractions such that 1/23 + 4/56 + 7/89 = 1Write a program that simulates one of the state lottery games
	(you'll have to look up some rules online), letting the user pick
	a number, generating a winning number, and looking for a win with payoffs.Write a program that simulates a dice game like
	  craps (find rules online, e.g. here) or Cosmic Wimpout (http://www.cosmicwimpout.com/cwrules.htm), or a simplified
	version of one of these.Play the classic "Mine sweep" game.Play hangman.  (You'll have to pick a random word from
	a list of possible words, and count letters - look for 
	string manipulation functions.for Tues September 28
 
    More practice - pick another of the many projects from last week,
    and try again.Read (if you havne't already) chapters 1 and 2 in the text.We'll be moving into chapter 6 - searching - next week.for Tues October 5
 
  Read chapter 6 in the text, on searching and sorting.
        The author's style is fairly technical, but don't let
	that scare you away - most of what's in there is pretty
	cool once you see how it works.Browse through 
  Sort algorithms on the Wikipedia to see the range of what's out there.Pick any two of the sorting algorithms listed 
  on the wikipedia site, above.  Describe in words 
  how the algorithm proceeds, and work out (by hand) 
  what each would do on a short list like {6,4,1,7,1}.
  (I call your attention to the "Stupid sort" for a particularly simple one,
  and the "bogosort" for a particluarly amusing one.")
  See my version of Mathematica code to do this stuff
  in code/search_and_sortOf those two, pick one to implement in Mathematica.
  (Get help, if need be, or start with implementations in the wikipedia.)
  Test your routine on various kinds of initial scrambled lists
  (at least random and reverse order) and see how they work as
  the size of the list gets big.  While it may be hard to distinguish
  Mathematica's behavior from the algorithm's behavior, it'd be
  great if you could measure the O(n) behavior as n gets larger.Pick any one of the exercises on pg 138 and following to do.for Tues October 12
 
  An extra week to finish last week's assingnment.
  Check out my example of a binary tree 
    dictionary, complete with random words : 
    code/dictionary.
  for Thurs October 21 (Tues is Hendrick's days) This is a practice with file input/output and data manipulation week.
 
  Read the Mathematica documentation on
      the commands Directory[], SetDirectory[],
      Import[], and Export[], BarChart[] (in the Graphics`Graphics` Add-on Package)
      and ListPlot[].  A .csv file with survey data from a statistics course last
      year is here.  Download it, import it into mathematica, and create a histogram
of the women's heights as a bar chart.  That is, for each of a number
of ranges of heights (5 ft, 5 ft 1 in, 5 ft 2 in, ...) count how many
women fall in that range. With the same data, make plots that shows each woman's height
  as a function of (a) her mother's height, (b) her father's height,
  and (c) the average of her parent's height. Does your intuition
  lead you to any conclusions?Again with that data, create a new file that has the ages and heights of 
      the black haired men.Here is a link to the text of 
    Moby Dick.  
    Read it in one line at a time, and make a list of the 50 most frequently 
    used words.  Do you think these numbers are representative of the English
    language, or of this author?  (You can find other public texts at
    the Gutenberg project, http://promo.net/pg/.)for Tues October 26 
 
  Finish up at least the .csv stuff from last time.Read online about Conway's Game of Life; there are many good online sources.
    
   Submit a preliminary proposal for your final project.  This is your only 
     written assignment for this week - so put some thought in.  I want more than
     one sentence here - tell me some thought on how you're going to go about the
     project, what readings (if any) you've found on the topic, and how you think
     it might work in Mathematica.for Tues November 2
  
    Read about computer graphics and how they work in Mathematica : 
      
	Check out the blurbs on
	  raster graphics 
	  and "vector graphics" in the wikipedia.  There are links there to human vision, as well, that make interesting reading.Explore my mathmatica notebooks in code/graphics/ and code/oct_28/Read the parts of the online Mathematica documentation 
	that discuss the Graphics object, the Graphics3D object, 
	as well as some of the more general discussions of graphics :
	"Tour/Visualization" and especially the section 
	"The Mathematica Book / Principles of Mathematica / The Structure of Graphics and Sound".  (You can read this in the big hardcopy version of the book on the shelf in 217.)Look over the code/TurtleGraphics.nb notebook we did earlier this semester,
      and see how I did the graphics stuff in it.Please do more thinking about your project, and report what you've done,
      either some research, or create an initial specification for your project 
      code : what Mathematica functions do you want, and what should they do?Play around with some kind of graphics in Mathematica.  
        What exactly is up to you.  You're welcome to start with some
        of my code, but I would like to see evidence that you've
        looked at the documentation and added some new features.  
        Draw a pattern, or animate some random shapes, 
        or rotate a raster image, or create (or even solve) a random maze...for Tues November 9
  
    Read about buttons and mathematica notebooks, 
    both (a) in the help file, and (b) looking at
    the examples in the buttons/
    directory, including the "LightsOut" game I showed
    in class.
    Continue work on your term projects, including
        brief a progress report as to what you got
        done this week.Create a mathematica notebook that has three buttons,
        which change what is displayed below them.
        The idea is something like this, where the picture
	depends on which button is pushed.
 button1 | button2 | button3
 ---------------------------
 |  picture                |
 ---------------------------
for Thurs Nov 11 and Tues Nov 16
  
    Be ready to discuss and look at in class your project.for Tues Nov 30 - optional
  
    Last weekly assignment.Read the beginning of chapter 14 in the textWrite a short mathematica program in an object oriented style.
        See object_oriented.
        Either convert one of the programs you've written earlier
        this semester, or follow the assignment in the objects.nb file.
 |