<!--{{{-->
<link rel='alternate' type='application/rss+xml' title='RSS' href='index.xml' />
<!--}}}-->
Background: #fff
Foreground: #000
PrimaryPale: #8cf
PrimaryLight: #18f
PrimaryMid: #04b
PrimaryDark: #014
SecondaryPale: #ffc
SecondaryLight: #fe8
SecondaryMid: #db4
SecondaryDark: #841
TertiaryPale: #eee
TertiaryLight: #ccc
TertiaryMid: #999
TertiaryDark: #666
Error: #f88
/*{{{*/
body {background:[[ColorPalette::Background]]; color:[[ColorPalette::Foreground]];}

a {color:[[ColorPalette::PrimaryMid]];}
a:hover {background-color:[[ColorPalette::PrimaryMid]]; color:[[ColorPalette::Background]];}
a img {border:0;}

h1,h2,h3,h4,h5,h6 {color:[[ColorPalette::SecondaryDark]]; background:transparent;}
h1 {border-bottom:2px solid [[ColorPalette::TertiaryLight]];}
h2,h3 {border-bottom:1px solid [[ColorPalette::TertiaryLight]];}

.button {color:[[ColorPalette::PrimaryDark]]; border:1px solid [[ColorPalette::Background]];}
.button:hover {color:[[ColorPalette::PrimaryDark]]; background:[[ColorPalette::SecondaryLight]]; border-color:[[ColorPalette::SecondaryMid]];}
.button:active {color:[[ColorPalette::Background]]; background:[[ColorPalette::SecondaryMid]]; border:1px solid [[ColorPalette::SecondaryDark]];}

.header {background:[[ColorPalette::PrimaryMid]];}
.headerShadow {color:[[ColorPalette::Foreground]];}
.headerShadow a {font-weight:normal; color:[[ColorPalette::Foreground]];}
.headerForeground {color:[[ColorPalette::Background]];}
.headerForeground a {font-weight:normal; color:[[ColorPalette::PrimaryPale]];}

.tabSelected{color:[[ColorPalette::PrimaryDark]];
	background:[[ColorPalette::TertiaryPale]];
	border-left:1px solid [[ColorPalette::TertiaryLight]];
	border-top:1px solid [[ColorPalette::TertiaryLight]];
	border-right:1px solid [[ColorPalette::TertiaryLight]];
}
.tabUnselected {color:[[ColorPalette::Background]]; background:[[ColorPalette::TertiaryMid]];}
.tabContents {color:[[ColorPalette::PrimaryDark]]; background:[[ColorPalette::TertiaryPale]]; border:1px solid [[ColorPalette::TertiaryLight]];}
.tabContents .button {border:0;}

#sidebar {}
#sidebarOptions input {border:1px solid [[ColorPalette::PrimaryMid]];}
#sidebarOptions .sliderPanel {background:[[ColorPalette::PrimaryPale]];}
#sidebarOptions .sliderPanel a {border:none;color:[[ColorPalette::PrimaryMid]];}
#sidebarOptions .sliderPanel a:hover {color:[[ColorPalette::Background]]; background:[[ColorPalette::PrimaryMid]];}
#sidebarOptions .sliderPanel a:active {color:[[ColorPalette::PrimaryMid]]; background:[[ColorPalette::Background]];}

.wizard {background:[[ColorPalette::PrimaryPale]]; border:1px solid [[ColorPalette::PrimaryMid]];}
.wizard h1 {color:[[ColorPalette::PrimaryDark]]; border:none;}
.wizard h2 {color:[[ColorPalette::Foreground]]; border:none;}
.wizardStep {background:[[ColorPalette::Background]]; color:[[ColorPalette::Foreground]];
	border:1px solid [[ColorPalette::PrimaryMid]];}
.wizardStep.wizardStepDone {background:[[ColorPalette::TertiaryLight]];}
.wizardFooter {background:[[ColorPalette::PrimaryPale]];}
.wizardFooter .status {background:[[ColorPalette::PrimaryDark]]; color:[[ColorPalette::Background]];}
.wizard .button {color:[[ColorPalette::Foreground]]; background:[[ColorPalette::SecondaryLight]]; border: 1px solid;
	border-color:[[ColorPalette::SecondaryPale]] [[ColorPalette::SecondaryDark]] [[ColorPalette::SecondaryDark]] [[ColorPalette::SecondaryPale]];}
.wizard .button:hover {color:[[ColorPalette::Foreground]]; background:[[ColorPalette::Background]];}
.wizard .button:active {color:[[ColorPalette::Background]]; background:[[ColorPalette::Foreground]]; border: 1px solid;
	border-color:[[ColorPalette::PrimaryDark]] [[ColorPalette::PrimaryPale]] [[ColorPalette::PrimaryPale]] [[ColorPalette::PrimaryDark]];}

.wizard .notChanged {background:transparent;}
.wizard .changedLocally {background:#80ff80;}
.wizard .changedServer {background:#8080ff;}
.wizard .changedBoth {background:#ff8080;}
.wizard .notFound {background:#ffff80;}
.wizard .putToServer {background:#ff80ff;}
.wizard .gotFromServer {background:#80ffff;}

#messageArea {border:1px solid [[ColorPalette::SecondaryMid]]; background:[[ColorPalette::SecondaryLight]]; color:[[ColorPalette::Foreground]];}
#messageArea .button {color:[[ColorPalette::PrimaryMid]]; background:[[ColorPalette::SecondaryPale]]; border:none;}

.popupTiddler {background:[[ColorPalette::TertiaryPale]]; border:2px solid [[ColorPalette::TertiaryMid]];}

.popup {background:[[ColorPalette::TertiaryPale]]; color:[[ColorPalette::TertiaryDark]]; border-left:1px solid [[ColorPalette::TertiaryMid]]; border-top:1px solid [[ColorPalette::TertiaryMid]]; border-right:2px solid [[ColorPalette::TertiaryDark]]; border-bottom:2px solid [[ColorPalette::TertiaryDark]];}
.popup hr {color:[[ColorPalette::PrimaryDark]]; background:[[ColorPalette::PrimaryDark]]; border-bottom:1px;}
.popup li.disabled {color:[[ColorPalette::TertiaryMid]];}
.popup li a, .popup li a:visited {color:[[ColorPalette::Foreground]]; border: none;}
.popup li a:hover {background:[[ColorPalette::SecondaryLight]]; color:[[ColorPalette::Foreground]]; border: none;}
.popup li a:active {background:[[ColorPalette::SecondaryPale]]; color:[[ColorPalette::Foreground]]; border: none;}
.popupHighlight {background:[[ColorPalette::Background]]; color:[[ColorPalette::Foreground]];}
.listBreak div {border-bottom:1px solid [[ColorPalette::TertiaryDark]];}

.tiddler .defaultCommand {font-weight:bold;}

.shadow .title {color:[[ColorPalette::TertiaryDark]];}

.title {color:[[ColorPalette::SecondaryDark]];}
.subtitle {color:[[ColorPalette::TertiaryDark]];}

.toolbar {color:[[ColorPalette::PrimaryMid]];}
.toolbar a {color:[[ColorPalette::TertiaryLight]];}
.selected .toolbar a {color:[[ColorPalette::TertiaryMid]];}
.selected .toolbar a:hover {color:[[ColorPalette::Foreground]];}

.tagging, .tagged {border:1px solid [[ColorPalette::TertiaryPale]]; background-color:[[ColorPalette::TertiaryPale]];}
.selected .tagging, .selected .tagged {background-color:[[ColorPalette::TertiaryLight]]; border:1px solid [[ColorPalette::TertiaryMid]];}
.tagging .listTitle, .tagged .listTitle {color:[[ColorPalette::PrimaryDark]];}
.tagging .button, .tagged .button {border:none;}

.footer {color:[[ColorPalette::TertiaryLight]];}
.selected .footer {color:[[ColorPalette::TertiaryMid]];}

.sparkline {background:[[ColorPalette::PrimaryPale]]; border:0;}
.sparktick {background:[[ColorPalette::PrimaryDark]];}

.error, .errorButton {color:[[ColorPalette::Foreground]]; background:[[ColorPalette::Error]];}
.warning {color:[[ColorPalette::Foreground]]; background:[[ColorPalette::SecondaryPale]];}
.lowlight {background:[[ColorPalette::TertiaryLight]];}

.zoomer {background:none; color:[[ColorPalette::TertiaryMid]]; border:3px solid [[ColorPalette::TertiaryMid]];}

.imageLink, #displayArea .imageLink {background:transparent;}

.annotation {background:[[ColorPalette::SecondaryLight]]; color:[[ColorPalette::Foreground]]; border:2px solid [[ColorPalette::SecondaryMid]];}

.viewer .listTitle {list-style-type:none; margin-left:-2em;}
.viewer .button {border:1px solid [[ColorPalette::SecondaryMid]];}
.viewer blockquote {border-left:3px solid [[ColorPalette::TertiaryDark]];}

.viewer table, table.twtable {border:2px solid [[ColorPalette::TertiaryDark]];}
.viewer th, .viewer thead td, .twtable th, .twtable thead td {background:[[ColorPalette::SecondaryMid]]; border:1px solid [[ColorPalette::TertiaryDark]]; color:[[ColorPalette::Background]];}
.viewer td, .viewer tr, .twtable td, .twtable tr {border:1px solid [[ColorPalette::TertiaryDark]];}

.viewer pre {border:1px solid [[ColorPalette::SecondaryLight]]; background:[[ColorPalette::SecondaryPale]];}
.viewer code {color:[[ColorPalette::SecondaryDark]];}
.viewer hr {border:0; border-top:dashed 1px [[ColorPalette::TertiaryDark]]; color:[[ColorPalette::TertiaryDark]];}

.highlight, .marked {background:[[ColorPalette::SecondaryLight]];}

.editor input {border:1px solid [[ColorPalette::PrimaryMid]];}
.editor textarea {border:1px solid [[ColorPalette::PrimaryMid]]; width:100%;}
.editorFooter {color:[[ColorPalette::TertiaryMid]];}

#backstageArea {background:[[ColorPalette::Foreground]]; color:[[ColorPalette::TertiaryMid]];}
#backstageArea a {background:[[ColorPalette::Foreground]]; color:[[ColorPalette::Background]]; border:none;}
#backstageArea a:hover {background:[[ColorPalette::SecondaryLight]]; color:[[ColorPalette::Foreground]]; }
#backstageArea a.backstageSelTab {background:[[ColorPalette::Background]]; color:[[ColorPalette::Foreground]];}
#backstageButton a {background:none; color:[[ColorPalette::Background]]; border:none;}
#backstageButton a:hover {background:[[ColorPalette::Foreground]]; color:[[ColorPalette::Background]]; border:none;}
#backstagePanel {background:[[ColorPalette::Background]]; border-color: [[ColorPalette::Background]] [[ColorPalette::TertiaryDark]] [[ColorPalette::TertiaryDark]] [[ColorPalette::TertiaryDark]];}
.backstagePanelFooter .button {border:none; color:[[ColorPalette::Background]];}
.backstagePanelFooter .button:hover {color:[[ColorPalette::Foreground]];}
#backstageCloak {background:[[ColorPalette::Foreground]]; opacity:0.6; filter:'alpha(opacity:60)';}
/*}}}*/
/*{{{*/
* html .tiddler {height:1%;}

body {font-size:.75em; font-family:arial,helvetica; margin:0; padding:0;}

h1,h2,h3,h4,h5,h6 {font-weight:bold; text-decoration:none;}
h1,h2,h3 {padding-bottom:1px; margin-top:1.2em;margin-bottom:0.3em;}
h4,h5,h6 {margin-top:1em;}
h1 {font-size:1.35em;}
h2 {font-size:1.25em;}
h3 {font-size:1.1em;}
h4 {font-size:1em;}
h5 {font-size:.9em;}

hr {height:1px;}

a {text-decoration:none;}

dt {font-weight:bold;}

ol {list-style-type:decimal;}
ol ol {list-style-type:lower-alpha;}
ol ol ol {list-style-type:lower-roman;}
ol ol ol ol {list-style-type:decimal;}
ol ol ol ol ol {list-style-type:lower-alpha;}
ol ol ol ol ol ol {list-style-type:lower-roman;}
ol ol ol ol ol ol ol {list-style-type:decimal;}

.txtOptionInput {width:11em;}

#contentWrapper .chkOptionInput {border:0;}

.externalLink {text-decoration:underline;}

.indent {margin-left:3em;}
.outdent {margin-left:3em; text-indent:-3em;}
code.escaped {white-space:nowrap;}

.tiddlyLinkExisting {font-weight:bold;}
.tiddlyLinkNonExisting {font-style:italic;}

/* the 'a' is required for IE, otherwise it renders the whole tiddler in bold */
a.tiddlyLinkNonExisting.shadow {font-weight:bold;}

#mainMenu .tiddlyLinkExisting,
	#mainMenu .tiddlyLinkNonExisting,
	#sidebarTabs .tiddlyLinkNonExisting {font-weight:normal; font-style:normal;}
#sidebarTabs .tiddlyLinkExisting {font-weight:bold; font-style:normal;}

.header {position:relative;}
.header a:hover {background:transparent;}
.headerShadow {position:relative; padding:4.5em 0em 1em 1em; left:-1px; top:-1px;}
.headerForeground {position:absolute; padding:4.5em 0em 1em 1em; left:0px; top:0px;}

.siteTitle {font-size:3em;}
.siteSubtitle {font-size:1.2em;}

#mainMenu {position:absolute; left:0; width:10em; text-align:right; line-height:1.6em; padding:1.5em 0.5em 0.5em 0.5em; font-size:1.1em;}

#sidebar {position:absolute; right:3px; width:16em; font-size:.9em;}
#sidebarOptions {padding-top:0.3em;}
#sidebarOptions a {margin:0em 0.2em; padding:0.2em 0.3em; display:block;}
#sidebarOptions input {margin:0.4em 0.5em;}
#sidebarOptions .sliderPanel {margin-left:1em; padding:0.5em; font-size:.85em;}
#sidebarOptions .sliderPanel a {font-weight:bold; display:inline; padding:0;}
#sidebarOptions .sliderPanel input {margin:0 0 .3em 0;}
#sidebarTabs .tabContents {width:15em; overflow:hidden;}

.wizard {padding:0.1em 1em 0em 2em;}
.wizard h1 {font-size:2em; font-weight:bold; background:none; padding:0em 0em 0em 0em; margin:0.4em 0em 0.2em 0em;}
.wizard h2 {font-size:1.2em; font-weight:bold; background:none; padding:0em 0em 0em 0em; margin:0.4em 0em 0.2em 0em;}
.wizardStep {padding:1em 1em 1em 1em;}
.wizard .button {margin:0.5em 0em 0em 0em; font-size:1.2em;}
.wizardFooter {padding:0.8em 0.4em 0.8em 0em;}
.wizardFooter .status {padding:0em 0.4em 0em 0.4em; margin-left:1em;}
.wizard .button {padding:0.1em 0.2em 0.1em 0.2em;}

#messageArea {position:fixed; top:2em; right:0em; margin:0.5em; padding:0.5em; z-index:2000; _position:absolute;}
.messageToolbar {display:block; text-align:right; padding:0.2em 0.2em 0.2em 0.2em;}
#messageArea a {text-decoration:underline;}

.tiddlerPopupButton {padding:0.2em 0.2em 0.2em 0.2em;}
.popupTiddler {position: absolute; z-index:300; padding:1em 1em 1em 1em; margin:0;}

.popup {position:absolute; z-index:300; font-size:.9em; padding:0; list-style:none; margin:0;}
.popup .popupMessage {padding:0.4em;}
.popup hr {display:block; height:1px; width:auto; padding:0; margin:0.2em 0em;}
.popup li.disabled {padding:0.4em;}
.popup li a {display:block; padding:0.4em; font-weight:normal; cursor:pointer;}
.listBreak {font-size:1px; line-height:1px;}
.listBreak div {margin:2px 0;}

.tabset {padding:1em 0em 0em 0.5em;}
.tab {margin:0em 0em 0em 0.25em; padding:2px;}
.tabContents {padding:0.5em;}
.tabContents ul, .tabContents ol {margin:0; padding:0;}
.txtMainTab .tabContents li {list-style:none;}
.tabContents li.listLink { margin-left:.75em;}

#contentWrapper {display:block;}
#splashScreen {display:none;}

#displayArea {margin:1em 17em 0em 14em;}

.toolbar {text-align:right; font-size:.9em;}

.tiddler {padding:1em 1em 0em 1em;}

.missing .viewer,.missing .title {font-style:italic;}

.title {font-size:1.6em; font-weight:bold;}

.missing .subtitle {display:none;}
.subtitle {font-size:1.1em;}

.tiddler .button {padding:0.2em 0.4em;}

.tagging {margin:0.5em 0.5em 0.5em 0; float:left; display:none;}
.isTag .tagging {display:block;}
.tagged {margin:0.5em; float:right;}
.tagging, .tagged {font-size:0.9em; padding:0.25em;}
.tagging ul, .tagged ul {list-style:none; margin:0.25em; padding:0;}
.tagClear {clear:both;}

.footer {font-size:.9em;}
.footer li {display:inline;}

.annotation {padding:0.5em; margin:0.5em;}

* html .viewer pre {width:99%; padding:0 0 1em 0;}
.viewer {line-height:1.4em; padding-top:0.5em;}
.viewer .button {margin:0em 0.25em; padding:0em 0.25em;}
.viewer blockquote {line-height:1.5em; padding-left:0.8em;margin-left:2.5em;}
.viewer ul, .viewer ol {margin-left:0.5em; padding-left:1.5em;}

.viewer table, table.twtable {border-collapse:collapse; margin:0.8em 1.0em;}
.viewer th, .viewer td, .viewer tr,.viewer caption,.twtable th, .twtable td, .twtable tr,.twtable caption {padding:3px;}
table.listView {font-size:0.85em; margin:0.8em 1.0em;}
table.listView th, table.listView td, table.listView tr {padding:0px 3px 0px 3px;}

.viewer pre {padding:0.5em; margin-left:0.5em; font-size:1.2em; line-height:1.4em; overflow:auto;}
.viewer code {font-size:1.2em; line-height:1.4em;}

.editor {font-size:1.1em;}
.editor input, .editor textarea {display:block; width:100%; font:inherit;}
.editorFooter {padding:0.25em 0em; font-size:.9em;}
.editorFooter .button {padding-top:0px; padding-bottom:0px;}

.fieldsetFix {border:0; padding:0; margin:1px 0px 1px 0px;}

.sparkline {line-height:1em;}
.sparktick {outline:0;}

.zoomer {font-size:1.1em; position:absolute; overflow:hidden;}
.zoomer div {padding:1em;}

* html #backstage {width:99%;}
* html #backstageArea {width:99%;}
#backstageArea {display:none; position:relative; overflow: hidden; z-index:150; padding:0.3em 0.5em 0.3em 0.5em;}
#backstageToolbar {position:relative;}
#backstageArea a {font-weight:bold; margin-left:0.5em; padding:0.3em 0.5em 0.3em 0.5em;}
#backstageButton {display:none; position:absolute; z-index:175; top:0em; right:0em;}
#backstageButton a {padding:0.1em 0.4em 0.1em 0.4em; margin:0.1em 0.1em 0.1em 0.1em;}
#backstage {position:relative; width:100%; z-index:50;}
#backstagePanel {display:none; z-index:100; position:absolute; width:90%; margin:0em 3em 0em 3em; padding:1em 1em 1em 1em;}
.backstagePanelFooter {padding-top:0.2em; float:right;}
.backstagePanelFooter a {padding:0.2em 0.4em 0.2em 0.4em;}
#backstageCloak {display:none; z-index:20; position:absolute; width:100%; height:100px;}

.whenBackstage {display:none;}
.backstageVisible .whenBackstage {display:block;}
/*}}}*/
/***
StyleSheet for use when a translation requires any css style changes.
This StyleSheet can be used directly by languages such as Chinese, Japanese and Korean which need larger font sizes.
***/
/*{{{*/
body {font-size:0.8em;}
#sidebarOptions {font-size:1.05em;}
#sidebarOptions a {font-style:normal;}
#sidebarOptions .sliderPanel {font-size:0.95em;}
.subtitle {font-size:0.8em;}
.viewer table.listView {font-size:0.95em;}
/*}}}*/
/*{{{*/
@media print {
#mainMenu, #sidebar, #messageArea, .toolbar, #backstageButton, #backstageArea {display: none ! important;}
#displayArea {margin: 1em 1em 0em 1em;}
/* Fixes a feature in Firefox 1.5.0.2 where print preview displays the noscript content */
noscript {display:none;}
}
/*}}}*/
<!--{{{-->
<div class='header' macro='gradient vert [[ColorPalette::PrimaryLight]] [[ColorPalette::PrimaryMid]]'>
<div class='headerShadow'>
<span class='siteTitle' refresh='content' tiddler='SiteTitle'></span>&nbsp;
<span class='siteSubtitle' refresh='content' tiddler='SiteSubtitle'></span>
</div>
<div class='headerForeground'>
<span class='siteTitle' refresh='content' tiddler='SiteTitle'></span>&nbsp;
<span class='siteSubtitle' refresh='content' tiddler='SiteSubtitle'></span>
</div>
</div>
<div id='mainMenu' refresh='content' tiddler='MainMenu'></div>
<div id='sidebar'>
<div id='sidebarOptions' refresh='content' tiddler='SideBarOptions'></div>
<div id='sidebarTabs' refresh='content' force='true' tiddler='SideBarTabs'></div>
</div>
<div id='displayArea'>
<div id='messageArea'></div>
<div id='tiddlerDisplay'></div>
</div>
<!--}}}-->
<!--{{{-->
<div class='toolbar' macro='toolbar [[ToolbarCommands::ViewToolbar]]'></div>
<div class='title' macro='view title'></div>
<div class='subtitle'><span macro='view modifier link'></span>, <span macro='view modified date'></span> (<span macro='message views.wikified.createdPrompt'></span> <span macro='view created date'></span>)</div>
<div class='tagging' macro='tagging'></div>
<div class='tagged' macro='tags'></div>
<div class='viewer' macro='view text wikified'></div>
<div class='tagClear'></div>
<!--}}}-->
<!--{{{-->
<div class='toolbar' macro='toolbar [[ToolbarCommands::EditToolbar]]'></div>
<div class='title' macro='view title'></div>
<div class='editor' macro='edit title'></div>
<div macro='annotations'></div>
<div class='editor' macro='edit text'></div>
<div class='editor' macro='edit tags'></div><div class='editorFooter'><span macro='message views.editor.tagPrompt'></span><span macro='tagChooser excludeLists'></span></div>
<!--}}}-->
To get started with this blank TiddlyWiki, you'll need to modify the following tiddlers:
* SiteTitle & SiteSubtitle: The title and subtitle of the site, as shown above (after saving, they will also appear in the browser title bar)
* MainMenu: The menu (usually on the left)
* DefaultTiddlers: Contains the names of the tiddlers that you want to appear when the TiddlyWiki is opened
You'll also need to enter your username for signing your edits: <<option txtUserName>>
These InterfaceOptions for customising TiddlyWiki are saved in your browser

Your username for signing your edits. Write it as a WikiWord (eg JoeBloggs)

<<option txtUserName>>
<<option chkSaveBackups>> SaveBackups
<<option chkAutoSave>> AutoSave
<<option chkRegExpSearch>> RegExpSearch
<<option chkCaseSensitiveSearch>> CaseSensitiveSearch
<<option chkAnimate>> EnableAnimations

----
Also see [[AdvancedOptions]]
<<importTiddlers>>
http://www.tiddlywiki.com/
http://www.giffmex.org/twfortherestofus.html

http://processing.tiddlyspot.com/
http://www.math.ist.utl.pt/~psoares/MathSVG.html

http://www.uncw.edu/reg/calendars-events.htm#Jun09

*Investigate how mathsvg and jsmath interact
An array is a list of data. Each piece of data in an array is identified by an index number representing its position in the array. Arrays are zero based, which means that the first element in the array is [0], the second element is [1], and so on. In this example, an array named "coswav" is created and filled with the cosine values. This data is displayed three separate ways on the screen.

<<Processing 

size(200, 200);

float[] coswave = new float[width];

for(int i=0; i<width; i++) {
  float ratio = (float)i/(float)width;
  coswave[i] = abs( cos(ratio*PI) );
}

for(int i=0; i<width; i++) {
  stroke(coswave[i]*255);
  line(i, 0, i, width/3);
}

for(int i=0; i<width; i++) {
  stroke(coswave[i]*255/4);
  line(i, width/3, i, width/3*2);
}

for(int i=0; i<width; i++) {
  stroke(255-coswave[i]*255);
  line(i, width/3*2, i, height);
}

>>

Taken from [[basic/array.html|http://ejohn.org/apps/processing.js/examples/basic/array.html]]
Please refresh/reload the webpage to see the latest updates to the site.
<<tabs Assignments
Quizzes "Quizzes" [[Quizzes]]
Tests "Tests" [[Tests]]
Homework "Homework" [[Homework]]
>>
<<tabs Outline
Outline "Outline" ./outline
>>

<part outline hidden>
*Powers of the Binomial $1+x$
*Pascal's Triangle
*Coefficients of the expansion of $(1+x)^n$
*Binomial Coefficients
*Combinatorial Identity
</part>
''Definition''
A common divisor of integers $a$ and $b$ is an integer $c$ with $c | a$ and $c | b.$
''Theorem''
Let $a$ and $b$ be integers.  A nonnegative common divisor $d$ is their gcd if and only if $c | d$ for every common divisor $c.$
*Congruence modulo $m$
*Congruence is an equivalence relation
*Congruence is compatible with addition and multiplication
*Identifying non-square numbers via congruence
*Determining divisibility by 9
*Solution of linear congruences
*Instructor
**Dr. Michael Freeze
*Class meeting time
**Section 001:  Tuesdays and Thursdays, 12:30-01:45p in Bear 164
*Office Location
**Bear Hall 124
*Office Hours
**by appointment
*Phone
**910.795.1385
*Email
**freezem at uncw dot edu
All shapes drawn to the screen have a position that is specified as a coordinate. All coordinates are measured as the distance from the origin in units of pixels. The origin [0, 0] is the coordinate is in the upper left of the window and the coordinate in the lower right is [width-1, height-1].

<<Processing 

// Sets the screen to be 200, 200, so the width of the window is 200 pixels
// and the height of the window is 200 pixels
size(200, 200);
background(0);
noFill();
stroke(255);

// The two parameters of the point() method each specify coordinates.
// This call to point() draws at the position [100, 100]
point(width/2, height/2);

// Draws to the position [100, 50]
point(width/2, height/4); 

// It is also possible to specify a point with any parameter, 
// but only coordinates on the screen are visible
point(60, 30);
point(60, 134);
point(160, 50);
point(280, -800);
point(201, 100);

// Coordinates are used for drawing all shapes, not just points.
// Parameters for different methods are used for different purposes.
// For example, the first two parameters to line() specify the coordinates of the 
// first point and the second two parameters specify the second point
stroke(204);
line(0, 73, width, 73);

// The first two parameters to rect() are coordinates
// and the second two are the width and height
rect(110, 55, 40, 36);

>>

Taken from [[basic/coordinates.html|http://ejohn.org/apps/processing.js/examples/basic/coordinates.html]]
!Theorem
Let $H$ be a subgroup of a group $G.$  Then $a \sim b$ iff $b^{-1}a \in H$ defines an equivalence relation on $G.$

!Definition
Let $G$ be a group with subgroup $H$ and $a \in G.$  The set $aH = \{ ah : h \in H \}$ is a left coset of $H$ in $G$ with representative $a.$

!Observation
The distinct cosets of $H$ in $G$ partition $G.$

!Lemma
$aH = bH$ if and only if $b^{-1}a \in H$

!Lemma
If $aH \cap bH \neq \emptyset,$ then $aH = bH.$

!Lemma
Let $H$ be a subgroup of $G$ and $a,b \in G.$  The following are equivalent.
# $b^{-1}a \in H$
# $a = bh$ for some $h \in H$
# $a \in bH$
# $aH = bH$

!Example
Find the left cosets of $\langle s \rangle$ in $D_{8}.$

!Example
Find the left cosets of $3 \mathbb{Z}$ in $\mathbb{Z}.$

!Lemma
If $H$ is a subgroup of a group $G$ and $a \in G,$ then $|H| = |aH|.$

!Theorem (Lagrange)
If $H$ is a subgroup of a finite group $G,$ then $|H|$ is a divisor of $|G|.$

!Corollary
If $G$ is a finite group and $a \in G,$ then $|a|$ is a divisor of $|G|.$

!Corollary
If $G$ is a finite group and $a \in G,$ then $a^{|G|}=1.$

!Corollary
A group $G$ of prime order contains no subgroups other than $\{1\}$ and $G.$

!Corollary
Each group $G$ of prime order is cyclic.

!Objectives
#To provide students knowledge of basic algebraic structures including groups, rings, and fields.
#To provide students practice with proof writing techniques.
#To provide students clear examples of applications and connections of modern algebra to problems in diverse contexts.
!Text
//A First Course in Abstract Algebra with Applications//, 3rd ed., Joseph Rotman, 2006.
!Course Content
This course introduces the elementary concepts of group and ring theory. Groups will be considered through their actions on mathematical objects; rings will be considered through their arithmetic properties.
!Computer Use
This course may make use of the Maple and GAP software packages in addition to Java applets as aids in understanding concrete representations of groups.
!Attendance
You are expected to attend class on time each day. Attendance will be recorded on a regular basis.		
!Tests, Homework and Quizzes
Two tests and a final exam will be given. There will be no make-up tests without prior permission. Homework problems will be suggested for each section. Short, unannounced quizzes may also be given occasionally.
!Grading
Each of your two tests will contribute 25% toward your grade. Your combined homework grades will contribute an additional 25%, and your final exam will determine the remaining 25%.
!Academic Expectations
In choosing UNCW, you have become part of our community of scholars.  We recognize that the UNCW learning experience is challenging and requires hard work.  It also requires a commitment to make time available to do that hard work.  The university expects you to make academics your highest priority by dedicating your time and energy to training your mind and acquiring knowledge.

You are expected to follow the academic Honor Code as covered in the UNCW Student Handbook.  Please note that plagiarism, a form of academic dishonesty in which you take someone else's ideas and represent them as your own, is a specific violation of the Honor Code.

Academic success in critical thinking and problem solving prepares you for the changes and challenges you will encounter in the future.  Our faculty and academic support resources are readily available as partners in this effort, but the primary responsibility for learning is yours.
!Federal Americans with Disabilities Act
Students with diagnosed disabilities should contact the Office of Disability Services.  Please give me, within the first week of class or as soon as possible, a copy of the letter you receive from Office of Disability Services detailing class accommodations you may need.  If you require accommodation for test-taking please make sure I have the referral letter no less than three days before the test.
!Violence and Harassment
UNCW practices a zero tolerance policy for any kind of violent or harassing behavior.  If you are experiencing an emergency of this type contact the police at 911 or UNCW CARE at 962-2273.  Resources for individuals concerned with a violent or harassing situation can be located at http://www.uncw.edu/wsrc/crisis.html.
!Campus Respect Compact
UNCW has recently instituted a Respect Compact to affirm our commitment to a civil community characterized by mutual respect.  A copy of the Respect Compact is affixed to the wall of each classroom and can be accessed at http://www.uncw.edu/stuaff/pdc/documents/SeahawkRespectCompact.pdf .  Individuals desiring more information about the Respect Compact should contact the Office of Institutional Diversity and Inclusion.
[[Schedule]]
{{center{
Secant line of $\left\{\begin{array}{l l}
x^2, & \textrm{if } x < 1 \\
x^2+1, & \textrm{if } x \ge 1
\end{array}\right.$  at $a=1$
}}}
(:graph(center,{width:250,height:250,scales:[-2.5,2.5,-0.7,3]})
dynamic.click = function() {
  a=SVG.mouse[0];
  fa2 = f2(a);
  setOptions({stroke:"blue",markerstroke:"blue"});
  line([a,fa2],[a,0],{id:"apos",marker:"*-*",label:["P","a"],pos:["w","n"],strokedasharray: "10,10"});
  m = (f2(a+0.01)-fa2)/0.01;
  c = fa2-m*a;
  if (a!=1) plot("m*x+c",{min:-2.5,max:2.5,id:"tangent",points:2,strokedasharray:"none", stroke:"red", strokewidth:2});
};

dynamic.update = function() {
  fb2 = f2(b);
  setOptions({stroke: "green",markerstroke: "green"});
  line([b,fb2],[b,0],{id:"xpos",marker:"*-*",label:["Q","x"],pos:["e","n"],strokedasharray: "10,10"});
  if (abs(b-a)>0.000001) m = (fb2-fa2)/(b-a);
  else m = (f2(a+0.01)-fa2)/0.01;
  c = fa2-m*a;
  plot("m*x+c",{min:-2.5,max:2.5,id:"secant",points:2,strokedasharray:"none", strokewidth:2});
  text([-2.5,-0.6],"slope = "+m.toFixed(2),{pos:"ne",id:"slope"});
  b = SVG.mouse[0];
};

axes();
setAction("mousemove",dynamic.update);
setAction("click",dynamic.click);
f2=function(x){return (x < 1?x*x:x*x+1)};
plot(f2,{steps:[1],leftMarkers:"o",rightMarkers:"*"});
a = 1;
b = 0.8;
dynamic.click();
dynamic.update();
:)
''Theorem''
Given integers $a$ and $b$ with $a \ne 0,$ there exist unique integers $q$ and $r$ with $b=qa+r$ and $0 \le r < |a|.$
''Definition''
An integer $d$ is a divisor of an integer $n$ if $n=da$ for some integer $a.$
A natural number $n$ is called prime if $n \ge 2$ and its only divisors are $\pm 1$ and $\pm n.$

''Theorem''
If $p$ is a prime and $p | ab,$ then $p | a$ or $p | b.$
''Theorem''
Let $a$ and $b$ be positive integers.  There is an algorithm that finds the gcd $d=(a,b),$ and there is an algorithm that finds a pair of integers $s$ and $t$ with $d=sa+tb.$
/***
|Name|ExternalTiddlersPlugin|
|Source|http://www.TiddlyTools.com/#ExternalTiddlersPlugin|
|Documentation|http://www.TiddlyTools.com/#ExternalTiddlersPluginInfo|
|Version|1.3.1|
|Author|Eric Shulman|
|License|http://www.TiddlyTools.com/#LegalStatements <br>and [[Creative Commons Attribution-ShareAlike 2.5 License|http://creativecommons.org/licenses/by-sa/2.5/]]|
|~CoreVersion|2.1|
|Type|plugin|
|Requires|TemporaryTiddlersPlugin (optional, recommended)|
|Overrides|config.macros.tiddler.handler|
|Options|##Configuration|
|Description|retrieve and wikify content from external files or remote URLs|
This plugin extends the {{{<<tiddler>>}}} macro syntax so you can retrieve and wikify content directly from external files or remote URLs.  You can also define alternative "fallback" sources to provide basic "import on demand" handling by automatically creating/importing tiddler content from external sources when the specified ~TiddlerName does not already exist in your document.
!!!!!Documentation
>see [[ExternalTiddlersPluginInfo]]
!!!!!Configuration
<<<
<<option chkExternalTiddlersImport>> automatically create/import tiddlers when using external fallback references
{{{usage: <<option chkExternalTiddlersImport>>}}}
<<option chkExternalTiddlersQuiet>> don't display messages when adding tiddlers ("quiet mode")
{{{usage: <<option chkExternalTiddlersQuiet>>}}}
<<option chkExternalTiddlersTemporary>> tag retrieved tiddlers as 'temporary'(requires [[TemporaryTiddlersPlugin]])
{{{usage: <<option chkExternalTiddlersTemporary>>}}}
tag retrieved tiddlers with: <<option txtExternalTiddlersTags>>
{{{usage: <<option txtExternalTiddlersTags>>}}}

__password-protected server settings //(optional, if needed)//:__
>username: <<option txtRemoteUsername>> password: <<option txtRemotePassword>>
>{{{usage: <<option txtRemoteUsername>> <<option txtRemotePassword>>}}}
>''note: these settings are also used by [[LoadTiddlersPlugin]] and [[ImportTiddlersPlugin]]''
<<<
!!!!!Revisions
<<<
2008.10.27 [1.3.1] in insertTiddler(), fixed Safari bug by replacing static Array.concat(...) with new Array().concat(...)
|please see [[ExternalTiddlersPluginInfo]] for additional revision details|
2007.11.25 [1.0.0] initial release - moved from CoreTweaks
<<<
!!!!!Code
***/
//{{{
version.extensions.ExternalTiddlersPlugin= {major: 1, minor: 3, revision: 1, date: new Date(2008,10,27)};

// optional automatic import/create for missing tiddlers
if (config.options.chkExternalTiddlersImport==undefined) config.options.chkExternalTiddlersImport=true;
if (config.options.chkExternalTiddlersTemporary==undefined) config.options.chkExternalTiddlersTemporary=true;
if (config.options.chkExternalTiddlersQuiet==undefined) config.options.chkExternalTiddlersQuiet=false;
if (config.options.txtExternalTiddlersTags==undefined) config.options.txtExternalTiddlersTags="external";
if (config.options.txtRemoteUsername==undefined) config.options.txtRemoteUsername="";
if (config.options.txtRemotePassword==undefined) config.options.txtRemotePassword="";

config.macros.tiddler.externalTiddlers_handler = config.macros.tiddler.handler;
config.macros.tiddler.handler = function(place,macroName,params,wikifier,paramString,tiddler)
{
	params = paramString.parseParams("name",null,true,false,true);
	var names = params[0]["name"];
	var list = names[0];
	var items = list.split("|"); 
	var className = names[1] ? names[1] : null;
	var args = params[0]["with"];

	// UTILITY FUNCTIONS
	function extract(text,tids) { // get tiddler source content from plain text or TW doc
		if (!text || !tids || !tids.length) return text; // no text or no tiddler list... return text as-is
		var remoteStore=new TiddlyWiki();
		if (!remoteStore.importTiddlyWiki(text)) return text; // not a TW document... return text as-is
		var out=[]; for (var t=0;t<tids.length;t++)
			{ var txt=remoteStore.getTiddlerText(tids[t]); if (txt) out.push(txt); }
		return out.join("\n");
	}
	function substitute(text,args) { // replace "substitution markers" ($1-$9) with macro param values (if any)
		if (!text || !args || !args.length) return text;
		var n=args.length; if (n>9) n=9;
		for(var i=0; i<n; i++) { var re=new RegExp("\\$" + (i + 1),"mg"); text=text.replace(re,args[i]); }
		return text;
	}
	function addTiddler(src,text,tids) { // extract tiddler(s) from text and create local copy
		if (!config.options.chkExternalTiddlersImport) return; // not enabled... do nothing
		if (!text || !tids || !tids.length) return; // no text or no tiddler list... do nothing
		var remoteStore=new TiddlyWiki();
		if (!remoteStore.importTiddlyWiki(text)) // not a TW document... create a single tiddler from text
			makeTiddler(src,text,tids[0]);
		else // TW document with "permaview-like" suffix... copy tiddler(s) from remote store
			for (var t=0;t<tids.length;t++)
				insertTiddler(src,remoteStore.getTiddler(tids[t]));
		return;
	}
	function makeTiddler(src,text,title) { // create a new tiddler object from text
		var who=config.options.txtUserName; var when=new Date();
		var msg="/%\n\nThis tiddler was automatically created using ExternalTiddlersPlugin\n";
		msg+="by %0 on %1\nsource: %2\n\n%/";
		var tags=config.options.txtExternalTiddlersTags.readBracketedList();
		if (config.options.chkExternalTiddlersTemporary) tags.pushUnique(config.options.txtTemporaryTag); 
		store.saveTiddler(null,title,msg.format([who,when,src])+text,who,when,tags,{});
		if (!config.options.chkExternalTiddlersQuiet) displayMessage("Created new tiddler '"+title+"' from text file "+src);
	}
	function insertTiddler(src,t) { // import a single tiddler object into the current document store
		if (!t) return;
		var who=config.options.txtUserName; var when=new Date();
		var msg="/%\n\nThis tiddler was automatically imported using ExternalTiddlersPlugin\n";
		msg+="by %0 on %1\nsource: %2\n\n%/";
		var newtags=new Array().concat(t.tags,config.options.txtExternalTiddlersTags.readBracketedList());
		if (config.options.chkExternalTiddlersTemporary) newtags.push(config.options.txtTemporaryTag);
		store.saveTiddler(null,t.title,msg.format([who,when,src])+t.text,t.modifier,t.modified,newtags,t.fields);
		if (!config.options.chkExternalTiddlersQuiet) displayMessage("Imported tiddler '"+t.title+"' from "+src);
	}
	function getGUID()  // create a Globally Unique ID (for async reference to DOM elements)
		 { return new Date().getTime()+Math.random().toString(); }

	// loop through "|"-separated list of alternative tiddler/file/URL references until successful
	var fallback="";
	for (var i=0; i<items.length; i++) { var src=items[i];
		// if tiddler (or shadow) exists, replace reference list with current source name and apply core handler
		if (store.getTiddlerText(src)) {
			arguments[2][0]=src; // params[] array
			var p=arguments[4].split(list); arguments[4]=p[0]+src+p[1]; // paramString
			this.externalTiddlers_handler.apply(this,arguments);
			break; // stop processing alternatives
		}
		// tiddler doesn't exist, and not an external file/URL reference... skip it
		if (!config.formatterHelpers.isExternalLink(src)) {
			if (!fallback.length) fallback=src; // title to use when importing external tiddler
			continue;
		}
		// separate 'permaview' list of tiddlers (if any) from file/URL (i.e., '#name name name..." suffix)
		var p=src.split("#"); src=p[0]; var tids=p[1]?p[1].readBracketedList(false):[];
		// if reference is to a remotely hosted document or the current document is remotely hosted...
		if (src.substr(0,4)=="http" || document.location.protocol.substr(0,4)=="http") {
			if (src.substr(0,4)!="http") // fixup URL for relative remote references
				{ var h=document.location.href; src=h.substr(0,h.lastIndexOf("/")+1)+src; }
			var wrapper = createTiddlyElement(place,"span",getGUID(),className); // create placeholder for async rendering
			var callback=function(success,params,text,src,xhr) { // ASYNC CALLBACK
				if (!success) { displayMessage(xhr.status); return; } // couldn't read remote file... report the error 
				if (params.fallback.length)
					addTiddler(params.url,text,params.tids.length?params.tids:[params.fallback]); // import tiddler
				var wrapper=document.getElementById(params.id); if (!wrapper) return; 
				wikify(substitute(extract(text,params.tids),params.args),wrapper); // ASYNC RENDER
			};
			var callbackparams={ url:src, id:wrapper.id, args:args, tids:tids, fallback:fallback }  // ASYNC PARAMS
			var name=config.options.txtRemoteUsername; // optional value
			var pass=config.options.txtRemotePassword; // optional value
			var x=doHttp("GET",src,null,null,name,pass,callback,callbackparams,null)
			if (typeof(x)=="string") // couldn't start XMLHttpRequest... report error
				{ displayMessage("error: cannot access "+src); displayMessage(x); }
			break; // can't tell if async read will succeed.... stop processing alternatives anyway.
		}
		else { // read file from local filesystem
			var text=loadFile(getLocalPath(src));
			if (!text) { // couldn't load file... fixup path for relative reference and retry...
				var h=document.location.href;
				var text=loadFile(getLocalPath(decodeURIComponent(h.substr(0,h.lastIndexOf("/")+1)))+src);
			}
			if (text) { // test it again... if file was loaded OK, render it in a class wrapper
				if (fallback.length) // create new tiddler using primary source name (if any)
					addTiddler(src,text,tids.length?tids:[fallback]);
				var wrapper=createTiddlyElement(place,"span",null,className);
				wikify(substitute(extract(text,tids),args),wrapper); // render
				break; // stop processing alternatives
			}
		}
	}
};
//}}}
|Name|ExternalTiddlersPluginInfo|
|Source|http://www.TiddlyTools.com/#ExternalTiddlersPlugin|
|Documentation|http://www.TiddlyTools.com/#ExternalTiddlersPluginInfo|
|Version|1.3.1|
|Author|Eric Shulman|
|License|http://www.TiddlyTools.com/#LegalStatements <br>and [[Creative Commons Attribution-ShareAlike 2.5 License|http://creativecommons.org/licenses/by-sa/2.5/]]|
|~CoreVersion|2.1|
|Type|documentation|
|Requires||
|Overrides||
|Description|documentation for ExternalTiddlersPlugin|
This plugin extends the {{{<<tiddler>>}}} macro syntax so you can retrieve and wikify content directly from external files or remote URLs.  You can also define alternative "fallback" sources to provide basic "import on demand" handling by automatically creating/importing tiddler content from external sources when the specified ~TiddlerName does not already exist in your document.
!!!!!Configuration
>see ExternalTiddlersPlugin
!!!!!Usage
<<<
The standard TiddlyWiki core syntax for the {{{<<tiddler>>}}} macro is:
>{{{<<tiddler TiddlerName with: param param param ...>>}}}
where the optional {{{with: param param param...}}} values are used to replace any corresponding "substitution markers" ($1 to $9) that may be embedded in the referenced tiddler content.

This plugin allows the {{{<<tiddler>>}}} macro to ''use external file/URL references in place of the usual ~TiddlerName parameter'', so that you can render wiki-formatted source content retrieved from an external file/URL reference (as determined by the core's isExternalLink() test function), ''//as if// it had come from a tiddler in the current document''.  The external file/URL can be either ''a relative or absolute reference'' and can contain ''"plain text" or a full TiddlyWiki document''.  When using a TiddlyWiki document, you must specify which tiddlers should be included in the output by appending a permaview-like suffix to the file or URL reference, e.g.:
>{{{<<tiddler "myfile.txt" with: param param param...>>}}}
>or
>{{{<<tiddler "myfile.html#TiddlerName TiddlerName..." with: param param param...>>}}}
>or
>{{{<<tiddler "http://www.TiddlyWiki.com/index.html#HelloThere" with: param param param...>>}}}
If the plugin-enhanced {{{<<tiddler>>}}} macro is unable to retrieve the external content --  perhaps because the file doesn't exist or doesn't contain the requested tiddler(s), or cross-domain security blocked file access, or the network/server "timed out", etc., -- then it produces no output (i.e., just as when the standard {{{<<tiddler>>}}} macro is given a ~TiddlerName does not exist in the current document.)
<<<
!!!!!Using alternative "fallback" references
<<<
In addition to using external file/URL references in place of the usual ~TiddlerName, the plugin also allows you to use a ''fallback list'' consisting of a combination of alternative sources: tiddlers, local files, and/or URL references, each separated by "|".  The first reference in a fallback list is the "primary source"; the remaining references are "fallback sources".  The plugin will attempt to retrieve content from each fallback source until one is successfully retrieved or all alternatives have been tried.

For example, if you create a tiddler called [[HelloThere]], as well as a remotely-hosted TW document containing a published tiddler, also called [[HelloThere]], then you can write:
>{{{<<tiddler [[HelloThere|http://www.TiddlyWiki.com/#HelloThere]]>>}}}
When [[HelloThere]] is present in the local document, it is processed in the normal manner.  However, if you delete the  local [[HelloThere]] tiddler, the plugin will attempt to retrieve the [[HelloThere]] tiddler from the indicated remote URL.

Please note: although you can list any number of alternative sources, in whatever order you prefer, retrieval from a remote URL occurs asynchronously via XMLHttpRequest() processing.  As a consequence, there can be ''no more than one remote URL reference in the fallback list'', and any alternatives that follow a remote URL reference will not be processed.
<<<
!!!!!Automatically import/create missing tiddlers
<<<
When content is retrieved from an external fallback source, the plugin can automatically import/create tiddler(s) containing that content into your document, allowing you to display, modify, save and/or search for text in that tiddler from within your own document, without needing to retrieve it again from the external source.

If no local ~TiddlerName(s) are specified in the fallback list (i.e., only direct file/URL references are present), then a tiddler will NOT be created, so that each time you render the tiddler display the external source will be re-read in order to render the most recently saved external file content.  To illustrate using the example from above:
>&nbsp;&nbsp;&nbsp;{{{<<tiddler [[HelloThere|http://www.TiddlyWiki.com/#HelloThere]]>>}}}
will automatically create a locally-stored [[HelloThere]] tiddler, so that the external source is only accessed the first time the content is rendered, while:
>&nbsp;&nbsp;&nbsp;{{{<<tiddler [[http://www.TiddlyWiki.com/#HelloThere]]>>}}}
will re-load the content from the external source each time the display is rendered.

For easy identification, any tiddlers that are automatically created/imported are tagged with <<tag external>> (or other custom-defined tag values).  These tiddlers can also be automatically tagged with <<tag temporary>> for use with [[TemporaryTiddlersPlugin]], which will skip over those tiddlers when saving changes to your document so that when you reload the document, the temporary tiddlers will no longer be present and will be retrieved anew from the external source, on demand, when (or if) they are needed.  Important reminder: ''If you modify a temporary tiddler and want to retain it in your local document, be sure to remove the <<tag temporary>> tag from the tiddler before saving.''
<<<
!!!!!~XMLHttpRequest: performance and security issues
<<<
This plugin uses asynchronous XMLHttpRequest() processing to access external content directly from URLs hosted on remote web servers.  This often creates delays ranging from mere moments to many minutes while waiting for the remote web server to transfer the requested file.  This performance can vary greatly depending upon the size of the remote file, how the remote server responds to repeated requests for the same URL (e.g, with a //"304 - no change"// response code), as well as how your ''browser's cache mechanism'' has been configured (to avoid repeated downloads).

In addition to server-originated delays, ''cross-domain access from one remote domain to another using XMLHttpRequest() processing is generally restricted for security reasons''.  As a result, if you publish your document to a remote web server, then external file/URL references contained in that document will not work if they are not located on the same server as the hosted document.

Fortunately, this security restriction does NOT usually apply when accessing remote URLs rendered into a locally-viewed document, since blocking such access would interfere with normal browser functions!  As a "rule of thumb", in order to ensure that external content included in server-hosted documents will be displayed as intended, you should ''always use either a relative path/file reference or an http: reference located on the same domain as the published document.'' for any document you intend to publish.

Note: Some hosting providers, such as http://www.TiddlySpot.com/ offer ''"proxy" services that may allow you to bypass the security restrictions'' for certain designated remote web sites.  Consult your hosting service for information regarding their proxy arrangments (if any).
<<<
!!!!!Revisions
<<<
2008.10.27 [1.3.1] in insertTiddler(), fixed Safari bug by replacing static Array.concat(...) with new Array().concat(...)
2008.01.08 [*.*.*] plugin size reduction: documentation moved to ExternalTiddlersPluginInfo
2008.01.03 [1.3.0] use lower-level doHttp() instead loadRemoteFile() so that optional username/password values can be used in XMLHttpRequest
2007.12.22 [1.2.2] in handler(), when reading from local file with relative path fixup, use decodeURIComponent() instead of decodeURI 
2007.11.30 [1.2.1] lots of code/docmentation cleanup.  renamed option cookies.  changed auto tag value to "external".
2007.11.27 [1.2.0] added support for automatically importing external tiddlers
2007.11.26 [1.1.1] improved XMLHttpRequest() error reporting for cross-domain security issues
2007.11.26 [1.1.0] added support for multiple alternative fallback references
2007.11.25 [1.0.0] initial release - moved from CoreTweaks
<<<
!Theorem
If $p$ is prime, then $a^p \equiv a (\mbox{mod }p)$ for every $a \in \mathbb{Z}.$
(:graph(center,{width:200,height:200,scales:[-1.1,1.1],coords: 'none'})
a = []
n = 9
 for (i = 0; i < n; i++)
 a[i] = [cos(PI/4*(-1)*i+PI/2),
 sin(PI/4*(-1)*i+PI/2)]
path([a[0],a[3],a[6],a[1],a[4],a[7],a[2],a[5],
 a[0],a[4],a[5],a[1],a[2],a[6],a[7],a[3]])
path(a,{marker:"oo",markerfill:"orange"})
:)
(:graph({width:250,height:250,scales:[-10,10]})
axes({dx:2});
polarPlot("x/PI",{min:0,max:10*PI,stroke:"red"});
:)
A famous result due to [[Euler|http://www-groups.dcs.st-and.ac.uk/~history/Mathematicians/Euler.html]] in ~LaTeX: $\sum_{n=1}^{+\infty}{\frac1{n^2}=\frac{\pi^2}6$
and again as a centered equation using {{{$$ ... $$}}}$$\sum_{n=1}^{+\infty} \frac{1}{n^2}=\frac{\pi^2}{6}.$$
or using {{{\[ ... \]}}} \[\sum_{n=1}^{+\infty} \frac{1}{n^2}=\frac{\pi^2}{6}.\]
Here is a graph of $x-\frac{x^3}{6}$ and $\sin(x)$

(:graph({width:600,height:300,scales:[-6.29,6.29]})
grid({dx:1,stroke:"green"});
axes({marker:">"});
plot("sin(x)",{stroke:"red"})
plot("x-pow(x,3)/6",{min:-4,max:4,stroke:"blue", strokedasharray:"10,10"})
text([-2,-2.5],"Close friends near 0!",{id:"rot",fontsize:18,fill:"orange"});
rotate("rot",PI/18,{center:[-5,-3]});
:)
and a diagram illustrating why Pythagoras' Theorem holds:

(:graph({width:400,height:150,scales:[-4,4,1,4],coords:"none"})
setOptions({fill:"yellow"});
rect([1,1],[4,4])
rect([-4,1],[-1,4])
setOptions({fill:"red"});
rect([-2,1],[-1,2])
setOptions({fill:"blue"});
rect([-4,2],[-2,4])
setOptions({fill:"green"});
path([[1,2],[2,4],[4,3],[3,1],[1,2]])
setOptions({fill:"none"});
path([[-4,1],[-2,2],[-1,4]])
:)
*Every nonzero, nonunit integer is a prime or a product of primes, essentially uniquely.
(:graph({width:120,height:120,scales:[-0.5,1.5,-0.5,1.5],coords:"none"})
a=[0,1];
b=[1,1];
c=[1,0];
d=[0,0];
path([b,d,a,c]);
path([a,b,c,d],{marker:"ooo",markerfill:"yellow",label:["a","b","c","d"],pos:["nw","ne","se","sw"]});
text([.5,-0.5],"$K_4$",{pos:"n"})
:)
*[[Division Algorithm]]
*Quotient and remainder
*Infinitude of the primes
*Divisors and multiples
*[[Common divisor]]
*[[Greatest common divisor]]
*[[Linear combinations of integers]]
*[[gcds are linear combinations]]
*[[Common divisors divide the gcd]]
*[[Euclid's Lemma]]
*Relatively prime
*[[Euclidean Algorithm]]
*[[Lame's Theorem]]
''Definition''
The greatest common divisor of integers $a$ and $b,$ not both 0, is the largest common divisor of $a$ and $b$.  It is denoted by $\mbox{gcd}(a,b)$ or $(a,b)$ when the context is clear.

We stipulate that $\mbox{gcd}(0,0)=0.$
!Definition
A group is a set $G$ equipped with a binary operation $*$ and a special element $e \in G,$ called the identity, such that
#  $a*(b*c)=(a*b)*c$ for all $a,b,c \in G$
# $e*a = a = a*e$ for all $a \in G$
# for every $a \in G,$ there is $a' \in G$ with $a' * a = e = a * a'$

!Definition
A group $G$ is abelian if $a*b=b*a$ for all $a,b \in G.$

!Proposition
Let $G$ be a group with identity $e,$ and let $a,b,c \in G.$  Then
* $e$ is unique
* inverses are unique
* whenever $a*c=b*c,$ it follows that $a=b.$
* $(a*b)^{-1} = b^{-1}*a^{-1}$
* $(a^{-1})^{-1}=a$

!Examples
* $S_{n}$ is a group under composition
* $\mathbb{Z}$ is a group under addition
* $\mathbb{I}_{n}$ is a group under addition
* $\mathbb{C}^{\times}$ is a group under multiplication
* $S^{1} = \{ a+bi \in \mathbb{C} : a^2+b^2=1 \}$ is a group under multiplication


!Note
When using multiplicative notation, we write $a*b$ more simply as $ab,$ and denote the identity $e$ by 1.

!Definition
Given an element $a$ of a group $G$, define the powers $a^n$ for $n \ge 1$ inductively by taking $a^1 = a$ and $a^{n+1} = a*a^{n}$.  Further define $a^{-n} = (a^{-1})^n$ and let $a^{0}=1.$

!Definition
We denote the set of integer powers of $a$, $\{ a^k : k \in \mathbb{Z} \},$ by $<a>.$


!Definition
Let $G$ be a group a let $a \in G.$  If $a^k = 1$ for some integer $k \ge 1,$ then the smallest such exponent $k$ is called the order of $a.$  If no such power exists, then we say that $a$ has infinite order.  We denote the order of $a$ by $|a|.$

!Lemma
If $b^n=1$ then $|b|$ divides $n.$

!Proposition
Suppose $|a|=n$ and $k | n.$  Then $|a^k| = \frac{n}{k}.$

!Lemma
$<a^{m}>=<a^{d}>$ for some $d$ dividing $|a|.$

!Lemma
$|a^{m}| = |<a^{m}>|.$

!Theorem
Suppose $|a|=n.$  Then $|a^{k}| = \frac{n}{\mbox{gcd}(k,n)}.$

*Review $S_{n}$ and $\mathbb{I}_{n}$
*Introduce $\Gamma_{n},$ $U(\mathbb{I}_{n}),$ and $D_{2n}$
*Presentations versus representations of groups
**Presentations: abstract, implicit, action-oriented, synthetic
**Representations: concrete, explicit, result-oriented, coordinatized
*Representations arise from actions on object configurations
**elements of $S_{n}$ reorder list of n symbols
**elements of $\mathbb{I}_{n}$ cycle hand of n-hour clock
**isometries of plane permute vertex-labels of (regular) polygons
*When are two ostensibly different groups essentially the same?

from Rotman's //First Course in Abstract Algebra with Applications//, 3rd ed:
!Suggested Exercises 
*Chapter 1
**1.1,1.3,1.5,1.10,1.11
**1.28,1.30,1.31,1.45
**1.46,1.47,1.49,1.50,1.58,1.60
**1.68,1.71,1.72
**1.77,1.78,1.80,1.86,1.88
*Chapter 2
**2.1,2.3,2.13,2.14
**2.21,2.25,2.30,2.35
**2.36,2.40,2.44,2.46
**2.52,2.53,2.55,2.57
**2.64,2.68,2.70,2.71,2.79
**2.95,2.98,2.102,2.106
**2.114,2.117,2.125,2.126
*Chapter 3
**3.1,3.3,3.4,3.6
**3.17,3.19,3.20,3.21
/%
**3.29,3.30,3.32,3.33
**3.41,3.42,3.43,3.44
**3.56,3.58,3.61,3.64
**3.82,3.85
**3.86,3.87,3.88,3.91
**3.92,3.97,3.98,3.99
%/
<<tabs Outline
Outline "Outline" ./outline
>>

<part outline hidden>
*Integers and natural numbers
*[[Divisors and primes]]
*[[Least Integer Axiom]]
*[[Least Criminal]]
**Theorem:  Every integer $n \ge 2$ is either a prime or a product of primes.
*Indirect Proof / Proof by Contradiction
*[[Mathematical Induction]]
**Proposition:  $2^n > n$ for all integers $n \ge 1.$
**Proposition: $2^n > n^2$ for all integers $n \ge 5.$
*[[Predecessors]] of natural numbers
*[[Second Form of Induction]]
**Explicit formula for the $n$th Fibonnaci number.
</part>
''Theorem''
Let $b \ge a$ be positive integers, and let $d(a)$ be the number of digits in the decimal expression of $a.$  If $n$ is the number of steps in the Euclidean algorithm computing $\mbox{gcd}(a,b),$ then $n \le 5 d(a).$
The University Learning Center, located on the first floor of Westside Hall, provides tutoring for basic studies mathematics and statistics courses.  Math Services also provides course-specific review and problem sessions, and help with math study skills and math anxiety.

No appointment is needed during open lab hours.

Web: [[www.uncw.edu/stuaff/uls|http://www.uncw.edu/stuaff/uls]]
Phone: 962-7857
Email: ULC@uncw.edu
''Proposition''
Let $k$ be a natural number, and let $S(k), S(k+1), \ldots, S(n), \ldots$ be a list of statements.  If some of these statements are false, then there is a first false statement.
''Axiom''
There is a smallest integer in every nonempty subset $C$ of the natural numbers $\mathbb{N}$.
''Definition''
A linear combination of integers $a$ and $b$ is an integer of the form $sa+tb,$ where $s$ and $t$ are integers.
[[Schedule]]
[[Notable Dates]]
[[Assignments]]
[[Course Policies]]
[[Contact Information]]
[[Learning Center]]
<<toggleSideBar '' '' hide>>
/***
|''Name:''|MathSVGPlugin|
|''Description:''|This plugin translates a subset of the LaTeX math notation to MathML with a customisable  image fallback when MathML is not supported. It also provides an easy way to produce mathematical SVG graphics with dynamical features and animation.|
|''Version:''|1.1|
|''Date:''|2009-05-05|
|''Source:''|http://www.math.ist.utl.pt/~psoares/mathsvg.html|
|''Author:''|Paulo Soares|
|''License:''|[[GNU Lesser General Public License|http://www.gnu.org/licences/lgpl.html]]|
|''~CoreVersion:''|2.5.0|
!Original copyright notice
{{{
ASCIIMathML.js
==============
Version 2.1 Oct 8, 2008, (c) Peter Jipsen http://www.chapman.edu/~jipsen
This version extends ASCIIMathML.js with LaTeXMathML.js and ASCIIsvg.js.
Latest version at http://www.chapman.edu/~jipsen/mathml/ASCIIMathML.js
If you use it on a webpage, please send the URL to jipsen@chapman.edu

The LaTeXMathML modifications were made by Douglas Woodall, June 2006.
(for details see header on the LaTeXMathML part in middle of file)
Extensive clean-up and improvements by Paulo Soares, Oct 2007.

This program is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2.1 of the License, or (at
your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT 
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 
FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License 
(at http://www.gnu.org/licences/lgpl.html) for more details.
}}}
!~MathSVG code (minified)
***/
//{{{
Math.sec=function(a){return 1/Math.cos(a)};Math.csc=function(a){return 1/Math.sin(a)};Math.cot=function(a){return 1/Math.tan(a)};Math.asec=function(a){return Math.acos(1/a)};Math.acsc=function(a){return Math.asin(1/a)};Math.acot=function(a){return Math.atan(1/a)};Math.sinh=function(a){return(Math.exp(a)-Math.exp(-a))/2};Math.cosh=function(a){return(Math.exp(a)+Math.exp(-a))/2};Math.tanh=function(a){return(Math.exp(a)-Math.exp(-a))/(Math.exp(a)+Math.exp(-a))};Math.sech=function(a){return 1/Math.cosh(a)};Math.csch=function(a){return 1/Math.sinh(a)};Math.coth=function(a){return 1/Math.tanh(a)};Math.asinh=function(a){return Math.log(a+Math.sqrt(a*a+1))};Math.acosh=function(a){return Math.log(a+Math.sqrt(a*a-1))};Math.atanh=function(a){return Math.log((1+a)/(1-a))/2};Math.sech=function(a){return 1/Math.cosh(a)};Math.csch=function(a){return 1/Math.sinh(a)};Math.coth=function(a){return 1/Math.tanh(a)};Math.asech=function(a){return Math.acosh(1/a)};Math.acsch=function(a){return Math.asinh(1/a)};Math.acoth=function(a){return Math.atanh(1/a)};Math.sign=function(a){return(a===0?0:(a<0?-1:1))};Math.step=function(a,c,b){return(a<0?(b?b:0):(c?c:1))};Math.root=function(a,b){return Math.pow(a,1/b)};Math.factorial=function(b){if(b===0){return 1}if(b<0){if((b%1)===0){return}if(b>-1){return Math.factorial(b+1)/(b+1)}return -Math.PI/(Math.factorial(-1-b)*Math.sin(Math.PI*b))}var a=b;if((b%1)===0){while(b>1){b=b-1;a=a*b}}else{a=Math.exp((b+0.5)*Math.log(b+1)-b-b*(0.1121105+b*0.08106103)/(1.452342+b*(2.410858+b)))}return a};Math.Gamma=function(a){return Math.factorial(a-1)};Math.Beta=function(a,b){return Math.Gamma(a)*Math.Gamma(b)/Math.Gamma(a+b)};Math.C=function(a,b){var c=1/((a+1)*Math.Beta(b+1,a-b+1));return c};Math.truncate=function(a,c){var b=c||0;return Math.floor(a*Math.pow(10,b))/Math.pow(10,b)};Math.randomString=function(b,d){var c,e="";var a=b.length-1;for(c=0;c<d;c++){e+=b.substr(Math.runif(0,a),1)}return e};Math.runif=function(d,c,f){var e=f||0;return Math.truncate((c+Math.pow(10,-e)-d)*Math.random()+d,e)};Math.rnormal=function(a,b){a=a||0;b=b||1;var d=0,c=0;while(d*c===0){d=Math.random();c=Math.random()}return b*(Math.sqrt(-2*Math.log(d))*Math.cos(2*Math.PI*c))+a};Math.range=function(e,a,d){if((a-e)*d<=0){return}var c,b=[];for(c=e;c<=a;c+=d){b[b.length]=c}return b};var MSVG=function(m){var h="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";var t=["\uD835\uDC9C","\u212C","\uD835\uDC9E","\uD835\uDC9F","\u2130","\u2131","\uD835\uDCA2","\u210B","\u2110","\uD835\uDCA5","\uD835\uDCA6","\u2112","\u2133","\uD835\uDCA9","\uD835\uDCAA","\uD835\uDCAB","\uD835\uDCAC","\u211B","\uD835\uDCAE","\uD835\uDCAF","\uD835\uDCB0","\uD835\uDCB1","\uD835\uDCB2","\uD835\uDCB3","\uD835\uDCB4","\uD835\uDCB5","\uD835\uDCB6","\uD835\uDCB7","\uD835\uDCB8","\uD835\uDCB9","\u212F","\uD835\uDCBB","\u210A","\uD835\uDCBD","\uD835\uDCBE","\uD835\uDCBF","\uD835\uDCC0","\uD835\uDCC1","\uD835\uDCC2","\uD835\uDCC3","\u2134","\uD835\uDCC5","\uD835\uDCC6","\uD835\uDCC7","\uD835\uDCC8","\uD835\uDCC9","\uD835\uDCCA","\uD835\uDCCB","\uD835\uDCCC","\uD835\uDCCD","\uD835\uDCCE","\uD835\uDCCF"];var D=["\uD835\uDD04","\uD835\uDD05","\u212D","\uD835\uDD07","\uD835\uDD08","\uD835\uDD09","\uD835\uDD0A","\u210C","\u2111","\uD835\uDD0D","\uD835\uDD0E","\uD835\uDD0F","\uD835\uDD10","\uD835\uDD11","\uD835\uDD12","\uD835\uDD13","\uD835\uDD14","\u211C","\uD835\uDD16","\uD835\uDD17","\uD835\uDD18","\uD835\uDD19","\uD835\uDD1A","\uD835\uDD1B","\uD835\uDD1C","\u2128","\uD835\uDD1E","\uD835\uDD1F","\uD835\uDD20","\uD835\uDD21","\uD835\uDD22","\uD835\uDD23","\uD835\uDD24","\uD835\uDD25","\uD835\uDD26","\uD835\uDD27","\uD835\uDD28","\uD835\uDD29","\uD835\uDD2A","\uD835\uDD2B","\uD835\uDD2C","\uD835\uDD2D","\uD835\uDD2E","\uD835\uDD2F","\uD835\uDD30","\uD835\uDD31","\uD835\uDD32","\uD835\uDD33","\uD835\uDD34","\uD835\uDD35","\uD835\uDD36","\uD835\uDD37"];var s=["\uD835\uDD38","\uD835\uDD39","\u2102","\uD835\uDD3B","\uD835\uDD3C","\uD835\uDD3D","\uD835\uDD3E","\u210D","\uD835\uDD40","\uD835\uDD41","\uD835\uDD42","\uD835\uDD43","\uD835\uDD44","\u2115","\uD835\uDD46","\u2119","\u211A","\u211D","\uD835\uDD4A","\uD835\uDD4B","\uD835\uDD4C","\uD835\uDD4D","\uD835\uDD4E","\uD835\uDD4F","\uD835\uDD50","\u2124","\uD835\uDD52","\uD835\uDD53","\uD835\uDD54","\uD835\uDD55","\uD835\uDD56","\uD835\uDD57","\uD835\uDD58","\uD835\uDD59","\uD835\uDD5A","\uD835\uDD5B","\uD835\uDD5C","\uD835\uDD5D","\uD835\uDD5E","\uD835\uDD5F","\uD835\uDD60","\uD835\uDD61","\uD835\uDD62","\uD835\uDD63","\uD835\uDD64","\uD835\uDD65","\uD835\uDD66","\uD835\uDD67","\uD835\uDD68","\uD835\uDD69","\uD835\uDD6A","\uD835\uDD6B"];var z=0,b=1,d=2,p=3,x=4,e=5,q=6,r=7,o=8,f=9,B=10,A=11,c=12,j=13,l=14;var a=[{input:"\\varepsilon",tag:"mi",output:"\u025B",ttype:z},{input:"\\varsigma",tag:"mi",output:"\u03C2",ttype:z},{input:"\\vartheta",tag:"mi",output:"\u03D1",ttype:z},{input:"\\varphi",tag:"mi",output:"\u03D5",ttype:z},{input:"\\varpi",tag:"mi",output:"\u03D6",ttype:z},{input:"\\varrho",tag:"mi",output:"\u03F1",ttype:z},{input:"\\alpha",tag:"mi",output:"\u03B1",ttype:z},{input:"\\beta",tag:"mi",output:"\u03B2",ttype:z},{input:"\\gamma",tag:"mi",output:"\u03B3",ttype:z},{input:"\\delta",tag:"mi",output:"\u03B4",ttype:z},{input:"\\epsilon",tag:"mi",output:"\u03B5",ttype:z},{input:"\\zeta",tag:"mi",output:"\u03B6",ttype:z},{input:"\\eta",tag:"mi",output:"\u03B7",ttype:z},{input:"\\theta",tag:"mi",output:"\u03B8",ttype:z},{input:"\\iota",tag:"mi",output:"\u03B9",ttype:z},{input:"\\kappa",tag:"mi",output:"\u03BA",ttype:z},{input:"\\lambda",tag:"mi",output:"\u03BB",ttype:z},{input:"\\mu",tag:"mi",output:"\u03BC",ttype:z},{input:"\\nu",tag:"mi",output:"\u03BD",ttype:z},{input:"\\xi",tag:"mi",output:"\u03BE",ttype:z},{input:"\\omicron",tag:"mi",output:"\u03BF",ttype:z},{input:"\\pi",tag:"mi",output:"\u03C0",ttype:z},{input:"\\rho",tag:"mi",output:"\u03C1",ttype:z},{input:"\\sigma",tag:"mi",output:"\u03C3",ttype:z},{input:"\\tau",tag:"mi",output:"\u03C4",ttype:z},{input:"\\upsilon",tag:"mi",output:"\u03C5",ttype:z},{input:"\\phi",tag:"mi",output:"\u03C6",ttype:z},{input:"\\chi",tag:"mi",output:"\u03C7",ttype:z},{input:"\\psi",tag:"mi",output:"\u03C8",ttype:z},{input:"\\omega",tag:"mi",output:"\u03C9",ttype:z},{input:"\\Alpha",tag:"mo",output:"\u0391",ttype:z},{input:"\\Beta",tag:"mo",output:"\u0392",ttype:z},{input:"\\Gamma",tag:"mo",output:"\u0393",ttype:z},{input:"\\Delta",tag:"mo",output:"\u0394",ttype:z},{input:"\\Epsilon",tag:"mo",output:"\u0395",ttype:z},{input:"\\Zeta",tag:"mo",output:"\u0396",ttype:z},{input:"\\Eta",tag:"mo",output:"\u0397",ttype:z},{input:"\\Theta",tag:"mo",output:"\u0398",ttype:z},{input:"\\Iota",tag:"mo",output:"\u0399",ttype:z},{input:"\\Kappa",tag:"mo",output:"\u039A",ttype:z},{input:"\\Lambda",tag:"mo",output:"\u039B",ttype:z},{input:"\\Mu",tag:"mo",output:"\u039C",ttype:z},{input:"\\Nu",tag:"mo",output:"\u039D",ttype:z},{input:"\\Xi",tag:"mo",output:"\u039E",ttype:z},{input:"\\Omicron",tag:"mo",output:"\u039F",ttype:z},{input:"\\Pi",tag:"mo",output:"\u03A0",ttype:z},{input:"\\Rho",tag:"mo",output:"\u03A1",ttype:z},{input:"\\Sigma",tag:"mo",output:"\u03A3",ttype:z},{input:"\\Tau",tag:"mo",output:"\u03A4",ttype:z},{input:"\\Upsilon",tag:"mo",output:"\u03A5",ttype:z},{input:"\\Phi",tag:"mo",output:"\u03A6",ttype:z},{input:"\\Chi",tag:"mo",output:"\u03A7",ttype:z},{input:"\\Psi",tag:"mo",output:"\u03A8",ttype:z},{input:"\\Omega",tag:"mo",output:"\u03A9",ttype:z},{input:"\\frac12",tag:"mo",output:"\u00BD",ttype:z},{input:"\\frac14",tag:"mo",output:"\u00BC",ttype:z},{input:"\\frac34",tag:"mo",output:"\u00BE",ttype:z},{input:"\\frac13",tag:"mo",output:"\u2153",ttype:z},{input:"\\frac23",tag:"mo",output:"\u2154",ttype:z},{input:"\\frac15",tag:"mo",output:"\u2155",ttype:z},{input:"\\frac25",tag:"mo",output:"\u2156",ttype:z},{input:"\\frac35",tag:"mo",output:"\u2157",ttype:z},{input:"\\frac45",tag:"mo",output:"\u2158",ttype:z},{input:"\\frac16",tag:"mo",output:"\u2159",ttype:z},{input:"\\frac56",tag:"mo",output:"\u215A",ttype:z},{input:"\\frac18",tag:"mo",output:"\u215B",ttype:z},{input:"\\frac38",tag:"mo",output:"\u215C",ttype:z},{input:"\\frac58",tag:"mo",output:"\u215D",ttype:z},{input:"\\frac78",tag:"mo",output:"\u215E",ttype:z},{input:"\\pm",tag:"mo",output:"\u00B1",ttype:z},{input:"\\mp",tag:"mo",output:"\u2213",ttype:z},{input:"\\triangleleft",tag:"mo",output:"\u22B2",ttype:z},{input:"\\triangleright",tag:"mo",output:"\u22B3",ttype:z},{input:"\\cdot",tag:"mo",output:"\u22C5",ttype:z},{input:"\\star",tag:"mo",output:"\u22C6",ttype:z},{input:"\\ast",tag:"mo",output:"\u002A",ttype:z},{input:"\\times",tag:"mo",output:"\u00D7",ttype:z},{input:"\\div",tag:"mo",output:"\u00F7",ttype:z},{input:"\\circ",tag:"mo",output:"\u2218",ttype:z},{input:"\\bullet",tag:"mo",output:"\u2022",ttype:z},{input:"\\oplus",tag:"mo",output:"\u2295",ttype:z},{input:"\\ominus",tag:"mo",output:"\u2296",ttype:z},{input:"\\otimes",tag:"mo",output:"\u2297",ttype:z},{input:"\\bigcirc",tag:"mo",output:"\u25CB",ttype:z},{input:"\\oslash",tag:"mo",output:"\u2298",ttype:z},{input:"\\odot",tag:"mo",output:"\u2299",ttype:z},{input:"\\land",tag:"mo",output:"\u2227",ttype:z},{input:"\\wedge",tag:"mo",output:"\u2227",ttype:z},{input:"\\lor",tag:"mo",output:"\u2228",ttype:z},{input:"\\vee",tag:"mo",output:"\u2228",ttype:z},{input:"\\cap",tag:"mo",output:"\u2229",ttype:z},{input:"\\cup",tag:"mo",output:"\u222A",ttype:z},{input:"\\sqcap",tag:"mo",output:"\u2293",ttype:z},{input:"\\sqcup",tag:"mo",output:"\u2294",ttype:z},{input:"\\uplus",tag:"mo",output:"\u228E",ttype:z},{input:"\\amalg",tag:"mo",output:"\u2210",ttype:z},{input:"\\bigtriangleup",tag:"mo",output:"\u25B3",ttype:z},{input:"\\bigtriangledown",tag:"mo",output:"\u25BD",ttype:z},{input:"\\dag",tag:"mo",output:"\u2020",ttype:z},{input:"\\dagger",tag:"mo",output:"\u2020",ttype:z},{input:"\\ddag",tag:"mo",output:"\u2021",ttype:z},{input:"\\ddagger",tag:"mo",output:"\u2021",ttype:z},{input:"\\lhd",tag:"mo",output:"\u22B2",ttype:z},{input:"\\rhd",tag:"mo",output:"\u22B3",ttype:z},{input:"\\unlhd",tag:"mo",output:"\u22B4",ttype:z},{input:"\\unrhd",tag:"mo",output:"\u22B5",ttype:z},{input:"\\sum",tag:"mo",output:"\u2211",ttype:r},{input:"\\prod",tag:"mo",output:"\u220F",ttype:r},{input:"\\bigcap",tag:"mo",output:"\u22C2",ttype:r},{input:"\\bigcup",tag:"mo",output:"\u22C3",ttype:r},{input:"\\bigwedge",tag:"mo",output:"\u22C0",ttype:r},{input:"\\bigvee",tag:"mo",output:"\u22C1",ttype:r},{input:"\\bigsqcap",tag:"mo",output:"\u2A05",ttype:r},{input:"\\bigsqcup",tag:"mo",output:"\u2A06",ttype:r},{input:"\\coprod",tag:"mo",output:"\u2210",ttype:r},{input:"\\bigoplus",tag:"mo",output:"\u2A01",ttype:r},{input:"\\bigotimes",tag:"mo",output:"\u2A02",ttype:r},{input:"\\bigodot",tag:"mo",output:"\u2A00",ttype:r},{input:"\\biguplus",tag:"mo",output:"\u2A04",ttype:r},{input:"\\int",tag:"mo",output:"\u222B",ttype:z},{input:"\\oint",tag:"mo",output:"\u222E",ttype:z},{input:":=",tag:"mo",output:":=",ttype:z},{input:"\\lt",tag:"mo",output:"<",ttype:z},{input:"\\gt",tag:"mo",output:">",ttype:z},{input:"\\ne",tag:"mo",output:"\u2260",ttype:z},{input:"\\neq",tag:"mo",output:"\u2260",ttype:z},{input:"\\le",tag:"mo",output:"\u2264",ttype:z},{input:"\\leq",tag:"mo",output:"\u2264",ttype:z},{input:"\\leqslant",tag:"mo",output:"\u2264",ttype:z},{input:"\\ge",tag:"mo",output:"\u2265",ttype:z},{input:"\\geq",tag:"mo",output:"\u2265",ttype:z},{input:"\\geqslant",tag:"mo",output:"\u2265",ttype:z},{input:"\\equiv",tag:"mo",output:"\u2261",ttype:z},{input:"\\ll",tag:"mo",output:"\u226A",ttype:z},{input:"\\gg",tag:"mo",output:"\u226B",ttype:z},{input:"\\doteq",tag:"mo",output:"\u2250",ttype:z},{input:"\\prec",tag:"mo",output:"\u227A",ttype:z},{input:"\\succ",tag:"mo",output:"\u227B",ttype:z},{input:"\\preceq",tag:"mo",output:"\u227C",ttype:z},{input:"\\succeq",tag:"mo",output:"\u227D",ttype:z},{input:"\\subset",tag:"mo",output:"\u2282",ttype:z},{input:"\\supset",tag:"mo",output:"\u2283",ttype:z},{input:"\\subseteq",tag:"mo",output:"\u2286",ttype:z},{input:"\\supseteq",tag:"mo",output:"\u2287",ttype:z},{input:"\\sqsubset",tag:"mo",output:"\u228F",ttype:z},{input:"\\sqsupset",tag:"mo",output:"\u2290",ttype:z},{input:"\\sqsubseteq",tag:"mo",output:"\u2291",ttype:z},{input:"\\sqsupseteq",tag:"mo",output:"\u2292",ttype:z},{input:"\\sim",tag:"mo",output:"\u223C",ttype:z},{input:"\\simeq",tag:"mo",output:"\u2243",ttype:z},{input:"\\approx",tag:"mo",output:"\u2248",ttype:z},{input:"\\cong",tag:"mo",output:"\u2245",ttype:z},{input:"\\Join",tag:"mo",output:"\u22C8",ttype:z},{input:"\\bowtie",tag:"mo",output:"\u22C8",ttype:z},{input:"\\in",tag:"mo",output:"\u2208",ttype:z},{input:"\\ni",tag:"mo",output:"\u220B",ttype:z},{input:"\\owns",tag:"mo",output:"\u220B",ttype:z},{input:"\\propto",tag:"mo",output:"\u221D",ttype:z},{input:"\\vdash",tag:"mo",output:"\u22A2",ttype:z},{input:"\\dashv",tag:"mo",output:"\u22A3",ttype:z},{input:"\\models",tag:"mo",output:"\u22A8",ttype:z},{input:"\\perp",tag:"mo",output:"\u22A5",ttype:z},{input:"\\smile",tag:"mo",output:"\u2323",ttype:z},{input:"\\frown",tag:"mo",output:"\u2322",ttype:z},{input:"\\asymp",tag:"mo",output:"\u224D",ttype:z},{input:"\\notin",tag:"mo",output:"\u2209",ttype:z},{input:"\\begin{eqnarray}",output:"X",ttype:l,invisible:true},{input:"\\begin{array}",output:"X",ttype:l,invisible:true},{input:"\\\\",output:"}&{",ttype:o},{input:"\\end{eqnarray}",output:"}}",ttype:o},{input:"\\end{array}",output:"}}",ttype:o},{input:"\\big",tag:"mo",output:"X",atval:"1.2",ttype:A},{input:"\\Big",tag:"mo",output:"X",atval:"1.6",ttype:A},{input:"\\bigg",tag:"mo",output:"X",atval:"2.2",ttype:A},{input:"\\Bigg",tag:"mo",output:"X",atval:"2.9",ttype:A},{input:"\\left",tag:"mo",output:"X",ttype:x},{input:"\\right",tag:"mo",output:"X",ttype:e},{input:"{",output:"{",ttype:x,invisible:true},{input:"}",output:"}",ttype:e,invisible:true},{input:"(",tag:"mo",output:"(",atval:"1",ttype:j},{input:"[",tag:"mo",output:"[",atval:"1",ttype:j},{input:"\\lbrack",tag:"mo",output:"[",atval:"1",ttype:j},{input:"\\{",tag:"mo",output:"{",atval:"1",ttype:j},{input:"\\lbrace",tag:"mo",output:"{",atval:"1",ttype:j},{input:"\\langle",tag:"mo",output:"\u2329",atval:"1",ttype:j},{input:"\\lfloor",tag:"mo",output:"\u230A",atval:"1",ttype:j},{input:"\\lceil",tag:"mo",output:"\u2308",atval:"1",ttype:j},{input:")",tag:"mo",output:")",rtag:"mi",atval:"1",ttype:j},{input:"]",tag:"mo",output:"]",rtag:"mi",atval:"1",ttype:j},{input:"\\rbrack",tag:"mo",output:"]",rtag:"mi",atval:"1",ttype:j},{input:"\\}",tag:"mo",output:"}",rtag:"mi",atval:"1",ttype:j},{input:"\\rbrace",tag:"mo",output:"}",rtag:"mi",atval:"1",ttype:j},{input:"\\rangle",tag:"mo",output:"\u232A",rtag:"mi",atval:"1",ttype:j},{input:"\\rfloor",tag:"mo",output:"\u230B",rtag:"mi",atval:"1",ttype:j},{input:"\\rceil",tag:"mo",output:"\u2309",rtag:"mi",atval:"1",ttype:j},{input:"|",tag:"mo",output:"\u2223",atval:"1",ttype:j},{input:"\\|",tag:"mo",output:"\u2225",atval:"1",ttype:j},{input:"\\vert",tag:"mo",output:"\u2223",atval:"1",ttype:j},{input:"\\Vert",tag:"mo",output:"\u2225",atval:"1",ttype:j},{input:"\\mid",tag:"mo",output:"\u2223",atval:"1",ttype:j},{input:"\\parallel",tag:"mo",output:"\u2225",atval:"1",ttype:j},{input:"/",tag:"mo",output:"/",atval:"1.01",ttype:j},{input:"\\backslash",tag:"mo",output:"\u2216",atval:"1",ttype:j},{input:"\\setminus",tag:"mo",output:"\\",ttype:z},{input:"\\!",tag:"mspace",atname:"width",atval:"-0.167em",ttype:q},{input:"\\,",tag:"mspace",atname:"width",atval:"0.167em",ttype:q},{input:"\\>",tag:"mspace",atname:"width",atval:"0.222em",ttype:q},{input:"\\:",tag:"mspace",atname:"width",atval:"0.222em",ttype:q},{input:"\\;",tag:"mspace",atname:"width",atval:"0.278em",ttype:q},{input:"~",tag:"mspace",atname:"width",atval:"0.333em",ttype:q},{input:"\\quad",tag:"mspace",atname:"width",atval:"1em",ttype:q},{input:"\\qquad",tag:"mspace",atname:"width",atval:"2em",ttype:q},{input:"\\prime",tag:"mo",output:"\u2032",ttype:z},{input:"'",tag:"mo",output:"\u02B9",ttype:z},{input:"''",tag:"mo",output:"\u02BA",ttype:z},{input:"'''",tag:"mo",output:"\u2034",ttype:z},{input:"''''",tag:"mo",output:"\u2057",ttype:z},{input:"\\ldots",tag:"mo",output:"\u2026",ttype:z},{input:"\\cdots",tag:"mo",output:"\u22EF",ttype:z},{input:"\\vdots",tag:"mo",output:"\u22EE",ttype:z},{input:"\\ddots",tag:"mo",output:"\u22F1",ttype:z},{input:"\\forall",tag:"mo",output:"\u2200",ttype:z},{input:"\\exists",tag:"mo",output:"\u2203",ttype:z},{input:"\\Re",tag:"mo",output:"\u211C",ttype:z},{input:"\\Im",tag:"mo",output:"\u2111",ttype:z},{input:"\\aleph",tag:"mo",output:"\u2135",ttype:z},{input:"\\hbar",tag:"mo",output:"\u210F",ttype:z},{input:"\\ell",tag:"mo",output:"\u2113",ttype:z},{input:"\\wp",tag:"mo",output:"\u2118",ttype:z},{input:"\\emptyset",tag:"mo",output:"\u2205",ttype:z},{input:"\\infty",tag:"mo",output:"\u221E",ttype:z},{input:"\\surd",tag:"mo",output:"\\sqrt{}",ttype:o},{input:"\\partial",tag:"mo",output:"\u2202",ttype:z},{input:"\\nabla",tag:"mo",output:"\u2207",ttype:z},{input:"\\triangle",tag:"mo",output:"\u25B3",ttype:z},{input:"\\therefore",tag:"mo",output:"\u2234",ttype:z},{input:"\\angle",tag:"mo",output:"\u2220",ttype:z},{input:"\\diamond",tag:"mo",output:"\u22C4",ttype:z},{input:"\\Diamond",tag:"mo",output:"\u25C7",ttype:z},{input:"\\neg",tag:"mo",output:"\u00AC",ttype:z},{input:"\\lnot",tag:"mo",output:"\u00AC",ttype:z},{input:"\\bot",tag:"mo",output:"\u22A5",ttype:z},{input:"\\top",tag:"mo",output:"\u22A4",ttype:z},{input:"\\square",tag:"mo",output:"\u25AB",ttype:z},{input:"\\Box",tag:"mo",output:"\u25A1",ttype:z},{input:"\\wr",tag:"mo",output:"\u2240",ttype:z},{input:"\\arccos",tag:"mi",output:"arccos",ttype:b,func:true},{input:"\\arcsin",tag:"mi",output:"arcsin",ttype:b,func:true},{input:"\\arctan",tag:"mi",output:"arctan",ttype:b,func:true},{input:"\\arg",tag:"mi",output:"arg",ttype:b,func:true},{input:"\\cos",tag:"mi",output:"cos",ttype:b,func:true},{input:"\\cosh",tag:"mi",output:"cosh",ttype:b,func:true},{input:"\\cot",tag:"mi",output:"cot",ttype:b,func:true},{input:"\\coth",tag:"mi",output:"coth",ttype:b,func:true},{input:"\\csc",tag:"mi",output:"csc",ttype:b,func:true},{input:"\\deg",tag:"mi",output:"deg",ttype:b,func:true},{input:"\\det",tag:"mi",output:"det",ttype:b,func:true},{input:"\\dim",tag:"mi",output:"dim",ttype:b,func:true},{input:"\\exp",tag:"mi",output:"exp",ttype:b,func:true},{input:"\\gcd",tag:"mi",output:"gcd",ttype:b,func:true},{input:"\\hom",tag:"mi",output:"hom",ttype:b,func:true},{input:"\\inf",tag:"mo",output:"inf",ttype:r},{input:"\\ker",tag:"mi",output:"ker",ttype:b,func:true},{input:"\\lg",tag:"mi",output:"lg",ttype:b,func:true},{input:"\\lim",tag:"mo",output:"lim",ttype:r},{input:"\\liminf",tag:"mo",output:"liminf",ttype:r},{input:"\\limsup",tag:"mo",output:"limsup",ttype:r},{input:"\\ln",tag:"mi",output:"ln",ttype:b,func:true},{input:"\\log",tag:"mi",output:"log",ttype:b,func:true},{input:"\\max",tag:"mo",output:"max",ttype:r},{input:"\\min",tag:"mo",output:"min",ttype:r},{input:"\\Pr",tag:"mi",output:"Pr",ttype:b,func:true},{input:"\\sec",tag:"mi",output:"sec",ttype:b,func:true},{input:"\\sin",tag:"mi",output:"sin",ttype:b,func:true},{input:"\\sinh",tag:"mi",output:"sinh",ttype:b,func:true},{input:"\\sup",tag:"mo",output:"sup",ttype:r},{input:"\\tan",tag:"mi",output:"tan",ttype:b,func:true},{input:"\\tanh",tag:"mi",output:"tanh",ttype:b,func:true},{input:"\\gets",tag:"mo",output:"\u2190",ttype:z},{input:"\\leftarrow",tag:"mo",output:"\u2190",ttype:z},{input:"\\to",tag:"mo",output:"\u2192",ttype:z},{input:"\\rightarrow",tag:"mo",output:"\u2192",ttype:z},{input:"\\leftrightarrow",tag:"mo",output:"\u2194",ttype:z},{input:"\\uparrow",tag:"mo",output:"\u2191",ttype:z},{input:"\\downarrow",tag:"mo",output:"\u2193",ttype:z},{input:"\\updownarrow",tag:"mo",output:"\u2195",ttype:z},{input:"\\Leftarrow",tag:"mo",output:"\u21D0",ttype:z},{input:"\\Rightarrow",tag:"mo",output:"\u21D2",ttype:z},{input:"\\Leftrightarrow",tag:"mo",output:"\u21D4",ttype:z},{input:"\\iff",tag:"mo",output:"~\\Longleftrightarrow~",ttype:o},{input:"\\Uparrow",tag:"mo",output:"\u21D1",ttype:z},{input:"\\Downarrow",tag:"mo",output:"\u21D3",ttype:z},{input:"\\Updownarrow",tag:"mo",output:"\u21D5",ttype:z},{input:"\\mapsto",tag:"mo",output:"\u21A6",ttype:z},{input:"\\longleftarrow",tag:"mo",output:"\u2190",ttype:c},{input:"\\longrightarrow",tag:"mo",output:"\u2192",ttype:c},{input:"\\longleftrightarrow",tag:"mo",output:"\u2194",ttype:c},{input:"\\Longleftarrow",tag:"mo",output:"\u21D0",ttype:c},{input:"\\Longrightarrow",tag:"mo",output:"\u21D2",ttype:c},{input:"\\implies",tag:"mo",output:"\u21D2",ttype:c},{input:"\\Longleftrightarrow",tag:"mo",output:"\u21D4",ttype:c},{input:"\\longmapsto",tag:"mo",output:"\u21A6",ttype:z},{input:"\\sqrt",tag:"msqrt",output:"sqrt",ttype:b},{input:"\\root",tag:"mroot",output:"root",ttype:d},{input:"\\frac",tag:"mfrac",output:"/",ttype:d},{input:"\\stackrel",tag:"mover",output:"stackrel",ttype:d},{input:"\\atop",tag:"mfrac",output:"",ttype:p},{input:"\\choose",tag:"mfrac",output:"",ttype:p},{input:"_",tag:"msub",output:"_",ttype:p},{input:"^",tag:"msup",output:"^",ttype:p},{input:"\\mbox",tag:"mtext",output:"mbox",ttype:B},{input:"\\acute",tag:"mover",output:"\u00B4",ttype:b,acc:true},{input:"\\grave",tag:"mover",output:"\u0060",ttype:b,acc:true},{input:"\\breve",tag:"mover",output:"\u02D8",ttype:b,acc:true},{input:"\\check",tag:"mover",output:"\u02C7",ttype:b,acc:true},{input:"\\dot",tag:"mover",output:".",ttype:b,acc:true},{input:"\\ddot",tag:"mover",output:"..",ttype:b,acc:true},{input:"\\mathring",tag:"mover",output:"\u00B0",ttype:b,acc:true},{input:"\\vec",tag:"mover",output:"\u20D7",ttype:b,acc:true},{input:"\\overrightarrow",tag:"mover",output:"\u20D7",ttype:b,acc:true},{input:"\\overleftarrow",tag:"mover",output:"\u20D6",ttype:b,acc:true},{input:"\\hat",tag:"mover",output:"\u005E",ttype:b,acc:true},{input:"\\widehat",tag:"mover",output:"\u0302",ttype:b,acc:true},{input:"\\tilde",tag:"mover",output:"~",ttype:b,acc:true},{input:"\\widetilde",tag:"mover",output:"\u02DC",ttype:b,acc:true},{input:"\\bar",tag:"mover",output:"\u203E",ttype:b,acc:true},{input:"\\overbrace",tag:"mover",output:"\u23B4",ttype:b,acc:true},{input:"\\overline",tag:"mover",output:"\u00AF",ttype:b,acc:true},{input:"\\underbrace",tag:"munder",output:"\u23B5",ttype:b,acc:true},{input:"\\underline",tag:"munder",output:"\u00AF",ttype:b,acc:true},{input:"\\displaystyle",tag:"mstyle",atname:"displaystyle",atval:"true",ttype:b},{input:"\\textstyle",tag:"mstyle",atname:"displaystyle",atval:"false",ttype:b},{input:"\\scriptstyle",tag:"mstyle",atname:"scriptlevel",atval:"1",ttype:b},{input:"\\scriptscriptstyle",tag:"mstyle",atname:"scriptlevel",atval:"2",ttype:b},{input:"\\mathrm",tag:"mtext",output:"text",ttype:B},{input:"\\textrm",tag:"mtext",output:"text",ttype:B},{input:"\\mathbf",tag:"mstyle",atname:"mathvariant",atval:"bold",ttype:b,codes:h},{input:"\\textbf",tag:"mstyle",atname:"mathvariant",atval:"bold",ttype:b,codes:h},{input:"\\mathit",tag:"mstyle",atname:"mathvariant",atval:"italic",ttype:b},{input:"\\textit",tag:"mstyle",atname:"mathvariant",atval:"italic",ttype:b},{input:"\\mathtt",tag:"mstyle",atname:"mathvariant",atval:"monospace",ttype:b},{input:"\\texttt",tag:"mstyle",atname:"mathvariant",atval:"monospace",ttype:b},{input:"\\mathsf",tag:"mstyle",atname:"mathvariant",atval:"sans-serif",ttype:b},{input:"\\mathbb",tag:"mstyle",atname:"mathvariant",atval:"double-struck",ttype:b,codes:s},{input:"\\mathcal",tag:"mstyle",atname:"mathvariant",atval:"script",ttype:b,codes:t},{input:"\\mathfrak",tag:"mstyle",atname:"mathvariant",atval:"fraktur",ttype:b,codes:D}];var u=[];function n(){if(m.browser.mozilla||m.browser.opera){return true}else{return false}}function G(H,I){if(H.input>I.input){return 1}else{return -1}}function w(){var H=a.length;a.sort(G);for(var I=0;I<H;I++){u[I]=a[I].input}}function y(H,I){return m.trim(H.slice(I))}function E(I,L,M){if(M===0){var K,H;M=-1;K=I.length;while(M+1<K){H=(M+K)>>1;if(I[H]<L){M=H}else{K=H}}return K}else{for(var J=M;J<I.length&&I[J]<L;J++){}}return J}function v(O){var H=0;var I=0;var K;var Q;var P;var L="";var N=true;var M=O.length;for(var J=1;J<=M&&N;J++){Q=O.slice(0,J);I=H;H=E(u,Q,I);if(H<u.length&&O.slice(0,u[H].length)==u[H]){L=u[H];K=H;J=L.length}N=H<u.length&&O.slice(0,u[H].length)>=u[H]}if(L!==""){return a[K]}H=1;Q=O.slice(0,1);if("0"<=Q&&Q<="9"){P="mn"}else{P=(("A">Q||Q>"Z")&&("a">Q||Q>"z")?"mo":"mi")}return{input:Q,tag:P,output:Q,ttype:z}}function g(P){var K,I,U,J,M,S,O=document.createDocumentFragment();P=m.trim(P);K=v(P);if(K===null||K.ttype==e){return[null,P,null]}if(K.ttype==o){P=K.output+y(P,K.input.length);K=v(P);if(K===null||K.ttype==e){return[null,P,null]}}P=y(P,K.input.length);switch(K.ttype){case q:I=C(K.tag);I.setAttribute(K.atname,K.atval);return[I,P,K.tag];case r:return[C(K.tag,document.createTextNode(K.output)),P,K.tag];case z:I=C(K.tag,document.createTextNode(K.output));return[I,P,K.tag];case c:I=C(K.tag,document.createTextNode(K.output));I.setAttribute("minsize","1.5");I.setAttribute("maxsize","1.5");I=C("mover",I);I.appendChild(C("mspace"));return[I,P,K.tag];case j:I=C(K.tag,document.createTextNode(K.output));if(K.input=="|"||K.input=="\\vert"||K.input=="\\|"||K.input=="\\Vert"){I.setAttribute("lspace","0em");I.setAttribute("rspace","0em")}I.setAttribute("maxsize",K.atval);if(K.rtag!==null){return[I,P,K.rtag]}else{return[I,P,K.tag]}break;case A:var N=K.atval;K=v(P);if(K===null){return[null,P,null]}P=y(P,K.input.length);I=C(K.tag,document.createTextNode(K.output));I.setAttribute("minsize",N);I.setAttribute("maxsize",N);return[I,P,K.tag];case x:if(K.input=="\\left"){K=v(P);if(K!==null){if(K.input=="."){K.invisible=true}P=y(P,K.input.length)}}U=k(P,true,false);if(K===null||(typeof K.invisible=="boolean"&&K.invisible)){I=C("mrow",U[0])}else{I=C("mo",document.createTextNode(K.output));I=C("mrow",I);I.appendChild(U[0])}return[I,U[1],U[2]];case l:if(K.input=="\\begin{array}"){var T="";K=v(P);P=m.trim(P);if(K===null){T="l"}else{P=y(P,K.input.length);if(K.input!="{"){T="l"}else{do{K=v(P);if(K!==null){P=y(P,K.input.length);if(K.input!="}"){T=T+K.input}}}while(K!==null&&K.input!==""&&K.input!="}")}}U=k("{"+P,true,true);I=C("mtable",U[0]);T=T.replace(/l/g,"left ");T=T.replace(/r/g,"right ");T=T.replace(/c/g,"center ");I.setAttribute("columnalign",T);I.setAttribute("displaystyle","false");return[I,U[1],null]}else{U=k("{"+P,true,true);I=C("mtable",U[0]);I.setAttribute("columnspacing","0.167em");I.setAttribute("columnalign","right center left");I.setAttribute("displaystyle","true");I=C("mrow",I);return[I,U[1],null]}break;case B:if(P.charAt(0)=="{"){M=P.indexOf("}")}else{M=0}if(M==-1){M=P.length}S=P.slice(1,M);O.appendChild(C(K.tag,document.createTextNode(S)));P=y(P,M+1);return[C("mrow",O),P,null];case b:U=g(P);if(U[0]===null){return[C(K.tag,document.createTextNode(K.output)),P]}if(typeof K.func=="boolean"&&K.func){S=P.charAt(0);if(S=="^"||S=="_"||S==","){return[C(K.tag,document.createTextNode(K.output)),P,K.tag]}else{I=C("mrow",C(K.tag,document.createTextNode(K.output)));I.appendChild(U[0]);return[I,U[1],K.tag]}}if(K.input=="\\sqrt"){return[C(K.tag,U[0]),U[1],K.tag]}else{if(typeof K.acc=="boolean"&&K.acc){I=C(K.tag,U[0]);var H=K.output;var R=C("mo",document.createTextNode(H));if(K.input=="\\vec"||K.input=="\\check"){R.setAttribute("maxsize","1.2")}if(K.input=="\\underbrace"||K.input=="\\underline"){R.setAttribute("accentunder","true")}else{R.setAttribute("accent","true")}I.appendChild(R);if(K.input=="\\overbrace"||K.input=="\\underbrace"){I.ttype=r}return[I,U[1],K.tag]}else{if(typeof K.codes!="undefined"){for(M=0;M<U[0].childNodes.length;M++){if(U[0].childNodes[M].nodeName=="mi"||U[0].nodeName=="mi"){S=(U[0].nodeName=="mi"?U[0].firstChild.nodeValue:U[0].childNodes[M].firstChild.nodeValue);var Q=[];for(var L=0;L<S.length;L++){if(S.charCodeAt(L)>64&&S.charCodeAt(L)<91){Q=Q+K.codes[S.charCodeAt(L)-65]}else{if(S.charCodeAt(L)>96&&S.charCodeAt(L)<123){Q=Q+K.codes[S.charCodeAt(L)-71]}}}if(U[0].nodeName=="mi"){U[0]=C("mo").appendChild(document.createTextNode(Q))}else{U[0].replaceChild(C("mo").appendChild(document.createTextNode(Q)),U[0].childNodes[M])}}}}I=C(K.tag,U[0]);I.setAttribute(K.atname,K.atval);if(K.input=="\\scriptstyle"||K.input=="\\scriptscriptstyle"){I.setAttribute("displaystyle","false")}return[I,U[1],K.tag]}}break;case d:U=g(P);if(U[0]===null){return[C("mo",document.createTextNode(K.input)),P,null]}J=g(U[1]);if(J[0]===null){return[C("mo",document.createTextNode(K.input)),P,null]}if(K.input=="\\root"||K.input=="\\stackrel"){O.appendChild(J[0])}O.appendChild(U[0]);if(K.input=="\\frac"){O.appendChild(J[0])}return[C(K.tag,O),J[1],K.tag];case p:P=y(P,K.input.length);return[C("mo",document.createTextNode(K.output)),P,K.tag];default:return[C(K.tag,document.createTextNode(K.output)),P,K.tag]}}function F(M){var L,J,I,K,O,P,N;M=m.trim(M);J=v(M);O=g(M);K=O[0];M=O[1];P=O[2];L=v(M);if(L.ttype==p){M=y(M,L.input.length);O=g(M);if(O[0]===null){O[0]=C("mo",document.createTextNode("\u25A1"))}M=O[1];P=O[2];if(L.input=="_"||L.input=="^"){I=v(M);P=null;N=((J.ttype==r)||(K.ttype==r));if(L.input=="_"&&I.input=="^"){M=y(M,I.input.length);var H=g(M);M=H[1];P=H[2];K=C((N?"munderover":"msubsup"),K);K.appendChild(O[0]);K.appendChild(H[0])}else{if(L.input=="_"){K=C((N?"munder":"msub"),K);K.appendChild(O[0])}else{K=C((N?"mover":"msup"),K);K.appendChild(O[0])}}K=C("mrow",K)}else{K=C(L.tag,K);if(L.input=="\\atop"||L.input=="\\choose"){K.setAttribute("linethickness","0ex")}K.appendChild(O[0]);if(L.input=="\\choose"){K=C("mfenced",K)}}}return[K,M,P]}function k(O,N,T){var S,P,K,V,Z,L=document.createDocumentFragment();do{O=m.trim(O);K=F(O);P=K[0];O=K[1];Z=K[2];S=v(O);if(P!=undefined){if((Z=="mn"||Z=="mi")&&S!==null&&typeof S.func=="boolean"&&S.func){var Y=C("mspace");Y.setAttribute("width","0.167em");P=C("mrow",P);P.appendChild(Y)}L.appendChild(P)}}while((S.ttype!=e)&&S!==null&&S.output!="");Z=null;if(S.ttype==e){if(S.input=="\\right"){O=y(O,S.input.length);S=v(O);if(S!==null&&S.input=="."){S.invisible=true}if(S!==null){Z=S.rtag}}if(S!==null){O=y(O,S.input.length)}var W=L.childNodes.length;if(T&&W>0&&L.childNodes[W-1].nodeName=="mrow"&&W>1&&L.childNodes[W-2].nodeName=="mo"&&L.childNodes[W-2].firstChild.nodeValue=="&"){var I=[];var Q=L.childNodes.length;for(V=0;T&&V<Q;V=V+2){I[V]=[];P=L.childNodes[V];for(var U=0;U<P.childNodes.length;U++){if(P.childNodes[U].firstChild.nodeValue=="&"){I[V][I[V].length]=U}}}var J,H,M,R,X=document.createDocumentFragment();for(V=0;V<Q;V=V+2){J=document.createDocumentFragment();H=document.createDocumentFragment();P=L.firstChild;M=P.childNodes.length;R=0;for(U=0;U<M;U++){if(typeof I[V][R]!="undefined"&&U==I[V][R]){P.removeChild(P.firstChild);J.appendChild(C("mtd",H));R++}else{H.appendChild(P.firstChild)}}J.appendChild(C("mtd",H));if(L.childNodes.length>2){L.removeChild(L.firstChild);L.removeChild(L.firstChild)}X.appendChild(C("mtr",J))}return[X,O]}if(typeof S.invisible!="boolean"||!S.invisible){P=C("mo",document.createTextNode(S.output));L.appendChild(P)}}return[L,O,Z]}if(!document.createElementNS){document.createElementNS=function(I,H){return this.createElement(H)}}function C(H,J){var I=document.createElementNS("http://www.w3.org/1998/Math/MathML",H);if(J){m(I).append(J)}return I}return{showFormulaOnMouseOver:false,latexImages:false,latexConverter:"http://www.forkosh.dreamhost.com/mimetex.cgi?",mathColor:"black",mathFontSize:"",mathFontFamily:"",createElementXHTML:function(H,I,K){var J=document.createElementNS("http://www.w3.org/1999/xhtml",H);if(I){J.id=I}if(K){J.className=K}return J},define:function(J,K){if(MSVG.latexImages){return}if((typeof J)=="string"){J=[J];K=[K]}var I,H=J.length;if(H!=K.length){return}for(I=0;I<H;I++){a=a.concat([{input:"\\"+J[I],tag:"mo",output:K[I],ttype:o}])}w()},parseMath:function(L,K,I,H){if(L===null){return null}var M=k(L.replace(/^\s+/g,""),false,false)[0];var J=(M.firstChild.nodeName=="mstyle")?M.firstChild:C("mstyle",M);if(K){m(J).attr({displaystyle:"true"})}m(J).attr({mathcolor:H||MSVG.mathColor,fontsize:I||MSVG.mathFontSize,fontfamily:MSVG.mathFontFamily});J=C("math",J);if(MSVG.showFormulaOnMouseOver){m(J).attr({title:L.replace(/\s+/g," ")})}return J},parseMathExternal:function(M,L,I,H){if(M===null){return null}var K=MSVG.createElementXHTML("img");var J=MSVG.latexConverter+M;m(K).attr({src:J});if(MSVG.showFormulaOnMouseOver){m(K).attr({title:M.replace(/\s+/g," ")})}return K},generic:function(){if(MSVG.latexImages||!n()){MSVG.parseMath=MSVG.parseMathExternal}else{w()}if(!(window.SVGElement||m.browser.opera||m.browser.safari)){ASVG.drawPictures=ASVG.removePictures}}}}(jQuery);var ASVG=function($){var SVG;var collection=[];var chars="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";var markerChars="o*sSx+<>|";function createSVGElement(elType){return document.createElementNS("http://www.w3.org/2000/svg",elType)}function getSVGElement(id,el){var node,res={node:null,newEl:false};if(id){id=SVG.id+"_"+id;res.node=$("#"+id)[0]}if(!res.node){res.node=createSVGElement(el);if(id){res.node.id=id}res.newEl=true}return res}function appendSVG(elmt){if(elmt.newEl){$(SVG.canvas).append(elmt.node)}}function setButton(text,title,func){var node=MSVG.createElementXHTML("span",null,"svgButton");node.title=title;node.onclick=func;$(node).append(text);$(node).css({paddingRight:"0.5em",paddingLeft:"0.5em",fontSize:"1em",fontFamily:"monospace",background:"blue",color:"yellow",cursor:"pointer"});$(node).mouseover(function(){$(this).css({background:"yellow",color:"blue"})});$(node).mouseout(function(){$(this).css({background:"blue",color:"yellow"})});node.setAttribute("owner",SVG.id);return node}function pictureAttributes(){this.stroke="blue";this.strokewidth=1;this.strokeopacity=1;this.strokedasharray="none";this.fill="none";this.fillopacity=1;this.fontstyle="normal";this.fontfamily="serif";this.fontweight="normal";this.fontsize=12;this.fontstroke="none";this.fontfill="black";this.largearc=0;this.sweep=0;this.rx=0;this.ry=0;this.closed=false;this.curve="";this.marker="o";this.markerstrokewidth=1;this.markerstroke="blue";this.markerfill=null;this.markersize=8;this.markeropacity=1;this.direction=[1,0];this.ticklabels="";this.pos="";this.points=200;this.axesstroke="black";this.axesstrokewidth=0.5;this.gridstroke="grey";this.gridstrokewidth=0.25;this.backgroundcolor="white";this.backgroundopacity=1}function pictureObject(){this.id=null;this.src="";this.borderstroke="black";this.borderwidth=0;this.canvas=null;this.width=300;this.height=200;this.factor=1;this.xmin=-5;this.xmax=5;this.ymin=null;this.ymax=null;this.xunitlength=null;this.yunitlength=null;this.origin=[0,0];this.coords="cartesian";this.mouse=[null,null];this.drag=null;this.pan=true;this.attr=new pictureAttributes()}function refresh(){translateAndEval(SVG.id)}function translateAndEval(id){var errstr;var src=SVG.src;$("#"+SVG.id+"Canvas").empty();$("#"+SVG.id+"mml").empty();ASVG.dynamic[id]={};src=src.replace(/dynamic\./g,"ASVG.dynamic."+id+".");SVG.attr=new pictureAttributes();try{with(Math){eval(src)}}catch(err){if(typeof err=="object"){errstr=err.name+" "+err.message+" "+err.number+" "+err.description}else{errstr=err}alert(errstr+"\n"+src)}collection[SVG.id]=SVG}function setOptions(atr){for(i in atr){SVG.attr[i]=atr[i]}}function getOption(opt,options){return(opt in options)?options[opt]:SVG.attr[opt]}function setAction(evt,fn,id){if(!$.isFunction(fn)){return}var node=(id)?$("#"+SVG.id+"_"+id):$("#"+SVG.id);$(node).bind(evt,fn)}function getPosition(evt){var obj=evt.currentTarget;var posX=(evt.pageX-obj.parentNode.offsetLeft-SVG.origin[0])/SVG.xunitlength;var posY=(SVG.height-SVG.origin[1]-(evt.pageY-obj.parentNode.offsetTop))/SVG.yunitlength;return[posX,posY]}function getAngle(p){p=p||[0,0];var res=Math.atan2(SVG.mouse[1]-p[1],SVG.mouse[0]-p[0]);res=(res<0)?res+2*Math.PI:res;return res}function getDistance(p){p=p||[0,0];return Math.sqrt(Math.pow(SVG.mouse[0]-p[0],2)+Math.pow(SVG.mouse[1]-p[1],2))}function updateButton(obj){var id=$(obj).attr("owner");var node=$("#"+id+"src");if(obj.firstChild.nodeValue=="Edit"){obj.firstChild.nodeValue="Update";obj.title="Update picture";node.val(SVG.src).css("display","block");return}else{SVG.src=node.val();translateAndEval(id)}}function switchTo(evt){var name=evt.currentTarget.id;if(SVG.id==name){return}SVG=collection[name]}function onWheel(evt){evt=evt||window.event;var factor=1;if(evt.wheelDelta){factor=(evt.wheelDelta>0)?0.8:1.25}else{if(evt.detail){factor=(evt.detail<0)?0.8:1.25}}if(evt.shiftKey){changeSize(factor)}else{changeScales(factor)}evt.preventDefault();evt.stopPropagation();return false}function onClick(evt){if(evt.button===0){if(evt.shiftKey){$("#"+SVG.id+"toolbar").slideToggle();$("#"+SVG.id+"src").val(SVG.src);evt.stopImmediatePropagation()}else{if(SVG.pan){SVG.drag=[evt.clientX,evt.clientY]}}}return false}function onDrop(evt){if(SVG.drag==null){return false}var xlen=(SVG.drag[0]-evt.clientX)/SVG.xunitlength;var ylen=(-SVG.drag[1]+evt.clientY)/SVG.yunitlength;SVG.drag=null;if(xlen==0&&ylen==0){return false}changeScales(1,[SVG.xmin+xlen,SVG.xmax+xlen,SVG.ymin+ylen,SVG.ymax+ylen]);return false}function setScales(){SVG.xunitlength=SVG.width/(SVG.xmax-SVG.xmin);SVG.yunitlength=SVG.height/(SVG.ymax-SVG.ymin);SVG.origin=[-SVG.xmin*SVG.xunitlength,-SVG.ymin*SVG.yunitlength]}function setSize(){var picture=$("#"+SVG.id)[0];picture.setAttribute("width",SVG.width);picture.setAttribute("height",SVG.height);picture.parentNode.style.width=SVG.width+"px";picture.parentNode.style.height=SVG.height+"px";var border=SVG.borderwidth*0.5;var node=$("#"+SVG.id+"ClipPath")[0];node.firstChild.setAttribute("d","M"+border+","+border+" "+(SVG.width-border)+","+border+" "+(SVG.width-border)+","+(SVG.height-border)+" "+border+","+(SVG.height-border));node=$("#"+SVG.id+"Coords")[0];if(node){node.setAttribute("x",SVG.width-border-2);node.setAttribute("y",SVG.height-border-5)}}function changeSize(factor){SVG.factor*=factor;SVG.width/=factor;SVG.height/=factor;setSize();setScales();translateAndEval(SVG.id)}function changeScales(factor,trans){trans=trans||[SVG.xmin,SVG.xmax,SVG.ymin,SVG.ymax];SVG.factor*=factor;var dx=(SVG.xmax-SVG.xmin)*(1-factor)*0.5;var dy=(SVG.ymax-SVG.ymin)*(1-factor)*0.5;SVG.xmin=trans[0]+dx;SVG.xmax=trans[1]-dx;SVG.ymin=trans[2]+dy;SVG.ymax=trans[3]-dy;setScales();translateAndEval(SVG.id)}function updateCoord(evt){if($.browser.opera){switchTo(evt)}SVG.mouse=getPosition(evt);if(SVG.coords!="none"){var coords;if(SVG.coords=="cartesian"){coords="C: ("+SVG.mouse[0].toFixed(2)+", "+SVG.mouse[1].toFixed(2)+")"}else{coords="P: ("+getDistance().toFixed(2)+", "+getAngle().toFixed(2)+")"}$("#"+SVG.id+"Coords").text(coords)}return false}function removeCoord(){$("#"+SVG.id+"Coords").text("")}function exportSVG(obj){var name=$(obj).attr("owner");var pic=$("#"+name)[0].parentNode.innerHTML;var pos=pic.indexOf("</svg")+6;pic=pic.substr(0,pos);var svg="<?xml version='1.0' encoding='UTF-8' standalone='no'?>\n";if(pic.indexOf("svgCoords")>-1){pos=pic.lastIndexOf("<text");svg+=pic.substr(0,pos);pos=pic.lastIndexOf("</text")+7;svg+=pic.substr(pos)}else{svg+=pic}svg=svg.replace(/&nbsp;/g,"");svg=svg.replace(/><(?!\/)/g,">\n<");obj.previousSibling.firstChild.nodeValue="Edit";$("#"+name+"src").val(svg).css("display","block")}function toSVG(p){var x=p[0]*SVG.xunitlength+SVG.origin[0];var y=SVG.height-p[1]*SVG.yunitlength-SVG.origin[1];return[x,y]}function toSVGPair(p){p=toSVG(p);return p[0]+" "+p[1]}function setStrokeAndFill(node,options){node.setAttribute("stroke",getOption("stroke",options));node.setAttribute("stroke-width",getOption("strokewidth",options)/SVG.factor);node.setAttribute("stroke-dasharray",getOption("strokedasharray",options));node.setAttribute("stroke-opacity",getOption("strokeopacity",options));node.setAttribute("fill",getOption("fill",options));node.setAttribute("fill-opacity",getOption("fillopacity",options))}function setText(st,id){$("#"+id).text(st)}function setMarkers(obj,options){if(!options.marker){return}var markersize=getOption("markersize",options)/SVG.factor;var markerstroke=getOption("markerstroke",options);var markeropacity=getOption("markeropacity",options);var markerfill=getOption("markerfill",options);if(!markerfill){markerfill=SVG.attr.backgroundcolor}var markerstrokewidth=getOption("markerstrokewidth",options)/SVG.factor;var node,node2,i,id,pos=["marker-start","marker-mid","marker-end"];var lim=options.marker.length;for(i=0;i<lim;i++){var type=options.marker.charAt(i);if(type=="-"){continue}id=((options.id)?options.id+"_":"")+"Marker_"+markerChars.indexOf(type);node=$("#"+SVG.id+"_"+id)[0];if(!node){node=getSVGElement(id,"marker").node;node.setAttribute("viewBox","0 0 10 10");node.setAttribute("refX",5);node.setAttribute("refY",5);node.setAttribute("orient","auto");node.setAttribute("stroke",markerstroke);node.setAttribute("stroke-width",markerstrokewidth);node.setAttribute("fill",markerfill);node.setAttribute("stroke-opacity",markeropacity);node.setAttribute("fill-opacity",markeropacity);switch(type){case"*":node.setAttribute("fill",markerstroke);case"o":node2=createSVGElement("circle");node2.setAttribute("cx",5);node2.setAttribute("cy",5);node2.setAttribute("r",4);break;case">":node2=createSVGElement("path");node2.setAttribute("d","M 0 0 L 10 5 L 0 10 z");node.setAttribute("fill",markerstroke);node.setAttribute("refX",10);break;case"<":node2=createSVGElement("path");node2.setAttribute("d","M 10 0 L 10 10 L 0 5 z");node.setAttribute("fill",markerstroke);node.setAttribute("refX",0);break;case"x":node2=createSVGElement("path");node2.setAttribute("d","M 0 0 L 10 10 M 0 10 L 10 0");break;case"+":node2=createSVGElement("path");node2.setAttribute("d","M 5 0 L 5 10 M 0 5 L 10 5");break;case"|":node2=createSVGElement("path");node2.setAttribute("d","M 5 0 L 5 10");break;case"S":node.setAttribute("fill",markerstroke);case"s":node2=createSVGElement("rect");node2.setAttribute("x",0);node2.setAttribute("y",0);node2.setAttribute("width",10);node2.setAttribute("height",10)}$(node).append(node2);$("#"+SVG.id+"_Defs:first").append(node)}node.setAttribute("markerWidth",markersize);node.setAttribute("markerHeight",markersize);obj.setAttribute(pos[i],"url(#"+SVG.id+"_"+id+")")}}function setLabels(p,options){if(!options.label){return}var i,point,pos;var label=(typeof options.label=="string")?[options.label]:options.label;var labelpos=getOption("pos",options);labelpos=(typeof labelpos=="string")?[labelpos]:labelpos;var poslen=labelpos.length;var markersize=getOption("markersize",options)/SVG.factor;var dx=(0.5*markersize/SVG.xunitlength)/SVG.factor;var dy=(0.5*markersize/SVG.yunitlength)/SVG.factor;for(i=0;i<label.length;i++){options.isLabel="_label"+i;point=p[i];pos=(poslen>i)?labelpos[i].toUpperCase():pos;if(/E/.test(pos)){point[0]+=dx}if(/W/.test(pos)){point[0]-=dx}if(/N/.test(pos)){point[1]+=dy}if(/S/.test(pos)){point[1]-=dy}options.pos=pos;text(point,label[i],options)}}function line(p,q,options){options=options||{};options.closed=false;options.curve="";path([p,q],options)}function dot(p,options){options=options||{};var direction=getOption("direction",options);var q=[p[0]+direction[0]/SVG.xunitlength,p[1]+direction[1]/SVG.yunitlength];options.marker=getOption("marker",options).charAt(0);var elmt=getSVGElement(options.id,"path");var st="M"+toSVGPair(p)+" "+toSVGPair(q);elmt.node.setAttribute("d",st);elmt.node.setAttribute("stroke","none");setMarkers(elmt.node,options);setLabels([p,q],options);appendSVG(elmt)}function path(list,options){options=options||{};var st,i,elmt=getSVGElement(options.id,"path");var curve=getOption("curve",options);var closed=getOption("closed",options);if(typeof plist=="string"){st=list}else{var len=list.length;if(len===0){return}st="M"+toSVGPair(list[0])+" "+curve;for(i=1;i<len;i++){st+=toSVGPair(list[i])+" "}if(closed){st+="Z"}}elmt.node.setAttribute("d",st);setStrokeAndFill(elmt.node,options);setMarkers(elmt.node,options);setLabels(list,options);appendSVG(elmt)}function rotate(id,angle,options){if(!id||!angle){return}var node=$("#"+SVG.id+"_"+id)[0];if(node){options=options||{};var center=options.center?toSVG(options.center):SVG.origin;angle=-angle*180/Math.PI;var transform=node.getAttribute("transform")||"";transform="rotate("+angle+" "+center+") "+(options.replace?"":transform);node.setAttribute("transform",transform)}}function translate(id,delta,options){if(!id||!delta){return}var node=$("#"+SVG.id+"_"+id)[0];if(node){options=options||{};delta=toSVG(delta);var transform=node.getAttribute("transform")||"";transform="translate("+(delta[0]-SVG.origin[0])+"  "+(SVG.origin[1]+delta[1]-SVG.height)+") "+(options.replace?"":transform);node.setAttribute("transform",transform)}}function curve(list,options){options=options||{};options.curve=options.curve||"T";path(list,options)}function circle(center,radius,options){ellipse(center,radius,radius,options)}function loop(p,options){options=options||{};var d=options.direction||[1,0];options.curve="C";options.closed=false;path([p,[p[0]+d[0],p[1]+d[1]],[p[0]-d[1],p[1]+d[0]],p],options)}function arc(options){options=options||{};var start=options.start;var end=options.end;var center=options.center;var startangle=options.startangle;var endangle=options.endangle;var st="M",elmt=getSVGElement(options.id,"path");var largearc=getOption("largearc",options);var sweep=getOption("sweep",options);var closed=getOption("closed",options);var radius=options.radius;if(center!=null&&startangle!=null&&endangle!=null&&radius!=null){end=[radius*Math.cos(startangle)+center[0],radius*Math.sin(startangle)+center[1]];start=[radius*Math.cos(endangle)+center[0],radius*Math.sin(endangle)+center[1]]}if(start==null||end==null){return}if(!radius){var v=[end[0]-start[0],end[1]-start[1]];radius=Math.sqrt(v[0]*v[0]+v[1]*v[1])}if(closed&&center!=null){st+=toSVGPair(center)+" "}st+=toSVGPair(start)+" A"+radius*SVG.xunitlength+","+radius*SVG.yunitlength+" 0 "+largearc+","+sweep+" "+toSVGPair(end);if(closed&&center!=null){st+=" z"}elmt.node.setAttribute("d",st);setStrokeAndFill(elmt.node,options);setMarkers(elmt.node,options);setLabels([start,end],options);appendSVG(elmt)}function ellipse(center,rx,ry,options){options=options||{};var elmt=getSVGElement(options.id,"ellipse");center=toSVG(center);elmt.node.setAttribute("cx",center[0]);elmt.node.setAttribute("cy",center[1]);elmt.node.setAttribute("rx",rx*SVG.xunitlength);elmt.node.setAttribute("ry",ry*SVG.yunitlength);setStrokeAndFill(elmt.node,options);appendSVG(elmt)}function polygon(list,options){options=options||{};options.closed=true;path(list,options)}function rect(p,q,options){options=options||{};var elmt=getSVGElement(options.id,"rect");elmt.node.setAttribute("x",toSVG(p)[0]);elmt.node.setAttribute("y",toSVG(q)[1]);elmt.node.setAttribute("width",(q[0]-p[0])*SVG.xunitlength);elmt.node.setAttribute("height",(q[1]-p[1])*SVG.yunitlength);elmt.node.setAttribute("rx",getOption("rx",options)*SVG.xunitlength);elmt.node.setAttribute("ry",getOption("ry",options)*SVG.yunitlength);setStrokeAndFill(elmt.node,options);appendSVG(elmt)}function text(p,st,options){options=options||{};options.fill=options.fill||SVG.attr.fontfill;var id=options.id;var factor=(options.fixed)?1:SVG.factor;if(id&&options.isLabel){id+=options.isLabel}var pos=getOption("pos",options).toUpperCase();var fontsize=getOption("fontsize",options)/factor;var node,dx=0,dy=0,str=st.toString();var q=toSVG(p);if(/\$/.test(str)){var dnode=$("#"+SVG.id+"mml:first");if(id){node=$("#"+id)[0]}if(!node){node=MSVG.createElementXHTML("div",id);node.style.position="absolute";dnode.append(node)}else{$(node).empty()}str=$.trim(str);str=str.substr(1,str.length-2);$(node).append(MSVG.parseMath(str,true,fontsize+"px",options.fill));dx=-node.offsetWidth/2;dy=-node.offsetHeight/2;if(/N/.test(pos)){dy=-node.offsetHeight}if(/S/.test(pos)){dy=0}if(/E/.test(pos)){dx=0}if(/W/.test(pos)){dx=-node.offsetWidth}node.style.left=(q[0]+dx)+"px";node.style.top=(q[1]+dy)+"px"}else{var baseline="middle",textanchor="middle";if(/E/.test(pos)){textanchor="start"}if(/W/.test(pos)){textanchor="end"}if(/N/.test(pos)){baseline="text-after-edge"}if(/S/.test(pos)){baseline="text-before-edge"}var elmt=getSVGElement(id,"text");$(elmt.node).empty().text(str);elmt.node.setAttribute("x",q[0]);elmt.node.setAttribute("y",q[1]);elmt.node.setAttribute("font-style",getOption("fontstyle",options));elmt.node.setAttribute("font-family",getOption("fontfamily",options));elmt.node.setAttribute("font-weight",getOption("fontweight",options));elmt.node.setAttribute("font-size",fontsize);elmt.node.setAttribute("text-anchor",textanchor);elmt.node.setAttribute("dominant-baseline",baseline);options.stroke=getOption("fontstroke",options);setStrokeAndFill(elmt.node,options);appendSVG(elmt)}}function image(url,options){options=options||{};var elmt=getSVGElement(options.id,"image");var height=options.height||SVG.height;var width=options.width||SVG.width;var point=toSVG(options.point||[SVG.xmin,SVG.ymin]);var pos=(options.pos||"").toUpperCase();var x=point[0]-width*0.5;var y=point[1]-height*0.5;if(/N/.test(pos)){y-=height*0.5}if(/S/.test(pos)){y+=height*0.5}if(/E/.test(pos)){x+=width*0.5}if(/W/.test(pos)){x-=width*0.5}elmt.node.setAttribute("x",x);elmt.node.setAttribute("y",y);elmt.node.setAttribute("width",width);elmt.node.setAttribute("height",height);elmt.node.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",url);appendSVG(elmt)}function grid(options){options=options||{};var dx,dy,x,y,k,st="",start,stop,limit;var stroke=options.stroke||SVG.attr.gridstroke;var strokewidth=(options.strokewidth||SVG.attr.gridstrokewidth)/SVG.factor;var strokedasharray=getOption("strokedasharray",options);var strokeopacity=getOption("strokeopacity",options);if(SVG.coords=="polar"){dx=options.dx||1;dy=options.dy||3;var lim=Math.max(Math.abs(SVG.xmax),Math.abs(SVG.xmin),Math.abs(SVG.ymax),Math.abs(SVG.ymin));for(x=dx;x<lim;x+=dx){circle([0,0],x,{stroke:stroke,strokewidth:strokewidth,strokedasharray:strokedasharray,strokeopacity:strokeopacity})}if(dy>1){for(y=1;y<dy;y++){k=Math.tan(y*Math.PI/(2*dy));line([SVG.xmin,SVG.xmin*k],[SVG.xmax,SVG.xmax*k],{stroke:stroke,strokewidth:strokewidth,strokedasharray:strokedasharray,strokeopacity:strokeopacity});line([SVG.xmin,-SVG.xmin*k],[SVG.xmax,-SVG.xmax*k],{stroke:stroke,strokewidth:strokewidth,strokedasharray:strokedasharray,strokeopacity:strokeopacity})}}}else{dx=options.dx||1;dy=options.dy||dx;var gdx=dx*SVG.xunitlength;var gdy=dy*SVG.yunitlength;var border=SVG.borderwidth*0.5;var node=createSVGElement("path");node.setAttribute("class","svgGrid");start=SVG.origin[0];stop=SVG.width-border;limit=SVG.height-border;for(x=start;x<stop;x+=gdx){st+=" M"+x+","+border+" "+x+","+limit}start=SVG.origin[0]-gdx;for(x=start;x>border;x-=gdx){st+=" M"+x+","+border+" "+x+","+limit}start=SVG.height-SVG.origin[1];stop=SVG.height-border;limit=SVG.width-border;for(y=start;y<stop;y+=gdy){st+=" M"+border+","+y+" "+limit+","+y}start=SVG.height-SVG.origin[1]-gdy;for(y=start;y>border;y-=gdy){st+=" M"+border+","+y+" "+limit+","+y}node.setAttribute("d",st);node.setAttribute("stroke-width",strokewidth);node.setAttribute("stroke",stroke);node.setAttribute("stroke-dasharray",strokedasharray);node.setAttribute("stroke-opacity",strokeopacity);$(SVG.canvas).append(node)}}function axes(options){options=options||{};var x,y,start,stop;var orig=options.origin||[0,0];var origin=toSVG(orig);var dx=options.dx||1;var dy=options.dy||dx;var fontsize=getOption("fontsize",options);var border=SVG.borderwidth*0.5;var ddx=Math.max(0,Math.floor(-Math.log(dx+1e-9)/Math.log(10))+1);var ddy=Math.max(0,Math.floor(-Math.log(dy+1e-9)/Math.log(10))+1);options.marker="-|"+(options.marker||"-");options.strokewidth=(options.strokewidth||SVG.attr.axesstrokewidth)/SVG.factor;options.stroke=options.stroke||SVG.attr.axesstroke;var temp=options.stroke;options.markerstroke=options.stroke;options.markersize=fontsize*SVG.factor;var list1=[],label1=[];start=orig[0]+dx;stop=SVG.xmax-0.25*dx;for(x=start;x<stop;x+=dx){list1.push([x,orig[1]]);label1.push(String(x.toFixed(ddx)))}list1.push([SVG.xmax-border/SVG.xunitlength,orig[1]]);label1.push("");var list2=[],label2=[];start=orig[0]-dx;stop=SVG.xmin+0.25*dx;for(x=start;x>stop;x-=dx){list2.push([x,orig[1]]);label2.push(String(x.toFixed(ddx)))}list2.push([SVG.xmin+border/SVG.xunitlength,orig[1]]);label2.push("");list2.reverse();list2=list2.concat(list1);if(options.ticklabels!=false){label2.reverse();options.label=label2.concat(label1);options.pos=(SVG.height-origin[1]>2*fontsize)?"S":"N"}var group=getSVGElement("Axes","g");$(group.node).empty();var tempNode=SVG.canvas;SVG.canvas=group.node;path(list2,options);list1=[],label1=[];start=orig[1]+dy;stop=SVG.ymax-0.25*dy;for(y=start;y<stop;y+=dy){list1.push([orig[0],y]);label1.push(String(y.toFixed(ddy)))}list1.push([orig[0],SVG.ymax-border/SVG.yunitlength]);label1.push("");list2=[];label2=[];start=orig[1]-dy;stop=SVG.ymin+0.25*dy;for(y=start;y>stop;y-=dy){list2.push([orig[0],y]);label2.push(String(y.toFixed(ddy)))}list2.push([orig[0],SVG.ymin+border/SVG.yunitlength]);label2.push("");list2.reverse();list2=list2.concat(list1);if(options.ticklabels!=false){label2.reverse();options.label=label2.concat(label1);options.pos=(origin[0]>2*fontsize)?"W":"E"}options.stroke=temp;path(list2,options);SVG.canvas=tempNode;appendSVG(group)}function list(fun,tmin,tmax,points){var inc=(tmax-tmin)/points;if(inc<=0||fun.length==0){return}var t,pth,g=[],xt,yt;for(t=1;t>=0;t--){if($.isFunction(fun[t])){g[t]=fun[t]}else{if(typeof fun[t]=="string"){with(Math){eval("g["+t+"] = function(x){return "+fun[t]+"}")}}else{return}}}if(g.length<2){return}pth=[];for(t=tmin;t<=tmax;t+=inc){xt=g[0](t);yt=g[1](t);if(isFinite(xt)&&isFinite(yt)){pth[pth.length]=[xt,yt]}}return pth}function plot(fun,options){options=options||{};var i,steps=options.steps||[];var leftMarkers=options.leftMarkers||"-";var rightMarkers=options.rightMarkers||"-";if(steps.length===0){plotter(fun,options)}else{var n_steps=steps.length-1;options.max=steps[0];options.marker="--"+leftMarkers.charAt(0);plotter(fun,options);for(i=0;i<n_steps;i++){options.max=steps[i+1];options.min=steps[i];options.marker=rightMarkers.charAt((rightMarkers.length>i)?i:0)+"-"+leftMarkers.charAt((leftMarkers.length>i+1)?i+1:0);plotter(fun,options)}options.max=null;options.min=steps[n_steps];options.marker=rightMarkers.charAt((rightMarkers.length==n_steps)?n_steps-1:0)+"--";plotter(fun,options)}}function plotter(fun,options){options=options||{};options.closed=false;options.curve="";var xmin=(options.min==null)?SVG.xmin:options.min;var xmax=(options.max==null)?SVG.xmax:options.max;var points=getOption("points",options);var pth=list(["x",fun],xmin,xmax,points);if(pth){path(pth,options)}}function area(fun1,fun2,options){options=options||{};options.curve="";options.closed=true;var xmin=(options.min==null)?SVG.xmin:options.min;var xmax=(options.max==null)?SVG.xmax:options.max;var points=getOption("points",options);var pth1=list(["x",fun1],xmin,xmax,points);var pth2=list(["x",fun2],xmin,xmax,points);if(pth1&&pth2){pth2.reverse();pth1=pth1.concat(pth2);path(pth1,options)}}function polarPlot(fun,options){var g1,g2;if(typeof fun=="string"){with(Math){eval("g1 = function(x){return ("+fun+")*cos(x)}");eval("g2 = function(x){return ("+fun+")*sin(x)}")}}else{if($.isFunction(fun)){with(Math){eval("g1 = function(x){return fun(x)*cos(x)}");eval("g2 = function(x){return fun(x)*sin(x)}")}}}parametricPlot(g1,g2,options)}function parametricPlot(fun1,fun2,options){options=options||{};options.closed=false;options.curve="";var xmin=(options.min==null)?0:options.min;var xmax=(options.max==null)?2*Math.PI:options.max;var points=getOption("points",options);var pth=list([fun1,fun2],xmin,xmax,points);if(pth){path(pth,options)}}function slopeField(fun,options){options=options||{};var g=fun;if(typeof fun=="string"){with(Math){eval("g = function(x,y){return "+fun+"}")}}var gxy,x,y,u,v,dz;var dx=(options.dx==null)?1:options.dx;var dy=(options.dy==null)?1:options.dy;dz=Math.sqrt(dx*dx+dy*dy)/6;var xmin=Math.ceil(SVG.xmin/dx);var ymin=Math.ceil(SVG.ymin/dy);for(x=xmin;x<=SVG.xmax;x+=dx){for(y=ymin;y<=SVG.ymax;y+=dy){gxy=g(x,y);if(!isNaN(gxy)){if(Math.abs(gxy)=="Infinity"){u=0;v=dz}else{u=dz/Math.sqrt(1+gxy*gxy);v=gxy*u}line([x-u,y-v],[x+u,y+v],options)}}}}return{dynamic:{},removePictures:function(obj){var pictures=obj?[obj]:$(".svgGraph");$(pictures).each(function(){var target=this.parentNode;$(this).remove();$(target).css({color:"red",background:"yellow"});$(target).text("Missing picture: your  browser does not support inline SVG");window.setTimeout(function(){$(target).remove()},10000)})},drawPictures:function(obj){var options,xmin,xmax,ymin,ymax;var pictures=obj?[obj]:$(".svgGraph");$(pictures).each(function(){SVG=new pictureObject();options=this.getAttribute("options");if(options!=""){with(Math){eval("options="+options)}setOptions(options)}else{options={}}SVG.width=options.width||SVG.width;SVG.height=options.height||SVG.height;SVG.coords=options.coords||SVG.coords;SVG.borderwidth=options.borderwidth||SVG.borderwidth;SVG.borderstroke=options.borderstroke||SVG.borderstroke;if(options.pan==false){SVG.pan=false}SVG.src=this.getAttribute("script");var container=this.parentNode;container.removeChild(this);options.scales=options.scales||[];switch(options.scales.length){case 0:xmin=SVG.xmin;xmax=SVG.xmax;ymin=null;ymax=null;break;case 2:xmin=options.scales[0];xmax=options.scales[1];ymin=null;ymax=null;break;case 4:xmin=options.scales[0];xmax=options.scales[1];ymin=options.scales[2];ymax=options.scales[3];break;default:return}if(xmin>=xmax){throw"Incorrect values: xmax<=xmin."}var xunitlength=SVG.width/(xmax-xmin);if(typeof ymin!="number"){ymin=-SVG.height/(2*xunitlength);ymax=-ymin}if(ymin>=ymax){throw"Incorrect values: ymax<=ymin."}SVG.xmin=xmin;SVG.xmax=xmax;SVG.ymin=ymin;SVG.ymax=ymax;setScales();SVG.id=Math.randomString(chars,20);var qnode=createSVGElement("svg");qnode.id=SVG.id;qnode.setAttribute("xmlns","http://www.w3.org/2000/svg");var node=createSVGElement("clipPath");node.id=SVG.id+"ClipPath";var node2=createSVGElement("path");$(node).append(node2);node2=createSVGElement("defs");node2.id=SVG.id+"_Defs";$(node2).append(node);$(qnode).append(node2);node=createSVGElement("rect");node.setAttribute("class","svgBackground");node.setAttribute("x","0");node.setAttribute("y","0");node.setAttribute("width","100%");node.setAttribute("height","100%");node.setAttribute("stroke",SVG.borderstroke);node.setAttribute("stroke-width",SVG.borderwidth);node.setAttribute("fill",SVG.attr.backgroundcolor);node.setAttribute("fill-opacity",SVG.attr.backgroundopacity);$(qnode).append(node);node=createSVGElement("g");node.id=SVG.id+"Canvas";node.setAttribute("clip-path","url(#"+SVG.id+"ClipPath)");SVG.canvas=node;$(qnode).append(node);if(SVG.coords!="none"){node=createSVGElement("text");node.id=SVG.id+"Coords";node.setAttribute("class","svgCoords");node.setAttribute("text-anchor","end");node.setAttribute("font-size",(SVG.attr.fontsize*0.8));$(qnode).append(node)}$(container).append(qnode);container.style.position="relative";node=MSVG.createElementXHTML("span",SVG.id+"mml");$(container).append(node);node=MSVG.createElementXHTML("span",SVG.id+"toolbar");node.style.position="absolute";node.style.textAlign="left";node.style.zIndex=10;node2=setButton("Update","Edit script",function(){updateButton(this)});$(node).append(node2);node2=setButton("SVG","View SVG code",function(){exportSVG(this)});$(node).append(node2);node2=setButton("-","Zoom out",function(){changeScales(1.25)});$(node).append(node2);node2=setButton("+","Zoom in",function(){changeScales(0.8)});$(node).append(node2);node2=setButton("\u2191","Enlarge picture",function(){changeSize(0.8)});$(node).append(node2);node2=setButton("\u2193","Reduce picture",function(){changeSize(1.25)});$(node).append(node2);$(node).append("<br />");node2=MSVG.createElementXHTML("textarea",SVG.id+"src");$(node2).attr({rows:8,cols:80});$(node).append(node2);$(node).hide();$(container).append(node);setAction("mousemove",updateCoord);setAction("mouseout",removeCoord);setAction("mouseover",switchTo);setAction("mousedown",onClick);if(SVG.pan){setAction("mouseup",onDrop)}if(window.addEventListener){var evt=$.browser.mozilla?"DOMMouseScroll":"mousewheel";qnode.addEventListener(evt,onWheel,false)}setSize();translateAndEval(SVG.id)})}}}(jQuery);
//}}}
/***
!~TiddlyWiki formatters
***/
//{{{
if(!version.extensions.MathSVGPlugin) { //# ensure that the plugin is only installed once
version.extensions.MathSVGPlugin = {installed: true};
MSVG.generic();

config.formatterHelpers.MathSVGHelper = function(w) {
  this.lookaheadRegExp.lastIndex = w.matchStart;
  var lookaheadMatch = this.lookaheadRegExp.exec(w.source);
  if(lookaheadMatch){
    var eq = MSVG.parseMath(lookaheadMatch[1],this.displaystyle);
    if(this.displaystyle){
      var node = createTiddlyElement(w.output,"div");
      node.style.textAlign='center';
      node.appendChild(eq);
      w.output.appendChild(node);
    } else {w.output.appendChild(eq);}
    w.nextMatch = lookaheadMatch.index + lookaheadMatch[0].length;
  }
}

config.formatters.push( {
  name: "clatex",
  match: "\\$\\$",
  lookaheadRegExp: /\$\$((?:.|\n)*?)\$\$/mg,
  displaystyle: true,
  handler: config.formatterHelpers.MathSVGHelper
})

config.formatters.push( {
  name: "clatex2",
  match: "\\\\\\\[",
  lookaheadRegExp: /\\\[\s*(.*?)\s*\\\]/mg,
  displaystyle: true,
  handler: config.formatterHelpers.MathSVGHelper
})

config.formatters.push( {
  name: "latex",
  match: "\\$",
  lookaheadRegExp: /\$((?:.|\n)*?)\$/mg,
  displaystyle: false,
  handler: config.formatterHelpers.MathSVGHelper
})

config.formatters.push( {
  name: "graph",
  match: "\\(:graph",
  lookaheadRegExp: /\(:graph(\((.*?),?\s?(\{.+\})?\))?[\s]+((?:.|\n)*?)[\s]+:\)/mg,
  handler: function(w){
  this.lookaheadRegExp.lastIndex = w.matchStart;
  var lookaheadMatch = this.lookaheadRegExp.exec(w.source);
  if(lookaheadMatch){
    var element = (lookaheadMatch[2] == "inline") ? "span" : "div";
    var eq = createTiddlyElement(w.output,element);
    switch(lookaheadMatch[2]){
    case "center":
      eq.style.marginLeft = "auto";
      eq.style.marginRight = "auto";
      break;
    case "left":
      eq.style.cssFloat = "left";
      break;
    case "right":
      eq.style.cssFloat = "right";
    }
    var svg = createTiddlyElement(eq,"embed");
    svg.className="svgGraph";
    svg.setAttribute('options',lookaheadMatch[3]||"");
    svg.setAttribute('script',lookaheadMatch[4]);
    ASVG.drawPictures(svg);
    w.nextMatch = lookaheadMatch.index + lookaheadMatch[0].length;
  }
  }
})
}
//}}}
/***
The script should not be edited. All available options can be set by the following variables:
***/
//{{{
//MSVG.showFormulaOnMouseOver = false; //show LaTeX code on mouse over the equation
//MSVG.latexImages = false; //set to true to force the use of an external converter
//MSVG.latexConverter = "http://www.yourequations.com/eq.latex?"; //link to external converter
//MSVG.mathColor = "green"; //font color
//MSVG.mathFontSize = ""; //font size
//MSVG.mathFontFamily = ""; //font family
//}}}
/***
New symbols or commands can be defined here:
***/
//{{{
 var commands = ["nle","R","diagup","varnothing","ind","DD"];
 var symbols = ["\u2270","\u211D","\u2571","\u2205","\u2AEB","\\frac{d}{dr}"];
 MSVG.define(commands,symbols);
//}}}
''Theorem''
Given statements $S(n),$ one for each natural number $n \ge 1,$ suppose that
# ''Base Step:'' $S(1)$ is true
# ''Inductive Step:'' if $S(n)$ is true, then $S(n+1)$ is true.
Then $S(n)$ is true for all integers $n \ge 1.$
(:graph({width:300}) axes(); plot("sin(x)"); :)

(:graph({width:300,height:200,scales:[-3,3,-2,2]})
axes();
grid({dx:0.5,dy:0.5});
plot("(x-2)*(x-1)*x*(x+1)*(x+2)/2",{min:-2.5,max:2.5});
:)
$\diagup X\ind Y \tilde{A} \varnothing$

$$A = \left(\begin{array}{c c c}
1-x & 0 & 0 \\ 0 & 1-x & 0 \\ 0 & 0 & 1-x \end{array}\right)$$

$\sum a_i + \sum_{i=0}^{+\infty} b_i$

$f(x) = \left\{\begin{array}{l l}
x^2 \sin \frac1x & \textrm{if } x \ne 0, \\
0 & \textrm{if } x = 0 .
\end{array}\right.$

$\displaystyle{ \lim_{x\to\infty} f(x) = k \choose r + \frac ab \sum_{n=1}^{+\infty} a_n + \left\{ \frac{1}{13} \sum_{n=1}^{+\infty} b_n \right\} }$
*Test 1:  Thursday, September 24
*Test 2:  Thursday, November 5
*Final:  Thursday, December 10, 11:30a-02:30p
<!--{{{-->
<div class='header' macro='gradient vert [[ColorPalette::PrimaryLight]] [[ColorPalette::PrimaryMid]]'>
<div class='headerShadow'>
<span class='siteTitle' refresh='content' tiddler='SiteTitle'></span>&nbsp;
<span class='siteSubtitle' refresh='content' tiddler='SiteSubtitle'></span>
</div>
<div class='headerForeground'>
<span class='siteTitle' refresh='content' tiddler='SiteTitle'></span>&nbsp;
<span class='siteSubtitle' refresh='content' tiddler='SiteSubtitle'></span>
</div>
</div><!-- horizontal MainMenu -->
<div id='topMenu' refresh='content' tiddler='MainMenu'></div>
<!--original MainMenu menu
<div id='mainMenu' refresh='content' tiddler='MainMenu'></div>
-->
<div id='sidebar'>
<div id='sidebarOptions' refresh='content' tiddler='SideBarOptions'></div>
<div id='sidebarTabs' refresh='content' force='true' tiddler='SideBarTabs'></div>
</div>
<div id='displayArea'>
<div id='messageArea'></div>
<div id='tiddlerDisplay'></div>
</div>
<!--}}}-->
/***
|<html><a name="Top"/></html>''Name:''|PartTiddlerPlugin|
|''Version:''|1.0.9 (2007-07-14)|
|''Source:''|http://tiddlywiki.abego-software.de/#PartTiddlerPlugin|
|''Author:''|UdoBorkowski (ub [at] abego-software [dot] de)|
|''Licence:''|[[BSD open source license]]|
|''CoreVersion:''|2.1.3|
|''Browser:''|Firefox 1.0.4+; InternetExplorer 6.0|
!Table of Content<html><a name="TOC"/></html>
* <html><a href="javascript:;" onclick="window.scrollAnchorVisible('Description',null, event)">Description, Syntax</a></html>
* <html><a href="javascript:;" onclick="window.scrollAnchorVisible('Applications',null, event)">Applications</a></html>
** <html><a href="javascript:;" onclick="window.scrollAnchorVisible('LongTiddler',null, event)">Refering to Paragraphs of a Longer Tiddler</a></html>
** <html><a href="javascript:;" onclick="window.scrollAnchorVisible('Citation',null, event)">Citation Index</a></html>
** <html><a href="javascript:;" onclick="window.scrollAnchorVisible('TableCells',null, event)">Creating "multi-line" Table Cells</a></html>
** <html><a href="javascript:;" onclick="window.scrollAnchorVisible('Tabs',null, event)">Creating Tabs</a></html>
** <html><a href="javascript:;" onclick="window.scrollAnchorVisible('Sliders',null, event)">Using Sliders</a></html>
* <html><a href="javascript:;" onclick="window.scrollAnchorVisible('Revisions',null, event)">Revision History</a></html>
* <html><a href="javascript:;" onclick="window.scrollAnchorVisible('Code',null, event)">Code</a></html>
!Description<html><a name="Description"/></html>
With the {{{<part aPartName> ... </part>}}} feature you can structure your tiddler text into separate (named) parts. 
Each part can be referenced as a "normal" tiddler, using the "//tiddlerName//''/''//partName//" syntax (e.g. "About/Features").  E.g. you may create links to the parts (e.g. {{{[[Quotes/BAX95]]}}} or {{{[[Hobbies|AboutMe/Hobbies]]}}}), use it in {{{<<tiddler...>>}}} or {{{<<tabs...>>}}} macros etc.


''Syntax:'' 
|>|''<part'' //partName// [''hidden''] ''>'' //any tiddler content// ''</part>''|
|//partName//|The name of the part. You may reference a part tiddler with the combined tiddler name "//nameOfContainerTidder//''/''//partName//. <<br>>If you use a partName containing spaces you need to quote it (e.g. {{{"Major Overview"}}} or {{{[[Shortcut List]]}}}).|
|''hidden''|When defined the content of the part is not displayed in the container tiddler. But when the part is explicitly referenced (e.g. in a {{{<<tiddler...>>}}} macro or in a link) the part's content is displayed.|
|<html><i>any&nbsp;tiddler&nbsp;content</i></html>|<html>The content of the part.<br>A part can have any content that a "normal" tiddler may have, e.g. you may use all the formattings and macros defined.</html>|
|>|~~Syntax formatting: Keywords in ''bold'', optional parts in [...]. 'or' means that exactly one of the two alternatives must exist.~~|
<html><sub><a href="javascript:;" onclick="window.scrollAnchorVisible('Top',null, event)">[Top]</sub></a></html>

!Applications<html><a name="Applications"/></html>
!!Refering to Paragraphs of a Longer Tiddler<html><a name="LongTiddler"/></html>
Assume you have written a long description in a tiddler and now you want to refer to the content of a certain paragraph in that tiddler (e.g. some definition.) Just wrap the text with a ''part'' block, give it a nice name, create a "pretty link" (like {{{[[Discussion Groups|Introduction/DiscussionGroups]]}}}) and you are done.

Notice this complements the approach to first writing a lot of small tiddlers and combine these tiddlers to one larger tiddler in a second step (e.g. using the {{{<<tiddler...>>}}} macro). Using the ''part'' feature you can first write a "classic" (longer) text that can be read "from top to bottom" and later "reuse" parts of this text for some more "non-linear" reading.

<html><sub><a href="javascript:;" onclick="window.scrollAnchorVisible('Top',null, event)">[Top]</sub></a></html>

!!Citation Index<html><a name="Citation"/></html>
Create a tiddler "Citations" that contains your "citations". 
Wrap every citation with a part and a proper name. 

''Example''
{{{
<part BAX98>Baxter, Ira D. et al: //Clone Detection Using Abstract Syntax Trees.// 
in //Proc. ICSM//, 1998.</part>

<part BEL02>Bellon, Stefan: //Vergleich von Techniken zur Erkennung duplizierten Quellcodes.// 
Thesis, Uni Stuttgart, 2002.</part>

<part DUC99>Ducasse, Stéfane et al: //A Language Independent Approach for Detecting Duplicated Code.// 
in //Proc. ICSM//, 1999.</part>
}}}

You may now "cite" them just by using a pretty link like {{{[[Citations/BAX98]]}}} or even more pretty, like this {{{[[BAX98|Citations/BAX98]]}}}.

<html><sub><a href="javascript:;" onclick="window.scrollAnchorVisible('Top',null, event)">[Top]</sub></a></html>

!!Creating "multi-line" Table Cells<html><a name="TableCells"/></html>
You may have noticed that it is hard to create table cells with "multi-line" content. E.g. if you want to create a bullet list inside a table cell you cannot just write the bullet list
{{{
* Item 1
* Item 2
* Item 3
}}}
into a table cell (i.e. between the | ... | bars) because every bullet item must start in a new line but all cells of a table row must be in one line.

Using the ''part'' feature this problem can be solved. Just create a hidden part that contains the cells content and use a {{{<<tiddler >>}}} macro to include its content in the table's cell.

''Example''
{{{
|!Subject|!Items|
|subject1|<<tiddler ./Cell1>>|
|subject2|<<tiddler ./Cell2>>|

<part Cell1 hidden>
* Item 1
* Item 2
* Item 3
</part>
...
}}}

Notice that inside the {{{<<tiddler ...>>}}} macro you may refer to the "current tiddler" using the ".".

BTW: The same approach can be used to create bullet lists with items that contain more than one line.

<html><sub><a href="javascript:;" onclick="window.scrollAnchorVisible('Top',null, event)">[Top]</sub></a></html>

!!Creating Tabs<html><a name="Tabs"/></html>
The build-in {{{<<tabs ...>>}}} macro requires that you defined an additional tiddler for every tab it displays. When you want to have "nested" tabs you need to define a tiddler for the "main tab" and one for every tab it contains. I.e. the definition of a set of tabs that is visually displayed at one place is distributed across multiple tiddlers.

With the ''part'' feature you can put the complete definition in one tiddler, making it easier to keep an overview and maintain the tab sets.

''Example''
The standard tabs at the sidebar are defined by the following eight tiddlers:
* SideBarTabs
* TabAll
* TabMore
* TabMoreMissing
* TabMoreOrphans
* TabMoreShadowed
* TabTags
* TabTimeline

Instead of these eight tiddlers one could define the following SideBarTabs tiddler that uses the ''part'' feature:
{{{
<<tabs txtMainTab 
    Timeline Timeline SideBarTabs/Timeline 
    All 'All tiddlers' SideBarTabs/All 
    Tags 'All tags' SideBarTabs/Tags 
    More 'More lists' SideBarTabs/More>>
<part Timeline hidden><<timeline>></part>
<part All hidden><<list all>></part>
<part Tags hidden><<allTags>></part>
<part More hidden><<tabs txtMoreTab 
    Missing 'Missing tiddlers' SideBarTabs/Missing 
    Orphans 'Orphaned tiddlers' SideBarTabs/Orphans 
    Shadowed 'Shadowed tiddlers' SideBarTabs/Shadowed>></part>
<part Missing hidden><<list missing>></part>
<part Orphans hidden><<list orphans>></part>
<part Shadowed hidden><<list shadowed>></part>
}}}

Notice that you can easily "overwrite" individual parts in separate tiddlers that have the full name of the part.

E.g. if you don't like the classic timeline tab but only want to see the 100 most recent tiddlers you could create a tiddler "~SideBarTabs/Timeline" with the following content:
{{{
<<forEachTiddler 
		sortBy 'tiddler.modified' descending 
		write '(index < 100) ? "* [["+tiddler.title+"]]\n":""'>>
}}}
<html><sub><a href="javascript:;" onclick="window.scrollAnchorVisible('Top',null, event)">[Top]</sub></a></html>

!!Using Sliders<html><a name="Sliders"/></html>
Very similar to the build-in {{{<<tabs ...>>}}} macro (see above) the {{{<<slider ...>>}}} macro requires that you defined an additional tiddler that holds the content "to be slid". You can avoid creating this extra tiddler by using the ''part'' feature

''Example''
In a tiddler "About" we may use the slider to show some details that are documented in the tiddler's "Details" part.
{{{
...
<<slider chkAboutDetails About/Details details "Click here to see more details">>
<part Details hidden>
To give you a better overview ...
</part>
...
}}}

Notice that putting the content of the slider into the slider's tiddler also has an extra benefit: When you decide you need to edit the content of the slider you can just doubleclick the content, the tiddler opens for editing and you can directly start editing the content (in the part section). In the "old" approach you would doubleclick the tiddler, see that the slider is using tiddler X, have to look for the tiddler X and can finally open it for editing. So using the ''part'' approach results in a much short workflow.

<html><sub><a href="javascript:;" onclick="window.scrollAnchorVisible('Top',null, event)">[Top]</sub></a></html>

!Revision history<html><a name="Revisions"/></html>
* v1.0.9 (2007-07-14)
** Bugfix: Error when using the SideBarTabs example and switching between "More" and "Shadow". Thanks to cmari for reporting the issue.
* v1.0.8 (2007-06-16)
** Speeding up display of tiddlers containing multiple pard definitions. Thanks to Paco Rivière for reporting the issue.
** Support "./partName" syntax inside <<tabs ...>> macro
* v1.0.7 (2007-03-07)
** Bugfix: <<tiddler "./partName">> does not always render correctly after a refresh (e.g. like it happens when using the "Include" plugin). Thanks to Morris Gray for reporting the bug.
* v1.0.6 (2006-11-07)
** Bugfix: cannot edit tiddler when UploadPlugin by Bidix is installed. Thanks to José Luis González Castro for reporting the bug.
* v1.0.5 (2006-03-02)
** Bugfix: Example with multi-line table cells does not work in IE6. Thanks to Paulo Soares for reporting the bug.
* v1.0.4 (2006-02-28)
** Bugfix: Shadow tiddlers cannot be edited (in TW 2.0.6). Thanks to Torsten Vanek for reporting the bug.
* v1.0.3 (2006-02-26)
** Adapt code to newly introduced Tiddler.prototype.isReadOnly() function (in TW 2.0.6). Thanks to Paulo Soares for reporting the problem.
* v1.0.2 (2006-02-05)
** Also allow other macros than the "tiddler" macro use the "." in the part reference (to refer to "this" tiddler)
* v1.0.1 (2006-01-27)
** Added Table of Content for plugin documentation. Thanks to RichCarrillo for suggesting.
** Bugfix: newReminder plugin does not work when PartTiddler is installed. Thanks to PauloSoares for reporting.
* v1.0.0 (2006-01-25)
** initial version
<html><sub><a href="javascript:;" onclick="window.scrollAnchorVisible('Top',null, event)">[Top]</sub></a></html>

!Code<html><a name="Code"/></html>
<html><sub><a href="javascript:;" onclick="window.scrollAnchorVisible('Top',null, event)">[Top]</sub></a></html>
***/
//{{{
//============================================================================
//                           PartTiddlerPlugin

// Ensure that the PartTiddler Plugin is only installed once.
//
if (!version.extensions.PartTiddlerPlugin) {



version.extensions.PartTiddlerPlugin = {
    major: 1, minor: 0, revision: 9,
    date: new Date(2007, 6, 14), 
    type: 'plugin',
    source: "http://tiddlywiki.abego-software.de/#PartTiddlerPlugin"
};

if (!window.abego) window.abego = {};
if (version.major < 2) alertAndThrow("PartTiddlerPlugin requires TiddlyWiki 2.0 or newer.");

//============================================================================
// Common Helpers

// Looks for the next newline, starting at the index-th char of text. 
//
// If there are only whitespaces between index and the newline 
// the index behind the newline is returned, 
// otherwise (or when no newline is found) index is returned.
//
var skipEmptyEndOfLine = function(text, index) {
	var re = /(\n|[^\s])/g;
	re.lastIndex = index;
	var result = re.exec(text);
	return (result && text.charAt(result.index) == '\n') 
			? result.index+1
			: index;
}


//============================================================================
// Constants

var partEndOrStartTagRE = /(<\/part>)|(<part(?:\s+)((?:[^>])+)>)/mg;
var partEndTagREString = "<\\/part>";
var partEndTagString = "</part>";

//============================================================================
// Plugin Specific Helpers

// Parse the parameters inside a <part ...> tag and return the result.
//
// @return [may be null] {partName: ..., isHidden: ...}
//
var parseStartTagParams = function(paramText) {
	var params = paramText.readMacroParams();
	if (params.length == 0 || params[0].length == 0) return null;
	
	var name = params[0];
	var paramsIndex = 1;
	var hidden = false;
	if (paramsIndex < params.length) {
		hidden = params[paramsIndex] == "hidden";
		paramsIndex++;
	}
	
	return {
		partName: name, 
		isHidden: hidden
	};
}

// Returns the match to the next (end or start) part tag in the text, 
// starting the search at startIndex.
// 
// When no such tag is found null is returned, otherwise a "Match" is returned:
// [0]: full match
// [1]: matched "end" tag (or null when no end tag match)
// [2]: matched "start" tag (or null when no start tag match)
// [3]: content of start tag (or null if no start tag match)
//
var findNextPartEndOrStartTagMatch = function(text, startIndex) {
	var re = new RegExp(partEndOrStartTagRE);
	re.lastIndex = startIndex;
	var match = re.exec(text);
	return match;
}

//============================================================================
// Formatter

// Process the <part ...> ... </part> starting at (w.source, w.matchStart) for formatting.
//
// @return true if a complete part section (including the end tag) could be processed, false otherwise.
//
var handlePartSection = function(w) {
	var tagMatch = findNextPartEndOrStartTagMatch(w.source, w.matchStart);
	if (!tagMatch) return false;
	if (tagMatch.index != w.matchStart || !tagMatch[2]) return false;

	// Parse the start tag parameters
	var arguments = parseStartTagParams(tagMatch[3]);
	if (!arguments) return false;
	
	// Continue processing
	var startTagEndIndex = skipEmptyEndOfLine(w.source, tagMatch.index + tagMatch[0].length);
	var endMatch = findNextPartEndOrStartTagMatch(w.source, startTagEndIndex);
	if (endMatch && endMatch[1]) {
		if (!arguments.isHidden) {
			w.nextMatch = startTagEndIndex;
			w.subWikify(w.output,partEndTagREString);
		}
		w.nextMatch = skipEmptyEndOfLine(w.source, endMatch.index + endMatch[0].length);
		
		return true;
	}
	return false;
}

config.formatters.push( {
    name: "part",
    match: "<part\\s+[^>]+>",
	
	handler: function(w) {
		if (!handlePartSection(w)) {
			w.outputText(w.output,w.matchStart,w.matchStart+w.matchLength);
		}
	}
} )

//============================================================================
// Extend "fetchTiddler" functionality to also recognize "part"s of tiddlers 
// as tiddlers.

var currentParent = null; // used for the "." parent (e.g. in the "tiddler" macro)

// Return the match to the first <part ...> tag of the text that has the
// requrest partName.
//
// @return [may be null]
//
var findPartStartTagByName = function(text, partName) {
	var i = 0;
	
	while (true) {
		var tagMatch = findNextPartEndOrStartTagMatch(text, i);
		if (!tagMatch) return null;

		if (tagMatch[2]) {
			// Is start tag
	
			// Check the name
			var arguments = parseStartTagParams(tagMatch[3]);
			if (arguments && arguments.partName == partName) {
				return tagMatch;
			}
		}
		i = tagMatch.index+tagMatch[0].length;
	}
}

// Return the part "partName" of the given parentTiddler as a "readOnly" Tiddler 
// object, using fullName as the Tiddler's title. 
//
// All remaining properties of the new Tiddler (tags etc.) are inherited from 
// the parentTiddler.
// 
// @return [may be null]
//
var getPart = function(parentTiddler, partName, fullName) {
	var text = parentTiddler.text;
	var startTag = findPartStartTagByName(text, partName);
	if (!startTag) return null;
	
	var endIndexOfStartTag = skipEmptyEndOfLine(text, startTag.index+startTag[0].length);
	var indexOfEndTag = text.indexOf(partEndTagString, endIndexOfStartTag);

	if (indexOfEndTag >= 0) {
		var partTiddlerText = text.substring(endIndexOfStartTag,indexOfEndTag);
		var partTiddler = new Tiddler();
		partTiddler.set(
						fullName,
						partTiddlerText,
						parentTiddler.modifier,
						parentTiddler.modified,
						parentTiddler.tags,
						parentTiddler.created);
		partTiddler.abegoIsPartTiddler = true;
		return partTiddler;
	}
	
	return null;
}

// Hijack the store.fetchTiddler to recognize the "part" addresses.
//
var hijackFetchTiddler = function() {
	var oldFetchTiddler = store.fetchTiddler ;
	store.fetchTiddler = function(title) {
		var result = oldFetchTiddler.apply(this, arguments);
		if (!result && title) {
			var i = title.lastIndexOf('/');
			if (i > 0) {
				var parentName = title.substring(0, i);
				var partName = title.substring(i+1);
				var parent = (parentName == ".") 
						? store.resolveTiddler(currentParent)
						: oldFetchTiddler.apply(this, [parentName]);
				if (parent) {
					return getPart(parent, partName, parent.title+"/"+partName);
				}
			}
		}
		return result;	
	};
};

// for debugging the plugin is not loaded through the systemConfig mechanism but via a script tag. 
// At that point in the "store" is not yet defined. In that case hijackFetchTiddler through the restart function.
// Otherwise hijack now.
if (!store) {
	var oldRestartFunc = restart;
	window.restart = function() {
		hijackFetchTiddler();
		oldRestartFunc.apply(this,arguments);
	};
} else
	hijackFetchTiddler();




// The user must not edit a readOnly/partTiddler
//

config.commands.editTiddler.oldIsReadOnlyFunction = Tiddler.prototype.isReadOnly;

Tiddler.prototype.isReadOnly = function() {
	// Tiddler.isReadOnly was introduced with TW 2.0.6.
	// For older version we explicitly check the global readOnly flag
	if (config.commands.editTiddler.oldIsReadOnlyFunction) {
		if (config.commands.editTiddler.oldIsReadOnlyFunction.apply(this, arguments)) return true;
	} else {
		if (readOnly) return true;
	}

	return this.abegoIsPartTiddler;
}

config.commands.editTiddler.handler = function(event,src,title)
{
	var t = store.getTiddler(title);
	// Edit the tiddler if it either is not a tiddler (but a shadowTiddler)
	// or the tiddler is not readOnly
	if(!t || !t.abegoIsPartTiddler)
		{
		clearMessage();
		story.displayTiddler(null,title,DEFAULT_EDIT_TEMPLATE);
		story.focusTiddler(title,"text");
		return false;
		}
}

// To allow the "./partName" syntax in macros we need to hijack 
// the invokeMacro to define the "currentParent" while it is running.
// 
var oldInvokeMacro = window.invokeMacro;
function myInvokeMacro(place,macro,params,wikifier,tiddler) {
	var oldCurrentParent = currentParent;
	if (tiddler) currentParent = tiddler;
	try {
		oldInvokeMacro.apply(this, arguments);
	} finally {
		currentParent = oldCurrentParent;
	}
}
window.invokeMacro = myInvokeMacro;

// To correctly support the "./partName" syntax while refreshing we need to hijack 
// the config.refreshers.tiddlers to define the "currentParent" while it is running.
// 
(function() {
	var oldTiddlerRefresher= config.refreshers.tiddler;
	config.refreshers.tiddler = function(e,changeList) {
		var oldCurrentParent = currentParent;
		try {
			currentParent = e.getAttribute("tiddler");
			return oldTiddlerRefresher.apply(this,arguments);
		} finally {
			currentParent = oldCurrentParent;
		}
	};
})();

// Support "./partName" syntax inside <<tabs ...>> macro
(function() {
	var extendRelativeNames = function(e, title) {
		var nodes = e.getElementsByTagName("a");
		for(var i=0; i<nodes.length; i++) {
			var node = nodes[i];
			var s = node.getAttribute("content");
			if (s && s.indexOf("./") == 0)
				node.setAttribute("content",title+s.substr(1));
		}
	};
	var oldHandler = config.macros.tabs.handler;
	config.macros.tabs.handler = function(place,macroName,params,wikifier,paramString,tiddler) {
		var result = oldHandler.apply(this,arguments);
		if (tiddler)
			extendRelativeNames(place, tiddler.title);
		return result;
	};
})();

// Scroll the anchor anchorName in the viewer of the given tiddler visible.
// When no tiddler is defined use the tiddler of the target given event is used.
window.scrollAnchorVisible = function(anchorName, tiddler, evt) {
	var tiddlerElem = null;
	if (tiddler) {
		tiddlerElem = document.getElementById(story.idPrefix + tiddler);
	}
	if (!tiddlerElem && evt) {
		var target = resolveTarget(evt);
		tiddlerElem = story.findContainingTiddler(target);
	}
	if (!tiddlerElem) return;

	var children = tiddlerElem.getElementsByTagName("a");
	for (var i = 0; i < children.length; i++) {
		var child = children[i];
		var name = child.getAttribute("name");
		if (name == anchorName) {
			var y = findPosY(child);
			window.scrollTo(0,y);
			return;
		}
	}
}

} // of "install only once"
//}}}

/***
<html><sub><a href="javascript:;" onclick="scrollAnchorVisible('Top',null, event)">[Top]</sub></a></html>

!Licence and Copyright
Copyright (c) abego Software ~GmbH, 2006 ([[www.abego-software.de|http://www.abego-software.de]])

Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:

Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.

Redistributions in binary form must reproduce the above copyright notice, this
list of conditions and the following disclaimer in the documentation and/or other
materials provided with the distribution.

Neither the name of abego Software nor the names of its contributors may be
used to endorse or promote products derived from this software without specific
prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
DAMAGE.

<html><sub><a href="javascript:;" onclick="scrollAnchorVisible('Top',null, event)">[Top]</sub></a></html>
***/
!Definition
If $X$ is a set, then a list in $X$ is a function $f: \{1,2,\ldots,n\} \rightarrow X.$  If a list $f$ in $X$ is a bijection (so that $X$ is now a finite set with $\vert X \vert = n$), then $f$ is called an arrangement of $X.$

!Definition
A permutation of a possibly infinite set $X$ is a bijection $\alpha : X \rightarrow X.$

!Definition
The family of all the permutations of a set $X,$ denoted by $S_{X},$ is called the symmetric group on $X.$  When $X=\{1,2,\ldots,n\},$ $S_{X}$ is usually denoted by $S_{n},$ and it is called the symmetric group on $n$ letters.

!Definition
If $\alpha \in S_{n}$ and $i \in \{1,2,\ldots,n\},$ then $\alpha$ fixes $i$ if $\alpha(i)=i,$ and $\alpha$ moves $i$ if $\alpha(i) \ne i.$

!Definition
Let $i_1,i_2,\ldots,i_r$ be distinct integers in $\{1,2,\ldots,n\}.$  If $\alpha \in S_n$ fixes the other integers (if any) and if $\alpha(i_1)=i_2, \alpha(i_2)=i_3, \ldots \alpha(i_r)=i_1,$ then $\alpha$ is called an $r$-cycle.  One also says that $\alpha$ is a cycle of length $r.$

!Definition
Two permutations $\alpha,\beta \in S_n$ are disjoint if every $i$ moved by one is fixed by the other: if $\alpha(i) \ne i,$ then $\beta(i) = i,$ and if $\beta(j) \ne j,$ then $\alpha(j) = j.$  A family $\beta_1,\ldots,\beta_t$ of permutations is disjoint if each pair of them is disjoint.

!Lemma
Disjoint permutations $\alpha,\beta \in S_n$ commute.

!Proposition
Every permutation $\alpha \in S_n$ is either a cycle or a product of disjoint cycles.

!Definition
A complete factorization of a permutation $\alpha$ is a factorization of $\alpha$ into disjoint cycles that contains one 1-cycle $(i)$ for every $i$ fixed by $\alpha.$

!Theorem
Let $\alpha \in S_n$ and let $\alpha = \beta_1 \cdots \beta_t$ be a complete factorization into disjoint cycles.  This factorization is unique except for the order in which the cycles occur.

!Definition
Two permutations $\alpha, \beta \in S_n$ have the same cycle structure if their complete factorizations have the same number of $r$-cycles for each $r \ge 1.$

!Proposition
If $\gamma, \alpha \in S_n,$ then $\alpha \gamma \alpha^{-1}$ has the same cycle structure as $\gamma.$

!Proposition
If $n \ge 2,$ then every $\alpha \in S_n$ is a product of transpositions.

!Definition
If $\alpha \in S_n$ and $\alpha = \beta_1 \cdots \beta_t$ is a complete factorization into $t$ disjoint cycles, then the signum of $\alpha$ is defined by $\mbox{sgn}(\alpha)=(-1)^{n-t}.$

!Theorem
For all $\alpha,\beta \in S_n,$ $\mbox{sgn}(\alpha \beta) = \mbox{sgn}(\alpha) \mbox{sgn}(\beta).$

!Definition
A permutation $\alpha \in S_n$ is even if $\mbox{sgn}(\alpha)=1,$ and $\alpha$ is odd if $\mbox{sgn}(\alpha)=-1.$  We say that $\alpha$ and $\beta$ have the same parity if both are even or both are odd.

!Theorem
Let $\alpha \in S_n.$  Then $\alpha$ is even if and only if $\alpha$ is a product of an even number of transpositions.
''Definition''
The predecessors of a natural number $n \ge 1$ are the natural numbers $k$ with $k < n,$ namely, $0,1,2, \ldots, n-1.$

Note that $0$ has no predecessor.
/***
|''Name:''|ProcessingPlugin|
|''Description:''|TiddlyWiki Bundle of John Ressig's processing.js|
|''Date:''|May 9, 2008|
|''Author:''|PaulDowney (psd (at) osmosoft (dot) com)|
|''CodeRepository:''|http://svn.tiddlywiki.org/Trunk/contributors/PaulDowney/plugins/ProcessingPlugin.js|
|''Version:''|0.2|
|''License:''|[[MIT license]]|
|''Comments:''|Please make comments at http://groups.google.co.uk/group/TiddlyWikiDev |
|''~CoreVersion:''|2.2|

With contributions from Simon Baird.

***/

//{{{

// Ensure Plugin is only installed once.
if(!version.extensions.Processingjs) {
version.extensions.Processingjs = {installed:true};

config.macros.Processing = {
	counter: 0,
	handler: function (place,macroName,params,wikifier,paramString,tiddler) {
		var id = "processingcanvas"+this.counter;
		var canvas = createTiddlyElement(place,"canvas",id);

		// inlined code
		var code = paramString;

		// quick and dirty grab of code from a named tiddler
		if (store.tiddlerExists(params[0])) {
			code = store.getTiddlerText(params[0]);
		}

		// or with no params, grab code from this tiddler
		if (paramString.trim() == '') {
			code = tiddler.text;
		}

		createTiddlyElement(place,"br");
		var restartBtn = createTiddlyButton(place,"restart","restart",function() {
				story.refreshTiddler(tiddler.title,null,true);
				return false;
			},
			'processingRestart' // it's a class so you can style the button
		);

		Processing(canvas,code);
	}
};

// requires 2.4
merge(config.macros.view.views,{
	processing: function(value,place,params,wikifier,paramString,tiddler) {
		wikify("<<Processing\n"+value+"\n>>",place,highlightHack,tiddler);
	}
});

/*
 *  inlined copy of Processing.js
 *  latest code at: http://ejohn.org/blog/processingjs/
 */

/*
 * Processing.js - John Resig (http://ejohn.org/)
 * MIT Licensed
 * http://ejohn.org/blog/processingjs/
 *
 * This is a port of the Processing Visualization Language.
 * More information: http://processing.org/
 */

(function(){

this.Processing = function Processing( aElement, aCode )
{
  var p = buildProcessing( aElement );
  p.init( aCode );
  return p;
};

function log()
{
  try
  {
    console.log.apply( console, arguments );
  }
  catch(e)
  {
    try
    {
      opera.postError.apply( opera, arguments );
    }
    catch(e){}
  }
}

function parse( aCode, p )
{
  // Angels weep at this parsing code :-(

  // Remove end-of-line comments
  aCode = aCode.replace(/\/\/ .*\n/g, "\n");

  // Weird parsing errors with %
  aCode = aCode.replace(/([^\s])%([^\s])/g, "$1 % $2");
 
  // Simple convert a function-like thing to function
  aCode = aCode.replace(/(?:static )?(\w+ )(\w+)\s*(\([^\)]*\)\s*{)/g, function(all, type, name, args)
  {
    if ( name == "if" || name == "for" || name == "while" )
    {
      return all;
    }
    else
    {
      return "Processing." + name + " = function " + name + args;
    }
  });

  // Force .length() to be .length
  aCode = aCode.replace(/\.length\(\)/g, ".length");

  // foo( int foo, float bar )
  aCode = aCode.replace(/([\(,]\s*)(\w+)((?:\[\])+| )\s*(\w+\s*[\),])/g, "$1$4");
  aCode = aCode.replace(/([\(,]\s*)(\w+)((?:\[\])+| )\s*(\w+\s*[\),])/g, "$1$4");

  // float[] foo = new float[5];
  aCode = aCode.replace(/new (\w+)((?:\[([^\]]*)\])+)/g, function(all, name, args)
  {
    return "new ArrayList(" + args.slice(1,-1).split("][").join(", ") + ")";
  });
  
  aCode = aCode.replace(/(?:static )?\w+\[\]\s*(\w+)\[?\]?\s*=\s*{.*?};/g, function(all)
  {
    return all.replace(/{/g, "[").replace(/}/g, "]");
  });

  // int|float foo;
  var intFloat = /(\n\s*(?:int|float)(?:\[\])?(?:\s*|[^\(]*?,\s*))([a-z]\w*)(;|,)/i;
  while ( intFloat.test(aCode) )
  {
    aCode = aCode.replace(new RegExp(intFloat), function(all, type, name, sep)
    {
      return type + " " + name + " = 0" + sep;
    });
  }

  // float foo = 5;
  aCode = aCode.replace(/(?:static )?(\w+)((?:\[\])+| ) *(\w+)\[?\]?(\s*[=,;])/g, function(all, type, arr, name, sep)
  {
    if ( type == "return" )
      return all;
    else
      return "var " + name + sep;
  });

  // Fix Array[] foo = {...} to [...]
  aCode = aCode.replace(/=\s*{((.|\s)*?)};/g, function(all,data)
  {
    return "= [" + data.replace(/{/g, "[").replace(/}/g, "]") + "]";
  });
  
  // static { ... } blocks
  aCode = aCode.replace(/static\s*{((.|\n)*?)}/g, function(all, init)
  {
    // Convert the static definitons to variable assignments
    //return init.replace(/\((.*?)\)/g, " = $1");
    return init;
  });

  // super() is a reserved word
  aCode = aCode.replace(/super\(/g, "superMethod(");

  var classes = ["int", "float", "boolean", "string"];

  function ClassReplace(all, name, extend, vars, last)
  {
    classes.push( name );

    var static = "";

    vars = vars.replace(/final\s+var\s+(\w+\s*=\s*.*?;)/g, function(all,set)
    {
      static += " " + name + "." + set;
      return "";
    });

    // Move arguments up from constructor and wrap contents with
    // a with(this), and unwrap constructor
    return "function " + name + "() {with(this){\n  " +
      (extend ? "var __self=this;function superMethod(){extendClass(__self,arguments," + extend + ");}\n" : "") +
      // Replace var foo = 0; with this.foo = 0;
      // and force var foo; to become this.foo = null;
      vars
        .replace(/,\s?/g, ";\n  this.")
        .replace(/\b(var |final |public )+\s*/g, "this.")
        .replace(/this.(\w+);/g, "this.$1 = null;") + 
	(extend ? "extendClass(this, " + extend + ");\n" : "") +
        "<CLASS " + name + " " + static + ">" + (typeof last == "string" ? last : name + "(");
  }

  var matchClasses = /(?:public |abstract |static )*class (\w+)\s*(?:extends\s*(\w+)\s*)?{\s*((?:.|\n)*?)\b\1\s*\(/g;
  var matchNoCon = /(?:public |abstract |static )*class (\w+)\s*(?:extends\s*(\w+)\s*)?{\s*((?:.|\n)*?)(Processing)/g;
  
  aCode = aCode.replace(matchClasses, ClassReplace);
  aCode = aCode.replace(matchNoCon, ClassReplace);

  var matchClass = /<CLASS (\w+) (.*?)>/, m;
  
  while ( (m = aCode.match( matchClass )) )
  {
    var left = RegExp.leftContext,
      allRest = RegExp.rightContext,
      rest = nextBrace(allRest),
      className = m[1],
      staticVars = m[2] || "";
      
    allRest = allRest.slice( rest.length + 1 );

    rest = rest.replace(new RegExp("\\b" + className + "\\(([^\\)]*?)\\)\\s*{", "g"), function(all, args)
    {
      args = args.split(/,\s*?/);
      
      if ( args[0].match(/^\s*$/) )
        args.shift();
      
      var fn = "if ( arguments.length == " + args.length + " ) {\n";
        
      for ( var i = 0; i < args.length; i++ )
      {
        fn += "    var " + args[i] + " = arguments[" + i + "];\n";
      }
        
      return fn;
    });
    
    // Fix class method names
    // this.collide = function() { ... }
    // and add closing } for with(this) ...
    rest = rest.replace(/(?:public )?Processing.\w+ = function (\w+)\((.*?)\)/g, function(all, name, args)
    {
      return "ADDMETHOD(this, '" + name + "', function(" + args + ")";
    });
    
    var matchMethod = /ADDMETHOD([\s\S]*?{)/, mc;
    var methods = "";
    
    while ( (mc = rest.match( matchMethod )) )
    {
      var prev = RegExp.leftContext,
        allNext = RegExp.rightContext,
        next = nextBrace(allNext);

      methods += "addMethod" + mc[1] + next + "});"
      
      rest = prev + allNext.slice( next.length + 1 );
      
    }

    rest = methods + rest;
    
    aCode = left + rest + "\n}}" + staticVars + allRest;
  }

  // Do some tidying up, where necessary
  aCode = aCode.replace(/Processing.\w+ = function addMethod/g, "addMethod");
  
  function nextBrace( right )
  {
    var rest = right;
    var position = 0;
    var leftCount = 1, rightCount = 0;
    
    while ( leftCount != rightCount )
    {
      var nextLeft = rest.indexOf("{");
      var nextRight = rest.indexOf("}");
      
      if ( nextLeft < nextRight && nextLeft != -1 )
      {
        leftCount++;
        rest = rest.slice( nextLeft + 1 );
        position += nextLeft + 1;
      }
      else
      {
        rightCount++;
        rest = rest.slice( nextRight + 1 );
        position += nextRight + 1;
      }
    }
    
    return right.slice(0, position - 1);
  }

  // Handle (int) Casting
  aCode = aCode.replace(/\(int\)/g, "0|");

  // Remove Casting
  aCode = aCode.replace(new RegExp("\\((" + classes.join("|") + ")(\\[\\])?\\)", "g"), "");
  
  // Convert 3.0f to just 3.0
  aCode = aCode.replace(/(\d+)f/g, "$1");

  // Force numbers to exist
  //aCode = aCode.replace(/([^.])(\w+)\s*\+=/g, "$1$2 = ($2||0) +");

  // Force characters-as-bytes to work
  aCode = aCode.replace(/('[a-zA-Z0-9]')/g, "$1.charCodeAt(0)");

  // Convert #aaaaaa into color
  aCode = aCode.replace(/#([a-f0-9]{6})/ig, function(m, hex){
    var num = toNumbers(hex);
    return "color(" + num[0] + "," + num[1] + "," + num[2] + ")";
  });

  function toNumbers( str ){
    var ret = [];
     str.replace(/(..)/g, function(str){
      ret.push( parseInt( str, 16 ) );
    });
    return ret;
  }

//log(aCode);

  return aCode;
}

function buildProcessing( curElement ){

  var p = {};

  // init
  p.PI = Math.PI;
  p.TWO_PI = 2 * p.PI;
  p.HALF_PI = p.PI / 2;
  p.P3D = 3;
  p.CORNER = 0;
  p.CENTER = 1;
  p.CENTER_RADIUS = 2;
  p.RADIUS = 2;
  p.POLYGON = 1;
  p.TRIANGLES = 6;
  p.POINTS = 7;
  p.LINES = 8;
  p.TRIANGLE_STRIP = 9;
  p.CORNERS = 10;
  p.CLOSE = true;
  p.RGB = 1;
  p.HSB = 2;

  // "Private" variables used to maintain state
  var curContext = curElement.getContext("2d");
  var doFill = true;
  var doStroke = true;
  var loopStarted = false;
  var hasBackground = false;
  var doLoop = true;
  var curRectMode = p.CORNER;
  var curEllipseMode = p.CENTER;
  var inSetup = false;
  var inDraw = false;
  var curBackground = "rgba(204,204,204,1)";
  var curFrameRate = 1000;
  var curShape = p.POLYGON;
  var curShapeCount = 0;
  var opacityRange = 255;
  var redRange = 255;
  var greenRange = 255;
  var blueRange = 255;
  var pathOpen = false;
  var mousePressed = false;
  var keyPressed = false;
  var firstX, firstY, prevX, prevY;
  var curColorMode = p.RGB;
  var curTint = -1;
  var curTextSize = 12;
  var curTextFont = "Arial";
  var getLoaded = false;
  var start = (new Date).getTime();

  // Global vars for tracking mouse position
  p.pmouseX = 0;
  p.pmouseY = 0;
  p.mouseX = 0;
  p.mouseY = 0;

  // Will be replaced by the user, most likely
  p.mouseDragged = undefined;
  p.mouseMoved = undefined;
  p.mousePressed = undefined;
  p.mouseReleased = undefined;
  p.keyPressed = undefined;
  p.keyReleased = undefined;
  p.draw = undefined;
  p.setup = undefined;

  // The height/width of the canvas
  p.width = curElement.width - 0;
  p.height = curElement.height - 0;
  
  // In case I ever need to do HSV conversion:
  // http://srufaculty.sru.edu/david.dailey/javascript/js/5rml.js
  p.color = function color( aValue1, aValue2, aValue3, aValue4 )
  {
    var aColor = "";
    
    if ( arguments.length == 3 )
    {
      aColor = p.color( aValue1, aValue2, aValue3, opacityRange );
    }
    else if ( arguments.length == 4 )
    {
      var a = aValue4 / opacityRange;
      a = isNaN(a) ? 1 : a;

      if ( curColorMode == p.HSB )
      {
        var rgb = HSBtoRGB(aValue1, aValue2, aValue3);
        var r = rgb[0], g = rgb[1], b = rgb[2];
      }
      else
      {
        var r = getColor(aValue1, redRange);
        var g = getColor(aValue2, greenRange);
        var b = getColor(aValue3, blueRange);
      }

      aColor = "rgba(" + r + "," + g + "," + b + "," + a + ")";
    }
    else if ( typeof aValue1 == "string" )
    {
      aColor = aValue1;

      if ( arguments.length == 2 )
      {
        var c = aColor.split(",");
	c[3] = (aValue2 / opacityRange) + ")";
	aColor = c.join(",");
      }
    }
    else if ( arguments.length == 2 )
    {
      aColor = p.color( aValue1, aValue1, aValue1, aValue2 );
    }
    else if ( typeof aValue1 == "number" )
    {
      aColor = p.color( aValue1, aValue1, aValue1, opacityRange );
    }
    else
    {
      aColor = p.color( redRange, greenRange, blueRange, opacityRange );
    }

    // HSB conversion function from Mootools, MIT Licensed
    function HSBtoRGB(h, s, b)
    {
      h = (h / redRange) * 100;
      s = (s / greenRange) * 100;
      b = (b / blueRange) * 100;
      if (s == 0){
        return [b, b, b];
      } else {
        var hue = h % 360;
        var f = hue % 60;
        var br = Math.round(b / 100 * 255);
        var p = Math.round((b * (100 - s)) / 10000 * 255);
        var q = Math.round((b * (6000 - s * f)) / 600000 * 255);
        var t = Math.round((b * (6000 - s * (60 - f))) / 600000 * 255);
        switch (Math.floor(hue / 60)){
          case 0: return [br, t, p];
          case 1: return [q, br, p];
          case 2: return [p, br, t];
          case 3: return [p, q, br];
          case 4: return [t, p, br];
          case 5: return [br, p, q];
        }
      }
    }

    function getColor( aValue, range )
    {
      return Math.round(255 * (aValue / range));
    }
    
    return aColor;
  }

  p.nf = function( num, pad )
  {
    var str = "" + num;
    while ( pad - str.length )
      str = "0" + str;
    return str;
  };

  p.AniSprite = function( prefix, frames )
  {
    this.images = [];
    this.pos = 0;

    for ( var i = 0; i < frames; i++ )
    {
      this.images.push( prefix + p.nf( i, ("" + frames).length ) + ".gif" );
    }

    this.display = function( x, y )
    {
      p.image( this.images[ this.pos ], x, y );

      if ( ++this.pos >= frames )
        this.pos = 0;
    };

    this.getWidth = function()
    {
      return getImage(this.images[0]).width;
    };

    this.getHeight = function()
    {
      return getImage(this.images[0]).height;
    };
  };

  function buildImageObject( obj )
  {
    var pixels = obj.data;
    var data = p.createImage( obj.width, obj.height );

    if ( data.__defineGetter__ && data.__lookupGetter__ && !data.__lookupGetter__("pixels") )
    {
      var pixelsDone;
      data.__defineGetter__("pixels", function()
      {
        if ( pixelsDone )
	  return pixelsDone;

	pixelsDone = [];

        for ( var i = 0; i < pixels.length; i += 4 )
        {
          pixelsDone.push( p.color(pixels[i], pixels[i+1], pixels[i+2], pixels[i+3]) );
        }

	return pixelsDone;
      });
    }
    else
    {
      data.pixels = [];

      for ( var i = 0; i < pixels.length; i += 4 )
      {
        data.pixels.push( p.color(pixels[i], pixels[i+1], pixels[i+2], pixels[i+3]) );
      }
    }

    return data;
  }

  p.createImage = function createImage( w, h, mode )
  {
    var data = {
      width: w,
      height: h,
      pixels: new Array( w * h ),
      get: function(x,y)
      {
        return this.pixels[w*y+x];
      },
      _mask: null,
      mask: function(img)
      {
        this._mask = img;
      },
      loadPixels: function()
      {
      },
      updatePixels: function()
      {
      }
    };

    return data;
  }

  p.createGraphics = function createGraphics( w, h )
  {
    var canvas = document.createElement("canvas");
    var ret = buildProcessing( canvas );
    ret.size( w, h );
    ret.canvas = canvas;
    return ret;
  }

  p.beginDraw = function beginDraw()
  {

  }

  p.endDraw = function endDraw()
  {

  }

  p.tint = function tint( rgb, a )
  {
    curTint = a;
  }

  function getImage( img ) {
    if ( typeof img == "string" )
    {
      return document.getElementById(img);
    }

    if ( img.img || img.canvas )
    {
      return img.img || img.canvas;
    }

    img.data = [];

    for ( var i = 0, l = img.pixels.length; i < l; i++ )
    {
      var c = (img.pixels[i] || "rgba(0,0,0,1)").slice(5,-1).split(",");
      img.data.push( parseInt(c[0]), parseInt(c[1]), parseInt(c[2]), parseFloat(c[3]) * 100 );
    }

    var canvas = document.createElement("canvas")
    canvas.width = img.width;
    canvas.height = img.height;
    var context = canvas.getContext("2d");
    context.putImageData( img, 0, 0 );

    img.canvas = canvas;

    return canvas;
  }

  p.image = function image( img, x, y, w, h )
  {
    x = x || 0;
    y = y || 0;

    var obj = getImage(img);

    if ( curTint >= 0 )
    {
      var oldAlpha = curContext.globalAlpha;
      curContext.globalAlpha = curTint / opacityRange;
    }

    if ( arguments.length == 3 )
    {
      curContext.drawImage( obj, x, y );
    }
    else
    {
      curContext.drawImage( obj, x, y, w, h );
    }

    if ( curTint >= 0 )
    {
      curContext.globalAlpha = oldAlpha;
    }

    if ( img._mask )
    {
      var oldComposite = curContext.globalCompositeOperation;
      curContext.globalCompositeOperation = "darker";
      p.image( img._mask, x, y );
      curContext.globalCompositeOperation = oldComposite;
    }
  }

  p.exit = function exit()
  {

  }

  p.save = function save( file )
  {

  }

  p.loadImage = function loadImage( file )
  {
    var img = document.getElementById(file);
    if ( !img )
      return;

    var h = img.height, w = img.width;

    var canvas = document.createElement("canvas");
    canvas.width = w;
    canvas.height = h;
    var context = canvas.getContext("2d");

    context.drawImage( img, 0, 0 );
    var data = buildImageObject( context.getImageData( 0, 0, w, h ) );
    data.img = img;
    return data;
  }

  p.loadFont = function loadFont( name )
  {
    return {
      name: name,
      width: function( str )
      {
        if ( curContext.mozMeasureText )
          return curContext.mozMeasureText( typeof str == "number" ?
            String.fromCharCode( str ) :
            str) / curTextSize;
	else
	  return 0;
      }
    };
  }

  p.textFont = function textFont( name, size )
  {
    curTextFont = name;
    p.textSize( size );
  }

  p.textSize = function textSize( size )
  {
    if ( size )
    {
      curTextSize = size;
    }
  }

  p.textAlign = function textAlign()
  {

  }

  p.text = function text( str, x, y )
  {
    if ( str && curContext.mozDrawText )
    {
      curContext.save();
      curContext.mozTextStyle = curTextSize + "px " + curTextFont.name;
      curContext.translate(x, y);
      curContext.mozDrawText( typeof str == "number" ?
        String.fromCharCode( str ) :
	str );
      curContext.restore();
    }
  }

  p.char = function char( key )
  {
    //return String.fromCharCode( key );
    return key;
  }

  p.println = function println()
  {

  }

  p.map = function map( value, istart, istop, ostart, ostop )
  {
    return ostart + (ostop - ostart) * ((value - istart) / (istop - istart));
  };

  String.prototype.replaceAll = function(re, replace)
  {
    return this.replace(new RegExp(re, "g"), replace);
  };

  p.Point = function Point( x, y )
  {
    this.x = x;
    this.y = y;
    this.copy = function()
    {
      return new Point( x, y );
    }
  }

  p.Random = function()
  {
    var haveNextNextGaussian = false;
    var nextNextGaussian;

    this.nextGaussian = function()
    {
      if (haveNextNextGaussian) {
        haveNextNextGaussian = false;

        return nextNextGaussian;
      } else {
        var v1, v2, s;
        do { 
          v1 = 2 * p.random(1) - 1;   // between -1.0 and 1.0
          v2 = 2 * p.random(1) - 1;   // between -1.0 and 1.0
          s = v1 * v1 + v2 * v2;
        } while (s >= 1 || s == 0);
        var multiplier = Math.sqrt(-2 * Math.log(s)/s);
        nextNextGaussian = v2 * multiplier;
        haveNextNextGaussian = true;

        return v1 * multiplier;
      }
    };
  }

  p.ArrayList = function ArrayList( size, size2, size3 )
  {
    var array = new Array( 0 | size );
    
    if ( size2 )
    {
      for ( var i = 0; i < size; i++ )
      {
        array[i] = [];

        for ( var j = 0; j < size2; j++ )
        {
	  var a = array[i][j] = size3 ? new Array( size3 ) : 0;
	  for ( var k = 0; k < size3; k++ )
	  {
	    a[k] = 0;
	  }
        }
      }
    }
    else
    {
      for ( var i = 0; i < size; i++ )
      {
        array[i] = 0;
      }
    }
    
    array.size = function()
    {
      return this.length;
    };
    array.get = function( i )
    {
      return this[ i ];
    };
    array.remove = function( i )
    {
      return this.splice( i, 1 );
    };
    array.add = function( item )
    {
      for ( var i = 0; this[ i ] != undefined; i++ ) {}
      this[ i ] = item;
    };
    array.clone = function()
    {
      var a = new ArrayList( size );
      for ( var i = 0; i < size; i++ )
      {
        a[ i ] = this[ i ];
      }
      return a;
    };
    array.isEmpty = function()
    {
      return !this.length;
    };
    array.clear = function()
    {
      this.length = 0;
    };
    
    return array;
  }
  
  p.colorMode = function colorMode( mode, range1, range2, range3, range4 )
  {
    curColorMode = mode;

    if ( arguments.length >= 4 )
    {
      redRange = range1;
      greenRange = range2;
      blueRange = range3;
    }

    if ( arguments.length == 5 )
    {
      opacityRange = range4;
    }

    if ( arguments.length == 2 )
    {
      p.colorMode( mode, range1, range1, range1, range1 );
    }
  }
  
  p.beginShape = function beginShape( type )
  {
    curShape = type;
    curShapeCount = 0; 
  }
  
  p.endShape = function endShape( close )
  {
    if ( curShapeCount != 0 )
    {
      curContext.lineTo( firstX, firstY );

      if ( doFill )
        curContext.fill();
        
      if ( doStroke )
        curContext.stroke();
    
      curContext.closePath();
      curShapeCount = 0;
      pathOpen = false;
    }

    if ( pathOpen )
    {
      curContext.closePath();
    }
  }
  
  p.vertex = function vertex( x, y, x2, y2, x3, y3 )
  {
    if ( curShapeCount == 0 && curShape != p.POINTS )
    {
      pathOpen = true;
      curContext.beginPath();
      curContext.moveTo( x, y );
    }
    else
    {
      if ( curShape == p.POINTS )
      {
        p.point( x, y );
      }
      else if ( arguments.length == 2 )
      {
        if ( curShape == p.TRIANGLE_STRIP && curShapeCount == 2 )
	{
          curContext.moveTo( prevX, prevY );
          curContext.lineTo( firstX, firstY );
	}

        curContext.lineTo( x, y );
      }
      else if ( arguments.length == 4 )
      {
        if ( curShapeCount > 1 )
        {
	  curContext.moveTo( prevX, prevY );
          curContext.quadraticCurveTo( firstX, firstY, x, y );
	  curShapeCount = 1;
        }
      }
      else if ( arguments.length == 6 )
      {
        curContext.bezierCurveTo( x, y, x2, y2, x3, y3 );
        curShapeCount = -1;
      }
    }

    prevX = firstX;
    prevY = firstY;
    firstX = x;
    firstY = y;

    
    curShapeCount++;
    
    if ( curShape == p.LINES && curShapeCount == 2 ||
         (curShape == p.TRIANGLES || curShape == p.TRIANGLE_STRIP) && curShapeCount == 3 )
    {
      p.endShape();
    }

    if ( curShape == p.TRIANGLE_STRIP && curShapeCount == 3 )
    {
      curShapeCount = 2;
    }
  }

  p.curveTightness = function()
  {

  }

  // Unimplmented - not really possible with the Canvas API
  p.curveVertex = function( x, y, x2, y2 )
  {
    p.vertex( x, y, x2, y2 );
  }

  p.bezierVertex = p.vertex
  
  p.rectMode = function rectMode( aRectMode )
  {
    curRectMode = aRectMode;
  }

  p.imageMode = function()
  {

  }
  
  p.ellipseMode = function ellipseMode( aEllipseMode )
  {
    curEllipseMode = aEllipseMode;
  }
  
  p.dist = function dist( x1, y1, x2, y2 )
  {
    return Math.sqrt( Math.pow( x2 - x1, 2 ) + Math.pow( y2 - y1, 2 ) );
  }

  p.year = function year()
  {
    return (new Date).getYear() + 1900;
  }

  p.month = function month()
  {
    return (new Date).getMonth();
  }

  p.day = function day()
  {
    return (new Date).getDay();
  }

  p.hour = function hour()
  {
    return (new Date).getHours();
  }

  p.minute = function minute()
  {
    return (new Date).getMinutes();
  }

  p.second = function second()
  {
    return (new Date).getSeconds();
  }

  p.millis = function millis()
  {
    return (new Date).getTime() - start;
  }
  
  p.ortho = function ortho()
  {
  
  }
  
  p.translate = function translate( x, y )
  {
    curContext.translate( x, y );
  }
  
  p.scale = function scale( x, y )
  {
    curContext.scale( x, y || x );
  }
  
  p.rotate = function rotate( aAngle )
  {
    curContext.rotate( aAngle );
  }
  
  p.pushMatrix = function pushMatrix()
  {
    curContext.save();
  }
  
  p.popMatrix = function popMatrix()
  {
    curContext.restore();
  }
  
  p.redraw = function redraw()
  {
    if ( hasBackground )
    {
      p.background();
    }
    
    inDraw = true;
    p.pushMatrix();
    p.draw();
    p.popMatrix();
    inDraw = false;
  }
  
  p.loop = function loop()
  {
    if ( loopStarted )
      return;
    
    var looping = setInterval(function()
    {
      try
      {
        p.redraw();
      }
      catch(e)
      {
        clearInterval( looping );
        throw e;
      }
    }, 1000 / curFrameRate );
    
    loopStarted = true;
  }
  
  p.frameRate = function frameRate( aRate )
  {
    curFrameRate = aRate;
  }
  
  p.background = function background( img )
  {
    if ( arguments.length )
    {
      if ( img && img.img )
      {
        curBackground = img;
      }
      else
      {
        curBackground = p.color.apply( this, arguments );
      }
    }
    

    if ( curBackground.img )
    {
      p.image( curBackground, 0, 0 );
    }
    else
    {
      var oldFill = curContext.fillStyle;
      curContext.fillStyle = curBackground + "";
      curContext.fillRect( 0, 0, p.width, p.height );
      curContext.fillStyle = oldFill;
    }
  }

  p.sq = function sq( aNumber )
  {
    return aNumber * aNumber;
  }

  p.sqrt = function sqrt( aNumber )
  {
    return Math.sqrt( aNumber );
  }
  
  p.int = function int( aNumber )
  {
    return Math.floor( aNumber );
  }

  p.min = function min( aNumber, aNumber2 )
  {
    return Math.min( aNumber, aNumber2 );
  }

  p.max = function max( aNumber, aNumber2 )
  {
    return Math.max( aNumber, aNumber2 );
  }

  p.ceil = function ceil( aNumber )
  {
    return Math.ceil( aNumber );
  }

  p.floor = function floor( aNumber )
  {
    return Math.floor( aNumber );
  }

  p.float = function float( aNumber )
  {
    return typeof aNumber == "string" ?
	p.float( aNumber.charCodeAt(0) ) :
        parseFloat( aNumber );
  }

  p.byte = function byte( aNumber )
  {
    return aNumber || 0;
  }
  
  p.random = function random( aMin, aMax )
  {
    return arguments.length == 2 ?
      aMin + (Math.random() * (aMax - aMin)) :
      Math.random() * aMin;
  }

  // From: http://freespace.virgin.net/hugo.elias/models/m_perlin.htm
  p.noise = function( x, y, z )
  {
    return arguments.length >= 2 ?
      PerlinNoise_2D( x, y ) :
      PerlinNoise_2D( x, x );
  }

  function Noise(x, y)
  {
    var n = x + y * 57;
    n = (n<<13) ^ n;
    return Math.abs(1.0 - (((n * ((n * n * 15731) + 789221) + 1376312589) & 0x7fffffff) / 1073741824.0));
  }

  function SmoothedNoise(x, y)
  {
    var corners = ( Noise(x-1, y-1)+Noise(x+1, y-1)+Noise(x-1, y+1)+Noise(x+1, y+1) ) / 16;
    var sides   = ( Noise(x-1, y)  +Noise(x+1, y)  +Noise(x, y-1)  +Noise(x, y+1) ) /  8;
    var center  =  Noise(x, y) / 4;
    return corners + sides + center;
  }

  function InterpolatedNoise(x, y)
  {
    var integer_X    = Math.floor(x);
    var fractional_X = x - integer_X;

    var integer_Y    = Math.floor(y);
    var fractional_Y = y - integer_Y;

    var v1 = SmoothedNoise(integer_X,     integer_Y);
    var v2 = SmoothedNoise(integer_X + 1, integer_Y);
    var v3 = SmoothedNoise(integer_X,     integer_Y + 1);
    var v4 = SmoothedNoise(integer_X + 1, integer_Y + 1);

    var i1 = Interpolate(v1 , v2 , fractional_X);
    var i2 = Interpolate(v3 , v4 , fractional_X);

    return Interpolate(i1 , i2 , fractional_Y);
  }

  function PerlinNoise_2D(x, y)
  {
      var total = 0;
      var p = 0.25;
      var n = 3;

      for ( var i = 0; i <= n; i++ )
      {
          var frequency = Math.pow(2, i);
          var amplitude = Math.pow(p, i);

          total = total + InterpolatedNoise(x * frequency, y * frequency) * amplitude;
      }

      return total;
  }

  function Interpolate(a, b, x)
  {
    var ft = x * p.PI;
    var f = (1 - p.cos(ft)) * .5;
    return  a*(1-f) + b*f;
  }

  p.red = function( aColor )
  {
    return parseInt(aColor.slice(5));
  }

  p.green = function( aColor )
  {
    return parseInt(aColor.split(",")[1]);
  }

  p.blue = function( aColor )
  {
    return parseInt(aColor.split(",")[2]);
  }

  p.alpha = function( aColor )
  {
    return parseInt(aColor.split(",")[3]);
  }

  p.abs = function abs( aNumber )
  {
    return Math.abs( aNumber );
  }
  
  p.cos = function cos( aNumber )
  {
    return Math.cos( aNumber );
  }
  
  p.sin = function sin( aNumber )
  {
    return Math.sin( aNumber );
  }
  
  p.pow = function pow( aNumber, aExponent )
  {
    return Math.pow( aNumber, aExponent );
  }
  
  p.constrain = function constrain( aNumber, aMin, aMax )
  {
    return Math.min( Math.max( aNumber, aMin ), aMax );
  }
  
  p.sqrt = function sqrt( aNumber )
  {
  	return Math.sqrt( aNumber );
  }
  
  p.atan2 = function atan2( aNumber, aNumber2 )
  {
  	return Math.atan2( aNumber, aNumber2 );
  }
  
  p.radians = function radians( aAngle )
  {
    return ( aAngle / 180 ) * p.PI;
  }
  
  p.size = function size( aWidth, aHeight )
  {
    var fillStyle = curContext.fillStyle;
    var strokeStyle = curContext.strokeStyle;

    curElement.width = p.width = aWidth;
    curElement.height = p.height = aHeight;

    curContext.fillStyle = fillStyle;
    curContext.strokeStyle = strokeStyle;
  }
  
  p.noStroke = function noStroke()
  {
    doStroke = false;
  }
  
  p.noFill = function noFill()
  {
    doFill = false;
  }
  
  p.smooth = function smooth()
  {
  
  }
  
  p.noLoop = function noLoop()
  {
    doLoop = false;
  }
  
  p.fill = function fill()
  {
    doFill = true;
    curContext.fillStyle = p.color.apply( this, arguments );
  }
  
  p.stroke = function stroke()
  {
    doStroke = true;
    curContext.strokeStyle = p.color.apply( this, arguments );
  }

  p.strokeWeight = function strokeWeight( w )
  {
    curContext.lineWidth = w;
  }
  
  p.point = function point( x, y )
  {
    var oldFill = curContext.fillStyle;
    curContext.fillStyle = curContext.strokeStyle;
    curContext.fillRect( Math.round( x ), Math.round( y ), 1, 1 );
    curContext.fillStyle = oldFill;
  }

  p.get = function get( x, y )
  {
    if ( arguments.length == 0 )
    {
      var c = p.createGraphics( p.width, p.height );
      c.image( curContext, 0, 0 );
      return c;
    }

    if ( !getLoaded )
    {
      getLoaded = buildImageObject( curContext.getImageData(0, 0, p.width, p.height) );
    }

    return getLoaded.get( x, y );
  }

  p.set = function set( x, y, color )
  {
    var oldFill = curContext.fillStyle;
    curContext.fillStyle = color;
    curContext.fillRect( Math.round( x ), Math.round( y ), 1, 1 );
    curContext.fillStyle = oldFill;
  }
  
  p.arc = function arc( x, y, width, height, start, stop )
  {
    if ( width <= 0 )
      return;

    if ( curEllipseMode == p.CORNER )
    {
      x += width / 2;
      y += height / 2;
    }

    curContext.beginPath();
  
    curContext.moveTo( x, y );
    curContext.arc( x, y, curEllipseMode == p.CENTER_RADIUS ? width : width/2, start, stop, false );
    
    if ( doFill )
      curContext.fill();
      
    if ( doStroke )
      curContext.stroke();
    
    curContext.closePath();
  }
  
  p.line = function line( x1, y1, x2, y2 )
  {
    curContext.lineCap = "round";
    curContext.beginPath();
  
    curContext.moveTo( x1 || 0, y1 || 0 );
    curContext.lineTo( x2 || 0, y2 || 0 );
    
    curContext.stroke();
    
    curContext.closePath();
  }

  p.bezier = function bezier( x1, y1, x2, y2, x3, y3, x4, y4 )
  {
    curContext.lineCap = "butt";
    curContext.beginPath();
  
    curContext.moveTo( x1, y1 );
    curContext.bezierCurveTo( x2, y2, x3, y3, x4, y4 );
    
    curContext.stroke();
    
    curContext.closePath();
  }

  p.triangle = function triangle( x1, y1, x2, y2, x3, y3 )
  {
    p.beginShape();
    p.vertex( x1, y1 );
    p.vertex( x2, y2 );
    p.vertex( x3, y3 );
    p.endShape();
  }

  p.quad = function quad( x1, y1, x2, y2, x3, y3, x4, y4 )
  {
    p.beginShape();
    p.vertex( x1, y1 );
    p.vertex( x2, y2 );
    p.vertex( x3, y3 );
    p.vertex( x4, y4 );
    p.endShape();
  }
  
  p.rect = function rect( x, y, width, height )
  {
    if ( width == 0 && height == 0 )
      return;

    curContext.beginPath();
    
    var offsetStart = 0;
    var offsetEnd = 0;

    if ( curRectMode == p.CORNERS )
    {
      width -= x;
      height -= y;
    }
    
    if ( curRectMode == p.RADIUS )
    {
      width *= 2;
      height *= 2;
    }
    
    if ( curRectMode == p.CENTER || curRectMode == p.RADIUS )
    {
      x -= width / 2;
      y -= height / 2;
    }
  
    curContext.rect(
      Math.round( x ) - offsetStart,
      Math.round( y ) - offsetStart,
      Math.round( width ) + offsetEnd,
      Math.round( height ) + offsetEnd
    );
      
    if ( doFill )
      curContext.fill();
      
    if ( doStroke )
      curContext.stroke();
    
    curContext.closePath();
  }
  
  p.ellipse = function ellipse( x, y, width, height )
  {
    x = x || 0;
    y = y || 0;

    if ( width <= 0 && height <= 0 )
      return;

    curContext.beginPath();
    
    if ( curEllipseMode == p.RADIUS )
    {
      width *= 2;
      height *= 2;
    }
    
    var offsetStart = 0;
    
    // Shortcut for drawing a circle
    if ( width == height )
      curContext.arc( x - offsetStart, y - offsetStart, width / 2, 0, Math.PI * 2, false );
  
    if ( doFill )
      curContext.fill();
      
    if ( doStroke )
      curContext.stroke();
    
    curContext.closePath();
  }

  p.link = function( href, target )
  {
    window.location = href;
  }

  p.loadPixels = function()
  {
    p.pixels = buildImageObject( curContext.getImageData(0, 0, p.width, p.height) ).pixels;
  }

  p.updatePixels = function()
  {
    var colors = /(\d+),(\d+),(\d+),(\d+)/;
    var pixels = {};
    var data = pixels.data = [];
    pixels.width = p.width;
    pixels.height = p.height;

    var pos = 0;

    for ( var i = 0, l = p.pixels.length; i < l; i++ ) {
      var c = (p.pixels[i] || "rgba(0,0,0,1)").match(colors);
      data[pos] = parseInt(c[1]);
      data[pos+1] = parseInt(c[2]);
      data[pos+2] = parseInt(c[3]);
      data[pos+3] = parseFloat(c[4]) * 100;
      pos += 4;
    }

    curContext.putImageData(pixels, 0, 0);
  }

  p.extendClass = function extendClass( obj, args, fn )
  {
    if ( arguments.length == 3 )
    {
      fn.apply( obj, args );
    }
    else
    {
      args.call( obj );
    }
  }

  p.addMethod = function addMethod( object, name, fn )
  {
    if ( object[ name ] )
    {
      var args = fn.length;
      
      var oldfn = object[ name ];
      object[ name ] = function()
      {
        if ( arguments.length == args )
          return fn.apply( this, arguments );
        else
          return oldfn.apply( this, arguments );
      };
    }
    else
    {
      object[ name ] = fn;
    }
  }

  p.init = function init(code){
    p.stroke( 0 );
    p.fill( 255 );
  
    // Canvas has trouble rendering single pixel stuff on whole-pixel
    // counts, so we slightly offset it (this is super lame).
    curContext.translate( 0.5, 0.5 );

    if ( code )
    {
      (function(Processing){with (p){
        eval(parse(code, p));
      }})(p);
    }
  
    if ( p.setup )
    {
      inSetup = true;
      p.setup();
    }
    
    inSetup = false;
    
    if ( p.draw )
    {
      if ( !doLoop )
      {
        p.redraw();
      }
      else
      {
        p.loop();
      }
    }
    
    attach( curElement, "mousemove", function(e)
    {
      p.pmouseX = p.mouseX;
      p.pmouseY = p.mouseY;
      p.mouseX = e.clientX - curElement.offsetLeft;
      p.mouseY = e.clientY - curElement.offsetTop;

      if ( p.mouseMoved )
      {
        p.mouseMoved();
      }      

      if ( mousePressed && p.mouseDragged )
      {
        p.mouseDragged();
      }      
    });
    
    attach( curElement, "mousedown", function(e)
    {
      mousePressed = true;

      if ( typeof p.mousePressed == "function" )
      {
        p.mousePressed();
      }
      else
      {
        p.mousePressed = true;
      }
    });
      
    attach( curElement, "mouseup", function(e)
    {
      mousePressed = false;

      if ( typeof p.mousePressed != "function" )
      {
        p.mousePressed = false;
      }

      if ( p.mouseReleased )
      {
        p.mouseReleased();
      }
    });

    attach( document, "keydown", function(e)
    {
      keyPressed = true;

      p.key = e.keyCode + 32;

      if ( e.shiftKey )
      {
        p.key = String.fromCharCode(p.key).toUpperCase().charCodeAt(0);
      }

      if ( typeof p.keyPressed == "function" )
      {
        p.keyPressed();
      }
      else
      {
        p.keyPressed = true;
      }
    });

    attach( document, "keyup", function(e)
    {
      keyPressed = false;

      if ( typeof p.keyPressed != "function" )
      {
        p.keyPressed = false;
      }

      if ( p.keyReleased )
      {
        p.keyReleased();
      }
    });

    function attach(elem, type, fn)
    {
      if ( elem.addEventListener )
        elem.addEventListener( type, fn, false );
      else
        elem.attachEvent( "on" + type, fn );
    }
  };

  return p;
}


})();


} //# end of "install only once"
//}}}
*[[Quiz 1|quizzes/mat-336-001-2009-fall-quiz-1.pdf]]
*[[Quiz 2|quizzes/mat-336-001-2009-fall-quiz-2.pdf]]
*[[Quiz 3|quizzes/mat-336-001-2009-fall-quiz-3.pdf]]
*[[Quiz 4|quizzes/mat-336-001-2009-fall-quiz-4.pdf]] | [[Solutions|quizzes/mat-336-001-2009-fall-quiz-4-solutions-brief.pdf]]
*[[Quiz 5|quizzes/mat-336-001-2009-fall-quiz-5.pdf]] | [[Solutions|quizzes/mat-336-001-2009-fall-quiz-5-solutions-brief.pdf]]
!Fall 2009
<<tabs Schedule
Nov "November" [[Schedule/November]]
Dec "December" [[Schedule/December]]
Aug "August" [[Schedule/August]]
Sep "September" [[Schedule/September]]
Oct "October" [[Schedule/October]]
>>
<part August hidden>
*Thursday, August 20
**Section 1.1: [[Induction]]
**Section 1.2: [[Binomial Theorem]]
*Tuesday, August 25
**Section 1.3: [[Greatest Common Divisors]]
**Section 1.4: [[Fundamental Theorem of Arithmetic]]
*Thursday, August 27
**Section 1.5: [[Congruences]]
</part>
<part September hidden>
*Tuesday, September 01
**Section 1.5: [[Fermat's Little Theorem]]
**Section 2.1: [[Set Theory]]
*Thursday, September 03
**Section 2.2: [[Permutations: Cycle Decomposition]]
*Tuesday, September 08
**Section 2.2: [[Permutations: Parity]]
*Thursday, September 10
**Section 2.3: [[Groups: Axioms]]
*Tuesday, September 15
**Section 2.3: [[Groups: Orders]]
*Thursday, September 17
**Section 2.4: [[Groups: Representation]]
*Tuesday, September 22
**Review
*Thursday, September 24
**Test 1
*Tuesday, September 29
**Section 2.4: [[Subgroups]]
</part>
<part October hidden>
*Thursday, October 01
**Section 2.4: [[Cosets and Lagrange's Theorem]]
*Tuesday, October 06
**Fall Break
*Tuesday, October 13
**Debriefing
*Thursday, October 15
**Section 2.5: [[Cosets and Normal Subgroups]]
*Tuesday, October 20
**Section 2.6: [[Quotient Groups]]
*Thursday, October 22
**Section 2.6: [[First Isomorphism Theorem]]
*Tuesday, October 27
**Section 2.6: [[Direct Products]]
*Thursday, October 29
**Section 2.6: [[Decomposition of U(n) groups]]
</part>
<part November hidden>
*Tuesday, November 03
**Review
*Thursday, November 05
**Test 2
*Tuesday, November 10
**Section 2.7: [[Cayley's Theorem; Classification of Groups of Small Order]]
*Thursday, November 12
**Section 3.1: [[Commutative Rings]]
*Tuesday, November 17
**Debriefing
*Thursday, November 19
**Section 3.2: [[Fields]]
*Tuesday, November 24
**Section 3.3: [[Polynomial Rings]]
*Thursday, November 26
**Thanksgiving Holiday
</part>
<part December hidden>
*Tuesday, December 01
**Review
*Thursday, December 10 
**Final Exam, 11:30a-02:30p
</part>
''Theorem''
Let $S(n)$ be a family of statements, one for each integer $n \ge 1,$ and suppose that
# $S(1)$ is true
# if $S(k)$ is true for all predecessors $k$ of $n,$ then $S(n)$ is itself true
Then $S(n)$ is true for all integers $n \ge 1.$

*Set, element, and belongs are undefined terms
*A set is determined by the elements in it
*Equality of sets
*Subsets and inclusion
*Proper subsets
*Empty set
*Intersections, unions, and differences of sets
*Cartesian products
*Functions
*Domain and codomain
*Image / range
*Equality of functions
*Surjective / onto
*Injective / one-to-one
*Single-valued / well-defined
*Compositions
*Bijective
*Cardinality / countable / uncountable
*Equivalence classes partition
Introductory Modern Algebra I
MAT 336
/* horizontal main menu */

#displayArea { margin: 1em 15.5em 0em 1em; } /* use the full horizontal width */

#topMenu { background: [[ColorPalette::PrimaryMid]]; color: [[ColorPalette::PrimaryPale]]; padding: 0.2em 0.2em 0.2em 0.5em; border-bottom: 2px solid #000000; }

#topMenu br { display: none; }

#topMenu .button, #topMenu .tiddlyLink, #topMenu a { margin-left: 0.25em; margin-right: 0.25em; padding-left: 0.5em; padding-right: 0.5em; color: [[ColorPalette::PrimaryPale]]; font-size: 1.15em; }

#topMenu .button:hover, #topMenu .tiddlyLink:hover { background: [[ColorPalette::PrimaryDark]]; }
*Subgroup definition
*Subgroup criteria
*Subgroups of cyclic groups
*Products and intersections of subgroups
*Fall 2009
**[[Test 1 Sample|tests/mat-336-001-2009-fall-test-1-sample.pdf]]
**[[Test 2 Sample|tests/mat-336-001-2009-fall-test-2-sample.pdf]]
/***

|Name|ToggleSideBarMacro|
|Created by|SaqImtiaz|
|Location|http://tw.lewcid.org/#ToggleSideBarMacro|
|Version|1.0|
|Requires|~TW2.x|
!Description:
Provides a button for toggling visibility of the SideBar. You can choose whether the SideBar should initially be hidden or displayed.

!Demo
<<toggleSideBar "Toggle Sidebar">>

!Usage:
{{{<<toggleSideBar>>}}} <<toggleSideBar>>
additional options:
{{{<<toggleSideBar label tooltip show/hide>>}}} where:
label = custom label for the button,
tooltip = custom tooltip for the button,
show/hide = use one or the other, determines whether the sidebar is shown at first or not.
(default is to show the sidebar)

You can add it to your tiddler toolbar, your MainMenu, or where you like really.
If you are using a horizontal MainMenu and want the button to be right aligned, put the following in your StyleSheet:
{{{ .HideSideBarButton {float:right;} }}}

!History
*23-07-06: version 1.0: completely rewritten, now works with custom stylesheets too, and easier to customize start behaviour. 
*20-07-06: version 0.11
*27-04-06: version 0.1: working.

!Code
***/
//{{{
config.macros.toggleSideBar={};

config.macros.toggleSideBar.settings={
         styleHide :  "#sidebar { display: none;}\n"+"#contentWrapper #displayArea { margin-right: 1em;}\n"+"",
         styleShow : " ",
         arrow1: "«",
         arrow2: "»"
};

config.macros.toggleSideBar.handler=function (place,macroName,params,wikifier,paramString,tiddler)
{
          var tooltip= params[1]||'toggle sidebar';
          var mode = (params[2] && params[2]=="hide")? "hide":"show";
          var arrow = (mode == "hide")? this.settings.arrow1:this.settings.arrow2;
          var label= (params[0]&&params[0]!='.')?params[0]+" "+arrow:arrow;
          var theBtn = createTiddlyButton(place,label,tooltip,this.onToggleSideBar,"button HideSideBarButton");
          if (mode == "hide")
             { 
             (document.getElementById("sidebar")).setAttribute("toggle","hide");
              setStylesheet(this.settings.styleHide,"ToggleSideBarStyles");
             }
};

config.macros.toggleSideBar.onToggleSideBar = function(){
          var sidebar = document.getElementById("sidebar");
          var settings = config.macros.toggleSideBar.settings;
          if (sidebar.getAttribute("toggle")=='hide')
             {
              setStylesheet(settings.styleShow,"ToggleSideBarStyles");
              sidebar.setAttribute("toggle","show");
              this.firstChild.data= (this.firstChild.data).replace(settings.arrow1,settings.arrow2);
              }
          else
              {    
               setStylesheet(settings.styleHide,"ToggleSideBarStyles");
               sidebar.setAttribute("toggle","hide");
               this.firstChild.data= (this.firstChild.data).replace(settings.arrow2,settings.arrow1);
              }

     return false;
}

setStylesheet(".HideSideBarButton .button {font-weight:bold; padding: 0 5px;}\n","ToggleSideBarButtonStyles");

//}}}
**Section 1.1-1.2: Preliminaries
**Section 1.3-1.4: Greatest Common Divisor; Fundamental Theorem of Arithmetic
**Section 1.5: Congruences
**Section 1.5: Fermat's Little Theorem
**Section 2.1: Functions
**Section 2.2: Permutations: Cycle Decomposition
**Section 2.2: Permutations: Parity
**Section 2.3: Groups: Axioms
**Section 2.3: Groups: Examples
**Section 2.4: Subgroups
**Section 2.4: Cosets and Lagrange's Theorem
**Section 2.5: Cosets and Normal Subgroups
**Section 2.5: Group Homomorphisms
**Section 2.6: Quotient Groups
**Section 2.6: Isomorphism Theorems
**Section 2.6: Direct Products
**Section 2.7: Group Actions: Cayley's Theorem
**Section 2.7: Classification of Groups of Small Order
**Section 2.7: Orbits and Stabilizers
**Section 2.7:  The Class Equation
**Section 3.1: Commutative Rings
**Section 3.2: Fields



''Theorem''
If $a$ and $b$ are integers, then $\mbox{gcd}(a,b)$ is a linear combination of $a$ and $b.$