Guns, God, and Games

Mathematica 6 in the College Classroom

Bruce Torrence

Randolph-Macon College

Labeled[Manipulate[
(* If n is changed, reset game and scoreboard *)
If[Length[v]≠n,v=RandomReal[{-1,1},{n,2}];path={};pDist=0;mDist=0;games=0;mWins=0;pWins=0];
fst=FindShortestTour[v];
Column[{
(* gameboard *)
EventHandler[Dynamic@Graphics[{
(* !!! need If[...] here to prevent momentary pinking as fst udates when n is changed *)
If[Length[v]==Length[Last@fst],{EdgeForm[Directive[Thick,Orange,Opacity[8x]]],Opacity[x],RGBColor[.1,.1,.1],Polygon[v[[Last@fst]]]},{}],
{PointSize[.015],Point[v]},
If[Length[path]>0,{Red,Opacity[.3],Disk[p,r]},{}],
If[Length[path]>1,{Line[path]},{}]
},PlotRange->1.1,ImageSize->{375,375},Frame->True,FrameTicks->None,Background->Lighter[Yellow,.95]],"MouseDown":>(AppendTo[path,p=First@Nearest[v,MousePosition["Graphics"]]])
],
(* distance tally *)
Dynamic@Style[Grid[{{
Text@Grid[{
{"total distance = ",ToString[pDist=If[Length[path]>0,Total[Norm/@Apply[Subtract,Partition[path,2,1],1]],0]]},
{"distance to beat = ",ToString[mDist=N@fst[[1]]]}
},Alignment->{Right,Left},ItemSize->{{10,5}}],
Text[(* see !!! above *)If[Length[v]==Length[Last@fst],ToString[100*pDist/mDist]~~"%","0%"]]
}},ItemSize->{{18,8}}],Opacity[w]]
},Alignment->Center]
,
(* controls *)
{{n,20,"number of cities"},{5,10,15,20,25,30},ControlType->SetterBar,ControlPlacement->Top},
{{w,1,"distance tally"},{0->"hide",1->"show"},ControlPlacement->Top},
{{x,0,Row[{Style["Mathematica",Italic],"'s best tour"}]},{0->"hide",.1->"show"},ControlPlacement->Top},
{{v,RandomReal[{-1,1},{10,2}]},ControlType->None},
{{fst,{0}},ControlType->None},
{{path,{}},ControlType->None},
{{p,0},ControlType->None},
{{games,0,""},ControlType->None},
{{mWins,0,""},ControlType->None},
{{pWins,0,""},ControlType->None},
{{mDist,0,""},ControlType->None},
{{pDist,0,""},ControlType->None},
{{newgame,0,""},Button["new game",(* If game over, update scoreboard *)
If[Length[path]>0,If[Length[Union@path]==n&&First[path]==Last[path],
games+=1;
If[mDist<pDist,mWins+=1];
If[mDist>pDist+5.*(10^(-6)),pWins+=1]
]];v=RandomReal[{-1,1},{n,2}];path={};fst=FindShortestTour[v];pDist=0]&,ControlPlacement->Left},
{{clearpath,0,""},Button["clear path",path={};pDist=0]&,ControlPlacement->Left},
{{undo,0,""},Button["undo edge",If[Length[path]>1,path=Drop[path,-1];p=Last[path]]]&,ControlPlacement->Left},
Delimiter,
Style[" ",24],
(* begin scoreboard *)
Dynamic[Grid[{
{Style["scoreboard",10,Bold],SpanFromLeft},
{Style[ToString[n]~~" cities",10,Bold],SpanFromLeft},
Text/@{"games played",ToString[games]},
Text/@{Row[{Style["Mathematica",Italic]," won "}],ToString[mWins]},
Text/@{"tied",ToString[games-mWins-pWins]},
Text/@{"player won",ToString[pWins]}
},Alignment->{Right,Right},Dividers->Gray]],
(* end scoreboard *)
{{r,.04,"radius"},.03,2,ControlPlacement->Left,ImageSize->Tiny},
TrackedSymbols->{n,v,path,r},ControlPlacement->Left,AutorunSequencing->{1,2,3}],Style["The Traveling Salesman Game","Label",12],Top]

Overview

Overview

Course management

Overview

Course management

Courses for non-mathematics majors

Overview

Course management

Courses for non-mathematics majors

Courses  in the mathematics major

Overview

Course management

Courses for non-mathematics majors

Courses  in the mathematics major

Research experiences

Course Management

Create web content in Mathematica and export as HTML

Course Management

Create web content in Mathematica and export as HTML

Create a course calendar

Course Management

Create web content in Mathematica and export as HTML

Create a course calendar

After creating or editing, Export the file to a web server

Export["testCalendar.html",cal,"ConvertClosed"->"LinkedPage","ConversionRules"->{"Text"->{"<p class='Text' style='font-family: Arial;margin-top: 0px;margin-bottom: 2px;border: 1px;border-style: solid;border-color: #C0C0C0;background-color: #eeeee0;'>","</p>"}}]//Quiet

example site

Mathematics courses for non-majors

Mathematics courses for non-majors

Mathematica !

Mathematics courses for non-majors

Mathematica !

Offered in Spring 2007 using a pre-release of Mathematica 6

Mathematics courses for non-majors

Mathematica !

Offered in Spring 2007 using a pre-release of Mathematica 6

Honors course

Mathematics courses for non-majors

Mathematica !

Offered in Spring 2007 using a pre-release of Mathematica 6

Honors course

Final project: Make a Demonstration and publish to the Demonstrations Project

Mathematics courses for non-majors

Mathematica !

Offered in Spring 2007 using a pre-release of Mathematica 6

Honors course

Final project: Make a Demonstration and publish to the Demonstrations Project

What I discovered: Making a Manipulate is its own reward

Mathematics courses for non-majors

Mathematica !

Offered in Spring 2007 using a pre-release of Mathematica 6

Honors course

Final project: Make a Demonstration and publish to the Demonstrations Project

What I discovered: Making a Manipulate is its own reward

Examples:        Blackjack         Pong

Mathematics courses for non-majors

Introduction to Mathematical Modeling

Mathematics courses for non-majors

Introduction to Mathematical Modeling

100-level mathematics course taught with Mathematica since 1999

Mathematics courses for non-majors

Introduction to Mathematical Modeling

100-level mathematics course taught with Mathematica since 1999

Students do projects using Mathematica

Mathematics courses for non-majors

Introduction to Mathematical Modeling

100-level mathematics course taught with Mathematica since 1999

Students do projects using Mathematica

What I discovered: Games are a highly effective way of developing mathematical ideas

Mathematics courses for non-majors

Introduction to Mathematical Modeling

100-level mathematics course taught with Mathematica since 1999

Students do projects using Mathematica

What I discovered: Games are a highly effective way of developing mathematical ideas

Examples:        Traveling Salesman Game             Fibonacci Nim               Dodegball                Free-trade Economy

Mathematics courses for non-majors

The Human Genome

Mathematics courses for non-majors

The Human Genome

A full-year freshman seminar offered in 2005-06 and again in 2007-08

Mathematics courses for non-majors

The Human Genome

A full-year freshman seminar offered in 2005-06 and again in 2007-08

Team-taught with a biology professor

Mathematics courses for non-majors

The Human Genome

A full-year freshman seminar offered in 2005-06 and again in 2007-08

Team-taught with a biology professor

Final project: Deduce deep ancestry of groups based on mitochondrial DNA testing

Mathematics courses for non-majors

The Human Genome

A full-year freshman seminar offered in 2005-06 and again in 2007-08

Team-taught with a biology professor

Final project: Deduce deep ancestry of groups based on mitochondrial DNA testing

Examples:    allele frequency in a population           counting alignments       Smith-Waterman         mtDNA aligner            class tree

Mathematics courses for majors

Mathematics courses for majors

Multivariable Calculus

Mathematics courses for majors

Multivariable Calculus

First course in major program where Mathematica is required

Mathematics courses for majors

Multivariable Calculus

First course in major program where Mathematica is required

Students use Mathematica extensively, but hand work is also emphasized

Mathematics courses for majors

Multivariable Calculus

First course in major program where Mathematica is required

Students use Mathematica extensively, but hand work is also emphasized

Boot camp

Mathematics courses for majors

Multivariable Calculus

First course in major program where Mathematica is required

Students use Mathematica extensively, but hand work is also emphasized

Boot camp

What I've learned: It takes time for students to warm up to Mathematica

Mathematics courses for majors

Multivariable Calculus

First course in major program where Mathematica is required

Students use Mathematica extensively, but hand work is also emphasized

Boot camp

What I've learned: It takes time for students to warm up to Mathematica

What I've learned: Students initially prefer interactive tools to a command-line interface

Mathematics courses for majors

Multivariable Calculus

First course in major program where Mathematica is required

Students use Mathematica extensively, but hand work is also emphasized

Boot camp

What I've learned: It takes time for students to warm up to Mathematica

What I've learned: Students initially prefer interactive tools to a command-line interface

Examples:       multivariable function viewer              paintball project               shooting gallery

Student research projects

The Gauss-Lucas Theorem

The polynomials f(z)=(((x-r))^n)(x+i)(x-i) where the real root r is allowed to vary

Fix g(z), and view the convex hull of the roots of the integral of g, allowing the constant of integration to vary