<!--{{{-->
<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]];}

.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]];}
.readOnly {background:[[ColorPalette::TertiaryPale]];}

#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 0 1em 1em; left:-1px; top:-1px;}
.headerForeground {position:absolute; padding:4.5em 0 1em 1em; left:0; top:0;}

.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:0 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 0.3em 0;}
#sidebarTabs .tabContents {width:15em; overflow:hidden;}

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

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

.tiddlerPopupButton {padding:0.2em;}
.popupTiddler {position: absolute; z-index:300; padding: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 0;}
.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 0 0 0.5em;}
.tab {margin:0 0 0 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 0 14em;}

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

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

.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:0 0.25em; padding:0 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:0 3px 0 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 0; font-size:.9em;}
.editorFooter .button {padding-top:0; padding-bottom:0;}

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

.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;}
#backstageToolbar {position:relative;}
#backstageArea a {font-weight:bold; margin-left:0.5em; padding:0.3em 0.5em;}
#backstageButton {display:none; position:absolute; z-index:175; top:0; right:0;}
#backstageButton a {padding:0.1em 0.4em; margin:0.1em;}
#backstage {position:relative; width:100%; z-index:50;}
#backstagePanel {display:none; z-index:100; position:absolute; width:90%; margin-left:3em; padding:1em;}
.backstagePanelFooter {padding-top:0.2em; float:right;}
.backstagePanelFooter a {padding: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;}
noscript {display:none;} /* Fixes a feature in Firefox 1.5.0.2 where print preview displays the noscript content */
}
/*}}}*/
<!--{{{-->
<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>>
!Agenda
#Discusión de dudas y pendientes.
#Graficación de matrices y vectores (dimensión, producto, graficación).
#Solución gráfica (2 variableS) y analítica de un sistema de ecuaciones.
#Graficación de inecuaciones en 2 variables.
#Trabajo Individual problema 12.

[[ProblemasEvaluados|https://docs.google.com/document/d/1mjW5w9GKwuyQSOV4mBeSgAXLLA_DCYe4m54jYmRyiKo/edit]]

+++[ejemplo de PL en en notación matricial]
Esta es una prueba de programación lineal en formato matricial "abreviado":

`min Z(x)=c^T*x`
`s.t.:`
`A*x<=b`
`x>=0`
`x=0`


+++[Ahora en formato matricial explícito:]

`min Z(x)=[c_1,c_2,"...",c_n]*[(x_1),(x_2),(":"),(x_n)]`
`s.t.:`
`[(a_11,a_12,"...",a_1n),(a_21,a_22,"...",a_2n),(":",":","...",":"),(a_m1,a_m2,"...",a_mn)]_(mxn)*[(x_1),(x_2),(":"),(x_n)]<=[(b_1),(b_2),(":"),(b_m)]`
`[(x_1),(x_2),(":"),(x_n)]>=0`===

===

!Recursos:

Repaso de graficación de inecuaciones
http://es.wikihow.com/graficar-desigualdades (articulo de blog)
http://www.youtube.com/watch?v=plffRaU1a6E&feature=related (video)
 
Graficar Inecuación en 2 variables, y sistema de ecuaciones (encontrar el error!) (video)
http://www.youtube.com/watch?v=7rEj-gC_L_Q&feature=related

Graficar Inecuación en 2 variables, que pase por el 0 (muchos estudiantes fallan al graficarlas!) (video)
http://www.youtube.com/watch?v=a9UtdOr8P5k&feature=related

Graficando un Sistema de Inecuaciones Lineales
http://www.youtube.com/watch?v=1KImtr2AiYw&feature=channel&list=UL
http://www.youtube.com/watch?v=hIWEU_JQnak
http://www.youtube.com/watch?v=GVAQQPnVVio

Graficando Sistema de Ecuaciones Lineales, y aplicaciones
http://www.youtube.com/watch?v=FwSld66jYJc&feature=plcp


Repaso de Matrices
Suma y Resta:
http://www.youtube.com/watch?v=elScCVSE0NM&feature=related
http://www.youtube.com/watch?v=cPUchx8EpvE&feature=plcp
http://www.youtube.com/watch?v=M43gjTOO8EM&feature=plcp

Multiplicación
http://www.youtube.com/watch?v=OreedZyw_CA&feature=plcp
http://www.youtube.com/watch?v=esg1E-SmZvc&feature=plcp

Sistemas de Ecuaciones Lineales expresadas matricialmente
http://www.youtube.com/watch?v=DJwJVygu_us (video)
<html><iframe width="420" height="315" src="//www.youtube.com/embed/vIAwGovEFeI" frameborder="0" allowfullscreen></iframe></html>
!Sesión 1
#Revisión de pendientes
#Exposición del tema. Definición de conceptos de "variable de holgura", "base", y "costo reducido".
#Análisis grupal de los distintos casos de Análisis de Sensibilidad, analizados gráficamente.
#Elaboración deductiva de [[ÁrbolDeCasosDeAnálisisDeSensibilidad]]
#Asignación de problema 2 del Problemario (disponible en Aula Virtual)
#Entrega de ejercicios resueltos (disponible en Aula Virtual)
//{{{

scratch ={};
//for variables--avoids polluting main space too much
v = scratch;
//for math functions
mathfun = {};
m = mathfun;

//AsciiMath only need backticks
config.formatters.push( {
	name: "AsciiMath",
        match: "(?:\\\`)(?!\\\`)",
        lookahead: "(?:\\\`)((?:.|\\n)*?)(?:\\\`)",
	handler: function(w) {
            var lookaheadRegExp = new RegExp(this.lookahead,"mg");
            lookaheadRegExp.lastIndex = w.matchStart;
            var lookaheadMatch = lookaheadRegExp.exec(w.source);
            if(lookaheadMatch && lookaheadMatch.index == w.matchStart) {
                var e = createTiddlyElement(w.output,"span");
                var g = document.createElement("span"); 
                g.appendChild(document.createComment(lookaheadMatch[0]));
                ascii.math.processNode(g, true);
                e.appendChild(g);
                w.nextMatch = lookaheadMatch.index + lookaheadMatch[0].length;
            }
        }
    }
);

config.formatters.push( {
	name: "AsciiSvgDiv",
	match: "(?:\\\`){2}(?!\\\`)",
	lookahead: "(?:\\\`){2}((?:.|\\n)*?)(?:\\\`){2}",
	handler: function(w)
		{
		var lookaheadRegExp = new RegExp(this.lookahead,"mg");
		lookaheadRegExp.lastIndex = w.matchStart;
		var lookaheadMatch = lookaheadRegExp.exec(w.source);
		if(lookaheadMatch && lookaheadMatch.index == w.matchStart) {
			var e = createTiddlyElement(w.output,"div");
                        ascii.svg.parse(lookaheadMatch[1], e);
                        w.nextMatch = lookaheadMatch.index + lookaheadMatch[0].length;
                }
		}
    }
    );


config.formatters.push( {
	name: "AsciiSvgSpan",
	match: "(?:\\\`){4}(?!\\\`)",
	lookahead: "(?:\\\`){4}((?:.|\\n)*?)(?:\\\`){4}",
	handler: function(w)
		{
		var lookaheadRegExp = new RegExp(this.lookahead,"mg");
		lookaheadRegExp.lastIndex = w.matchStart;
		var lookaheadMatch = lookaheadRegExp.exec(w.source);
		if(lookaheadMatch && lookaheadMatch.index == w.matchStart) {
			var e = createTiddlyElement(w.output,"span");
                        ascii.svg.parse(lookaheadMatch[1], e);
                        w.nextMatch = lookaheadMatch.index + lookaheadMatch[0].length;
                }
		}
    }
    );



if (document.getElementById==null) 
  alert("This webpage requires a recent browser such as\
\nMozilla/Netscape 7+/Firefox or Internet Explorer 6+MathPlayer");

      
ascii = {};  //This contains all Ascii functions, mathstuff, and svg

//silly function to encapsulate all variables
//only stuff stored in ascii can be seen
ascii.initializer = function () {

ascii.cpi = "\u03C0";
ascii.ctheta = "\u03B8";

ascii.myCreateElementXHTML= function(t) {
  if (ascii.isIE) return document.createElement(t);
  else return document.createElementNS("http://www.w3.org/1999/xhtml",t);
};


ascii.isIE = (document.createElementNS==null);

/*
ASCII MathEvaluator

This portion sets up the evaluating functions. 

*/

ascii.func = {};

var af = ascii.func;

af.abs  = Math.abs;
af.acos = Math.acos;
af.asin = Math.asin;
af.atan = Math.atan;
af.atan2 = Math.atan2;
af.ceil = Math.ceil;
af.cos  = Math.cos;
af.exp  = Math.exp;
af.floor = Math.floor;
af.log  = Math.log;
af.max = Math.max;
af.min = Math.min;
af.pow = Math.pow;
af.random = Math.random;
af.round = Math.round;
af.sin  = Math.sin;
af.sqrt = Math.sqrt;
af.tan  = Math.tan;
af.E	   = Math.E;	    
af.PI	   = Math.PI;

af.pi = Math.PI;
af.ln = Math.log;
af.e = Math.E;
af.arcsin = Math.asin;
af.arccos = Math.acos;
af.arctan = Math.atan;
af.sec = function(x) { return 1/Math.cos(x) };
af.csc = function(x) { return 1/Math.sin(x) };
af.cot = function(x) { return 1/Math.tan(x) };
af.arcsec = function(x) { return arccos(1/x) };
af.arccsc = function(x) { return arcsin(1/x) };
af.arccot = function(x) { return arctan(1/x) };
af.sinh = function(x) { return (Math.exp(x)-Math.exp(-x))/2 };
af.cosh = function(x) { return (Math.exp(x)+Math.exp(-x))/2 };
af.tanh = 
  function(x) { return (Math.exp(x)-Math.exp(-x))/(Math.exp(x)+Math.exp(-x)) };
af.sech = function(x) { return 1/cosh(x) };
af.csch = function(x) { return 1/sinh(x) };
af.coth = function(x) { return 1/tanh(x) };
af.arcsinh = function(x) { return ln(x+Math.sqrt(x*x+1)) };
af.arccosh = function(x) { return ln(x+Math.sqrt(x*x-1)) };
af.arctanh = function(x) { return ln((1+x)/(1-x))/2 };
af.sech = function(x) { return 1/cosh(x) };
af.csch = function(x) { return 1/sinh(x) };
af.coth = function(x) { return 1/tanh(x) };
af.arcsech = function(x) { return arccosh(1/x) };
af.arccsch = function(x) { return arcsinh(1/x) };
af.arccoth = function(x) { return arctanh(1/x) };
af.sign = function(x) { return (x==0?0:(x<0?-1:1)) };

af.factorial = function(x,n) {
  if (n==null) n=1;
  for (var i=x-n; i>0; i-=n) x*=i;
  return (x<0?NaN:(x==0?1:x));
};

af.C = function(x,k) {
  var res=1;
  for (var i=0; i<k; i++) res*=(x-i)/(k-i);
  return res;
};

af.chop = function(x,n) {
  if (n==null) n=0;
  return Math.floor(x*Math.pow(10,n))/Math.pow(10,n);
};

af.ran = function(a,b,n) {
  if (n==null) n=0;
  return chop((b+Math.pow(10,-n)-a)*Math.random()+a,n);
};


af.less =  function(x,y)  { return x < y };  // used for scripts in XML files
                                     // since IE does not handle CDATA well




/*
ASCIIMathML.js
==============
This file contains JavaScript functions to convert ASCII math notation
to Presentation MathML. The conversion is done while the (X)HTML page 
loads, and should work with Firefox/Mozilla/Netscape 7+ and Internet 
Explorer 6+MathPlayer (http://www.dessci.com/en/products/mathplayer/).
Just add the next line to your (X)HTML page with this file in the same folder:
<script type="text/javascript" src="ASCIIMathML.js"></script>
This is a convenient and inexpensive solution for authoring MathML.

Version 1.4.7 Dec 15, 2005, (c) Peter Jipsen http://www.chapman.edu/~jipsen
Latest version at http://www.chapman.edu/~jipsen/mathml/ASCIIMathML.js
For changes see http://www.chapman.edu/~jipsen/mathml/asciimathchanges.txt
If you use it on a webpage, please send the URL to jipsen@chapman.edu

This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 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
General Public License (at http://www.gnu.org/copyleft/gpl.html) 
for more details.
*/

ascii.math ={};

ascii.math.parser = function () {}; //need to think about how to use this

var am = ascii.math;
var ame = ascii.math.parser;
var amep = ascii.math.parser.prototype;

am.checkForMathML = true;   // check if browser can display MathML
am.notifyIfNoMathML = false; // display note if no MathML capability
am.alertIfNoMathML = true;  // show alert box if no MathML capability

amep.mathcolor = "black";       // change it to "" (to inherit) or any other color
amep.mathfontfamily = "serif"; // change to "" to inherit (works in IE) 
                              // or another family (e.g. "arial")
amep.displaystyle = true;      // puts limits above and below large operators
amep.showasciiformulaonhover = true; // helps students learn ASCIIMath
amep.decimalsign = ".";        // change to "," if you like, beware of `(1,2)`!
amep.delimiter1 = "`";
amep.escape1 = "\\\\`"; // can use other characters
amep.delimiter2 = "$";
amep.escape2 = "\\\\\\$";
amep.delimiter2regexp = "\\$";
amep.doubleblankmathdelimiter = false; // if true,  x+1  is equal to `x+1`
                                      // for IE this works only in <!--   -->
//var separatetokens;// has been removed (email me if this is a problem)


// all further global variables start with "AM"


am.noMathMLNote = function() {
    var nd = ascii.myCreateElementXHTML("h3");
    nd.setAttribute("align","center")
    nd.appendChild(ascii.myCreateElementXHTML("p"));
  nd.appendChild(document.createTextNode("To view the "));
  var an = ascii.myCreateElementXHTML("a");
  an.appendChild(document.createTextNode("ASCIIMathML"));
  an.setAttribute("href","http://www.chapman.edu/~jipsen/asciimath.html");
  nd.appendChild(an);
  nd.appendChild(document.createTextNode(" notation use Internet Explorer 6+"));  
  an = ascii.myCreateElementXHTML("a");
  an.appendChild(document.createTextNode("MathPlayer"));
  an.setAttribute("href","http://www.dessci.com/en/products/mathplayer/download.htm");
  nd.appendChild(an);
  nd.appendChild(document.createTextNode(" or Netscape/Mozilla/Firefox"));
  nd.appendChild(ascii.myCreateElementXHTML("p"));
  return nd;
};

am.isMathMLavailable= function() {
  if (navigator.appName.slice(0,8)=="Netscape") 
    if (navigator.appVersion.slice(0,1)>="5") return null;
    else return am.noMathMLNote();
  else if (navigator.appName.slice(0,9)=="Microsoft")
    try {
        var ActiveX = new ActiveXObject("MathPlayer.Factory.1");
        return null;
    } catch (e) {
        return am.noMathMLNote();
    }
  else return am.noMathMLNote();
};

// character lists for Mozilla/Netscape fonts
am.cal =
["\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"];

am.frk =
["\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"];

am.bbb =
["\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"]; 

am.CONST = 0;
am.UNARY = 1;
am.BINARY = 2;
am.INFIX = 3;
am.LEFTBRACKET = 4; 
am.RIGHTBRACKET = 5;
am.SPACE = 6;
am.UNDEROVER = 7;
am.DEFINITION = 8; 
am.LEFTRIGHT = 9;
am.TEXT = 10; // token types

am.sqrt = {input:"sqrt", tag:"msqrt", output:"sqrt", tex:null, ttype:am.UNARY};
am.root  = {input:"root", tag:"mroot", output:"root", tex:null, ttype:am.BINARY};
am.frac  = {input:"frac", tag:"mfrac", output:"/",    tex:null, ttype:am.BINARY};
am.div   = {input:"/",    tag:"mfrac", output:"/",    tex:null, ttype:am.INFIX};
am.over  = {input:"stackrel", tag:"mover", output:"stackrel", tex:null, ttype:am.BINARY};
am.sub   = {input:"_",    tag:"msub",  output:"_",    tex:null, ttype:am.INFIX};
am.sup   = {input:"^",    tag:"msup",  output:"^",    tex:null, ttype:am.INFIX};
am.text  = {input:"text", tag:"mtext", output:"text", tex:null, ttype:am.TEXT};
am.mbox  = {input:"mbox", tag:"mtext", output:"mbox", tex:null, ttype:am.TEXT};
am.quote = {input:"\"",   tag:"mtext", output:"mbox", tex:null, ttype:am.TEXT};

am.symbols = [
//some greek symbols
{input:"alpha",  tag:"mi", output:"\u03B1", tex:null, ttype:am.CONST},
{input:"beta",   tag:"mi", output:"\u03B2", tex:null, ttype:am.CONST},
{input:"chi",    tag:"mi", output:"\u03C7", tex:null, ttype:am.CONST},
{input:"delta",  tag:"mi", output:"\u03B4", tex:null, ttype:am.CONST},
{input:"Delta",  tag:"mo", output:"\u0394", tex:null, ttype:am.CONST},
{input:"epsi",   tag:"mi", output:"\u03B5", tex:"epsilon", ttype:am.CONST},
{input:"varepsilon", tag:"mi", output:"\u025B", tex:null, ttype:am.CONST},
{input:"eta",    tag:"mi", output:"\u03B7", tex:null, ttype:am.CONST},
{input:"gamma",  tag:"mi", output:"\u03B3", tex:null, ttype:am.CONST},
{input:"Gamma",  tag:"mo", output:"\u0393", tex:null, ttype:am.CONST},
{input:"iota",   tag:"mi", output:"\u03B9", tex:null, ttype:am.CONST},
{input:"kappa",  tag:"mi", output:"\u03BA", tex:null, ttype:am.CONST},
{input:"lambda", tag:"mi", output:"\u03BB", tex:null, ttype:am.CONST},
{input:"Lambda", tag:"mo", output:"\u039B", tex:null, ttype:am.CONST},
{input:"mu",     tag:"mi", output:"\u03BC", tex:null, ttype:am.CONST},
{input:"nu",     tag:"mi", output:"\u03BD", tex:null, ttype:am.CONST},
{input:"omega",  tag:"mi", output:"\u03C9", tex:null, ttype:am.CONST},
{input:"Omega",  tag:"mo", output:"\u03A9", tex:null, ttype:am.CONST},
{input:"phi",    tag:"mi", output:"\u03C6", tex:null, ttype:am.CONST},
{input:"varphi", tag:"mi", output:"\u03D5", tex:null, ttype:am.CONST},
{input:"Phi",    tag:"mo", output:"\u03A6", tex:null, ttype:am.CONST},
{input:"pi",     tag:"mi", output:"\u03C0", tex:null, ttype:am.CONST},
{input:"Pi",     tag:"mo", output:"\u03A0", tex:null, ttype:am.CONST},
{input:"psi",    tag:"mi", output:"\u03C8", tex:null, ttype:am.CONST},
{input:"Psi",    tag:"mi", output:"\u03A8", tex:null, ttype:am.CONST},
{input:"rho",    tag:"mi", output:"\u03C1", tex:null, ttype:am.CONST},
{input:"sigma",  tag:"mi", output:"\u03C3", tex:null, ttype:am.CONST},
{input:"Sigma",  tag:"mo", output:"\u03A3", tex:null, ttype:am.CONST},
{input:"tau",    tag:"mi", output:"\u03C4", tex:null, ttype:am.CONST},
{input:"theta",  tag:"mi", output:"\u03B8", tex:null, ttype:am.CONST},
{input:"vartheta", tag:"mi", output:"\u03D1", tex:null, ttype:am.CONST},
{input:"Theta",  tag:"mo", output:"\u0398", tex:null, ttype:am.CONST},
{input:"upsilon", tag:"mi", output:"\u03C5", tex:null, ttype:am.CONST},
{input:"xi",     tag:"mi", output:"\u03BE", tex:null, ttype:am.CONST},
{input:"Xi",     tag:"mo", output:"\u039E", tex:null, ttype:am.CONST},
{input:"zeta",   tag:"mi", output:"\u03B6", tex:null, ttype:am.CONST},

//binary operation symbols
{input:"*",  tag:"mo", output:"\u22C5", tex:"cdot", ttype:am.CONST},
{input:"**", tag:"mo", output:"\u22C6", tex:"star", ttype:am.CONST},
{input:"//", tag:"mo", output:"/",      tex:null, ttype:am.CONST},
{input:"\\\\", tag:"mo", output:"\\",   tex:"backslash", ttype:am.CONST},
{input:"setminus", tag:"mo", output:"\\", tex:null, ttype:am.CONST},
{input:"xx", tag:"mo", output:"\u00D7", tex:"times", ttype:am.CONST},
{input:"-:", tag:"mo", output:"\u00F7", tex:"divide", ttype:am.CONST},
{input:"@",  tag:"mo", output:"\u2218", tex:"circ", ttype:am.CONST},
{input:"o+", tag:"mo", output:"\u2295", tex:"oplus", ttype:am.CONST},
{input:"ox", tag:"mo", output:"\u2297", tex:"otimes", ttype:am.CONST},
{input:"o.", tag:"mo", output:"\u2299", tex:"odot", ttype:am.CONST},
{input:"sum", tag:"mo", output:"\u2211", tex:null, ttype:am.UNDEROVER},
{input:"prod", tag:"mo", output:"\u220F", tex:null, ttype:am.UNDEROVER},
{input:"^^",  tag:"mo", output:"\u2227", tex:"wedge", ttype:am.CONST},
{input:"^^^", tag:"mo", output:"\u22C0", tex:"bigwedge", ttype:am.UNDEROVER},
{input:"vv",  tag:"mo", output:"\u2228", tex:"vee", ttype:am.CONST},
{input:"vvv", tag:"mo", output:"\u22C1", tex:"bigvee", ttype:am.UNDEROVER},
{input:"nn",  tag:"mo", output:"\u2229", tex:"cap", ttype:am.CONST},
{input:"nnn", tag:"mo", output:"\u22C2", tex:"bigcap", ttype:am.UNDEROVER},
{input:"uu",  tag:"mo", output:"\u222A", tex:"cup", ttype:am.CONST},
{input:"uuu", tag:"mo", output:"\u22C3", tex:"bigcup", ttype:am.UNDEROVER},

//binary relation symbols
{input:"!=",  tag:"mo", output:"\u2260", tex:"ne", ttype:am.CONST},
{input:":=",  tag:"mo", output:":=",     tex:null, ttype:am.CONST},
{input:"lt",  tag:"mo", output:"<",      tex:null, ttype:am.CONST},
{input:"<=",  tag:"mo", output:"\u2264", tex:"le", ttype:am.CONST},
{input:"lt=", tag:"mo", output:"\u2264", tex:"leq", ttype:am.CONST},
{input:">=",  tag:"mo", output:"\u2265", tex:"ge", ttype:am.CONST},
{input:"geq", tag:"mo", output:"\u2265", tex:null, ttype:am.CONST},
{input:"-<",  tag:"mo", output:"\u227A", tex:"prec", ttype:am.CONST},
{input:"-lt", tag:"mo", output:"\u227A", tex:null, ttype:am.CONST},
{input:">-",  tag:"mo", output:"\u227B", tex:"succ", ttype:am.CONST},
{input:"-<=", tag:"mo", output:"\u2AAF", tex:"preceq", ttype:am.CONST},
{input:">-=", tag:"mo", output:"\u2AB0", tex:"succeq", ttype:am.CONST},
{input:"in",  tag:"mo", output:"\u2208", tex:null, ttype:am.CONST},
{input:"!in", tag:"mo", output:"\u2209", tex:"notin", ttype:am.CONST},
{input:"sub", tag:"mo", output:"\u2282", tex:"subset", ttype:am.CONST},
{input:"sup", tag:"mo", output:"\u2283", tex:"supset", ttype:am.CONST},
{input:"sube", tag:"mo", output:"\u2286", tex:"subseteq", ttype:am.CONST},
{input:"supe", tag:"mo", output:"\u2287", tex:"supseteq", ttype:am.CONST},
{input:"-=",  tag:"mo", output:"\u2261", tex:"equiv", ttype:am.CONST},
{input:"~=",  tag:"mo", output:"\u2245", tex:"cong", ttype:am.CONST},
{input:"~~",  tag:"mo", output:"\u2248", tex:"approx", ttype:am.CONST},
{input:"prop", tag:"mo", output:"\u221D", tex:"propto", ttype:am.CONST},

//logical symbols
{input:"and", tag:"mtext", output:"and", tex:null, ttype:am.SPACE},
{input:"or",  tag:"mtext", output:"or",  tex:null, ttype:am.SPACE},
{input:"not", tag:"mo", output:"\u00AC", tex:"neg", ttype:am.CONST},
{input:"=>",  tag:"mo", output:"\u21D2", tex:"implies", ttype:am.CONST},
{input:"if",  tag:"mo", output:"if",     tex:null, ttype:am.SPACE},
{input:"<=>", tag:"mo", output:"\u21D4", tex:"iff", ttype:am.CONST},
{input:"AA",  tag:"mo", output:"\u2200", tex:"forall", ttype:am.CONST},
{input:"EE",  tag:"mo", output:"\u2203", tex:"exists", ttype:am.CONST},
{input:"_|_", tag:"mo", output:"\u22A5", tex:"bot", ttype:am.CONST},
{input:"TT",  tag:"mo", output:"\u22A4", tex:"top", ttype:am.CONST},
{input:"|--",  tag:"mo", output:"\u22A2", tex:"vdash", ttype:am.CONST},
{input:"|==",  tag:"mo", output:"\u22A8", tex:"models", ttype:am.CONST},

//grouping brackets
{input:"(", tag:"mo", output:"(", tex:null, ttype:am.LEFTBRACKET},
{input:")", tag:"mo", output:")", tex:null, ttype:am.RIGHTBRACKET},
{input:"[", tag:"mo", output:"[", tex:null, ttype:am.LEFTBRACKET},
{input:"]", tag:"mo", output:"]", tex:null, ttype:am.RIGHTBRACKET},
{input:"{", tag:"mo", output:"{", tex:null, ttype:am.LEFTBRACKET},
{input:"}", tag:"mo", output:"}", tex:null, ttype:am.RIGHTBRACKET},
{input:"|", tag:"mo", output:"|", tex:null, ttype:am.LEFTRIGHT},
//{input:"||", tag:"mo", output:"||", tex:null, ttype:am.LEFTRIGHT},
{input:"(:", tag:"mo", output:"\u2329", tex:"langle", ttype:am.LEFTBRACKET},
{input:":)", tag:"mo", output:"\u232A", tex:"rangle", ttype:am.RIGHTBRACKET},
{input:"<<", tag:"mo", output:"\u2329", tex:null, ttype:am.LEFTBRACKET},
{input:">>", tag:"mo", output:"\u232A", tex:null, ttype:am.RIGHTBRACKET},
{input:"{:", tag:"mo", output:"{:", tex:null, ttype:am.LEFTBRACKET, invisible:true},
{input:":}", tag:"mo", output:":}", tex:null, ttype:am.RIGHTBRACKET, invisible:true},

//miscellaneous symbols
{input:"int",  tag:"mo", output:"\u222B", tex:null, ttype:am.CONST},
{input:"dx",   tag:"mi", output:"{:d x:}", tex:null, ttype:am.DEFINITION},
{input:"dy",   tag:"mi", output:"{:d y:}", tex:null, ttype:am.DEFINITION},
{input:"dz",   tag:"mi", output:"{:d z:}", tex:null, ttype:am.DEFINITION},
{input:"dt",   tag:"mi", output:"{:d t:}", tex:null, ttype:am.DEFINITION},
{input:"oint", tag:"mo", output:"\u222E", tex:null, ttype:am.CONST},
{input:"del",  tag:"mo", output:"\u2202", tex:"partial", ttype:am.CONST},
{input:"grad", tag:"mo", output:"\u2207", tex:"nabla", ttype:am.CONST},
{input:"+-",   tag:"mo", output:"\u00B1", tex:"pm", ttype:am.CONST},
{input:"O/",   tag:"mo", output:"\u2205", tex:"emptyset", ttype:am.CONST},
{input:"oo",   tag:"mo", output:"\u221E", tex:"infty", ttype:am.CONST},
{input:"aleph", tag:"mo", output:"\u2135", tex:null, ttype:am.CONST},
{input:"...",  tag:"mo", output:"...",    tex:"ldots", ttype:am.CONST},
{input:":.",  tag:"mo", output:"\u2234",  tex:"therefore", ttype:am.CONST},
{input:"/_",  tag:"mo", output:"\u2220",  tex:"angle", ttype:am.CONST},
{input:"\\ ",  tag:"mo", output:"\u00A0", tex:null, ttype:am.CONST},
{input:"quad", tag:"mo", output:"\u00A0\u00A0", tex:null, ttype:am.CONST},
{input:"qquad", tag:"mo", output:"\u00A0\u00A0\u00A0\u00A0", tex:null, ttype:am.CONST},
{input:"cdots", tag:"mo", output:"\u22EF", tex:null, ttype:am.CONST},
{input:"vdots", tag:"mo", output:"\u22EE", tex:null, ttype:am.CONST},
{input:"ddots", tag:"mo", output:"\u22F1", tex:null, ttype:am.CONST},
{input:"diamond", tag:"mo", output:"\u22C4", tex:null, ttype:am.CONST},
{input:"square", tag:"mo", output:"\u25A1", tex:null, ttype:am.CONST},
{input:"|__", tag:"mo", output:"\u230A",  tex:"lfloor", ttype:am.CONST},
{input:"__|", tag:"mo", output:"\u230B",  tex:"rfloor", ttype:am.CONST},
{input:"|~", tag:"mo", output:"\u2308",  tex:"lceiling", ttype:am.CONST},
{input:"~|", tag:"mo", output:"\u2309",  tex:"rceiling", ttype:am.CONST},
{input:"CC",  tag:"mo", output:"\u2102", tex:null, ttype:am.CONST},
{input:"NN",  tag:"mo", output:"\u2115", tex:null, ttype:am.CONST},
{input:"QQ",  tag:"mo", output:"\u211A", tex:null, ttype:am.CONST},
{input:"RR",  tag:"mo", output:"\u211D", tex:null, ttype:am.CONST},
{input:"ZZ",  tag:"mo", output:"\u2124", tex:null, ttype:am.CONST},
{input:"f",   tag:"mi", output:"f",      tex:null, ttype:am.UNARY, func:true},
{input:"g",   tag:"mi", output:"g",      tex:null, ttype:am.UNARY, func:true},

//standard functions
{input:"lim",  tag:"mo", output:"lim", tex:null, ttype:am.UNDEROVER},
{input:"Lim",  tag:"mo", output:"Lim", tex:null, ttype:am.UNDEROVER},
{input:"sin",  tag:"mo", output:"sin", tex:null, ttype:am.UNARY, func:true},
{input:"cos",  tag:"mo", output:"cos", tex:null, ttype:am.UNARY, func:true},
{input:"tan",  tag:"mo", output:"tan", tex:null, ttype:am.UNARY, func:true},
{input:"sinh", tag:"mo", output:"sinh", tex:null, ttype:am.UNARY, func:true},
{input:"cosh", tag:"mo", output:"cosh", tex:null, ttype:am.UNARY, func:true},
{input:"tanh", tag:"mo", output:"tanh", tex:null, ttype:am.UNARY, func:true},
{input:"cot",  tag:"mo", output:"cot", tex:null, ttype:am.UNARY, func:true},
{input:"sec",  tag:"mo", output:"sec", tex:null, ttype:am.UNARY, func:true},
{input:"csc",  tag:"mo", output:"csc", tex:null, ttype:am.UNARY, func:true},
{input:"log",  tag:"mo", output:"log", tex:null, ttype:am.UNARY, func:true},
{input:"ln",   tag:"mo", output:"ln",  tex:null, ttype:am.UNARY, func:true},
{input:"det",  tag:"mo", output:"det", tex:null, ttype:am.UNARY, func:true},
{input:"dim",  tag:"mo", output:"dim", tex:null, ttype:am.CONST},
{input:"mod",  tag:"mo", output:"mod", tex:null, ttype:am.CONST},
{input:"gcd",  tag:"mo", output:"gcd", tex:null, ttype:am.UNARY, func:true},
{input:"lcm",  tag:"mo", output:"lcm", tex:null, ttype:am.UNARY, func:true},
{input:"lub",  tag:"mo", output:"lub", tex:null, ttype:am.CONST},
{input:"glb",  tag:"mo", output:"glb", tex:null, ttype:am.CONST},
{input:"min",  tag:"mo", output:"min", tex:null, ttype:am.UNDEROVER},
{input:"max",  tag:"mo", output:"max", tex:null, ttype:am.UNDEROVER},

//arrows
{input:"uarr", tag:"mo", output:"\u2191", tex:"uparrow", ttype:am.CONST},
{input:"darr", tag:"mo", output:"\u2193", tex:"downarrow", ttype:am.CONST},
{input:"rarr", tag:"mo", output:"\u2192", tex:"rightarrow", ttype:am.CONST},
{input:"->",   tag:"mo", output:"\u2192", tex:"to", ttype:am.CONST},
{input:"|->",  tag:"mo", output:"\u21A6", tex:"mapsto", ttype:am.CONST},
{input:"larr", tag:"mo", output:"\u2190", tex:"leftarrow", ttype:am.CONST},
{input:"harr", tag:"mo", output:"\u2194", tex:"leftrightarrow", ttype:am.CONST},
{input:"rArr", tag:"mo", output:"\u21D2", tex:"Rightarrow", ttype:am.CONST},
{input:"lArr", tag:"mo", output:"\u21D0", tex:"Leftarrow", ttype:am.CONST},
{input:"hArr", tag:"mo", output:"\u21D4", tex:"Leftrightarrow", ttype:am.CONST},

//commands with argument
am.sqrt, am.root, am.frac, am.div, am.over, am.sub, am.sup,
{input:"hat", tag:"mover", output:"\u005E", tex:null, ttype:am.UNARY, acc:true},
{input:"bar", tag:"mover", output:"\u00AF", tex:"overline", ttype:am.UNARY, acc:true},
{input:"vec", tag:"mover", output:"\u2192", tex:null, ttype:am.UNARY, acc:true},
{input:"dot", tag:"mover", output:".",      tex:null, ttype:am.UNARY, acc:true},
{input:"ddot", tag:"mover", output:"..",    tex:null, ttype:am.UNARY, acc:true},
{input:"ul", tag:"munder", output:"\u0332", tex:"underline", ttype:am.UNARY, acc:true},
am.text, am.mbox, am.quote,
{input:"bb", tag:"mstyle", atname:"fontweight", atval:"bold", output:"bb", tex:null, ttype:am.UNARY},
{input:"mathbf", tag:"mstyle", atname:"fontweight", atval:"bold", output:"mathbf", tex:null, ttype:am.UNARY},
{input:"sf", tag:"mstyle", atname:"fontfamily", atval:"sans-serif", output:"sf", tex:null, ttype:am.UNARY},
{input:"mathsf", tag:"mstyle", atname:"fontfamily", atval:"sans-serif", output:"mathsf", tex:null, ttype:am.UNARY},
{input:"bbb", tag:"mstyle", atname:"mathvariant", atval:"double-struck", output:"bbb", tex:null, ttype:am.UNARY, codes:am.bbb},
{input:"mathbb", tag:"mstyle", atname:"mathvariant", atval:"double-struck", output:"mathbb", tex:null, ttype:am.UNARY, codes:am.bbb},
{input:"cc",  tag:"mstyle", atname:"mathvariant", atval:"script", output:"cc", tex:null, ttype:am.UNARY, codes:am.cal},
{input:"mathcal", tag:"mstyle", atname:"mathvariant", atval:"script", output:"mathcal", tex:null, ttype:am.UNARY, codes:am.cal},
{input:"tt",  tag:"mstyle", atname:"fontfamily", atval:"monospace", output:"tt", tex:null, ttype:am.UNARY},
{input:"mathtt", tag:"mstyle", atname:"fontfamily", atval:"monospace", output:"mathtt", tex:null, ttype:am.UNARY},
{input:"fr",  tag:"mstyle", atname:"mathvariant", atval:"fraktur", output:"fr", tex:null, ttype:am.UNARY, codes:am.frk},
{input:"mathfrak",  tag:"mstyle", atname:"mathvariant", atval:"fraktur", output:"mathfrak", tex:null, ttype:am.UNARY, codes:am.frk}
];

am.compareNames = function(s1,s2) {
  if (s1.input > s2.input) return 1
  else return -1;
};

am.names = []; //list of input symbols

am.initSymbols =  function() {
  var texsymbols = [], i;
  for (i=0; i<am.symbols.length; i++)
    if (am.symbols[i].tex) 
      texsymbols[texsymbols.length] = {input:am.symbols[i].tex, 
        tag:am.symbols[i].tag, output:am.symbols[i].output, ttype:am.symbols[i].ttype};
  am.symbols = am.symbols.concat(texsymbols);
  am.symbols.sort(am.compareNames);
  for (i=0; i<am.symbols.length; i++) am.names[i] = am.symbols[i].input;
};

am.mathml = "http://www.w3.org/1998/Math/MathML";

am.createElementMathML= function(t) {
  if (ascii.isIE) return document.createElement("m:"+t);
  else return document.createElementNS(am.mathml,t);
};

am.createMmlNode= function(t,frag) {
//  var node = am.createElementMathML(name);
  if (ascii.isIE) var node = document.createElement("m:"+t);
  else var node = document.createElementNS(am.mathml,t);
  node.appendChild(frag);
  return node;
};

function newcommand(oldstr,newstr,texstr) {  //modified to also put in a tex str; if omitted, no harm
    if (!texstr) texstr = NULL;
  am.symbols = am.symbols.concat([{input:oldstr, tag:"mo", output:newstr, 
                                 tex:texstr, ttype:am.DEFINITION}]);
};

am.removeCharsAndBlanks = function(str,n) {
//remove n characters and any following blanks
  var st;
  if (str.charAt(n)=="\\" && str.charAt(n+1)!="\\" && str.charAt(n+1)!=" ") 
    st = str.slice(n+1);
  else st = str.slice(n);
  for (var i=0; i<st.length && st.charCodeAt(i)<=32; i=i+1);
  return st.slice(i);
};

am.position = function(arr, str, n) { 
// return position >=n where str appears or would be inserted
// assumes arr is sorted
  if (n==0) {
    var h,m;
    n = -1;
    h = arr.length;
    while (n+1<h) {
      m = (n+h) >> 1;
      if (arr[m]<str) n = m; else h = m;
    }
    return h;
  } else
    for (var i=n; i<arr.length && arr[i]<str; i++);
  return i; // i=arr.length || arr[i]>=str
};

am.getSymbol = function(str) {
//return maximal initial substring of str that appears in names
//return null if there is none
  var k = 0; //new pos
  var j = 0; //old pos
  var mk; //match pos
  var st;
  var tagst;
  var match = "";
  var more = true;
  for (var i=1; i<=str.length && more; i++) {
    st = str.slice(0,i); //initial substring of length i
    j = k;
    k = am.position(am.names, st, j);
    if (k<am.names.length && str.slice(0,am.names[k].length)==am.names[k]){
      match = am.names[k];
      mk = k;
      i = match.length;
    }
    more = k<am.names.length && str.slice(0,am.names[k].length)>=am.names[k];
    
  }
  am.previousSymbol=am.currentSymbol;
  if (match!=""){
    am.currentSymbol=am.symbols[mk].ttype;
    return am.symbols[mk]; 
  }
// if str[0] is a digit or - return maxsubstring of digits.digits
  am.currentSymbol=am.CONST;
  k = 1;
  st = str.slice(0,1);
  var integ = true;
  while ("0"<=st && st<="9" && k<=str.length) {
    st = str.slice(k,k+1);
    k++;
  }
  if (st == amep.decimalsign) {
    st = str.slice(k,k+1);
    if ("0"<=st && st<="9") {
      integ = false;
      k++;
      while ("0"<=st && st<="9" && k<=str.length) {
        st = str.slice(k,k+1);
        k++;
      }
    }
  }
  if ((integ && k>1) || k>2) {
    st = str.slice(0,k-1);
    tagst = "mn";
  } else {
    k = 2;
    st = str.slice(0,1); //take 1 character
    tagst = (("A">st || st>"Z") && ("a">st || st>"z")?"mo":"mi");
  }
  if (st=="-" && am.previousSymbol==am.INFIX) {
      am.currentSymbol = am.INFIX;  //trick "/" into recognizing "-" on second parse
      return {input:st, tag:tagst, output:st, ttype:am.UNARY, func:true};
  }
  return {input:st, tag:tagst, output:st, ttype:am.CONST};
};

am.removeBrackets = function(node) {
  var st;
  if (node.nodeName=="mrow") {
    st = node.firstChild.firstChild.nodeValue;
    if (st=="(" || st=="[" || st=="{") node.removeChild(node.firstChild);
  }
  if (node.nodeName=="mrow") {
    st = node.lastChild.firstChild.nodeValue;
    if (st==")" || st=="]" || st=="}") node.removeChild(node.lastChild);
  }
};

/*Parsing ASCII math expressions with the following grammar
v ::= [A-Za-z] | greek letters | numbers | other constant symbols
u ::= sqrt | text | bb | other unary symbols for font commands
b ::= frac | root | stackrel         binary symbols
l ::= ( | [ | { | (: | {:            left brackets
r ::= ) | ] | } | :) | :}            right brackets
S ::= v | lEr | uS | bSS             Simple expression
I ::= S_S | S^S | S_S^S | S          Intermediate expression
E ::= IE | I/I                       Expression
Each terminal symbol is translated into a corresponding mathml node.*/

/*am.nestingDepth,am.previousSymbol,am.currentSymbol;*/

am.parseSexpr =function(str) { //parses str and returns [node,tailstr]
  var symbol, node, result, i, st,// rightvert = false,
    newFrag = document.createDocumentFragment();
  str = am.removeCharsAndBlanks(str,0);
  symbol = am.getSymbol(str);             //either a token or a bracket or empty
 
  if (symbol == null || symbol.ttype == am.RIGHTBRACKET && am.nestingDepth > 0) {
    return [null,str];
  }
  if (symbol.ttype == am.DEFINITION) {
    str = symbol.output+am.removeCharsAndBlanks(str,symbol.input.length); 
    symbol = am.getSymbol(str);
  }
  switch (symbol.ttype) {
  case am.UNDEROVER:
  case am.CONST:
    str = am.removeCharsAndBlanks(str,symbol.input.length); 
    return [am.createMmlNode(symbol.tag,        //its a constant
                             document.createTextNode(symbol.output)),str];
  case am.LEFTBRACKET:   //read (expr+)
    am.nestingDepth++;
    str = am.removeCharsAndBlanks(str,symbol.input.length); 
    result = am.parseExpr(str,true);
    am.nestingDepth--;
    if (typeof symbol.invisible == "boolean" && symbol.invisible) 
      node = am.createMmlNode("mrow",result[0]);
    else {
      node = am.createMmlNode("mo",document.createTextNode(symbol.output));
      node = am.createMmlNode("mrow",node);
      node.appendChild(result[0]);
    }
    return [node,result[1]];
  case am.TEXT:
      if (symbol!=am.quote) str = am.removeCharsAndBlanks(str,symbol.input.length);
      if (str.charAt(0)=="{") i=str.indexOf("}");
      else if (str.charAt(0)=="(") i=str.indexOf(")");
      else if (str.charAt(0)=="[") i=str.indexOf("]");
      else if (symbol==am.quote) i=str.slice(1).indexOf("\"")+1;
      else i = 0;
      if (i==-1) i = str.length;
      st = str.slice(1,i);
      if (st.charAt(0) == " ") {
        node = am.createElementMathML("mspace");
        node.setAttribute("width","1ex");
        newFrag.appendChild(node);
      }
      newFrag.appendChild(
        am.createMmlNode(symbol.tag,document.createTextNode(st)));
      if (st.charAt(st.length-1) == " ") {
        node = am.createElementMathML("mspace");
        node.setAttribute("width","1ex");
        newFrag.appendChild(node);
      }
      str = am.removeCharsAndBlanks(str,i+1);
      return [am.createMmlNode("mrow",newFrag),str];
  case am.UNARY:
      str = am.removeCharsAndBlanks(str,symbol.input.length); 
      result = am.parseSexpr(str);
      if (result[0]==null) return [am.createMmlNode(symbol.tag,
                             document.createTextNode(symbol.output)),str];
      if (typeof symbol.func == "boolean" && symbol.func) { // functions hack
        st = str.charAt(0);
        if (st=="^" || st=="_" || st=="/" || st=="|" || st==",") {
          return [am.createMmlNode(symbol.tag,
                    document.createTextNode(symbol.output)),str];
        } else {
          node = am.createMmlNode("mrow",
           am.createMmlNode(symbol.tag,document.createTextNode(symbol.output)));
          node.appendChild(result[0]);
          return [node,result[1]];
        }
      }
      am.removeBrackets(result[0]);
      if (symbol.input == "sqrt") {           // sqrt
        return [am.createMmlNode(symbol.tag,result[0]),result[1]];
      } else if (typeof symbol.acc == "boolean" && symbol.acc) {   // accent
        node = am.createMmlNode(symbol.tag,result[0]);
        node.appendChild(am.createMmlNode("mo",document.createTextNode(symbol.output)));
        return [node,result[1]];
      } else {                        // font change command
        if (!ascii.isIE && typeof symbol.codes != "undefined") {
          for (i=0; i<result[0].childNodes.length; i++)
            if (result[0].childNodes[i].nodeName=="mi" || result[0].nodeName=="mi") {
              st = (result[0].nodeName=="mi"?result[0].firstChild.nodeValue:
                              result[0].childNodes[i].firstChild.nodeValue);
              var newst = [];
              for (var j=0; j<st.length; j++)

           /*  //old not full range    
             if (st.charCodeAt(j)>64 && st.charCodeAt(j)<91) newst = newst +
                  String.fromCharCode(symbol.codes[st.charCodeAt(j)-65]);
                else newst = newst + st.charAt(j);
           */
                        if (st.charCodeAt(j)>64 && st.charCodeAt(j)<91) 
                            newst = newst + symbol.codes[st.charCodeAt(j)-65];
                else if (st.charCodeAt(j)>96 && st.charCodeAt(j)<123)
                   newst = newst + symbol.codes[st.charCodeAt(j)-71]; 
               else newst = newst + st.charAt(j);

              if (result[0].nodeName=="mi")
                result[0]=am.createElementMathML("mo").
                          appendChild(document.createTextNode(newst));
              else result[0].replaceChild(am.createElementMathML("mo").
          appendChild(document.createTextNode(newst)),result[0].childNodes[i]);
            }
        }
        node = am.createMmlNode(symbol.tag,result[0]);
        node.setAttribute(symbol.atname,symbol.atval);
        return [node,result[1]];
      }
  case am.BINARY:
    str = am.removeCharsAndBlanks(str,symbol.input.length); 
    result = am.parseSexpr(str);
    if (result[0]==null) return [am.createMmlNode("mo",
                           document.createTextNode(symbol.input)),str];
    am.removeBrackets(result[0]);
    var result2 = am.parseSexpr(result[1]);
    if (result2[0]==null) return [am.createMmlNode("mo",
                           document.createTextNode(symbol.input)),str];
    am.removeBrackets(result2[0]);
    if (symbol.input=="root" || symbol.input=="stackrel") 
      newFrag.appendChild(result2[0]);
    newFrag.appendChild(result[0]);
    if (symbol.input=="frac") newFrag.appendChild(result2[0]);
    return [am.createMmlNode(symbol.tag,newFrag),result2[1]];
  case am.INFIX:
    str = am.removeCharsAndBlanks(str,symbol.input.length); 
    return [am.createMmlNode("mo",document.createTextNode(symbol.output)),str];
  case am.SPACE:
    str = am.removeCharsAndBlanks(str,symbol.input.length); 
    node = am.createElementMathML("mspace");
    node.setAttribute("width","1ex");
    newFrag.appendChild(node);
    newFrag.appendChild(
      am.createMmlNode(symbol.tag,document.createTextNode(symbol.output)));
    node = am.createElementMathML("mspace");
    node.setAttribute("width","1ex");
    newFrag.appendChild(node);
    return [am.createMmlNode("mrow",newFrag),str];
  case am.LEFTRIGHT:
//    if (rightvert) return [null,str]; else rightvert = true;
    am.nestingDepth++;
    str = am.removeCharsAndBlanks(str,symbol.input.length); 
    result = am.parseExpr(str,false);
    am.nestingDepth--;
    var st = "";
    if (result[0].lastChild!=null)
      st = result[0].lastChild.firstChild.nodeValue;
    if (st == "|") { // its an absolute value subterm
      node = am.createMmlNode("mo",document.createTextNode(symbol.output));
      node = am.createMmlNode("mrow",node);
      node.appendChild(result[0]);
      return [node,result[1]];
    } else { // the "|" is a \mid
      node = am.createMmlNode("mo",document.createTextNode(symbol.output));
      node = am.createMmlNode("mrow",node);
      return [node,str];
    }
  default:
//alert("default");
    str = am.removeCharsAndBlanks(str,symbol.input.length); 
    return [am.createMmlNode(symbol.tag,        //its a constant
                             document.createTextNode(symbol.output)),str];
  }
};

am.parseIexpr= function(str) {
  var symbol, sym1, sym2, node, result, underover;
  str = am.removeCharsAndBlanks(str,0);
  sym1 = am.getSymbol(str);
  result = am.parseSexpr(str);
  node = result[0];
  str = result[1];
  symbol = am.getSymbol(str);
  if (symbol.ttype == am.INFIX && symbol.input != "/") {
    str = am.removeCharsAndBlanks(str,symbol.input.length);
//    if (symbol.input == "/") result = am.parseIexpr(str); else ...
    result = am.parseSexpr(str);
    if (result[0] == null) // show box in place of missing argument
      result[0] = am.createMmlNode("mo",document.createTextNode("\u25A1"));
    else am.removeBrackets(result[0]);
    str = result[1];
//    if (symbol.input == "/") am.removeBrackets(node);
    if (symbol.input == "_") {
      sym2 = am.getSymbol(str);
      underover = (sym1.ttype == am.UNDEROVER);
      if (sym2.input == "^") {
        str = am.removeCharsAndBlanks(str,sym2.input.length);
        var res2 = am.parseSexpr(str);
        am.removeBrackets(res2[0]);
        str = res2[1];
        node = am.createMmlNode((underover?"munderover":"msubsup"),node);
        node.appendChild(result[0]);
        node.appendChild(res2[0]);
        node = am.createMmlNode("mrow",node); // so sum does not stretch
      } else {
        node = am.createMmlNode((underover?"munder":"msub"),node);
        node.appendChild(result[0]);
      }
    } else {
      node = am.createMmlNode(symbol.tag,node);
      node.appendChild(result[0]);
    }
  }
  return [node,str];
};

am.parseExpr = function(str,rightbracket) {
  var symbol, node, result, i, nodeList = [],
  newFrag = document.createDocumentFragment();
  do {
    str = am.removeCharsAndBlanks(str,0);
    result = am.parseIexpr(str);
    node = result[0];
    str = result[1];
    symbol = am.getSymbol(str);
    if (symbol.ttype == am.INFIX && symbol.input == "/") {
      str = am.removeCharsAndBlanks(str,symbol.input.length);
      result = am.parseIexpr(str);
      if (result[0] == null) // show box in place of missing argument
        result[0] = am.createMmlNode("mo",document.createTextNode("\u25A1"));
      else am.removeBrackets(result[0]);
      str = result[1];
      am.removeBrackets(node);
      node = am.createMmlNode(symbol.tag,node);
      node.appendChild(result[0]);
      newFrag.appendChild(node);
      symbol = am.getSymbol(str);
    } 
    else if (node!=undefined) newFrag.appendChild(node);
  } while ((symbol.ttype != am.RIGHTBRACKET && 
           (symbol.ttype != am.LEFTRIGHT || rightbracket)
           || am.nestingDepth == 0) && symbol!=null && symbol.output!="");
  if (symbol.ttype == am.RIGHTBRACKET || symbol.ttype == am.LEFTRIGHT) {
//    if (am.nestingDepth > 0) am.nestingDepth--;
    var len = newFrag.childNodes.length;
    if (len>0 && newFrag.childNodes[len-1].nodeName == "mrow" && len>1 &&
      newFrag.childNodes[len-2].nodeName == "mo" &&
      newFrag.childNodes[len-2].firstChild.nodeValue == ",") { //matrix
      var right = newFrag.childNodes[len-1].lastChild.firstChild.nodeValue;
      if (right==")" || right=="]") {
        var left = newFrag.childNodes[len-1].firstChild.firstChild.nodeValue;
        if (left=="(" && right==")" && symbol.output != "}" || 
            left=="[" && right=="]") {
        var pos = []; // positions of commas
        var matrix = true;
        var m = newFrag.childNodes.length;
        for (i=0; matrix && i<m; i=i+2) {
          pos[i] = [];
          node = newFrag.childNodes[i];
          if (matrix) matrix = node.nodeName=="mrow" && 
            (i==m-1 || node.nextSibling.nodeName=="mo" && 
            node.nextSibling.firstChild.nodeValue==",")&&
            node.firstChild.firstChild.nodeValue==left &&
            node.lastChild.firstChild.nodeValue==right;
          if (matrix) 
            for (var j=0; j<node.childNodes.length; j++)
              if (node.childNodes[j].firstChild.nodeValue==",")
                pos[i][pos[i].length]=j;
          if (matrix && i>1) matrix = pos[i].length == pos[i-2].length;
        }
        if (matrix) {
          var row, frag, n, k, table = document.createDocumentFragment();
          for (i=0; i<m; i=i+2) {
            row = document.createDocumentFragment();
            frag = document.createDocumentFragment();
            node = newFrag.firstChild; // <mrow>(-,-,...,-,-)</mrow>
            n = node.childNodes.length;
            k = 0;
            node.removeChild(node.firstChild); //remove (
            for (j=1; j<n-1; j++) {
              if (typeof pos[i][k] != "undefined" && j==pos[i][k]){
                node.removeChild(node.firstChild); //remove ,
                row.appendChild(am.createMmlNode("mtd",frag));
                k++;
              } else frag.appendChild(node.firstChild);
            }
            row.appendChild(am.createMmlNode("mtd",frag));
            if (newFrag.childNodes.length>2) {
              newFrag.removeChild(newFrag.firstChild); //remove <mrow>)</mrow>
              newFrag.removeChild(newFrag.firstChild); //remove <mo>,</mo>
            }
            table.appendChild(am.createMmlNode("mtr",row));
          }
          node = am.createMmlNode("mtable",table);
          if (typeof symbol.invisible == "boolean" && symbol.invisible) node.setAttribute("columnalign","left");
          newFrag.replaceChild(node,newFrag.firstChild);
        }
       }
      }
    }
    str = am.removeCharsAndBlanks(str,symbol.input.length);
    if (typeof symbol.invisible != "boolean" || !symbol.invisible) {
      node = am.createMmlNode("mo",document.createTextNode(symbol.output));
      newFrag.appendChild(node);
    }
  }
  return [newFrag,str];
};

am.parseMath  = function(str) { //this might be the magic function-jt
  var result, node = am.createElementMathML("mstyle");
  if (amep.mathcolor != "") node.setAttribute("mathcolor",amep.mathcolor);
  if (amep.displaystyle) node.setAttribute("displaystyle","true");
  if (amep.mathfontfamily != "") node.setAttribute("fontfamily",amep.mathfontfamily);
  am.nestingDepth = 0;
  node.appendChild(am.parseExpr(str.replace(/^\s+/g,""),false)[0]);
  node = am.createMmlNode("math",node);
  if (amep.showasciiformulaonhover)                      //fixed by djhsu so newline
    node.setAttribute("title",str.replace(/\s+/g," "));//does not show in Gecko
  if (amep.mathfontfamily != "" && (ascii.isIE || amep.mathfontfamily != "serif")) {
    var fnode = ascii.myCreateElementXHTML("font");
    fnode.setAttribute("face",amep.mathfontfamily);
    fnode.appendChild(node);
    return fnode;
  }
  return node;
};

am.strarr2docFrag = function(arr, linebreaks) {
  var newFrag=document.createDocumentFragment();
  var expr = false;
  for (var i=0; i<arr.length; i++) {
    if (expr) newFrag.appendChild(am.parseMath(arr[i]));
    else {
      var arri = (linebreaks ? arr[i].split("\n\n") : [arr[i]]);
      newFrag.appendChild(ascii.myCreateElementXHTML("span").
      appendChild(document.createTextNode(arri[0])));
      for (var j=1; j<arri.length; j++) {
        newFrag.appendChild(ascii.myCreateElementXHTML("p"));
        newFrag.appendChild(ascii.myCreateElementXHTML("span").
        appendChild(document.createTextNode(arri[j])));
      }
    }
    expr = !expr;
  }
  return newFrag;
};

am.processNodeR = function(n, linebreaks) {
  var mtch, str, arr, frg, i;
  if (n.childNodes.length == 0) {
   if ((n.nodeType!=8 || linebreaks) &&
    n.parentNode.nodeName!="form" && n.parentNode.nodeName!="FORM" &&
    n.parentNode.nodeName!="textarea" && n.parentNode.nodeName!="TEXTAREA" &&
    n.parentNode.nodeName!="pre" && n.parentNode.nodeName!="PRE") {
    str = n.nodeValue;
    if (!(str == null)) {
      str = str.replace(/\r\n\r\n/g,"\n\n");
      if (amep.doubleblankmathdelimiter) {
        str = str.replace(/\x20\x20\./g," "+am.delimiter1+".");
        str = str.replace(/\x20\x20,/g," "+am.delimiter1+",");
        str = str.replace(/\x20\x20/g," "+am.delimiter1+" ");
      }
      str = str.replace(/\x20+/g," ");
      str = str.replace(/\s*\r\n/g," ");
      mtch = false;
      str = str.replace(new RegExp(amep.escape2, "g"),
              function(st){mtch=true;return "am.escape2"});
      str = str.replace(new RegExp(amep.escape1, "g"),
              function(st){mtch=true;return "am.escape1"});
      str = str.replace(new RegExp(amep.delimiter2regexp, "g"),amep.delimiter1);
      arr = str.split(amep.delimiter1);
      for (i=0; i<arr.length; i++)
        arr[i]=arr[i].replace(/amep.escape2/g,amep.delimiter2).
                      replace(/amep.escape1/g,amep.delimiter1);
      if (arr.length>1 || mtch) {
        if (am.checkForMathML) {
          am.checkForMathML = false;
          var nd = am.isMathMLavailable();
          am.noMathML = nd != null;
          if (am.noMathML && am.notifyIfNoMathML) 
            if (am.alertIfNoMathML)
              alert("To view the ASCIIMathML notation use Internet Explorer 6 +\nMathPlayer (free from www.dessci.com)\n\
                or Firefox/Mozilla/Netscape");
            else am.body.insertBefore(nd,am.body.childNodes[0]);
        }
        if (!am.noMathML) {
          frg = am.strarr2docFrag(arr,n.nodeType==8);
          var len = frg.childNodes.length;
          n.parentNode.replaceChild(frg,n);
          return len-1;
        } else return 0;
      }
    }
   } else return 0;
  } else if (n.nodeName!="math") {
    for (i=0; i<n.childNodes.length; i++)
      i += am.processNodeR(n.childNodes[i], linebreaks);
  }
  return 0;
};

am.processNode = function(n, linebreaks, spanclassAM) {
  var frag,st;
  if (spanclassAM!=null) {
    frag = document.getElementsByTagName("span")
    for (var i=0;i<frag.length;i++)
      if (frag[i].className == "AM")
        am.processNodeR(frag[i],linebreaks);
  } else {
    try {
      st = n.innerHTML;
    } catch(err) {}
    if (st==null || 
        st.indexOf(amep.delimiter1)!=-1 || st.indexOf(amep.delimiter2)!=-1) 
      am.processNodeR(n,linebreaks);
  }
  if (ascii.isIE) { //needed to match size and font of formula to surrounding text
    frag = document.getElementsByTagName('math');
    for (var i=0;i<frag.length;i++) frag[i].update()
  }
};

/*ambody;*/
am.noMathML = false;
am.translated = false;

am.translate = function(spanclassAM) {
  if (!am.translated) { // run this only once
    am.translated = true;
    am.initSymbols();
    am.body = document.getElementsByTagName("body")[0];
    am.processNode(AMbody, false, spanclassAM);
  }
};

    
//if (isIE) { // avoid adding MathPlayer info explicitly to each webpage
//  document.write("<object id=\"mathplayer\"                           \
//  classid=\"clsid:32F66A20-7614-11D4-BD11-00104BD3F987\"></object>");
//  document.write("<?import namespace=\"m\" implementation=\"#mathplayer\"?>");
//}






/* ASCIIsvg.js
==============
JavaScript routines to dynamically generate Scalable Vector Graphics
using a mathematical xy-coordinate system (y increases upwards) and
very intuitive JavaScript commands (no programming experience required).
ASCIIsvg.js is good for learning math and illustrating online math texts.
Works with Internet Explorer+Adobe SVGviewer and SVG enabled Mozilla/Firefox.

Based on:
Ver 1.2.7 Oct 13, 2005 (c) Peter Jipsen http://www.chapman.edu/~jipsen
Latest version at http://www.chapman.edu/~jipsen/svg/ASCIIsvg.js
If you use it on a webpage, please send the URL to jipsen@chapman.edu

Modified by James Taylor at http://www.jostylr.com  for TiddlyWiki matters.

This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 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
General Public License (at http://www.gnu.org/copyleft/gpl.html) 
for more details.*/


ascii.svg = {};


//store all pictures here
//while an array, also add to it associative properties
ascii.svg.pictures = new Array();

//store all enviornments here
ascii.svg.environments = new Array ();

ascii.svg.currentpicture = {};

ascii.svg.currentenvironment ={};

var as = ascii.svg;




//Picture constructor
ascii.svg.Picture = function (id, height, width) {
    // this.rootnode is svg object
    //create embedded object?
    this.id = id;
    this.height = height;
    this.width = width;    
    this.embedded = document.createElement("embed");
    var obj = this.embedded;
    //obj.setAttribute("script", ase.src);
    obj.setAttribute("width", width);
    obj.setAttribute("height", height);
    obj.setAttribute("id", "emb"+id);
    // obj.setAttribute("src", "/d.svg");
    //obj.width = width;
    //obj.height = height;
    //obj.src = "d.svg";
    //obj.script = ase.src;
    //   obj.data =  "/d.svg";
    //    obj.type = "image/svg+xml";
    if (ascii.isIE) { 
        this.rootnode = obj.getSVGDocument().getElementById("root");
        //no clue what this is for
        while (this.rootnode.childNodes.length()>5) {
            this.rootnode.removeChild(this.rootnode.lastChild);
        };
        this.rootnode.setAttribute("width",width);
        this.rootnode.setAttribute("height",height);
        this.doc = obj.getSVGDocument();
    } else { //not IE
        this.rootnode = document.createElementNS("http://www.w3.org/2000/svg","svg");
        var qnode = this.rootnode;
        qnode.setAttribute("id",id);
        qnode.setAttribute("style","display:inline");
        qnode.setAttribute("width",width);
        qnode.setAttribute("height",height);
        //    if (picture.parentNode!=null)
        // picture.parentNode.replaceChild(qnode,picture);
        //else
        // this.rootnode.parentNode.replaceChild(qnode,this.rootnode);
        //this.rootnode = qnode;
        this.doc = document;
    }
    //appending object to child
    obj.appendChild(this.rootnode);
    //callback for mouseover to switch to this picture, hope id is id, you know
    //test for event handling
        if (document.implementation.hasFeature("MouseEvents","2.0")) {
            obj.addEventListener("mouseover", as.mousehand, true); };
};



var app = ascii.svg.Picture.prototype;
var asp = ascii.svg.currentpicture; //default picture reference, instance of as.Picture
var ase = ascii.svg.currentenvironment;

as.checkIfSVGavailable = true;
as.notifyIfNoSVG = true;
as.alertIfNoSVG = false;

app.xunitlength = 20;  // pixels
app.yunitlength = 20;  // pixels
app.origin = [0,0];   // in pixels (default is bottom left corner)
app.width = 500; 
app.height = 500; 
app.border = 0;
app.strokewidth = "1"; // pixel
app.strokedasharray = null;
app.stroke = "green"; // default line color
app.fill = "none";    // default fill color
app.fontstyle = "italic"; // default shape for text labels
app.fontfamily = "times"; // default font
app.fontsize = "16";      // default size
app.fontweight = "normal";
app.fontstroke = "none";  // default font outline color
app.fontfill = "none";    // default font color
app.marker = "none";
app.initialized = true;
app.markerstrokewidth = "1";
app.markerstroke = "black";
app.markerfill = "yellow";
app.marker = "none";
app.arrowfill = app.stroke;
app.dotradius = 4;
app.ticklength = 4;
app.axesstroke = "black";
app.gridstroke = "grey";
app.pointerpos = null;
app.coordinates = null;
app.above = "above";
app.below = "below";
app.left = "left";
app.right = "right";
app.aboveleft = "aboveleft";
app.aboveright = "aboveright";
app.belowleft = "belowleft";
app.belowright = "belowright";
//new defaults
app.xmin = -10;
app.xmax = 10;
app.ymin = -10;
app.ymax = 10;
app.xscl= 1;
app.yscl= 1;
app.xgrid = 1;
app.ygrid = 1;
app.xtick = 1;
app.ytick = 1;
app.initialized = true;
app.onmousemove="function () {}";//ascii.svg.updateCoords";



//var picture, currentpicture, doc, width, height, a, b, c, d, i, n, p, t, x, y;



//compatibility with Jipsen initPicture
as.jsPict= function (width, height, xmin, xmax, ymin, ymax, border) {
   var obj = {};
   if (width) {obj.width = width};
   if (height) {obj.height = height};
   if (height) {obj.border=border};
   if (xmin) {obj.xmin = xmin};
   if (ymin) {obj.ymin = ymin};
   if (xmax) {obj.xmax = xmax};
   if (ymax) {obj.ymax = ymax};
   as.initPicture(obj);
};

//compatibility with Jipsen initPicture; does graphing
as.jsGraph = function (width, height, xmin, xmax, ymin, ymax, border) {
    var obj = {};
    if (width) {obj.width = width};
    if (height) {obj.height = height};
    if (height) {obj.border=border};
    if (xmin) {obj.xmin = xmin};
    if (xmax) {obj.xmax = xmax};
    if (ymin) {obj.ymin = ymin};
    if (ymax) {obj.ymax = ymax};
    as.setGraph(obj);
};


//jt function, puts recognized commands into namespace
as.funreplace = function (st) {
    //parse for replacements, letter followed by identifiers and periods until weird stuff
    var regfun = /([a-zA-Z][\w\.]*)\W*/;
    var indexfun = 0;
    var match_arr, com;
    var len = st.length;
    //while loop to go through string and parse out commands
    while (indexfun < st.length) {
    //  for (var i = 0; i<st.length; i++){
        match_arr  = st.slice(indexfun).match(regfun);
        len -= 1; if (len <0) {break};
        //        if (match_arr) {alert(st+"\n"+indexfun+"\n"+match_arr[0]+"\n"+match_arr[1]+"\n"+match_arr.index);}
        
        if (!match_arr) {break};
        com = match_arr[1];
        indexfun += match_arr.index;
        //before pictures so asp will not be defined initially
        if (st.slice(indexfun+com.length).match(/^\s*:/)) { //colon found due to passing object ininitializer,...
            indexfun += match_arr[0].length;   //do nothing
        } else if (asp[com]) {
            st= st.slice(0,indexfun)+st.slice(indexfun).replace(com, 'ascii.svg.currentpicture.'+com);
            indexfun += 25+ match_arr[0].length;    
        } else if (app[com]) {
            st= st.slice(0,indexfun)+st.slice(indexfun).replace(com, 'ascii.svg.currentpicture.'+com);
            indexfun += 25+ match_arr[0].length;    
        } else if (as[com]) {
           st= st.slice(0,indexfun)+st.slice(indexfun).replace(com, 'ascii.svg.'+com);
            indexfun += 10+ match_arr[0].length;    ;
 
        } else if (af[com]) {
           st= st.slice(0,indexfun)+st.slice(indexfun).replace(com, 'ascii.func.'+com);
            indexfun += 11+ match_arr[0].length;    ;
 
        } else if (am[com]) {
            st= st.slice(0,indexfun)+st.slice(indexfun).replace(com, 'ascii.math.'+com);
            indexfun += 11+ match_arr[0].length;    ;
        } else if (ascii[com]) {
            st= st.slice(0,indexfun)+st.slice(indexfun).replace(com, 'ascii.'+com);
            indexfun += 6+ match_arr[0].length;    ;           
 
        } else {
            indexfun += match_arr[0].length;
        };
    };
    return st; 
};



as.isSVGavailable =  function () {
  var nd = a.myCreateElementXHTML("center");
  nd.appendChild(document.createTextNode("To view the "));
  var an = a.myCreateElementXHTML("a");
  an.appendChild(document.createTextNode("ASCIIsvg"));
  an.setAttribute("href","http://www.chapman.edu/~jipsen/asciisvg.html");
  nd.appendChild(an);
  nd.appendChild(document.createTextNode(" images use Internet Explorer 6+"));
  an = a.myCreateElementXHTML("a");
  an.appendChild(document.createTextNode("Adobe SVGviewer 3.02"));
  an.setAttribute("href","http://www.adobe.com/svg");
  nd.appendChild(an);
  nd.appendChild(document.createTextNode(" or "));
  an = a.myCreateElementXHTML("a");
  an.appendChild(document.createTextNode("SVG enabled Mozilla/Firefox"));
  an.setAttribute("href",
    "http://www.chapman.edu/~jipsen/svg/svgenabledmozillafirefox.html");
  nd.appendChild(an);
  if (navigator.appName.slice(0,8)=="Netscape") 
    if (window['SVGElement']) return null;
    else return nd;
  else if (navigator.appName.slice(0,9)=="Microsoft")
    try	{
      var oSVG=eval("new ActiveXObject('Adobe.SVGCtl.3');");
        return null;
    } catch (e) {
        return nd;
    }
  else return nd;
};


//assigns text to first child of node id. internal?
as.setText = function (st,id) { 
  var node = document.getElementById(id);
  if (node!=null){
      if (node.childNodes.length!=0) { node.childNodes[0].nodeValue = st;
      } else {
         node.appendChild(document.createTextNode(st));
      };
  }
};

//new svg. internal
as.myCreateElementSVG = function (t) {
  if (ascii.isIE) return asp.doc.createElement(t);
  else return asp.doc.createElementNS("http://www.w3.org/2000/svg",t);
};

//these deal with the mouse movements. perhaps make them part of constructor family 
as.getX = function() {
  return (asp.doc.getElementById("pointerpos").getAttribute("cx")-asp.origin[0])/asp.xunitlength;
};

as.getY = function () {
  return (asp.height-asp.origin[1]-asp.doc.getElementById("pointerpos").getAttribute("cy"))/asp.yunitlength;
};

as.mousemove_listener = function (evt) {
  if (asp.rootnode.getAttribute("xbase")!=null)
    as.pointerpos.cx.baseVal.value = evt.clientX-asp.rootnode.getAttribute("xbase");
  if (asp.rootnode.getAttribute("ybase")!=null)
    as.pointerpos.cy.baseVal.value = evt.clientY-asp.rootnode.getAttribute("ybase");
  //  alert("mousemove");
};

as.top_listener = function (evt) {
  asp.rootnode.setAttribute("ybase",evt.clientY);
  //alert("top");
};

as.bottom_listener = function (evt) { 
  asp.rootnode.setAttribute("ybase",evt.clientY-asp.height+1);
  // alert("bottom");
};

as.left_listener = function (evt) {
  asp.rootnode.setAttribute("xbase",evt.clientX);
  //alert("left");
};

as.right_listener = function (evt) {
  asp.rootnode.setAttribute("xbase",evt.clientX-asp.width+1);
  //alert("right");
};

//// Main initialization routines. 

as.parse = function(src, e) {
    ase.node = e;
    ase.src = src;

    //allows ability to get environment given the node
    as.environments.push(e);
    //prepare for evaluating source
    src = src.replace(/plot\(\x20*([^\"f\[][^\n\r]+?)\,/g,"plot\(\"$1\",");
    src = src.replace(/plot\(\x20*([^\"f\[][^\n\r]+)\)/g,"plot(\"$1\")");
    src = src.replace(/([0-9])([a-zA-Z])/g,"$1*$2");
    src = src.replace(/\)([\(0-9a-zA-Z])/g,"\)*$1");
    src = as.funreplace(src);
    try {
        eval(src);
    } catch(err) {alert(err+"\n SVG Evaluation: \n"+src)};
    //alert(asp.rootnode.lastChild.nodeName);
    //alert(src);
};



as.updatePicture = function (obj) {
    try{
        ascii.svg.currentpicture = as.pictures[obj];
        asp = ascii.svg.currentpicture;
    } catch(err) {
        alert(err+"\n"+obj);
        return null;
    };
    src = src.replace(/plot\(\x20*([^\"f\[][^\n\r]+?)\,/g,"plot\(\"$1\",");
    src = src.replace(/plot\(\x20*([^\"f\[][^\n\r]+)\)/g,"plot(\"$1\")");
    src = src.replace(/([0-9])([a-zA-Z])/g,"$1*$2");
    src = src.replace(/\)([\(0-9a-zA-Z])/g,"\)*$1");
    try {
        with (Math) eval(src);
    } catch(err) {alert(err+"\n"+src)}
};

//!!!prints out with wikify, need TW
as.print = function (txt) {
    txt = txt.toString();
    var node = document.createElement("span");
    ase.node.appendChild(node);
    wikify(txt, node);

};

//get id of current picture
as.getPicId = function () {
    return asp.rootnode.getAttribute("id");
};

//get embedding node's id
as.getEmbId = function () {
    return asp.embed.getAttribute("id");
};

//remove element from picture
as.rem = function (id) {
    if (id) {
        var node = document.getElementById(id);
        if (node.parentNode) {
            node.parentNode.removeChild(node);
        }
    }
};



//activates tracking, draws automatic grid
as.setGraph = function (initializer) {
    if ((!(initializer)) || (!(typeof initializer =="object"))) {initializer = {};};
    if (!initializer.onmousemove) {initializer.onmousemove = "ascii.svg.updateCoords"};
    as.initPicture(initializer);
    as.axes(true);
};

//creates a picture, requires object syntax for passing parameters, ignores other formats silently
as.initPicture = function (initializer) {
    //create initializer if it is empty
    //alert("hi");
    var id = as.pictures.length;
    var width = app.width;
    var height = app.height;
    //  alert(initializer.width);
    if ((!(initializer)) || (!(typeof initializer =="object"))) {initializer = {};};
    if (initializer.id) {id = initializer.id; delete initializer.id;};
    if (initializer.width) {width = initializer.width; delete initializer.width;};
    if (initializer.height) {height = initializer.height; delete initializer.height;};
    // Picture creates svg node as picture, does not link it to current environment
    as.pictures[id] = new as.Picture(id, width, height);
    ascii.svg.currentpicture = as.pictures[id];
    asp = ascii.svg.currentpicture;
    // alert("aw"+asp.width+"wi"+asp.width);
    asp.width = width;
    asp.height = height;
    asp.id = id;
    //alert("asp width: "+asp.width+"asp stroke: "+asp.stroke+"pict id: "+asp.id);
    //asp.embedded is the html embedding object, contained within that is the svg object
    ase.node.appendChild(asp.embedded);
    //have picture, now look through initializer object and figure out attributes.
    for (var prop in initializer) {
        if (initializer[prop] != null) {asp[prop] = initializer[prop];};
    };
    //alert("asp width: "+asp.width+"asp stroke: "+asp.stroke+"pict id: "+asp.id);
    //max, mins,
    if (typeof asp.xmin != "number" || typeof asp.xmax != "number" || asp.xmin >= asp.xmax) {
        alert("Requires two numbers xmin < xmax but has "+asp.xmin+asp.xmax);
        return null;
    } else if (asp.ymax != null && (typeof asp.ymin != "number" || 
                                 typeof asp.ymax != "number" || asp.ymin >= asp.ymax)) {
        alert("Requires numbers ymin < ymax has "+asp.ymin+asp.ymax);
        return null;
    }
    //maxs, mins fine
    asp.xunitlength = (width-2*asp.border)/(asp.xmax-asp.xmin);
    asp.yunitlength = asp.xunitlength;
    if (asp.ymin==null) {
            asp.origin = [-asp.xmin*asp.xunitlength+asp.border,asp.height/2];
            asp.ymin = -(asp.height-2*asp.border)/(2*asp.yunitlength);
            asp.ymax = -asp.ymin;
    } else {
        if (asp.ymax!=null) asp.yunitlength = (asp.height-2*asp.border)/(asp.ymax-asp.ymin);
        else asp.ymax = (asp.height-2*asp.border)/asp.yunitlength + asp.ymin;
        asp.origin = [-asp.xmin*asp.xunitlength+asp.border,-asp.ymin*asp.yunitlength+asp.border];
    };
    


  //non IE?, not sure about this function
  as.pointerpos = asp.doc.getElementById("pointerpos");
  if (as.pointerpos==null) {
      as.pointerpos = as.myCreateElementSVG("circle");
      as.pointerpos.setAttribute("id","pointerpos");
      as.pointerpos.setAttribute("cx",0);
      as.pointerpos.setAttribute("cy",0);
      as.pointerpos.setAttribute("r",0.5);
      as.pointerpos.setAttribute("fill","red");
      asp.rootnode.appendChild(as.pointerpos);
  };
  //setting attribute of pictures. 
  asp.rootnode.setAttribute("xunitlength",asp.xunitlength);
  asp.rootnode.setAttribute("yunitlength",asp.yunitlength);
  asp.rootnode.setAttribute("xmin",asp.xmin);
  asp.rootnode.setAttribute("xmax",asp.xmax);
  asp.rootnode.setAttribute("ymin",asp.ymin);
  asp.rootnode.setAttribute("ymax",asp.ymax);
  asp.rootnode.setAttribute("ox",asp.origin[0]);
  asp.rootnode.setAttribute("oy",asp.origin[1]);
  var node = as.myCreateElementSVG("rect");
  node.setAttribute("x","0");
  node.setAttribute("y","0");
  node.setAttribute("width",asp.width);
  node.setAttribute("height",asp.height);
  node.setAttribute("style","stroke-width:1;fill:white");
  asp.rootnode.appendChild(node);
    if (document.implementation.hasFeature("MouseEvents","2.0")) {
    asp.embedded.addEventListener("mousemove", as.mousemove_listener, true);
    //var st = picture.getAttribute("onmousemove");
    if (typeof asp.onmousemove == "string" ){
        asp.rootnode.addEventListener("mousemove", eval(asp.onmousemove), true);
    };
    node = as.myCreateElementSVG("polyline");
    node.setAttribute("points","0,0 "+width+",0");
    node.setAttribute("style","stroke:white; stroke-width:3");
    node.addEventListener("mousemove", as.top_listener, true);
    asp.rootnode.appendChild(node);
    node = as.myCreateElementSVG("polyline");
    node.setAttribute("points","0,"+height+" "+width+","+height);
    node.setAttribute("style","stroke:white; stroke-width:3");
    node.addEventListener("mousemove", as.bottom_listener, true);
    asp.rootnode.appendChild(node);
    node = as.myCreateElementSVG("polyline");
    node.setAttribute("points","0,0 0,"+height);
    node.setAttribute("style","stroke:white; stroke-width:3");
    node.addEventListener("mousemove", as.left_listener, true);
    asp.rootnode.appendChild(node);
    node = as.myCreateElementSVG("polyline");
    node.setAttribute("points",(width-1)+",0 "+(width-1)+","+height);
    node.setAttribute("style","stroke:white; stroke-width:3");
    node.addEventListener("mousemove", as.right_listener, true);
    asp.rootnode.appendChild(node);
    
  }
};


as.mousehand = function (e) {
     targetenquiry:
    if (e.currentTarget != asp.embedded) {
        for (var pict in as.pictures) {
            if (as.pictures[pict].embedded == e.currentTarget) {
                ascii.svg.currentpicture = as.pictures[pict];
                asp = ascii.svg.currentpicture;
                break targetenquiry;
            }
            //alert("Can't find element in list; MouseEvent triggered is messed");   
        }
    }
    

};
  

//expect to remove or simplify this
as.updateCoords = function () {
  var gx=as.getX(), gy=as.getY();
  if ((asp.xmax-gx)*asp.xunitlength > 6*asp.fontsize || (gy-asp.ymin)*asp.yunitlength > 2*asp.fontsize)
    as.text([asp.xmax,asp.ymin],"("+gx.toFixed(2)+", "+gy.toFixed(2)+")",
         "aboveleft","AScoord"+asp.id,"");
  else as.text([asp.xmax,asp.ymin]," ","aboveleft","AScoord"+asp.id,"");
};


as.showHideCode = function (obj) {
  var node = obj.nextSibling;
  while (node != null && node.nodeName != "BUTTON" && 
    node.nodeName != "button") node = node.nextSibling;
  if (node.style.display == "none") node.style.display = "";
  else node.style.display = "none";
  while (node != null && node.nodeName != "TEXTAREA" && 
    node.nodeName != "textarea") node = node.previousSibling;
  if (node.style.display == "none") node.style.display = "";
  else node.style.display = "none";
//  updatePicture(node.getAttribute("id"));
};

as.hideCode = function () { //do nothing
};

as.showcode = function () { //do nothing
};

as.nobutton = function () { //do nothing
};

as.setBorder = function (x) { asp.border = x }


//drawing commands below


as.line = function (p,q,id) { // segment connecting points p,q (coordinates in units)
  var node;
  if (id!=null) node = asp.doc.getElementById(id);
  if (node==null) {
    node = as.myCreateElementSVG("path");
    node.setAttribute("id", id);
    asp.rootnode.appendChild(node);
  }
  node.setAttribute("d","M"+(p[0]*asp.xunitlength+asp.origin[0])+","+
    (asp.height-p[1]*asp.yunitlength-asp.origin[1])+" "+
    (q[0]*asp.xunitlength+asp.origin[0])+","+(asp.height-q[1]*asp.yunitlength-asp.origin[1]));
  node.setAttribute("stroke-width", asp.strokewidth);
  if (asp.strokedasharray!=null) 
    node.setAttribute("stroke-dasharray", asp.strokedasharray);
  node.setAttribute("stroke", asp.stroke);
  node.setAttribute("fill", asp.fill);
  if (asp.marker=="dot" || asp.marker=="arrowdot") {
    as.ASdot(p,4,asp.markerstroke,asp.markerfill);
    if (asp.marker=="arrowdot") as.arrowhead(p,q);
    as.ASdot(q,4,asp.markerstroke,asp.markerfill);
  } else if (asp.marker=="arrow") as.arrowhead(p,q);
};

as.path = function (plist,id,c) {
  if (c==null) c="";
  var node, st, i;
  if (id!=null) node = asp.doc.getElementById(id);
  if (node==null) {
    node = as.myCreateElementSVG("path");
    node.setAttribute("id", id);
    asp.rootnode.appendChild(node);
  }
  if (typeof plist == "string") st = plist;
  else {
    st = "M";
    st += (plist[0][0]*asp.xunitlength+asp.origin[0])+","+
          (asp.height-plist[0][1]*asp.yunitlength-asp.origin[1])+" "+c;
    for (i=1; i<plist.length; i++)
      st += (plist[i][0]*asp.xunitlength+asp.origin[0])+","+
            (asp.height-plist[i][1]*asp.yunitlength-asp.origin[1])+" ";
  }
  node.setAttribute("d", st);
  node.setAttribute("stroke-width", asp.strokewidth);
  if (asp.strokedasharray!=null) 
    node.setAttribute("stroke-dasharray", asp.strokedasharray);
  node.setAttribute("stroke", asp.stroke);
  node.setAttribute("fill", asp.fill);
  if (asp.marker=="dot" || asp.marker=="arrowdot")
    for (i=0; i<plist.length; i++)
      if (c!="C" && c!="T" || i!=1 && i!=2)
        as.ASdot(plist[i],4,asp.markerstroke,asp.markerfill);
};

as.curve = function (plist,id) {
  as.path(plist,id,"T");
};

as.circle = function (center,radius,id) { // coordinates in units
  var node;
  if (id!=null) node = asp.doc.getElementById(id);
  if (node==null) {
    node = as.myCreateElementSVG("circle");
    node.setAttribute("id", id);
    asp.rootnode.appendChild(node);
  }
  node.setAttribute("cx",center[0]*asp.xunitlength+asp.origin[0]);
  node.setAttribute("cy",asp.height-center[1]*asp.yunitlength-asp.origin[1]);
  node.setAttribute("r",radius*asp.xunitlength);
  node.setAttribute("stroke-width", asp.strokewidth);
  node.setAttribute("stroke", asp.stroke);
  node.setAttribute("fill", asp.fill);
};

as.loop = function (p,d,id) { 
// d is a direction vector e.g. [1,0] means loop starts in that direction
  if (d==null) d=[1,0];
  as.path([p,[p[0]+d[0],p[1]+d[1]],[p[0]-d[1],p[1]+d[0]],p],id,"C");
  if (asp.marker=="arrow" || asp.marker=="arrowdot") 
    as.arrowhead([p[0]+Math.cos(1.4)*d[0]-Math.sin(1.4)*d[1],
                            p[1]+Math.sin(1.4)*d[0]+Math.cos(1.4)*d[1]],p);
};

as.arc = function (start,end,radius,id) { // coordinates in units
  var node, v;
//alert([fill, stroke, origin, xunitlength, yunitlength, height])
  if (id!=null) node = asp.doc.getElementById(id);
  if (radius==null) {
    v=[end[0]-start[0],end[1]-start[1]];
    radius = Math.sqrt(v[0]*v[0]+v[1]*v[1]);
  }
  if (node==null) {
    node = as.myCreateElementSVG("path");
    node.setAttribute("id", id);
    asp.rootnode.appendChild(node);
  }
  node.setAttribute("d","M"+(start[0]*asp.xunitlength+asp.origin[0])+","+
    (asp.height-start[1]*asp.yunitlength-asp.origin[1])+" A"+radius*asp.xunitlength+","+
     radius*asp.yunitlength+" 0 0,0 "+(end[0]*asp.xunitlength+asp.origin[0])+","+
    (asp.height-end[1]*asp.yunitlength-asp.origin[1]));
  node.setAttribute("stroke-width", asp.strokewidth);
  node.setAttribute("stroke", asp.stroke);
  node.setAttribute("fill", asp.fill);
  if (asp.marker=="arrow" || asp.marker=="arrowdot") {
    u = [(end[1]-start[1])/4,(start[0]-end[0])/4];
    v = [(end[0]-start[0])/2,(end[1]-start[1])/2];
//alert([u,v])
    v = [start[0]+v[0]+u[0],start[1]+v[1]+u[1]];
  } else v=[start[0],start[1]];
  if (asp.marker=="dot" || asp.marker=="arrowdot") {
    as.ASdot(start,4,asp.markerstroke,asp.markerfill);
    if (asp.marker=="arrowdot") as.arrowhead(v,end);
    as.ASdot(end,4,asp.markerstroke,asp.markerfill);
  } else if (asp.marker=="arrow") as.arrowhead(v,end);
};

as.ellipse = function (center,rx,ry,id) { // coordinates in units
  var node;
  if (id!=null) node = asp.doc.getElementById(id);
  if (node==null) {
    node = as.myCreateElementSVG("ellipse");
    node.setAttribute("id", id);
    asp.rootnode.appendChild(node);
  }
  node.setAttribute("cx",center[0]*asp.xunitlength+asp.origin[0]);
  node.setAttribute("cy",asp.height-center[1]*asp.yunitlength-asp.origin[1]);
  node.setAttribute("rx",rx*asp.xunitlength);
  node.setAttribute("ry",ry*asp.yunitlength);
  node.setAttribute("stroke-width", asp.strokewidth);
  node.setAttribute("stroke", asp.stroke);
  node.setAttribute("fill", asp.fill);
};

as.rect = function (p,q,id,rx,ry) { // opposite corners in units, rounded by radii
  var node;
  if (id!=null) node = asp.doc.getElementById(id);
  if (node==null) {
    node = as.myCreateElementSVG("rect");
    node.setAttribute("id", id);
    asp.rootnode.appendChild(node);
  }
  node.setAttribute("x",p[0]*asp.xunitlength+asp.origin[0]);
  node.setAttribute("y",asp.height-q[1]*asp.yunitlength-asp.origin[1]);
  node.setAttribute("width",(q[0]-p[0])*asp.xunitlength);
  node.setAttribute("height",(q[1]-p[1])*asp.yunitlength);
  if (rx!=null) node.setAttribute("rx",rx*asp.xunitlength);
  if (ry!=null) node.setAttribute("ry",ry*asp.yunitlength);
  node.setAttribute("stroke-width", asp.strokewidth);
  node.setAttribute("stroke", asp.stroke);
  node.setAttribute("fill", asp.fill);
};

as.text = function (p,st,pos,id,fontsty) {
  var textanchor = "middle";
  var dx = 0; var dy = asp.fontsize/3;
  if (pos!=null) {
    if (pos.slice(0,5)=="above") dy = -asp.fontsize/2;
    if (pos.slice(0,5)=="below") dy = asp.fontsize-0;
    if (pos.slice(0,5)=="right" || pos.slice(5,10)=="right") {
      textanchor = "start";
      dx = asp.fontsize/2;
    }
    if (pos.slice(0,4)=="left" || pos.slice(5,9)=="left") {
      textanchor = "end";
      dx = -asp.fontsize/2;
    }
  }
  var node;
  if (id!=null) node = asp.doc.getElementById(id);
  if (node==null) {
    node = as.myCreateElementSVG("text");
    node.setAttribute("id", id);
    asp.rootnode.appendChild(node);
    node.appendChild(asp.doc.createTextNode(st));
  }
  node.lastChild.nodeValue = st;
  node.setAttribute("x",p[0]*asp.xunitlength+asp.origin[0]+dx);
  node.setAttribute("y",asp.height-p[1]*asp.yunitlength-asp.origin[1]+dy);
  node.setAttribute("font-style",(fontsty!=null?fontsty:asp.fontstyle));
  node.setAttribute("font-family",asp.fontfamily);
  node.setAttribute("font-size",asp.fontsize);
  node.setAttribute("font-weight",asp.fontweight);
  node.setAttribute("text-anchor",textanchor);
  if (asp.fontstroke!="none") node.setAttribute("stroke",asp.fontstroke);
  if (asp.fontfill!="none") node.setAttribute("fill",asp.fontfill);
  return p;
};

as.ASdot = function (center,radius,s,f) { // coordinates in units, radius in pixel
  if (s==null) s = asp.stroke; if (f==null) f = asp.fill;
  var node = as.myCreateElementSVG("circle");
  node.setAttribute("cx",center[0]*asp.xunitlength+asp.origin[0]);
  node.setAttribute("cy",asp.height-center[1]*asp.yunitlength-asp.origin[1]);
  node.setAttribute("r",radius);
  node.setAttribute("stroke-width", asp.strokewidth);
  node.setAttribute("stroke", s);
  node.setAttribute("fill", f);
  asp.rootnode.appendChild(node);
};

as.dot = function (center, typ, label, pos, id) {
  var node;
  var cx = center[0]*asp.xunitlength+asp.origin[0];
  var cy = asp.height-center[1]*asp.yunitlength-asp.origin[1];
  if (id!=null) node = asp.doc.getElementById(id);
  if (typ=="+" || typ=="-" || typ=="|") {
    if (node==null) {
      node = as.myCreateElementSVG("path");
      node.setAttribute("id", id);
      asp.rootnode.appendChild(node);
    }
    if (typ=="+") {
      node.setAttribute("d",
        " M "+(cx-asp.ticklength)+" "+cy+" L "+(cx+asp.ticklength)+" "+cy+
        " M "+cx+" "+(cy-asp.ticklength)+" L "+cx+" "+(cy+asp.ticklength));
      node.setAttribute("stroke-width", .5);
      node.setAttribute("stroke", asp.axesstroke);
    } else {
      if (typ=="-") node.setAttribute("d",
        " M "+(cx-asp.ticklength)+" "+cy+" L "+(cx+asp.ticklength)+" "+cy);
      else node.setAttribute("d",
        " M "+cx+" "+(cy-asp.ticklength)+" L "+cx+" "+(cy+asp.ticklength));
      node.setAttribute("stroke-width", asp.strokewidth);
      node.setAttribute("stroke", asp.stroke);
    }
  } else {
    if (node==null) {
      node = as.myCreateElementSVG("circle");
      node.setAttribute("id", id);
      asp.rootnode.appendChild(node);
    }
    node.setAttribute("cx",cx);
    node.setAttribute("cy",cy);
    node.setAttribute("r",asp.dotradius);
    node.setAttribute("stroke-width", asp.strokewidth);
    node.setAttribute("stroke", asp.stroke);
    node.setAttribute("fill", (typ=="open"?"white":asp.stroke));
  }
  if (label!=null) 
      as.text(center,label,(pos==null?"below":pos),(id==null?id:id+"label"));
};

as.arrowhead = function (p,q) { // draw arrowhead at q (in units)
  var up;
  var v = [p[0]*asp.xunitlength+asp.origin[0],asp.height-p[1]*asp.yunitlength-asp.origin[1]];
  var w = [q[0]*asp.xunitlength+asp.origin[0],asp.height-q[1]*asp.yunitlength-asp.origin[1]];
  var u = [w[0]-v[0],w[1]-v[1]];
  var d = Math.sqrt(u[0]*u[0]+u[1]*u[1]);
  if (d > 0.00000001) {
    u = [u[0]/d, u[1]/d];
    up = [-u[1],u[0]];
    var node = as.myCreateElementSVG("path");
    node.setAttribute("d","M "+(w[0]-15*u[0]-4*up[0])+" "+
      (w[1]-15*u[1]-4*up[1])+" L "+(w[0]-3*u[0])+" "+(w[1]-3*u[1])+" L "+
      (w[0]-15*u[0]+4*up[0])+" "+(w[1]-15*u[1]+4*up[1])+" z");
    node.setAttribute("stroke-width", asp.markerstrokewidth);
    node.setAttribute("stroke", asp.stroke); /*was markerstroke*/
    node.setAttribute("fill", asp.stroke); /*was arrowfill*/
    asp.rootnode.appendChild(node);    
  }
};

as.chopZ = function (st) {
  var k = st.indexOf(".");
  if (k==-1) return st;
  for (var i=st.length-1; i>k && st.charAt(i)=="0"; i--);
  if (i==k) i--;
  return st.slice(0,i+1);
};

as.grid = function (dx,dy) { // for backward compatibility
  as.axes(dx,dy,null,dx,dy)
};

as.noaxes = function () {
    if (!(asp)  || !(asp.initialized)) as.initPicture();
};

//I think the parameters are useless since values defined
//just set xscl, yscl, xtick, ytick. labels is needed now to indicate labelling. 
as.axes = function (labels, dx,dy,labels,gdx,gdy) {
//xscl=x is equivalent to xtick=x; xgrid=x; labels=true;
  var x, y, ldx, ldy, lx, ly, lxp, lyp, pnode, st;
  if (!(asp)  || !(asp.initialized)) as.initPicture();
  if (typeof dx=="string") { asp.labels = dx; dx = null; }
  if (typeof dy=="string") { gdx = dy; dy = null; }
  if (asp.xscl!=null) {dx = asp.xscl; gdx = asp.xscl}//; labels = dx}
  if (asp.yscl!=null) {dy = asp.yscl; gdy = asp.yscl}
  if (asp.xtick!=null) {dx = asp.xtick}
  if (asp.ytick!=null) {dy = asp.ytick}
//alert(null)
  dx = (dx==null?asp.xunitlength:dx*asp.xunitlength);
  dy = (dy==null?dx:dy*asp.yunitlength);
  asp.fontsize = Math.min(dx/2,dy/2,16);//alert(fontsize)
  asp.ticklength = asp.fontsize/4;
  if (asp.xgrid!=null) gdx = asp.xgrid;
  if (asp.ygrid!=null) gdy = asp.ygrid;
  if (gdx!=null) {
    gdx = (typeof gdx=="string"?dx:gdx*asp.xunitlength);
    gdy = (gdy==null?dy:gdy*asp.yunitlength);
    pnode = as.myCreateElementSVG("path");
    st="";
    for (x = asp.origin[0]; x<asp.width; x = x+gdx)
      st += " M"+x+",0"+" "+x+","+asp.height;
    for (x = asp.origin[0]-gdx; x>0; x = x-gdx)
      st += " M"+x+",0"+" "+x+","+asp.height;
    for (y = asp.height-asp.origin[1]; y<asp.height; y = y+gdy)
      st += " M0,"+y+" "+asp.width+","+y;
    for (y = asp.height-asp.origin[1]-gdy; y>0; y = y-gdy)
      st += " M0,"+y+" "+asp.width+","+y;
    pnode.setAttribute("d",st);
    pnode.setAttribute("stroke-width", .5);
    pnode.setAttribute("stroke", asp.gridstroke);
    pnode.setAttribute("fill", asp.fill);
    asp.rootnode.appendChild(pnode);
  }
  pnode = as.myCreateElementSVG("path");
  st="M0,"+(asp.height-asp.origin[1])+" "+asp.width+","+
    (asp.height-asp.origin[1])+" M"+asp.origin[0]+",0 "+asp.origin[0]+","+asp.height;
  for (x = asp.origin[0]+dx; x<asp.width; x = x+dx)
    st += " M"+x+","+(asp.height-asp.origin[1]+asp.ticklength)+" "+x+","+
           (asp.height-asp.origin[1]-asp.ticklength);
  for (x = asp.origin[0]-dx; x>0; x = x-dx)
    st += " M"+x+","+(asp.height-asp.origin[1]+asp.ticklength)+" "+x+","+
           (asp.height-asp.origin[1]-asp.ticklength);
  for (y = asp.height-asp.origin[1]+dy; y<asp.height; y = y+dy)
    st += " M"+(asp.origin[0]+asp.ticklength)+","+y+" "+(asp.origin[0]-asp.ticklength)+","+y;
  for (y = asp.height-asp.origin[1]-dy; y>0; y = y-dy)
    st += " M"+(asp.origin[0]+asp.ticklength)+","+y+" "+(asp.origin[0]-asp.ticklength)+","+y;
  if (labels!=null) with (Math) {
    ldx = dx/asp.xunitlength;
    ldy = dy/asp.yunitlength;
    lx = (asp.xmin>0 || asp.xmax<0?asp.xmin:0);
    ly = (asp.ymin>0 || asp.ymax<0?asp.ymin:0);
    lxp = (ly==0?"below":"above");
    lyp = (lx==0?"left":"right");
    var ddx = floor(1.1-log(ldx)/log(10))+1;
    var ddy = floor(1.1-log(ldy)/log(10))+1;
    for (x = ldx; x<=asp.xmax; x = x+ldx)
      as.text([x,ly],as.chopZ(x.toFixed(ddx)),lxp);
    for (x = -ldx; asp.xmin<=x; x = x-ldx)
      as.text([x,ly],as.chopZ(x.toFixed(ddx)),lxp);
    for (y = ldy; y<=asp.ymax; y = y+ldy)
      as.text([lx,y],as.chopZ(y.toFixed(ddy)),lyp);
    for (y = -ldy; asp.ymin<=y; y = y-ldy)
      as.text([lx,y],as.chopZ(y.toFixed(ddy)),lyp);
  }
  pnode.setAttribute("d",st);
  pnode.setAttribute("stroke-width", .5);
  pnode.setAttribute("stroke", asp.axesstroke);
  pnode.setAttribute("fill", asp.fill);
  asp.rootnode.appendChild(pnode);
};

as.mathjs = function (st) {
  //translate a math formula to js function notation
  // a^b --> pow(a,b)
  // na --> n*a
  // (...)d --> (...)*d
  // n! --> factorial(n)
  // sin^-1 --> arcsin etc.
  //while ^ in string, find term on left and right
  //slice and concat new formula string
  st = st.replace(/\s/g,"");
  if (st.indexOf("^-1")!=-1) {
    st = st.replace(/sin\^-1/g,"arcsin");
    st = st.replace(/cos\^-1/g,"arccos");
    st = st.replace(/tan\^-1/g,"arctan");
    st = st.replace(/sec\^-1/g,"arcsec");
    st = st.replace(/csc\^-1/g,"arccsc");
    st = st.replace(/cot\^-1/g,"arccot");
    st = st.replace(/sinh\^-1/g,"arcsinh");
    st = st.replace(/cosh\^-1/g,"arccosh");
    st = st.replace(/tanh\^-1/g,"arctanh");
    st = st.replace(/sech\^-1/g,"arcsech");
    st = st.replace(/csch\^-1/g,"arccsch");
    st = st.replace(/coth\^-1/g,"arccoth");
  }
  st = st.replace(/^e$/g,"(E)");
  st = st.replace(/^e([^a-zA-Z])/g,"(E)$1");
  st = st.replace(/([^a-zA-Z])e([^a-zA-Z])/g,"$1(E)$2");
  st = st.replace(/([0-9])([\(a-zA-Z])/g,"$1*$2");
  st = st.replace(/\)([\(0-9a-zA-Z])/g,"\)*$1");
  var i,j,k, ch, nested;
  while ((i=st.indexOf("^"))!=-1) {
    //find left argument
    if (i==0) return "Error: missing argument";
    j = i-1;
    ch = st.charAt(j);
    if (ch>="0" && ch<="9") {// look for (decimal) number
      j--;
      while (j>=0 && (ch=st.charAt(j))>="0" && ch<="9") j--;
      if (ch==".") {
        j--;
        while (j>=0 && (ch=st.charAt(j))>="0" && ch<="9") j--;
      }
    } else if (ch==")") {// look for matching opening bracket and function name
      nested = 1;
      j--;
      while (j>=0 && nested>0) {
        ch = st.charAt(j);
        if (ch=="(") nested--;
        else if (ch==")") nested++;
        j--;
      }
      while (j>=0 && (ch=st.charAt(j))>="a" && ch<="z" || ch>="A" && ch<="Z")
        j--;
    } else if (ch>="a" && ch<="z" || ch>="A" && ch<="Z") {// look for variable
      j--;
      while (j>=0 && (ch=st.charAt(j))>="a" && ch<="z" || ch>="A" && ch<="Z")
        j--;
    } else { 
      return "Error: incorrect syntax in "+st+" at position "+j;
    }
    //find right argument
    if (i==st.length-1) return "Error: missing argument";
    k = i+1;
    ch = st.charAt(k);
    if (ch>="0" && ch<="9" || ch=="-") {// look for signed (decimal) number
      k++;
      while (k<st.length && (ch=st.charAt(k))>="0" && ch<="9") k++;
      if (ch==".") {
        k++;
        while (k<st.length && (ch=st.charAt(k))>="0" && ch<="9") k++;
      }
    } else if (ch=="(") {// look for matching closing bracket and function name
      nested = 1;
      k++;
      while (k<st.length && nested>0) {
        ch = st.charAt(k);
        if (ch=="(") nested++;
        else if (ch==")") nested--;
        k++;
      }
    } else if (ch>="a" && ch<="z" || ch>="A" && ch<="Z") {// look for variable
      k++;
      while (k<st.length && (ch=st.charAt(k))>="a" && ch<="z" ||
               ch>="A" && ch<="Z") k++;
    } else { 
      return "Error: incorrect syntax in "+st+" at position "+k;
    }
    st = st.slice(0,j+1)+"pow("+st.slice(j+1,i)+","+st.slice(i+1,k)+")"+
           st.slice(k);
  }
  while ((i=st.indexOf("!"))!=-1) {
    //find left argument
    if (i==0) return "Error: missing argument";
    j = i-1;
    ch = st.charAt(j);
    if (ch>="0" && ch<="9") {// look for (decimal) number
      j--;
      while (j>=0 && (ch=st.charAt(j))>="0" && ch<="9") j--;
      if (ch==".") {
        j--;
        while (j>=0 && (ch=st.charAt(j))>="0" && ch<="9") j--;
      }
    } else if (ch==")") {// look for matching opening bracket and function name
      nested = 1;
      j--;
      while (j>=0 && nested>0) {
        ch = st.charAt(j);
        if (ch=="(") nested--;
        else if (ch==")") nested++;
        j--;
      }
      while (j>=0 && (ch=st.charAt(j))>="a" && ch<="z" || ch>="A" && ch<="Z")
        j--;
    } else if (ch>="a" && ch<="z" || ch>="A" && ch<="Z") {// look for variable
      j--;
      while (j>=0 && (ch=st.charAt(j))>="a" && ch<="z" || ch>="A" && ch<="Z")
        j--;
    } else { 
      return "Error: incorrect syntax in "+st+" at position "+j;
    }
    st = st.slice(0,j+1)+"factorial("+st.slice(j+1,i)+")"+st.slice(i+1);
  }
  st = as.funreplace(st);
  return st;
};


//plots functions, either (x,g(x)) or (f(x),g(x), x ranges, id of graph,
as.plot = function (fun,x_min,x_max,points,id) {
  var pth = [];
  var f = function(x) { return x }, g = fun;
  var name = null;
  if (typeof fun=="string") {
    eval("g = function(x){ with(Math) return "+as.mathjs(fun)+" }");
  } else if (typeof fun=="object") {
    eval("f = function(t){ with(Math) return "+as.mathjs(fun[0])+" }");
    eval("g = function(t){ with(Math) return "+as.mathjs(fun[1])+" }");
  }
  // user did not provide x_min so it defaults and name is that value
  if (typeof x_min=="string") {
      name = x_min;
      x_min = asp.xmin;
  } else {
      name = id;
  };
  var min = (x_min==null?asp.xmin:x_min);
  var max = (x_max==null?asp.xmax:x_max);
  var inc = max-min-0.000001*(max-min);
  inc = (points==null?inc/200:inc/points);
  var gt;
//alert(typeof g(min))
  for (var t = min; t <= max; t += inc) {
    gt = g(t);
    if (!(isNaN(gt)||Math.abs(gt)=="Infinity")) pth[pth.length] = [f(t), gt];
  }
  as.path(pth,name)
  // return p;
};

//expects fun is the slope, guess the values below are chosen to make it look nice
as.slopefield = function (fun,dx,dy) {
  var g = fun;
  if (typeof fun=="string") 
    eval("g = function(x,y){ with(Math) return "+as.mathjs(fun)+" }");
  var gxy,x,y,u,v,dz;
  if (dx==null) dx=1;
  if (dy==null) dy=1;
  dz = Math.sqrt(dx*dx+dy*dy)/6;
  var x_min = Math.ceil(asp.xmin/dx);
  var y_min = Math.ceil(asp.ymin/dy);
  for (x = x_min; x <= asp.xmax; x += dx)
    for (y = y_min; y <= asp.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]);
      }
    }
};

//} ();

};
ascii.initializer();

//remove silly function
delete ascii.initializer;

doubleblankmathdelimiter = false;
//mathcolor ="black";
ascii.math.initSymbols();

ascii.svg.printId = function (txt, id) {
    var node = document.createElement("div");
    var target = document.getElementById(id);
       while (target.firstChild) {
        target.removeChild(target.firstChild);}
    target.appendChild(node);
    wikify(txt, node);
};


//}}}
    
!Basic TiddlyWiki notions
*A chunk of data, like the one you are viewing now is called a tiddler. It consists of a title, a text body, tags (to be used to find similar tiddlers and group them), fields for storing data with the tiddler of any kind, and modifier with dates. 
*Clicking on a blue link opens up the tiddler or closes it if it is open (depending on settings). 
*Double clicking a tiddler shows the code for the tiddler. If you cannot edit it, go to AdvancedOptions and click Edit while HTTPing. This is to prevent you from making changes and not being able to save them. 
*The whole system is called TiddlyWiki and http://www.tiddlywiki.com is the home of the original and a great jumping off point to learn more. 
!Basic syntax common to all TW's and generally wikis
*There is a lot to practice with. Two single quotes on the left and two on the right ''bold'' the quantity surrounded. 
*To italicize use slashes //italics//  {{{//italics// }}}
*Tables are done with vertical bars separating columns:
|hi|first|table|
| hi| first |table |
Type: 
{{{
|hi|first| table|
| hi| first |table |
}}}
Spaces are critical near the bars for changing behavior. 
*Highlighting and general CSS styling are accomplished by pairs of double at signs: @@high@@ or @@font-size:2em;high@@ Type: {{{@@high@@ or @@font-size:2em;high@@}}}
*Bullet lists and numbered lists are done with asterisks and number signs at beginning of line
**Nested is okay  {{{*Bullet lists and numbered lists are done with asterisks and number signs at beginning of line
**Nested is okay
}}}
*Headings are done with exclamations at the beginning of a line. One is   the largest, 5 is the smallest, I believe.
*Links are either done with WikiWords or done by using double square brackets [[Sample Link]].
*No doubt much more such as __this__ or --this-- or even slides and tooltips and images and and and
*Plugins extend this system and there are a lot of amazing ones out there. 
!AsciiMath 
*adapted from Peter Jipsen's AsciiMath.
*To do mathematics, first get FireFox. It can be done in IE and that is on my list, but it is a pain and not very good looking. FireFox 1.5.+ or 2.+ are good. You may need fonts from http://www.mozilla.org/projects/mathml/fonts/
*To do math, use a single backtick, followed by a math expression, followed by another backtick. While styling is doable, that is not quite nicely dealt with yet. Ditto with displaying centered math. But soon. 
*Simple: `x^2 + 3x = 5`  Type:{{{ `x^2 + 3x = 5` }}}
*Calculus:   `(d [int_0^x f(t) dt ])/(dx) = f(x)` Type:{{{ `(d [int_0^x f(t) dt ])/(dx) = f(x)` }}} 
*Functions: `sin(x)/cos(x)=tan(x)` and `e^(ix) = cos(x) + i sin(x)` and `log_3(x)` `root 3 4` Type: {{{`sin(x)/cos(x)=tan(x)` and `e^(ix) = cos(x) + i sin(x)` and `log_3(x)` `root 3 4`}}}
*Matrices:  `[(3,4, 6),(3/4, int_3^4 theta d theta,  sqrt(a_34^56))]` Type: {{{`[(3,4, 6),(3/4, int_3^4 theta d theta,  sqrt(a_34^56))]`}}}
*Symbols:  `Sigma sigma odot oplus otimes in nn cup cap delta del omega psi` Type: {{{`Sigma sigma odot oplus otimes in nn cup cap delta del omega psi` }}}
!AsciiSVG
*adapted from Peter Jipsen's AsciiSVG
*To draw pictures, use 2 backticks on either side. This is a full javascript environment, so be careful. 
*See [[Sample Pictures]] for lots of static examples. Code included in viewpoint.
*See InteractiveGallery for a baby step taste of what can be done. 
/***
|Name:|CloseOnCancelPlugin|
|Description:|Closes the tiddler if you click new tiddler then cancel. Default behaviour is to leave it open|
|Version:|3.0.1a|
|Date:|27-Jun-2011|
|Source:|http://mptw.tiddlyspot.com/#CloseOnCancelPlugin|
|Author:|Simon Baird <simon.baird@gmail.com>|
|License:|http://mptw.tiddlyspot.com/#TheBSDLicense|
***/
//{{{
merge(config.commands.cancelTiddler,{

  handler_mptw_orig_closeUnsaved: config.commands.cancelTiddler.handler,

  handler: function(event,src,title) {
    this.handler_mptw_orig_closeUnsaved(event,src,title);
    if (!story.isDirty(title) && !store.tiddlerExists(title) && !store.isShadowTiddler(title))
      story.closeTiddler(title,true);
    return false;
  }

});

//}}}
''Correo Electrónico'': omanzanilla <en> usb.ve
''Twitter'': @proforestes
''Página Académica'': http://sites.google.com/site/omanzanillausb
''Skype'': orestes.manzanilla
''gtalk-gmail'': ozono27 <en> gmail.com
Se recomienda:
#Ver la [[Presentación en Prezi|PreziPERT-CPMintro]]
#Dar una leída al tema en la [[bibliografía recomendada|Referencias]] y por último la [[Guía|GuiaPERT-CPM]]
#Realizar al menos 2 problemas de CPM y 2 problemas de PERT del [[Problemario|ProblemarioPERT-CPM]]
#Plantear las dudas que puedan presentarse, [[con el profesor|mailto:omanzanilla@usb.ve]]
#Realizar la Tarea web 2.0 del tema, y revisar los materiales encontrados por los compañeros.
[[Inicio]] [[PlanDeTrabajo]]
<html><a title="View DefSolGr on Scribd" href="http://www.scribd.com/doc/98886622/DefSolGr" style="margin: 12px auto 6px auto; font-family: Helvetica,Arial,Sans-serif; font-style: normal; font-variant: normal; font-weight: normal; font-size: 14px; line-height: normal; font-size-adjust: none; font-stretch: normal; -x-system-font: none; display: block; text-decoration: underline;">DefSolGr</a><iframe class="scribd_iframe_embed" src="http://www.scribd.com/embeds/98886622/content?start_page=1&view_mode=list&access_key=key-12ezox2vkj5sy6srgcwt" data-auto-height="true" data-aspect-ratio="0.772727272727273" scrolling="no" id="doc_64151" width="100%" height="600" frameborder="0"></iframe></html>
!Agenda de Sesión 1
#Verificación de Pendientes de clase anterior.
#Exposición del tema, metodología de creación del dual, y utilidad.
#Ejercicio grupal para encontrar el Dual de un modelo primal ejemplo.

!Agenda de Sesión 2
#Verificación de Pendientes de clase anterior. Recepción de tarea individual de Casos Especiales (Solución Gráfica) (5%).
#Ejemplo de formulación de Dual en Excel.
#Resolución de Dual en Excel y deducción de solución del Primal vía resolución de sistema de ecuaciones de variables básicas y restricciones activas.
#Asignación de PL para construcción de dual y resolución en hoja de excel en grupos (5%).
#Envío de [[Asignación Grupal de Dualidad|https://docs.google.com/document/d/1mYzSa70BU7oSAMC9dHGs9Jf_7qJIMnmq_ovMIgVZXso/edit?usp=sharing]].

!Agenda de Sesión 3
#Verificación de pendientes de clase anterior.
#Exposición de Corolarios.
#Ejercicios para ejemplificar uso de corolarios.
#Exposición sobre interpretación económica.
#Asignación de Quiz de Dualidad.

!Recursos de Teoría
*[[Transformación de Primal a Dual|https://sites.google.com/site/omanzanillausb/docencia/ps3161---tecnicas-de-optimizacion/1._Transformacion_de_Primal_a_Dual.pdf?attredirects=0&d=1]]
*[[Corolarios del Teorema de Dualidad|https://sites.google.com/site/omanzanillausb/docencia/ps3161---tecnicas-de-optimizacion/4.-_Corolarios_del_Teorema_D%26eacute%3Bbil_de_Dualidad.pdf?attredirects=0&d=1]]
*[[Interpretación económica del dual|https://sites.google.com/site/omanzanillausb/docencia/ps3161---tecnicas-de-optimizacion/2._Interpretacion_Economica_del_Dual.pdf?attredirects=0&d=1]]

!Recursos de Práctica
*[[Ejercicios de Dualidad para trabajar en clase|https://sites.google.com/site/omanzanillausb/docencia/ps3161---tecnicas-de-optimizacion/5._Enunciados_Problemas_de_Dualidad_para_Trabajar_en_Clase.pdf?attredirects=0&d=1]]
*[[Problemario de Dualidad|https://sites.google.com/site/omanzanillausb/docencia/ps3161---tecnicas-de-optimizacion/0._Problemario_Dualidad.pdf?attredirects=0&d=1]]
*[[Ejercicios de Dualidad|https://sites.google.com/site/omanzanillausb/docencia/ps3161---tecnicas-de-optimizacion/4._Ejercicios_de_Dualidad.pdf?attredirects=0&d=1]]

!Material de 3eros en internet
*http://www.investigaciondeoperaciones.net/dualidad_en_programacion_lineal.html explicación breve de dualidad, como transformar un problema y los teoremas. Carece de ejemplos.
*http://www.uv.es/~sala/Clase11.pdf pdf muy bien construido, con mucha info sobre optimalidad.
Una compañía producie regalos caros y poco comunes para su venta. Se necesita decidir si es recomendable producirlo, y de hacerlo, en qué cantidad. Se obtendrá un pronóstico para calcular cuántos pueden ser vendidos en el mercado. Se desea tomar una decisión que maximice las ganancias.

El costo fijo en que se incurre si se decide producir, es de 50.000 dólares. Este costo no se tendría, si se decide no producir.
El costo de producción (variable) es de 400 dólares por cada producto fabricado. Cada producto puede venderse en 900 dólares.

Construya una hoja de excel que permita apoyar en la toma de esta decisión. Se debe poder utilizar una celda en la que se coloca una cantidad de producción hipotética, y en otra celda debe indicarse la ganancia/pérdida calculada para cada caso de forma automática.
[[Slide1]]
[[Slide2]]
[[Prueba de Programación Lineal]]
[[QueEsLaInvestigacionDeOperaciones]]
[[QueEsLaProgramacionLineal]]
[[FormulandoUnModeloDeProgramacionLineal]]
[[ResolivendoUnModeloDeProgramacionLineal]]
<<slideShow>>
<html><iframe width="420" height="315" src="http://www.youtube.com/embed/a2QgdDk4Xjw" frameborder="0"></iframe></html>
<html><iframe width="420" height="315" src="http://www.youtube.com/embed/pzbSURDWluA" frameborder="0"></iframe></html>
[img[http://lh3.ggpht.com/_jj9y7lDF9zw/S_QGwvzMtyI/AAAAAAAACcw/ZwbyAQSTEfY/Problema%20Planeaci%C3%B3n%20de%20Producci%C3%B3n.jpg]]
/***
|Name:|ExtentTagButtonPlugin|
|Description:|Adds a New tiddler button in the tag drop down|
|Version:|3.2a|
|Date:|27-Jun-2011|
|Source:|http://mptw.tiddlyspot.com/#ExtendTagButtonPlugin|
|Author:|Simon Baird <simon.baird@gmail.com>|
|License|http://mptw.tiddlyspot.com/#TheBSDLicense|
***/
//{{{

window.onClickTag_mptw_orig = window.onClickTag;
window.onClickTag = function(e) {
  window.onClickTag_mptw_orig.apply(this,arguments);
  var tag = this.getAttribute("tag");
  var title = this.getAttribute("tiddler");
  // Thanks Saq, you're a genius :)
  var popup = Popup.stack[Popup.stack.length-1].popup;
  createTiddlyElement(createTiddlyElement(popup,"li",null,"listBreak"),"div");
  wikify("<<newTiddler label:'New tiddler' tag:'"+tag+"'>>",createTiddlyElement(popup,"li"));
  return false;
}

//}}}
<html><iframe width="420" height="315" src="http://www.youtube.com/embed/8qIl5K0EDdg" frameborder="0" allowfullscreen></iframe></html>
!Agenda de Sesión 1
#Verificación de Pendientes de clase anterior.
#Discusión de video sobre I.O.
#Discusión de video sobre PL.
#Formulación conjunta de modelo de PL de dos variables. 
#Formulación individual de modelo de PL de dos variables. ([[disponible acá|https://docs.google.com/document/d/1NGyctOS1uoKJdakAiWBOWffgCSxz04bMn1s5_RsjT-Y/edit]])
#Comentarios de Herramientas de Google Docs
#Asignación de PL para formulación colaborativa Online. ([[disponible acá|https://docs.google.com/document/d/1Qjhpiwc1ns2QRdrzefTOsYitJPvJp6S1FMPBaJfNvxU/edit]])

!Agenda de Sesión 2
#Verificación de Pendientes de clase anterior. Atención: Formación de grupos.
#Discusión breve sobre videos.
#Discusión de dudas sobre formulación colaborativa.
#Formulación conjunta de modelo de PL de más de dos variables.
#Formulación individual de PL de más de dos variables.
#Asignación de PL para formulación en hoja de excel.

[[VideosDeFormulacionEnHojaDeCalculo]]

''Descargar'' [[ProblemarioDeFormulación|https://sites.google.com/site/omanzanillausb/docencia/ps3161---tecnicas-de-optimizacion/0._Problemario-Formulacion.pdf]]

!Agenda de Sesión 3
#Verificación de Pendientes de clase anterior. Atención: dudas del contenido cubierto en el curso, fin de asignación de grupos, dudas sobre uso de google docs.
#Formulación conjunta de modelo de PL de más de dos variables. Repaso, sobre el ejemplo, de conceptos y definiciones de PL.
#Formulación individual de PL de más de dos variables.
#Asignación de PL para formulación en hoja de excel.

!Agenda de Sesión 4
#Discusión de dudas sobre uso de hoja excel para formular PL.
#Formulación problemas 8, 15, 22 y 23 del problemario.
#Asignación de PL para formulación usando MS-Excel (grupal). Problema 7.
#Asignación de PL para formulación individual durante la siguiente clase. Problema 12.
#Envío de Quiz de Formulación.

''Acceder al'' QuizDeFormulación

!Presentaciones en línea sobre Programación Lineal
[[ResumenDeProgramaciónLineal|http://www.slideshare.net/Juanp3000/resumen-programacion-lineal]] - Resúmen muy breve de distintos aspectos de la Programación Lineal

!Videos en línea sobre Programación Lineal y su formulación
#[[FormulandoUnModeloDeProgramacionLineal]] - Video ''básico'' sobre cómo se formula un problema como un modelo de Programación Lineal
#''__Ejemplos de Formulación de Modelos de Programación Lineal__'' - ejemplos de problemas de distinta naturaleza, formulados como modelos de Programación Lineal.
##EjemplosDeFormulaciónPL-1raParte
##EjemplosDeFormulaciónPL-2daParte
https://www.me.utexas.edu/~jensen/ORMM/omie/computation/unit/project/index.html

(Deben descargar el Add-in e instalarlo en excel)

Varias acotaciones:
1) Debe haber 2 actividades "extra", la "start" y la "end".
2) En esas actividades extra, ... no colocar precedentes, ni tiempos
de duración mínimo, probable (likely) ni máximo.
3) Coloquen que la duración de los proyectos es "Random".
4) Desactiven las casillas de "Cash Flow" y "Random Data".

Una vez hayan presionado "Solve", en la columna a la derecha de los
botones tendrán información importante respecto a la fecha de
culminación del proyecto:
Critical = esperanza de ocurrencia del final del proyecto.
Var. = Varianza del momento de finalización del proyecto.
SD = Desviación estándar del momento de finalización del proyecto.
Prob = probabilidad de terminar el proyecto en la el momento que
ustedes hayan colocado en la celda "Due".

Las demás son de menos importancia. Por lo tanto, para encontrar el
día o la semana en la que se puede culminar el proyecto con 80% de
probabilidad, es cosa de "tantear" colocando números en la casilla
descrita como "Due". Noten, que si colocan como numero, exactamente el
que les da la casilla de "Critical", la probabilidad de 0,5.

Eso es porque estarían calculando la probabilidad de culminar
exactamente en la fecha de la esperanza de finalización del proyecto
(y esta se distribuye como una curva normal).
/***
|Name:|HideWhenPlugin|
|Description:|Allows conditional inclusion/exclusion in templates|
|Version:|3.2a|
|Date:|27-Jun-2011|
|Source:|http://mptw.tiddlyspot.com/#HideWhenPlugin|
|Author:|Simon Baird <simon.baird@gmail.com>|
|License:|http://mptw.tiddlyspot.com/#TheBSDLicense|
For use in ViewTemplate and EditTemplate. Example usage:
{{{<div macro="showWhenTagged Task">[[TaskToolbar]]</div>}}}
{{{<div macro="showWhen tiddler.modifier == 'BartSimpson'"><img src="bart.gif"/></div>}}}

Warning: the showWhen and hideWhen macros will blindly eval paramString.
This could be used to execute harmful javascript from a tiddler.

(TODO: Make some effort to sanitize paramString. Perhaps disallow the equals sign?)
***/
//{{{

window.hideWhenLastTest = false;

window.removeElementWhen = function(test,place) {
  window.hideWhenLastTest = test;
  if (test) {
    jQuery(place).empty()
    place.parentNode.removeChild(place);
  }
};

merge(config.macros,{

  hideWhen: { handler: function(place,macroName,params,wikifier,paramString,tiddler) {
    removeElementWhen( eval(paramString), place );
  }},

  showWhen: { handler: function(place,macroName,params,wikifier,paramString,tiddler) {
    removeElementWhen( !eval(paramString), place );
  }},

  hideWhenTagged: { handler: function (place,macroName,params,wikifier,paramString,tiddler) {
    removeElementWhen( tiddler.tags.containsAll(params), place );
  }},

  showWhenTagged: { handler: function (place,macroName,params,wikifier,paramString,tiddler) {
    removeElementWhen( !tiddler.tags.containsAll(params), place );
  }},

  hideWhenTaggedAny: { handler: function (place,macroName,params,wikifier,paramString,tiddler) {
    removeElementWhen( tiddler.tags.containsAny(params), place );
  }},

  showWhenTaggedAny: { handler: function (place,macroName,params,wikifier,paramString,tiddler) {
    removeElementWhen( !tiddler.tags.containsAny(params), place );
  }},

  hideWhenTaggedAll: { handler: function (place,macroName,params,wikifier,paramString,tiddler) {
    removeElementWhen( tiddler.tags.containsAll(params), place );
  }},

  showWhenTaggedAll: { handler: function (place,macroName,params,wikifier,paramString,tiddler) {
    removeElementWhen( !tiddler.tags.containsAll(params), place );
  }},

  hideWhenExists: { handler: function(place,macroName,params,wikifier,paramString,tiddler) {
    removeElementWhen( store.tiddlerExists(params[0]) || store.isShadowTiddler(params[0]), place );
  }},

  showWhenExists: { handler: function(place,macroName,params,wikifier,paramString,tiddler) {
    removeElementWhen( !(store.tiddlerExists(params[0]) || store.isShadowTiddler(params[0])), place );
  }},

  hideWhenTitleIs: { handler: function(place,macroName,params,wikifier,paramString,tiddler) {
    removeElementWhen( tiddler.title == params[0], place );
  }},

  showWhenTitleIs: { handler: function(place,macroName,params,wikifier,paramString,tiddler) {
    removeElementWhen( tiddler.title != params[0], place );
  }},

  'else': { handler: function(place,macroName,params,wikifier,paramString,tiddler) {
    removeElementWhen( !window.hideWhenLastTest, place );
  }}

});

//}}}
<html><a rel="license" href="http://creativecommons.org/licenses/by-nc-sa/3.0/"><img alt="Licencia de Creative Commons" style="border-width:0" src="http://i.creativecommons.org/l/by-nc-sa/3.0/88x31.png" /></a><br /><span xmlns:dct="http://purl.org/dc/terms/" href="http://purl.org/dc/dcmitype/InteractiveResource" property="dct:title" rel="dct:type">Técnicas de Optimización en Modelos Organizacionales</span> by <a xmlns:cc="http://creativecommons.org/ns#" href="sites.google.com/site/omanzanillausb" property="cc:attributionName" rel="cc:attributionURL">Orestes Manzanilla</a> is licensed under a <a rel="license" href="http://creativecommons.org/licenses/by-nc-sa/3.0/">Creative Commons Reconocimiento-NoComercial-CompartirIgual 3.0 Unported License</a>.</html>

[img[PS3161|https://sites.google.com/site/omanzanillausb/docencia/ps3161---tecnicas-de-optimizacion/PS3161.jpg]]
IntroducciónAlCurso
[[Coordenadas del Docente|CoordenadasOManzanilla]]


/***
|''Name:''|InlineJavascriptPlugin|
|''Source:''|http://www.TiddlyTools.com/#InlineJavascriptPlugin|
|''Author:''|Eric Shulman - ELS Design Studios|
|''License:''|[[Creative Commons Attribution-ShareAlike 2.5 License|http://creativecommons.org/licenses/by-sa/2.5/]]|
|''~CoreVersion:''|2.0.10|

Insert Javascript executable code directly into your tiddler content.  Lets you ''call directly into TW core utility routines, define new functions, calculate values, add dynamically-generated TiddlyWiki-formatted output'' into tiddler content, or perform any other programmatic actions each time the tiddler is rendered.
!!!!!Usage
<<<
When installed, this plugin adds new wiki syntax for surrounding tiddler content with {{{<script>}}} and {{{</script>}}} markers, so that it can be treated as embedded javascript and executed each time the tiddler is rendered.

''Deferred execution from an 'onClick' link''
By including a label="..." parameter in the initial {{{<script>}}} marker, the plugin will create a link to an 'onclick' script that will only be executed when that specific link is clicked, rather than running the script each time the tiddler is rendered.

''External script source files:''
You can also load javascript from an external source URL, by including a src="..." parameter in the initial {{{<script>}}} marker (e.g., {{{<script src="demo.js"></script>}}}).  This is particularly useful when incorporating third-party javascript libraries for use in custom extensions and plugins.  The 'foreign' javascript code remains isolated in a separate file that can be easily replaced whenever an updated library file becomes available.

''Display script source in tiddler output''
By including the keyword parameter "show", in the initial {{{<script>}}} marker, the plugin will include the script source code in the output that it displays in the tiddler.

''Defining javascript functions and libraries:''
Although the external javascript file is loaded while the tiddler content is being rendered, any functions it defines will not be available for use until //after// the rendering has been completed.  Thus, you cannot load a library and //immediately// use it's functions within the same tiddler.  However, once that tiddler has been loaded, the library functions can be freely used in any tiddler (even the one in which it was initially loaded).

To ensure that your javascript functions are always available when needed, you should load the libraries from a tiddler that will be rendered as soon as your TiddlyWiki document is opened.  For example, you could put your {{{<script src="..."></script>}}} syntax into a tiddler called LoadScripts, and then add {{{<<tiddler LoadScripts>>}}} in your MainMenu tiddler.

Since the MainMenu is always rendered immediately upon opening your document, the library will always be loaded before any other tiddlers that rely upon the functions it defines.  Loading an external javascript library does not produce any direct output in the tiddler, so these definitions should have no impact on the appearance of your MainMenu.

''Creating dynamic tiddler content''
An important difference between this implementation of embedded scripting and conventional embedded javascript techniques for web pages is the method used to produce output that is dynamically inserted into the document:
* In a typical web document, you use the document.write() function to output text sequences (often containing HTML tags) that are then rendered when the entire document is first loaded into the browser window.
* However, in a ~TiddlyWiki document, tiddlers (and other DOM elements) are created, deleted, and rendered "on-the-fly", so writing directly to the global 'document' object does not produce the results you want (i.e., replacing the embedded script within the tiddler content), and completely replaces the entire ~TiddlyWiki document in your browser window.
* To allow these scripts to work unmodified, the plugin automatically converts all occurences of document.write() so that the output is inserted into the tiddler content instead of replacing the entire ~TiddlyWiki document.

If your script does not use document.write() to create dynamically embedded content within a tiddler, your javascript can, as an alternative, explicitly return a text value that the plugin can then pass through the wikify() rendering engine to insert into the tiddler display.  For example, using {{{return "thistext"}}} will produce the same output as {{{document.write("thistext")}}}.

//Note: your script code is automatically 'wrapped' inside a function, {{{_out()}}}, so that any return value you provide can be correctly handled by the plugin and inserted into the tiddler.  To avoid unpredictable results (and possibly fatal execution errors), this function should never be redefined or called from ''within'' your script code.//

''Accessing the ~TiddlyWiki DOM''
The plugin provides one pre-defined variable, 'place', that is passed in to your javascript code so that it can have direct access to the containing DOM element into which the tiddler output is currently being rendered.

Access to this DOM element allows you to create scripts that can:
* vary their actions based upon the specific location in which they are embedded
* access 'tiddler-relative' information (use findContainingTiddler(place))
* perform direct DOM manipulations (when returning wikified text is not enough)
<<<
!!!!!Examples
<<<
an "alert" message box:
><script show>
	alert('InlineJavascriptPlugin: this is a demonstration message');
</script>
dynamic output:
><script show>
	return (new Date()).toString();
</script>
wikified dynamic output:
><script show>
	return "link to current user: [["+config.options.txtUserName+"]]";
</script>
dynamic output using 'place' to get size information for current tiddler:
><script show>
   if (!window.story) window.story=window;
   var title=story.findContainingTiddler(place).id.substr(7);
   return title+" is using "+store.getTiddlerText(title).length+" bytes";
</script>
creating an 'onclick' button/link that runs a script:
><script label="click here" show>
   if (!window.story) window.story=window;
   alert("Hello World!\nlinktext='"+place.firstChild.data+"'\ntiddler='"+story.findContainingTiddler(place).id.substr(7)+"'");
</script>
loading a script from a source url:
>http://www.TiddlyTools.com/demo.js contains:
>>{{{function demo() { alert('this output is from demo(), defined in demo.js') } }}}
>>{{{alert('InlineJavascriptPlugin: demo.js has been loaded'); }}}
><script src="demo.js" show>
	return "loading demo.js..."
</script>
><script label="click to execute demo() function" show>
	demo()
</script>
<<<
!!!!!Installation
<<<
import (or copy/paste) the following tiddlers into your document:
''InlineJavascriptPlugin'' (tagged with <<tag systemConfig>>)
<<<
!!!!!Revision History
<<<
''2006.10.16 [1.5.2]'' add newline before closing '}' in 'function out_' wrapper.  Fixes error caused when last line of script is a comment.
''2006.06.01 [1.5.1]'' when calling wikify() on script return value, pass hightlightRegExp and tiddler params so macros that rely on these values can render properly
''2006.04.19 [1.5.0]'' added 'show' parameter to force display of javascript source code in tiddler output
''2006.01.05 [1.4.0]'' added support 'onclick' scripts.  When label="..." param is present, a button/link is created using the indicated label text, and the script is only executed when the button/link is clicked.  'place' value is set to match the clicked button/link element.
''2005.12.13 [1.3.1]'' when catching eval error in IE, e.description contains the error text, instead of e.toString().  Fixed error reporting so IE shows the correct response text.  Based on a suggestion by UdoBorkowski
''2005.11.09 [1.3.0]'' for 'inline' scripts (i.e., not scripts loaded with src="..."), automatically replace calls to 'document.write()' with 'place.innerHTML+=' so script output is directed into tiddler content.  Based on a suggestion by BradleyMeck
''2005.11.08 [1.2.0]'' handle loading of javascript from an external URL via src="..." syntax
''2005.11.08 [1.1.0]'' pass 'place' param into scripts to provide direct DOM access 
''2005.11.08 [1.0.0]'' initial release
<<<
!!!!!Credits
<<<
This feature was developed by EricShulman from [[ELS Design Studios|http:/www.elsdesign.com]]
<<<
!!!!!Code
***/
//{{{
version.extensions.inlineJavascript= {major: 1, minor: 5, revision: 2, date: new Date(2006,10,16)};

config.formatters.push( {
	name: "inlineJavascript",
	match: "\\<script",
	lookahead: "\\<script(?: src=\\\"((?:.|\\n)*?)\\\")?(?: label=\\\"((?:.|\\n)*?)\\\")?( show)?\\>((?:.|\\n)*?)\\</script\\>",

	handler: function(w) {
		var lookaheadRegExp = new RegExp(this.lookahead,"mg");
		lookaheadRegExp.lastIndex = w.matchStart;
		var lookaheadMatch = lookaheadRegExp.exec(w.source)
		if(lookaheadMatch && lookaheadMatch.index == w.matchStart) {
			if (lookaheadMatch[1]) { // load a script library
				// make script tag, set src, add to body to execute, then remove for cleanup
				var script = document.createElement("script"); script.src = lookaheadMatch[1];
				document.body.appendChild(script); document.body.removeChild(script);
			}
			if (lookaheadMatch[4]) { // there is script code
				if (lookaheadMatch[3]) // show inline script code in tiddler output
					wikify("{{{\n"+lookaheadMatch[0]+"\n}}}\n",w.output);
				if (lookaheadMatch[2]) { // create a link to an 'onclick' script
					// add a link, define click handler, save code in link (pass 'place'), set link attributes
					var link=createTiddlyElement(w.output,"a",null,"tiddlyLinkExisting",lookaheadMatch[2]);
					link.onclick=function(){try{return(eval(this.code))}catch(e){alert(e.description?e.description:e.toString())}}
					link.code="function _out(place){"+lookaheadMatch[4]+"\n};_out(this);"
					link.setAttribute("href","javascript:;"); link.setAttribute("title",""); link.style.cursor="pointer";
				}
				else { // run inline script code
					var code="function _out(place){"+lookaheadMatch[4]+"\n};_out(w.output);"
					code=code.replace(/document.write\(/gi,'place.innerHTML+=(');
					try { var out = eval(code); } catch(e) { out = e.description?e.description:e.toString(); }
					if (out && out.length) wikify(out,w.output,w.highlightRegExp,w.tiddler);
				}
			}
			w.nextMatch = lookaheadMatch.index + lookaheadMatch[0].length;
		}
	}
} )
//}}}
/***
|Name:|InstantTimestampPlugin|
|Description:|A handy way to insert timestamps in your tiddler content|
|Version:|1.0.10a|
|Date:|27-Jun-2011|
|Source:|http://mptw.tiddlyspot.com/#InstantTimestampPlugin|
|Author:|Simon Baird <simon.baird@gmail.com>|
|License:|http://mptw.tiddlyspot.com/#TheBSDLicense|
!!Usage
If you enter {ts} in your tiddler content (without the spaces) it will be replaced with a timestamp when you save the tiddler. Full list of formats:
* {ts} or {t} -> timestamp
* {ds} or {d} -> datestamp
* !ts or !t at start of line -> !!timestamp
* !ds or !d at start of line -> !!datestamp
(I added the extra ! since that's how I like it. Remove it from translations below if required)
!!Notes
* Change the timeFormat and dateFormat below to suit your preference.
* See also http://mptw2.tiddlyspot.com/#AutoCorrectPlugin
* You could invent other translations and add them to the translations array below.
***/
//{{{

config.InstantTimestamp = {

  // adjust to suit
  timeFormat: 'DD/0MM/YY 0hh:0mm',
  dateFormat: 'DD/0MM/YY',

  translations: [
    [/^!ts?$/img,  "'!!{{ts{'+now.formatString(config.InstantTimestamp.timeFormat)+'}}}'"],
    [/^!ds?$/img,  "'!!{{ds{'+now.formatString(config.InstantTimestamp.dateFormat)+'}}}'"],

    // thanks Adapted Cat
    [/\{ts?\}(?!\}\})/ig,"'{{ts{'+now.formatString(config.InstantTimestamp.timeFormat)+'}}}'"],
    [/\{ds?\}(?!\}\})/ig,"'{{ds{'+now.formatString(config.InstantTimestamp.dateFormat)+'}}}'"]

  ],

  excludeTags: [
    "noAutoCorrect",
    "noTimestamp",
    "html",
    "CSS",
    "css",
    "systemConfig",
    "systemConfigDisabled",
    "zsystemConfig",
    "Plugins",
    "Plugin",
    "plugins",
    "plugin",
    "javascript",
    "code",
    "systemTheme",
    "systemPalette"
  ],

  excludeTiddlers: [
    "StyleSheet",
    "StyleSheetLayout",
    "StyleSheetColors",
    "StyleSheetPrint"
    // more?
  ]

};

TiddlyWiki.prototype.saveTiddler_mptw_instanttimestamp = TiddlyWiki.prototype.saveTiddler;
TiddlyWiki.prototype.saveTiddler = function(title,newTitle,newBody,modifier,modified,tags,fields,clearChangeCount,created) {

  tags = tags ? tags : []; // just in case tags is null
  tags = (typeof(tags) == "string") ? tags.readBracketedList() : tags;
  var conf = config.InstantTimestamp;

  if ( !tags.containsAny(conf.excludeTags) && !conf.excludeTiddlers.contains(newTitle) ) {

    var now = new Date();
    var trans = conf.translations;
    for (var i=0;i<trans.length;i++) {
      newBody = newBody.replace(trans[i][0], eval(trans[i][1]));
    }
  }

  // TODO: use apply() instead of naming all args?
  return this.saveTiddler_mptw_instanttimestamp(title,newTitle,newBody,modifier,modified,tags,fields,clearChangeCount,created);
}

// you can override these in StyleSheet
setStylesheet(".ts,.ds { font-style:italic; }","instantTimestampStyles");

//}}}
#[[¿De qué trata el tema?]]
#[[Cómo transitar el tema con éxito]]
#''Introducción a PERT-CPM''
##[[Presentación en Prezi|PreziPERT-COMintro]] [[(ver fuera de esta wiki)|http://prezi.com/r5xjr9aas_d8/introduccion-a-pert-cpm/?utm_source=prezi-view&utm_medium=ending-bar&utm_content=Title-link&utm_campaign=ending-bar-tryout]]
##[[Quiz introductorio|QuizPERT-CPMintro]]
#''Algoritmos y métodos en PERT-CPM''
##[[GuiaPERT-CPM (descargar pdf)|https://sites.google.com/site/omanzanillausb/docencia/ps3161---tecnicas-de-optimizacion/SesionCPM_y_PERT.pdf?attredirects=0&d=1]]
##[[Ejemplo (descargar pdf)|https://sites.google.com/site/omanzanillausb/docencia/ps3161---tecnicas-de-optimizacion/2.-_Clase_del_Laboratorio_3.pdf?attredirects=0&d=1]]
##[[Problemario (descargar pdf)|https://sites.google.com/site/omanzanillausb/docencia/ps3161---tecnicas-de-optimizacion/0.-_Problemario-PertCPM.pdf?attredirects=0&d=1]]
##[[Proyecto PERT-CPM]]
#[[Tarea web 2.0|TareaWebPERT-CPM]]

!Agenda de clase
#Presentación del docente
#Leer la nota informativa
#Conocer las plataformas y métodos de evaluación
#Discusión sobre el concepto de Investigación de Operaciones
#Resolver prueba diagnóstica
#Asignación de lectura de material.

!Pendientes de la clase:
#[[Prueba Diagnóstica|https://docs.google.com/document/d/1SW-QeS7Iha1edFOGjUHKFIWfpgfwaJWIYk4HCJDxgVI/edit]]
#[[Problema|EjemploDePuntoDeEquilibrio]] a resolver para el jueves 10-01-2012 en Microsoft Excel
#Escribir a ozono27@gmail.com desde el correo personal (no usb.ve)
#Activar la cuenta USB en Google Apps.
#Inscribirse en Aula Virtual
#En caso de no haber finalizado la prueba diagnóstica, terminarla para el jueves.
#Revisar los materiales abajo indicados


!Videos en línea sobre Investigación de Operaciones y Programación Lineal
[[QueEsLaInvestigacionDeOperaciones]] - Video para comprender más lo que es la Investigación de Operaciones como un área del conocimiento.
[[AntecedentesDeLaInvestigacionDeOperaciones]] - Video que comenta sobre los antecedentes históricos y conceptos relacionados con la Investigación de Operaciones.
[[QueEsLaProgramacionLineal]] - Videos para comprender, en particular, la técnica de optimización llamada Programación Lineal.

!Hablando de Investigación de Operaciones en la red (artículos de blogs)
[[ArticuloQuéEsLaInvestigaciónDeOperaciones|http://optimachine.blogspot.com/2007/06/qu-es-la-investigacin-de-operaciones.html]] - Artículo reflexionando sobre la definición del área de Investigación de Operaciones
[[ArtículoRegresiónUsandoPL|http://optimachine.blogspot.com/2008/02/regresin-usando-programacin-lineal.html]] - Artículo mostrando cómo se puede usar la programación lineal (resolviendo con Excel Solver), para obtener una regresión. Normalmente esto se hace minimizando el cuadrado de los errores, mediante el método lamado "Mínimos Cuadrados".
[[BlogSobreAplicacionesRealesDeLaOptimizaciónLineal|http://opti-lineal.blogspot.com/]] - Blog con publicaciones del curso de Modelos Lineales, sobre aplicaciones reales de la Programación Lineal.
[[ArtículoPsicologíaAplicadaEnMáquinasDeAprendizaje|http://optimachine.blogspot.com/2008/05/psicologa-aplicada-en-mquinas-de.html]] - Un ejemplo de cómo la experiencia y conocimiento de una persona experta en un tema "blando", logra mejorar resultados, al incluír sus criterios en el diseño de métodos matemáticos.
[[BlogSobreOptimizaciónYmáquinasDeAprendizaje|http://opti-lineal.blogspot.com/]] - Blog sobre algunos temas de Máquinas de Aprendizaje (también llamado Aprendizaje Automático) e Investigación de Operaciones.

!Recurdos adicionales en internet:
[[VideoHechoPorEstudiantes|http://www.youtube.com/watch?v=Va2K5d5kMjg]]
[[VideoDeHistoriaFases-y-Tecnicas|http://www.youtube.com/watch?v=ElPAJ6zSON0]]
En un mundo globalizado, en el que con frecuencia se toman decisiones de diseño de procesos y 
de planificación, involucrando millones de pequeñas decisiones, muchas empresas de alto nivel 
recurren a métodos lógico-matemáticos para ayudarse en las decisiones.
Con sus operaciones y decisiones, la empresa o institución tiene siempre uno o más objetivos (a 
veces contradictorios en sus implicaciones), como por ejemplo:
*Minimizar costos
*Minimizar retrasos en las fechas de cumplimiento
*Minimizar riesgos
*Maximizar ganancias
*Maximizar calidad
*Minimizar desechos
Las miles de decisiones que deben tomarse en sistemas organizacionales complejos, con 
frecuencia deben respetar ciertas limitaciones que invalidarían algunas posibles formas de 
resolver los problemas, tanto por infactibilidad física, como porque implicarían el incumplimiento 
de políticas y legislaciones. 
Ejemplos de estas limitantes, que son llamadas “restricciones”, pueden ser:
*No agotar el presupuesto
*No puede utilizarse una máquina para procesar más de un producto a la vez
*No se puede exceder el horario laboral
*Lo que se produce, se debe almacenar o vender
*Para producir un bien, se requiere cierta cantidad de cierto material
*No puede utilizarse más material del que se dispone
*No puede generarse más contaminación de la que permite la legislación
*No puede dejar de satisfacerse la demanda
En el área de la Optimización, que forma parte de la ciencia de la Investigación de Operaciones, se 
crean modelos matemáticos de las infinitas maneras “válidas” de resolver el problema o conjunto 
de decisiones a tomar, y se genera una expresión matemática que permite saber una medida 
cuantitativa del cumplimiento de un objetivo. De esta forma, el optimizador, junto a un equipo 
interdisciplinario:
#Convierte el problema en un modelo matemático.
#Selecciona un método computacional para encontrar la solución que, respetando las 
limitaciones, cumpla lo mejor posible el objetivo.
#Emplea el método para obtener una solución.
#Interpreta la solución para dar recomendaciones sobre el sistema real.
A lo largo del curso, se aprenderá a realizar estos 4 pasos, en particular para problemas 
organizacionales. Esto se aclara, debido a que la optimización también se utiliza para una 
innumerable cantidad de áreas, como:
#Diseño en ingeniería
#Ecología
#Diseño de sistemas de información
#Diseño de sistemas de control
#Análisis de datos
#Inteligencia Artificial
#Operaciones militares
Al final del curso, el estudiante podrá, en problemas típicos de decisiones organizacionales, 
plantear modelos de optimización, introducirlos en paquetes computacionales especializados, 
obtener resultados óptimos e interpretar sus respuestas.
/***
|Name:|LessBackupsPlugin|
|Description:|Intelligently limit the number of backup files you create|
|Version:|3.0.1a|
|Date:|27-Jun-2011|
|Source:|http://mptw.tiddlyspot.com/#LessBackupsPlugin|
|Author:|Simon Baird|
|Email:|simon.baird@gmail.com|
|License:|http://mptw.tiddlyspot.com/#TheBSDLicense|
!!Description
You end up with just backup one per year, per month, per weekday, per hour, minute, and second.  So total number won't exceed about 200 or so. Can be reduced by commenting out the seconds/minutes/hours line from modes array
!!Notes
Works in IE and Firefox only.  Algorithm by Daniel Baird. IE specific code by by Saq Imtiaz.
***/
//{{{

var MINS  = 60 * 1000;
var HOURS = 60 * MINS;
var DAYS  = 24 * HOURS;

if (!config.lessBackups) {
  config.lessBackups = {
    // comment out the ones you don't want or set config.lessBackups.modes in your 'tweaks' plugin
    modes: [
      ["YYYY",  365*DAYS], // one per year for ever
      ["MMM",   31*DAYS],  // one per month
      ["ddd",   7*DAYS],   // one per weekday
      //["d0DD",  1*DAYS],   // one per day of month
      ["h0hh",  24*HOURS], // one per hour
      ["m0mm",  1*HOURS],  // one per minute
      ["s0ss",  1*MINS],   // one per second
      ["latest",0]         // always keep last version. (leave this).
    ]
  };
}

window.getSpecialBackupPath = function(backupPath) {

  var now = new Date();

  var modes = config.lessBackups.modes;

  for (var i=0;i<modes.length;i++) {

    // the filename we will try
    var specialBackupPath = backupPath.replace(/(\.)([0-9]+\.[0-9]+)(\.html)$/,
        '$1'+now.formatString(modes[i][0]).toLowerCase()+'$3')

    // open the file
    try {
      if (config.browser.isIE) {
        var fsobject = new ActiveXObject("Scripting.FileSystemObject")
        var fileExists  = fsobject.FileExists(specialBackupPath);
        if (fileExists) {
          var fileObject = fsobject.GetFile(specialBackupPath);
          var modDate = new Date(fileObject.DateLastModified).valueOf();
        }
      }
      else {
        netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
        var file = Components.classes["@mozilla.org/file/local;1"].createInstance(Components.interfaces.nsILocalFile);
        file.initWithPath(specialBackupPath);
        var fileExists = file.exists();
        if (fileExists) {
          var modDate = file.lastModifiedTime;
        }
      }
    }
    catch(e) {
      // give up
      return backupPath;
    }

    // expiry is used to tell if it's an 'old' one. Eg, if the month is June and there is a
    // June file on disk that's more than an month old then it must be stale so overwrite
    // note that "latest" should be always written because the expiration period is zero (see above)
    var expiry = new Date(modDate + modes[i][1]);
    if (!fileExists || now > expiry)
      return specialBackupPath;
  }
}

// hijack the core function
window.getBackupPath_mptw_orig = window.getBackupPath;
window.getBackupPath = function(localPath) {
  return getSpecialBackupPath(getBackupPath_mptw_orig(localPath));
}

//}}}
/***
|''Name:''|LoadRemoteFileThroughProxy (previous LoadRemoteFileHijack)|
|''Description:''|When the TiddlyWiki file is located on the web (view over http) the content of [[SiteProxy]] tiddler is added in front of the file url. If [[SiteProxy]] does not exist "/proxy/" is added. |
|''Version:''|1.1.0|
|''Date:''|mar 17, 2007|
|''Source:''|http://tiddlywiki.bidix.info/#LoadRemoteFileHijack|
|''Author:''|BidiX (BidiX (at) bidix (dot) info)|
|''License:''|[[BSD open source license|http://tiddlywiki.bidix.info/#%5B%5BBSD%20open%20source%20license%5D%5D ]]|
|''~CoreVersion:''|2.2.0|
***/
//{{{
version.extensions.LoadRemoteFileThroughProxy = {
 major: 1, minor: 1, revision: 0, 
 date: new Date("mar 17, 2007"), 
 source: "http://tiddlywiki.bidix.info/#LoadRemoteFileThroughProxy"};

if (!window.bidix) window.bidix = {}; // bidix namespace
if (!bidix.core) bidix.core = {};

bidix.core.loadRemoteFile = loadRemoteFile;
loadRemoteFile = function(url,callback,params)
{
 if ((document.location.toString().substr(0,4) == "http") && (url.substr(0,4) == "http")){ 
 url = store.getTiddlerText("SiteProxy", "/proxy/") + url;
 }
 return bidix.core.loadRemoteFile(url,callback,params);
}
//}}}
[[Inicio]] [[Formulación|FormularPL]] [[SolucionGráfica|ResolverPLconGrafica]] [[DefinicionesYAlgoritmos]] [[AnálisisDeSensibilidad]] [[Transporte-Transbordo]] [[PERT-CPM]] [[Simulación]] [[OtrosModelosDeRedes]] 
/***
|''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.4.6|
|''Date:''|2012-12-29|
|''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(a,g){var f=(g||"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz").split("");var e=[],c=Math.random;var d=f.length;for(var b=0;b<a;b++){e[b]=f[0|c()*d]}return e.join("")};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};(function(){var a=jQuery.fn.attr,b="http://www.w3.org/2000/svg";jQuery.fn.attr=function(m,l){var g=this.length;if(!g){return this}for(var f=0;f<g;f++){var c=this[f];if(c.namespaceURI===b){if(l!==undefined){c.setAttribute(m,l)}else{if($.isArray(m)){var d=m.length,e={};while(d--){var k=m[d];var h=c.getAttribute(k);if(h||h==="0"){h=isNaN(h)?h:h-0}e[k]=h}return e}else{if(typeof m==="object"){for(v in m){c.setAttribute(v,m[v])}}else{var h=c.getAttribute(m);if(h||h==="0"){h=isNaN(h)?h:h-0}return h}}}}else{return a.apply(this,arguments)}}return this}}());var MSVG=function($){var cal=["\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 frk=["\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 bbb=["\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 CONST=0,UNARY=1,BINARY=2,INFIX=3,LEFTBRACKET=4,RIGHTBRACKET=5,SPACE=6,UNDEROVER=7,DEFINITION=8,LEFTRIGHT=9,TEXT=10,BIG=11,STRETCHY=13,MATRIX=14;var symbols=[{input:"\\varepsilon",tag:"mi",output:"\u025B",ttype:CONST},{input:"\\varsigma",tag:"mi",output:"\u03C2",ttype:CONST},{input:"\\vartheta",tag:"mi",output:"\u03D1",ttype:CONST},{input:"\\varphi",tag:"mi",output:"\u03D5",ttype:CONST},{input:"\\varpi",tag:"mi",output:"\u03D6",ttype:CONST},{input:"\\varrho",tag:"mi",output:"\u03F1",ttype:CONST},{input:"\\alpha",tag:"mi",output:"\u03B1",ttype:CONST},{input:"\\beta",tag:"mi",output:"\u03B2",ttype:CONST},{input:"\\gamma",tag:"mi",output:"\u03B3",ttype:CONST},{input:"\\delta",tag:"mi",output:"\u03B4",ttype:CONST},{input:"\\epsilon",tag:"mi",output:"\u03B5",ttype:CONST},{input:"\\zeta",tag:"mi",output:"\u03B6",ttype:CONST},{input:"\\eta",tag:"mi",output:"\u03B7",ttype:CONST},{input:"\\theta",tag:"mi",output:"\u03B8",ttype:CONST},{input:"\\iota",tag:"mi",output:"\u03B9",ttype:CONST},{input:"\\kappa",tag:"mi",output:"\u03BA",ttype:CONST},{input:"\\lambda",tag:"mi",output:"\u03BB",ttype:CONST},{input:"\\mu",tag:"mi",output:"\u03BC",ttype:CONST},{input:"\\nu",tag:"mi",output:"\u03BD",ttype:CONST},{input:"\\xi",tag:"mi",output:"\u03BE",ttype:CONST},{input:"\\omicron",tag:"mi",output:"\u03BF",ttype:CONST},{input:"\\pi",tag:"mi",output:"\u03C0",ttype:CONST},{input:"\\rho",tag:"mi",output:"\u03C1",ttype:CONST},{input:"\\sigma",tag:"mi",output:"\u03C3",ttype:CONST},{input:"\\tau",tag:"mi",output:"\u03C4",ttype:CONST},{input:"\\upsilon",tag:"mi",output:"\u03C5",ttype:CONST},{input:"\\phi",tag:"mi",output:"\u03C6",ttype:CONST},{input:"\\chi",tag:"mi",output:"\u03C7",ttype:CONST},{input:"\\psi",tag:"mi",output:"\u03C8",ttype:CONST},{input:"\\omega",tag:"mi",output:"\u03C9",ttype:CONST},{input:"\\Alpha",tag:"mo",output:"\u0391",ttype:CONST},{input:"\\Beta",tag:"mo",output:"\u0392",ttype:CONST},{input:"\\Gamma",tag:"mo",output:"\u0393",ttype:CONST},{input:"\\Delta",tag:"mo",output:"\u0394",ttype:CONST},{input:"\\Epsilon",tag:"mo",output:"\u0395",ttype:CONST},{input:"\\Zeta",tag:"mo",output:"\u0396",ttype:CONST},{input:"\\Eta",tag:"mo",output:"\u0397",ttype:CONST},{input:"\\Theta",tag:"mo",output:"\u0398",ttype:CONST},{input:"\\Iota",tag:"mo",output:"\u0399",ttype:CONST},{input:"\\Kappa",tag:"mo",output:"\u039A",ttype:CONST},{input:"\\Lambda",tag:"mo",output:"\u039B",ttype:CONST},{input:"\\Mu",tag:"mo",output:"\u039C",ttype:CONST},{input:"\\Nu",tag:"mo",output:"\u039D",ttype:CONST},{input:"\\Xi",tag:"mo",output:"\u039E",ttype:CONST},{input:"\\Omicron",tag:"mo",output:"\u039F",ttype:CONST},{input:"\\Pi",tag:"mo",output:"\u03A0",ttype:CONST},{input:"\\Rho",tag:"mo",output:"\u03A1",ttype:CONST},{input:"\\Sigma",tag:"mo",output:"\u03A3",ttype:CONST},{input:"\\Tau",tag:"mo",output:"\u03A4",ttype:CONST},{input:"\\Upsilon",tag:"mo",output:"\u03A5",ttype:CONST},{input:"\\Phi",tag:"mo",output:"\u03A6",ttype:CONST},{input:"\\Chi",tag:"mo",output:"\u03A7",ttype:CONST},{input:"\\Psi",tag:"mo",output:"\u03A8",ttype:CONST},{input:"\\Omega",tag:"mo",output:"\u03A9",ttype:CONST},{input:"\\frac12",tag:"mo",output:"\u00BD",ttype:CONST},{input:"\\frac14",tag:"mo",output:"\u00BC",ttype:CONST},{input:"\\frac34",tag:"mo",output:"\u00BE",ttype:CONST},{input:"\\frac13",tag:"mo",output:"\u2153",ttype:CONST},{input:"\\frac23",tag:"mo",output:"\u2154",ttype:CONST},{input:"\\frac15",tag:"mo",output:"\u2155",ttype:CONST},{input:"\\frac25",tag:"mo",output:"\u2156",ttype:CONST},{input:"\\frac35",tag:"mo",output:"\u2157",ttype:CONST},{input:"\\frac45",tag:"mo",output:"\u2158",ttype:CONST},{input:"\\frac16",tag:"mo",output:"\u2159",ttype:CONST},{input:"\\frac56",tag:"mo",output:"\u215A",ttype:CONST},{input:"\\frac18",tag:"mo",output:"\u215B",ttype:CONST},{input:"\\frac38",tag:"mo",output:"\u215C",ttype:CONST},{input:"\\frac58",tag:"mo",output:"\u215D",ttype:CONST},{input:"\\frac78",tag:"mo",output:"\u215E",ttype:CONST},{input:"\\pm",tag:"mo",output:"\u00B1",ttype:CONST},{input:"\\mp",tag:"mo",output:"\u2213",ttype:CONST},{input:"\\triangleleft",tag:"mo",output:"\u22B2",ttype:CONST},{input:"\\triangleright",tag:"mo",output:"\u22B3",ttype:CONST},{input:"\\cdot",tag:"mo",output:"\u22C5",ttype:CONST},{input:"\\star",tag:"mo",output:"\u22C6",ttype:CONST},{input:"\\ast",tag:"mo",output:"\u002A",ttype:CONST},{input:"\\times",tag:"mo",output:"\u00D7",ttype:CONST},{input:"\\div",tag:"mo",output:"\u00F7",ttype:CONST},{input:"\\circ",tag:"mo",output:"\u2218",ttype:CONST},{input:"\\bullet",tag:"mo",output:"\u2022",ttype:CONST},{input:"\\oplus",tag:"mo",output:"\u2295",ttype:CONST},{input:"\\ominus",tag:"mo",output:"\u2296",ttype:CONST},{input:"\\otimes",tag:"mo",output:"\u2297",ttype:CONST},{input:"\\bigcirc",tag:"mo",output:"\u25CB",ttype:CONST},{input:"\\oslash",tag:"mo",output:"\u2298",ttype:CONST},{input:"\\odot",tag:"mo",output:"\u2299",ttype:CONST},{input:"\\land",tag:"mo",output:"\u2227",ttype:CONST},{input:"\\wedge",tag:"mo",output:"\u2227",ttype:CONST},{input:"\\lor",tag:"mo",output:"\u2228",ttype:CONST},{input:"\\vee",tag:"mo",output:"\u2228",ttype:CONST},{input:"\\cap",tag:"mo",output:"\u2229",ttype:CONST},{input:"\\cup",tag:"mo",output:"\u222A",ttype:CONST},{input:"\\sqcap",tag:"mo",output:"\u2293",ttype:CONST},{input:"\\sqcup",tag:"mo",output:"\u2294",ttype:CONST},{input:"\\uplus",tag:"mo",output:"\u228E",ttype:CONST},{input:"\\amalg",tag:"mo",output:"\u2210",ttype:CONST},{input:"\\bigtriangleup",tag:"mo",output:"\u25B3",ttype:CONST},{input:"\\bigtriangledown",tag:"mo",output:"\u25BD",ttype:CONST},{input:"\\dag",tag:"mo",output:"\u2020",ttype:CONST},{input:"\\dagger",tag:"mo",output:"\u2020",ttype:CONST},{input:"\\ddag",tag:"mo",output:"\u2021",ttype:CONST},{input:"\\ddagger",tag:"mo",output:"\u2021",ttype:CONST},{input:"\\lhd",tag:"mo",output:"\u22B2",ttype:CONST},{input:"\\rhd",tag:"mo",output:"\u22B3",ttype:CONST},{input:"\\unlhd",tag:"mo",output:"\u22B4",ttype:CONST},{input:"\\unrhd",tag:"mo",output:"\u22B5",ttype:CONST},{input:"\\sum",tag:"mo",output:"\u2211",ttype:UNDEROVER},{input:"\\prod",tag:"mo",output:"\u220F",ttype:UNDEROVER},{input:"\\bigcap",tag:"mo",output:"\u22C2",ttype:UNDEROVER},{input:"\\bigcup",tag:"mo",output:"\u22C3",ttype:UNDEROVER},{input:"\\bigwedge",tag:"mo",output:"\u22C0",ttype:UNDEROVER},{input:"\\bigvee",tag:"mo",output:"\u22C1",ttype:UNDEROVER},{input:"\\bigsqcap",tag:"mo",output:"\u2A05",ttype:UNDEROVER},{input:"\\bigsqcup",tag:"mo",output:"\u2A06",ttype:UNDEROVER},{input:"\\coprod",tag:"mo",output:"\u2210",ttype:UNDEROVER},{input:"\\bigoplus",tag:"mo",output:"\u2A01",ttype:UNDEROVER},{input:"\\bigotimes",tag:"mo",output:"\u2A02",ttype:UNDEROVER},{input:"\\bigodot",tag:"mo",output:"\u2A00",ttype:UNDEROVER},{input:"\\biguplus",tag:"mo",output:"\u2A04",ttype:UNDEROVER},{input:"\\int",tag:"mo",output:"\u222B",ttype:CONST},{input:"\\oint",tag:"mo",output:"\u222E",ttype:CONST},{input:":=",tag:"mo",output:":=",ttype:CONST},{input:"\\lt",tag:"mo",output:"<",ttype:CONST},{input:"\\gt",tag:"mo",output:">",ttype:CONST},{input:"\\ne",tag:"mo",output:"\u2260",ttype:CONST},{input:"\\neq",tag:"mo",output:"\u2260",ttype:CONST},{input:"\\le",tag:"mo",output:"\u2264",ttype:CONST},{input:"\\leq",tag:"mo",output:"\u2264",ttype:CONST},{input:"\\leqslant",tag:"mo",output:"\u2264",ttype:CONST},{input:"\\ge",tag:"mo",output:"\u2265",ttype:CONST},{input:"\\geq",tag:"mo",output:"\u2265",ttype:CONST},{input:"\\geqslant",tag:"mo",output:"\u2265",ttype:CONST},{input:"\\equiv",tag:"mo",output:"\u2261",ttype:CONST},{input:"\\ll",tag:"mo",output:"\u226A",ttype:CONST},{input:"\\gg",tag:"mo",output:"\u226B",ttype:CONST},{input:"\\doteq",tag:"mo",output:"\u2250",ttype:CONST},{input:"\\prec",tag:"mo",output:"\u227A",ttype:CONST},{input:"\\succ",tag:"mo",output:"\u227B",ttype:CONST},{input:"\\preceq",tag:"mo",output:"\u227C",ttype:CONST},{input:"\\succeq",tag:"mo",output:"\u227D",ttype:CONST},{input:"\\subset",tag:"mo",output:"\u2282",ttype:CONST},{input:"\\supset",tag:"mo",output:"\u2283",ttype:CONST},{input:"\\subseteq",tag:"mo",output:"\u2286",ttype:CONST},{input:"\\supseteq",tag:"mo",output:"\u2287",ttype:CONST},{input:"\\sqsubset",tag:"mo",output:"\u228F",ttype:CONST},{input:"\\sqsupset",tag:"mo",output:"\u2290",ttype:CONST},{input:"\\sqsubseteq",tag:"mo",output:"\u2291",ttype:CONST},{input:"\\sqsupseteq",tag:"mo",output:"\u2292",ttype:CONST},{input:"\\sim",tag:"mo",output:"\u223C",ttype:CONST},{input:"\\simeq",tag:"mo",output:"\u2243",ttype:CONST},{input:"\\approx",tag:"mo",output:"\u2248",ttype:CONST},{input:"\\cong",tag:"mo",output:"\u2245",ttype:CONST},{input:"\\Join",tag:"mo",output:"\u22C8",ttype:CONST},{input:"\\bowtie",tag:"mo",output:"\u22C8",ttype:CONST},{input:"\\in",tag:"mo",output:"\u2208",ttype:CONST},{input:"\\ni",tag:"mo",output:"\u220B",ttype:CONST},{input:"\\owns",tag:"mo",output:"\u220B",ttype:CONST},{input:"\\propto",tag:"mo",output:"\u221D",ttype:CONST},{input:"\\vdash",tag:"mo",output:"\u22A2",ttype:CONST},{input:"\\dashv",tag:"mo",output:"\u22A3",ttype:CONST},{input:"\\models",tag:"mo",output:"\u22A8",ttype:CONST},{input:"\\perp",tag:"mo",output:"\u22A5",ttype:CONST},{input:"\\smile",tag:"mo",output:"\u2323",ttype:CONST},{input:"\\frown",tag:"mo",output:"\u2322",ttype:CONST},{input:"\\asymp",tag:"mo",output:"\u224D",ttype:CONST},{input:"\\notin",tag:"mo",output:"\u2209",ttype:CONST},{input:"\\begin{eqnarray}",output:"X",ttype:MATRIX,invisible:true},{input:"\\begin{array}",output:"X",ttype:MATRIX,invisible:true},{input:"\\\\",output:"}&{",ttype:DEFINITION},{input:"\\end{eqnarray}",output:"}}",ttype:DEFINITION},{input:"\\end{array}",output:"}}",ttype:DEFINITION},{input:"\\big",tag:"mo",output:"X",atval:"1.2",ttype:BIG},{input:"\\Big",tag:"mo",output:"X",atval:"1.8",ttype:BIG},{input:"\\bigg",tag:"mo",output:"X",atval:"2.3",ttype:BIG},{input:"\\Bigg",tag:"mo",output:"X",atval:"2.9",ttype:BIG},{input:"\\left",tag:"mo",output:"X",ttype:LEFTBRACKET},{input:"\\right",tag:"mo",output:"X",ttype:RIGHTBRACKET},{input:"{",output:"{",ttype:LEFTBRACKET,invisible:true},{input:"}",output:"}",ttype:RIGHTBRACKET,invisible:true},{input:"(",tag:"mo",output:"(",atval:"1",ttype:STRETCHY},{input:"[",tag:"mo",output:"[",atval:"1",ttype:STRETCHY},{input:"\\lbrack",tag:"mo",output:"[",atval:"1",ttype:STRETCHY},{input:"\\{",tag:"mo",output:"{",atval:"1",ttype:STRETCHY},{input:"\\lbrace",tag:"mo",output:"{",atval:"1",ttype:STRETCHY},{input:"\\langle",tag:"mo",output:"\u2329",atval:"1",ttype:STRETCHY},{input:"\\lfloor",tag:"mo",output:"\u230A",atval:"1",ttype:STRETCHY},{input:"\\lceil",tag:"mo",output:"\u2308",atval:"1",ttype:STRETCHY},{input:")",tag:"mo",output:")",rtag:"mi",atval:"1",ttype:STRETCHY},{input:"]",tag:"mo",output:"]",rtag:"mi",atval:"1",ttype:STRETCHY},{input:"\\rbrack",tag:"mo",output:"]",rtag:"mi",atval:"1",ttype:STRETCHY},{input:"\\}",tag:"mo",output:"}",rtag:"mi",atval:"1",ttype:STRETCHY},{input:"\\rbrace",tag:"mo",output:"}",rtag:"mi",atval:"1",ttype:STRETCHY},{input:"\\rangle",tag:"mo",output:"\u232A",rtag:"mi",atval:"1",ttype:STRETCHY},{input:"\\rfloor",tag:"mo",output:"\u230B",rtag:"mi",atval:"1",ttype:STRETCHY},{input:"\\rceil",tag:"mo",output:"\u2309",rtag:"mi",atval:"1",ttype:STRETCHY},{input:"|",tag:"mo",output:"\u2223",atval:"1",ttype:STRETCHY},{input:"\\|",tag:"mo",output:"\u2225",atval:"1",ttype:STRETCHY},{input:"\\vert",tag:"mo",output:"\u2223",atval:"1",ttype:STRETCHY},{input:"\\Vert",tag:"mo",output:"\u2225",atval:"1",ttype:STRETCHY},{input:"\\mid",tag:"mo",output:"\u2223",atval:"1",ttype:STRETCHY},{input:"\\parallel",tag:"mo",output:"\u2225",atval:"1",ttype:STRETCHY},{input:"/",tag:"mo",output:"/",atval:"1.01",ttype:STRETCHY},{input:"\\backslash",tag:"mo",output:"\u2216",atval:"1",ttype:STRETCHY},{input:"\\setminus",tag:"mo",output:"\\",ttype:CONST},{input:"\\!",tag:"mspace",atname:"width",atval:"-0.167em",ttype:SPACE},{input:"\\,",tag:"mspace",atname:"width",atval:"0.167em",ttype:SPACE},{input:"\\>",tag:"mspace",atname:"width",atval:"0.222em",ttype:SPACE},{input:"\\:",tag:"mspace",atname:"width",atval:"0.222em",ttype:SPACE},{input:"\\;",tag:"mspace",atname:"width",atval:"0.278em",ttype:SPACE},{input:"~",tag:"mspace",atname:"width",atval:"0.333em",ttype:SPACE},{input:"\\quad",tag:"mspace",atname:"width",atval:"1em",ttype:SPACE},{input:"\\qquad",tag:"mspace",atname:"width",atval:"2em",ttype:SPACE},{input:"\\prime",tag:"mo",output:"\u2032",ttype:CONST},{input:"'",tag:"mo",output:"\u02B9",ttype:CONST},{input:"''",tag:"mo",output:"\u02BA",ttype:CONST},{input:"'''",tag:"mo",output:"\u2034",ttype:CONST},{input:"''''",tag:"mo",output:"\u2057",ttype:CONST},{input:"\\ldots",tag:"mo",output:"\u2026",ttype:CONST},{input:"\\cdots",tag:"mo",output:"\u22EF",ttype:CONST},{input:"\\vdots",tag:"mo",output:"\u22EE",ttype:CONST},{input:"\\ddots",tag:"mo",output:"\u22F1",ttype:CONST},{input:"\\forall",tag:"mo",output:"\u2200",ttype:CONST},{input:"\\exists",tag:"mo",output:"\u2203",ttype:CONST},{input:"\\Re",tag:"mo",output:"\u211C",ttype:CONST},{input:"\\Im",tag:"mo",output:"\u2111",ttype:CONST},{input:"\\aleph",tag:"mo",output:"\u2135",ttype:CONST},{input:"\\hbar",tag:"mo",output:"\u210F",ttype:CONST},{input:"\\ell",tag:"mo",output:"\u2113",ttype:CONST},{input:"\\wp",tag:"mo",output:"\u2118",ttype:CONST},{input:"\\emptyset",tag:"mo",output:"\u2205",ttype:CONST},{input:"\\infty",tag:"mo",output:"\u221E",ttype:CONST},{input:"\\surd",tag:"mo",output:"\\sqrt{}",ttype:DEFINITION},{input:"\\partial",tag:"mo",output:"\u2202",ttype:CONST},{input:"\\nabla",tag:"mo",output:"\u2207",ttype:CONST},{input:"\\triangle",tag:"mo",output:"\u25B3",ttype:CONST},{input:"\\therefore",tag:"mo",output:"\u2234",ttype:CONST},{input:"\\angle",tag:"mo",output:"\u2220",ttype:CONST},{input:"\\diamond",tag:"mo",output:"\u22C4",ttype:CONST},{input:"\\Diamond",tag:"mo",output:"\u25C7",ttype:CONST},{input:"\\neg",tag:"mo",output:"\u00AC",ttype:CONST},{input:"\\lnot",tag:"mo",output:"\u00AC",ttype:CONST},{input:"\\bot",tag:"mo",output:"\u22A5",ttype:CONST},{input:"\\top",tag:"mo",output:"\u22A4",ttype:CONST},{input:"\\square",tag:"mo",output:"\u25AB",ttype:CONST},{input:"\\Box",tag:"mo",output:"\u25A1",ttype:CONST},{input:"\\wr",tag:"mo",output:"\u2240",ttype:CONST},{input:"\\arccos",tag:"mi",output:"arccos",ttype:UNARY,func:true},{input:"\\arcsin",tag:"mi",output:"arcsin",ttype:UNARY,func:true},{input:"\\arctan",tag:"mi",output:"arctan",ttype:UNARY,func:true},{input:"\\arg",tag:"mi",output:"arg",ttype:UNARY,func:true},{input:"\\cos",tag:"mi",output:"cos",ttype:UNARY,func:true},{input:"\\cosh",tag:"mi",output:"cosh",ttype:UNARY,func:true},{input:"\\cot",tag:"mi",output:"cot",ttype:UNARY,func:true},{input:"\\coth",tag:"mi",output:"coth",ttype:UNARY,func:true},{input:"\\csc",tag:"mi",output:"csc",ttype:UNARY,func:true},{input:"\\deg",tag:"mi",output:"deg",ttype:UNARY,func:true},{input:"\\det",tag:"mi",output:"det",ttype:UNARY,func:true},{input:"\\dim",tag:"mi",output:"dim",ttype:UNARY,func:true},{input:"\\exp",tag:"mi",output:"exp",ttype:UNARY,func:true},{input:"\\gcd",tag:"mi",output:"gcd",ttype:UNARY,func:true},{input:"\\hom",tag:"mi",output:"hom",ttype:UNARY,func:true},{input:"\\inf",tag:"mo",output:"inf",ttype:UNDEROVER},{input:"\\ker",tag:"mi",output:"ker",ttype:UNARY,func:true},{input:"\\lg",tag:"mi",output:"lg",ttype:UNARY,func:true},{input:"\\lim",tag:"mo",output:"lim",ttype:UNDEROVER},{input:"\\liminf",tag:"mo",output:"liminf",ttype:UNDEROVER},{input:"\\limsup",tag:"mo",output:"limsup",ttype:UNDEROVER},{input:"\\ln",tag:"mi",output:"ln",ttype:UNARY,func:true},{input:"\\log",tag:"mi",output:"log",ttype:UNARY,func:true},{input:"\\max",tag:"mo",output:"max",ttype:UNDEROVER},{input:"\\min",tag:"mo",output:"min",ttype:UNDEROVER},{input:"\\Pr",tag:"mi",output:"Pr",ttype:UNARY,func:true},{input:"\\sec",tag:"mi",output:"sec",ttype:UNARY,func:true},{input:"\\sin",tag:"mi",output:"sin",ttype:UNARY,func:true},{input:"\\sinh",tag:"mi",output:"sinh",ttype:UNARY,func:true},{input:"\\sup",tag:"mo",output:"sup",ttype:UNDEROVER},{input:"\\tan",tag:"mi",output:"tan",ttype:UNARY,func:true},{input:"\\tanh",tag:"mi",output:"tanh",ttype:UNARY,func:true},{input:"\\gets",tag:"mo",output:"\u2190",ttype:CONST},{input:"\\leftarrow",tag:"mo",output:"\u2190",ttype:CONST},{input:"\\to",tag:"mo",output:"\u2192",ttype:CONST},{input:"\\rightarrow",tag:"mo",output:"\u2192",ttype:CONST},{input:"\\leftrightarrow",tag:"mo",output:"\u2194",ttype:CONST},{input:"\\uparrow",tag:"mo",output:"\u2191",ttype:CONST},{input:"\\downarrow",tag:"mo",output:"\u2193",ttype:CONST},{input:"\\updownarrow",tag:"mo",output:"\u2195",ttype:CONST},{input:"\\Leftarrow",tag:"mo",output:"\u21D0",ttype:CONST},{input:"\\Rightarrow",tag:"mo",output:"\u21D2",ttype:CONST},{input:"\\Leftrightarrow",tag:"mo",output:"\u21D4",ttype:CONST},{input:"\\iff",tag:"mo",output:"~\\Longleftrightarrow~",ttype:DEFINITION},{input:"\\Uparrow",tag:"mo",output:"\u21D1",ttype:CONST},{input:"\\Downarrow",tag:"mo",output:"\u21D3",ttype:CONST},{input:"\\Updownarrow",tag:"mo",output:"\u21D5",ttype:CONST},{input:"\\mapsto",tag:"mo",output:"\u21A6",ttype:CONST},{input:"\\longleftarrow",tag:"mo",output:"\u27F5",ttype:CONST},{input:"\\longrightarrow",tag:"mo",output:"\u27F6",ttype:CONST},{input:"\\longleftrightarrow",tag:"mo",output:"\u27F7",ttype:CONST},{input:"\\Longleftarrow",tag:"mo",output:"\u27F8",ttype:CONST},{input:"\\Longrightarrow",tag:"mo",output:"\u27F9",ttype:CONST},{input:"\\Longleftrightarrow",tag:"mo",output:"\u27FA",ttype:CONST},{input:"\\longmapsto",tag:"mo",output:"\u27FC",ttype:CONST},{input:"\\sqrt",tag:"msqrt",output:"sqrt",ttype:UNARY},{input:"\\root",tag:"mroot",output:"root",ttype:BINARY},{input:"\\frac",tag:"mfrac",output:"/",ttype:BINARY},{input:"\\bfrac",tag:"mfrac",output:"/",ttype:BINARY},{input:"\\stackrel",tag:"mover",output:"stackrel",ttype:BINARY},{input:"\\atop",tag:"mfrac",output:"",ttype:INFIX},{input:"\\choose",tag:"mfrac",output:"",ttype:INFIX},{input:"\\over",tag:"mfrac",output:"/",ttype:INFIX},{input:"_",tag:"msub",output:"_",ttype:INFIX},{input:"^",tag:"msup",output:"^",ttype:INFIX},{input:"\\mbox",tag:"mtext",output:"mbox",ttype:TEXT},{input:"\\acute",tag:"mover",output:"\u00B4",ttype:UNARY,acc:true},{input:"\\grave",tag:"mover",output:"\u0060",ttype:UNARY,acc:true},{input:"\\breve",tag:"mover",output:"\u02D8",ttype:UNARY,acc:true},{input:"\\check",tag:"mover",output:"\u02C7",ttype:UNARY,acc:true},{input:"\\dot",tag:"mover",output:".",ttype:UNARY,acc:true},{input:"\\ddot",tag:"mover",output:"..",ttype:UNARY,acc:true},{input:"\\mathring",tag:"mover",output:"\u00B0",ttype:UNARY,acc:true},{input:"\\vec",tag:"mover",output:"\u2192",ttype:UNARY,acc:true},{input:"\\overrightarrow",tag:"mover",output:"\u2192",ttype:UNARY,acc:true},{input:"\\overleftarrow",tag:"mover",output:"\u2190",ttype:UNARY,acc:true},{input:"\\hat",tag:"mover",output:"\u005E",ttype:UNARY,acc:true},{input:"\\widehat",tag:"mover",output:"\u0302",ttype:UNARY,acc:true},{input:"\\tilde",tag:"mover",output:"~",ttype:UNARY,acc:true},{input:"\\widetilde",tag:"mover",output:"\u02DC",ttype:UNARY,acc:true},{input:"\\bar",tag:"mover",output:"\u203E",ttype:UNARY,acc:true},{input:"\\overbrace",tag:"mover",output:"\u23B4",ttype:UNARY,acc:true},{input:"\\overline",tag:"mover",output:"\u00AF",ttype:UNARY,acc:true},{input:"\\underbrace",tag:"munder",output:"\u23B5",ttype:UNARY,acc:true},{input:"\\underline",tag:"munder",output:"\u00AF",ttype:UNARY,acc:true},{input:"\\displaystyle",tag:"mstyle",atname:"displaystyle",atval:"true",ttype:UNARY},{input:"\\textstyle",tag:"mstyle",atname:"displaystyle",atval:"false",ttype:UNARY},{input:"\\scriptstyle",tag:"mstyle",atname:"scriptlevel",atval:"1",ttype:UNARY},{input:"\\scriptscriptstyle",tag:"mstyle",atname:"scriptlevel",atval:"2",ttype:UNARY},{input:"\\mathrm",tag:"mtext",output:"text",ttype:TEXT},{input:"\\textrm",tag:"mtext",output:"text",ttype:TEXT},{input:"\\mathbf",tag:"mstyle",atname:"mathvariant",atval:"bold",ttype:UNARY},{input:"\\textbf",tag:"mstyle",atname:"mathvariant",atval:"bold",ttype:UNARY},{input:"\\mathit",tag:"mstyle",atname:"mathvariant",atval:"italic",ttype:UNARY},{input:"\\textit",tag:"mstyle",atname:"mathvariant",atval:"italic",ttype:UNARY},{input:"\\mathtt",tag:"mstyle",atname:"mathvariant",atval:"monospace",ttype:UNARY},{input:"\\texttt",tag:"mstyle",atname:"mathvariant",atval:"monospace",ttype:UNARY},{input:"\\mathsf",tag:"mstyle",atname:"mathvariant",atval:"sans-serif",ttype:UNARY},{input:"\\mathbb",tag:"mstyle",atname:"mathvariant",atval:"double-struck",ttype:UNARY,codes:bbb},{input:"\\mathcal",tag:"mstyle",atname:"mathvariant",atval:"script",ttype:UNARY,codes:cal},{input:"\\mathfrak",tag:"mstyle",atname:"mathvariant",atval:"fraktur",ttype:UNARY,codes:frk}];var names=[];var mathVariant="italic";if(!document.createElementNS){document.createElementNS=function(link,type){return this.createElement(type)}}function compareNames(x,y){if(x.input>y.input){return 1}else{return -1}}function refreshSymbols(){var len=symbols.length;symbols.sort(compareNames);for(var i=0;i<len;i++){names[i]=symbols[i].input}}function strim(str,n){return $.trim(str.slice(n))}function createElementXHTML(elType){return document.createElementNS("http://www.w3.org/1999/xhtml",elType)}function position(str,n){var pos=$.inArray(str,names.slice(n));if(pos<0){var narr=names.concat([str]);narr.sort();pos=$.inArray(str,narr.slice(n))}return n+pos}function getSymbol(str){var k=0;var j=0;var mk;var st;var tagst;var match="";var more=true;var sLen=str.length;for(var i=1;i<=sLen&&more;i++){st=str.slice(0,i);j=k;k=position(st,j);if(k<names.length&&str.slice(0,names[k].length)==names[k]){match=names[k];mk=k;i=match.length}more=k<names.length&&str.slice(0,names[k].length)>=names[k]}if(match!==""){return symbols[mk]}k=1;st=str.slice(0,1);if("0"<=st&&st<="9"){tagst="mn"}else{tagst=(("A">st||st>"Z")&&("a">st||st>"z")?"mo":"mi")}return{input:st,tag:tagst,output:st,ttype:CONST}}function parseSexpr(str){var symbol,node,result,result2,i,st,newFrag=document.createDocumentFragment();var ch,newst,text="";symbol=getSymbol(str);if(symbol===null||symbol.ttype==RIGHTBRACKET){return[null,str,null]}if(symbol.ttype==DEFINITION){str=symbol.output+strim(str,symbol.input.length);symbol=getSymbol(str);if(symbol===null||symbol.ttype==RIGHTBRACKET){return[null,str,null]}}if(symbol.ttype==CONST&&symbol.tag=="mi"&&str!=""){while(symbol.ttype==CONST&&symbol.tag=="mi"&&str!=""){text+=symbol.output;str=strim(str,symbol.input.length);symbol=getSymbol(str)}node=createMmlNode("mi",document.createTextNode(text));node.setAttribute("mathvariant",mathVariant);return[node,str,"mi"]}else{str=strim(str,symbol.input.length)}switch(symbol.ttype){case SPACE:node=createMmlNode(symbol.tag);node.setAttribute(symbol.atname,symbol.atval);return[node,str,symbol.tag];case UNDEROVER:return[createMmlNode(symbol.tag,document.createTextNode(symbol.output)),str,symbol.tag];case CONST:node=createMmlNode(symbol.tag,document.createTextNode(symbol.output));return[node,str,symbol.tag];case STRETCHY:node=createMmlNode(symbol.tag,document.createTextNode(symbol.output));if(symbol.input=="|"||symbol.input=="\\vert"||symbol.input=="\\|"||symbol.input=="\\Vert"){node.setAttribute("lspace","0em");node.setAttribute("rspace","0em")}node.setAttribute("maxsize",symbol.atval);if(symbol.rtag!==null){return[node,str,symbol.rtag]}else{return[node,str,symbol.tag]}break;case BIG:var atval=symbol.atval;symbol=getSymbol(str);if(symbol===null){return[null,str,null]}str=strim(str,symbol.input.length);node=createMmlNode(symbol.tag,document.createTextNode(symbol.output));node.setAttribute("minsize",atval);node.setAttribute("maxsize",atval);return[node,str,symbol.tag];case LEFTBRACKET:if(symbol.input=="\\left"){symbol=getSymbol(str);if(symbol!==null){if(symbol.input=="."){symbol.invisible=true}str=strim(str,symbol.input.length)}}result=parseExpr(str,true,false);if(symbol===null||(typeof symbol.invisible=="boolean"&&symbol.invisible)){node=createMmlNode("mrow",result[0])}else{node=createMmlNode("mo",document.createTextNode(symbol.output));node=createMmlNode("mrow",node);node.appendChild(result[0])}return[node,result[1],result[2]];case MATRIX:if(symbol.input=="\\begin{array}"){var mask="";symbol=getSymbol(str);str=$.trim(str);if(symbol===null){mask="l"}else{str=strim(str,symbol.input.length);if(symbol.input!="{"){mask="l"}else{do{symbol=getSymbol(str);if(symbol!==null){str=strim(str,symbol.input.length);if(symbol.input!="}"){mask=mask+symbol.input}}}while(symbol!==null&&symbol.input!==""&&symbol.input!="}")}}result=parseExpr("{"+str,true,true);node=createMmlNode("mtable",result[0]);mask=mask.replace(/l/g,"left ");mask=mask.replace(/r/g,"right ");mask=mask.replace(/c/g,"center ");node.setAttribute("columnalign",mask);node.setAttribute("displaystyle","false");return[node,result[1],null]}else{result=parseExpr("{"+str,true,true);node=createMmlNode("mtable",result[0]);node.setAttribute("columnalign","right center left");node.setAttribute("displaystyle","true");node=createMmlNode("mrow",node);return[node,result[1],null]}break;case TEXT:if(str.charAt(0)=="{"){i=str.indexOf("}")}else{i=0}if(i==-1){i=str.length}st=str.slice(1,i);node=createMmlNode(symbol.tag,document.createTextNode(st));newFrag.appendChild(node);str=strim(str,i+1);return[createMmlNode("mrow",newFrag),str,null];case UNARY:if(symbol.atname=="mathvariant"){mathVariant=symbol.atval}result=parseSexpr(str);if(result[0]===null){return[createMmlNode(symbol.tag,document.createTextNode(symbol.output)),str]}if(typeof symbol.func=="boolean"&&symbol.func){st=str.charAt(0);if(st=="^"||st=="_"||st==","){return[createMmlNode(symbol.tag,document.createTextNode(symbol.output)),str,symbol.tag]}else{node=createMmlNode("mrow",createMmlNode(symbol.tag,document.createTextNode(symbol.output)));node.appendChild(result[0]);return[node,result[1],symbol.tag]}}if(symbol.input=="\\sqrt"){return[createMmlNode(symbol.tag,result[0]),result[1],symbol.tag]}else{if(typeof symbol.acc=="boolean"&&symbol.acc){node=createMmlNode(symbol.tag,result[0]);var output=symbol.output;var node1=createMmlNode("mo",document.createTextNode(output));if(symbol.input=="\\vec"||symbol.input=="\\check"){node1.setAttribute("maxsize","1.2")}if(symbol.input=="\\underbrace"||symbol.input=="\\underline"){node1.setAttribute("accentunder","true")}else{node1.setAttribute("accent","true")}node.appendChild(node1);if(symbol.input=="\\overbrace"||symbol.input=="\\underbrace"){node.ttype=UNDEROVER}return[node,result[1],symbol.tag]}else{if(typeof symbol.codes!="undefined"){for(i=0;i<result[0].childNodes.length;i++){if(result[0].childNodes[i].nodeName=="mi"||result[0].nodeName=="mi"){st=(result[0].nodeName=="mi"?result[0].firstChild.nodeValue:result[0].childNodes[i].firstChild.nodeValue);newst="";for(var j=0;j<st.length;j++){ch=st.charCodeAt(j);if(ch>64&&ch<91){newst=newst+symbol.codes[ch-65]}else{if(ch>96&&ch<123){newst=newst+symbol.codes[ch-71]}}}if(result[0].nodeName=="mi"){result[0]=createMmlNode("mo").appendChild(document.createTextNode(newst))}else{result[0].replaceChild(createMmlNode("mo").appendChild(document.createTextNode(newst)),result[0].childNodes[i])}}}}node=createMmlNode(symbol.tag,result[0]);node.setAttribute(symbol.atname,symbol.atval);if(symbol.input=="\\scriptstyle"||symbol.input=="\\scriptscriptstyle"){node.setAttribute("displaystyle","false")}return[node,result[1],symbol.tag]}}break;case BINARY:result=parseSexpr(str);if(result[0]===null){return[createMmlNode("mo",document.createTextNode(symbol.input)),str,null]}result2=parseSexpr(result[1]);if(result2[0]===null){return[createMmlNode("mo",document.createTextNode(symbol.input)),str,null]}if(symbol.input=="\\root"||symbol.input=="\\stackrel"){newFrag.appendChild(result2[0])}newFrag.appendChild(result[0]);if(symbol.input=="\\frac"||symbol.input=="\\bfrac"){newFrag.appendChild(result2[0])}node=createMmlNode(symbol.tag,newFrag);if(symbol.input=="\\bfrac"){node.setAttribute("bevelled","true")}return[node,result2[1],symbol.tag];case INFIX:str=strim(str,symbol.input.length);return[createMmlNode("mo",document.createTextNode(symbol.output)),str,symbol.tag];default:return[createMmlNode(symbol.tag,document.createTextNode(symbol.output)),str,symbol.tag]}}function parseIexpr(str){var symbol,sym1,sym2,node,result,tag,underover;sym1=getSymbol(str);result=parseSexpr(str);node=result[0];str=result[1];tag=result[2];symbol=getSymbol(str);if(symbol.ttype==INFIX){str=strim(str,symbol.input.length);result=parseSexpr(str);if(result[0]===null){result[0]=createMmlNode("mo",document.createTextNode("\u25A1"))}str=result[1];tag=result[2];if(symbol.input=="_"||symbol.input=="^"){sym2=getSymbol(str);tag=null;underover=((sym1.ttype==UNDEROVER)||(node.ttype==UNDEROVER));if((symbol.input=="_"&&sym2.input=="^")||(symbol.input=="^"&&sym2.input=="_")){str=strim(str,sym2.input.length);var res2=parseSexpr(str);str=res2[1];tag=res2[2];node=createMmlNode((underover?"munderover":"msubsup"),node);if(symbol.input=="_"){node.appendChild(result[0]);node.appendChild(res2[0])}else{node.appendChild(res2[0]);node.appendChild(result[0])}}else{if(symbol.input=="_"){node=createMmlNode((underover?"munder":"msub"),node);node.appendChild(result[0])}else{node=createMmlNode((underover?"mover":"msup"),node);node.appendChild(result[0])}}node=createMmlNode("mrow",node)}else{node=createMmlNode(symbol.tag,node);if(symbol.input=="\\atop"||symbol.input=="\\choose"){node.setAttribute("linethickness","0ex")}node.appendChild(result[0]);if(symbol.input=="\\choose"){node=createMmlNode("mfenced",node)}}}return[node,str,tag]}function parseExpr(str,rightbracket,matrix){var symbol,node,result,i,tag,newFrag=document.createDocumentFragment();do{str=$.trim(str);result=parseIexpr(str);node=result[0];str=result[1];tag=result[2];symbol=getSymbol(str);if(node){if((tag=="mn"||tag=="mi")&&symbol!==null&&typeof symbol.func=="boolean"&&symbol.func){var space=createMmlNode("mspace");space.setAttribute("width","0.167em");node=createMmlNode("mrow",node);node.appendChild(space)}if(tag=="mstyle"){mathVariant="italic"}newFrag.appendChild(node)}}while((symbol.ttype!=RIGHTBRACKET)&&symbol!==null&&symbol.output!=="");tag=null;if(symbol.ttype==RIGHTBRACKET){if(symbol.input=="\\right"){str=strim(str,symbol.input.length);symbol=getSymbol(str);if(symbol!==null&&symbol.input=="."){symbol.invisible=true}if(symbol!==null){tag=symbol.rtag}}if(symbol!==null){str=strim(str,symbol.input.length)}var len=newFrag.childNodes.length;if(matrix&&len>0&&newFrag.childNodes[len-1].nodeName=="mrow"){var pos=[];var m=newFrag.childNodes.length;for(i=0;matrix&&i<m;i=i+2){pos[i]=[];node=newFrag.childNodes[i];for(var j=0;j<node.childNodes.length;j++){if(node.childNodes[j].firstChild&&node.childNodes[j].firstChild.nodeValue=="&"){pos[i][pos[i].length]=j}}}var row,frag,n,k,table=document.createDocumentFragment();for(i=0;i<m;i=i+2){row=document.createDocumentFragment();frag=document.createDocumentFragment();node=newFrag.firstChild;n=node.childNodes.length;k=0;for(j=0;j<n;j++){if(typeof pos[i][k]!="undefined"&&j==pos[i][k]){node.removeChild(node.firstChild);row.appendChild(createMmlNode("mtd",frag));k++}else{frag.appendChild(node.firstChild)}}row.appendChild(createMmlNode("mtd",frag));if(newFrag.childNodes.length>2){newFrag.removeChild(newFrag.firstChild);newFrag.removeChild(newFrag.firstChild)}table.appendChild(createMmlNode("mtr",row))}return[table,str]}if(typeof symbol.invisible!="boolean"||!symbol.invisible){node=createMmlNode("mo",document.createTextNode(symbol.output));newFrag.appendChild(node)}}return[newFrag,str,tag]}function createMmlNode(t,frag){var node=document.createElementNS("http://www.w3.org/1998/Math/MathML",t);if(frag){$(node).append(frag)}return node}var SVG,canvas;var collection=[];function createSVGElement(elType){return document.createElementNS("http://www.w3.org/2000/svg",elType)}function getSVGElement(id,el){var 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 openGroup(id,clear){var newEl=getSVGElement(id,"g");appendSVG(newEl);canvas=$("#"+SVG.id+"_"+id)[0];if(clear){$(canvas).empty()}}function closeGroup(){canvas=$("#"+SVG.id+"_Canvas")[0]}function appendSVG(elmt){if(elmt.newEl){$(canvas).append(elmt.node)}}function addButton(parent,text,title,func,id){var node=createElementXHTML("span");node.className="svgButton";node.title=title;node.onclick=func;if(id){node.id=id}$(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"})});$(parent).append(node);return parent}function pictureAttributes(){this.id=null;this.stroke="blue";this.strokewidth=1;this.strokeopacity=1;this.strokedasharray="none";this.fill="none";this.fillopacity=1;this.fixed=false;this.fontstyle="normal";this.fontfamily="serif";this.fontweight="normal";this.fontsize=12;this.fontstroke="none";this.fontstrokewidth=1;this.fontstrokeopacity=1;this.fontstrokedasharray="none";this.fontfill="black";this.fontfillopacity=1;this.sector=false;this.largearc=0;this.marker="o";this.orient="auto";this.size=8;this.units="userSpaceOnUse";this.markerstroke="blue";this.markerstrokewidth=1;this.markerstrokeopacity=1;this.markerstrokedasharray="none";this.markerfill="none";this.markerfillopacity=1;this.sweep=0;this.rx=0;this.ry=0;this.closed=false;this.curve="";this.direction=[1,0];this.ticklabels="";this.pos="";this.points=200;this.backgroundcolor="none";this.backgroundopacity=1}function pictureObject(){this.id=null;this.src="";this.width=320;this.height=null;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.mouse=[null,null];this.coords="cartesian";this.drag=null;this.pan=true;this.locked=false;this.attr=new pictureAttributes()}function drawPicture(){$(canvas).empty();$("#"+SVG.id+" .svgMarker").remove();SVG.attr=new pictureAttributes();try{this.code=function(){with(Math){eval(SVG.src)}}();this.code=null}catch(err){var errstr;if(typeof err=="object"){errstr=err.name+" "+err.message+" "+err.number+" "+err.description}else{errstr=err}alert(errstr+"\n"+SVG.src)}collection[SVG.id]=SVG}function setOptions(atr){for(var i in atr){SVG.attr[i]=atr[i]}}function getOptions(attr,options,prefix){var pref=prefix||"";if(typeof attr=="string"){return(options[pref+attr]==undefined?SVG.attr[pref+attr]:options[pref+attr])}else{var i,newAttr={},len=attr.length,item;for(i=0;i<len;i++){item=attr[i];newAttr[item]=options[pref+item]==undefined?SVG.attr[pref+item]:options[pref+item]}return newAttr}}function setAction(evt,fn,id){if(!$.isFunction(fn)){return}var node=id?$("#"+SVG.id+"_"+id):$("#"+SVG.id);$(node).bind(evt,fn)}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(){var obj=$("#SVGtoolbar #SVGupdateButton");if(obj.text()=="Edit"){obj.text("Update");obj.attr("title","Update picture");$("#SVGsrc").val(SVG.src).css("display","block")}else{SVG.src=$("#SVGsrc").val();drawPicture()}}function closeEditor(){$("#SVGtoolbar").slideUp();$("#SVGsrc").val("");SVG.locked=false}function switchTo(evt){var name=evt.currentTarget.id;if(SVG.id==name||SVG.locked){return false}SVG=collection[name];canvas=$("#"+SVG.id+"_Canvas")[0];return false}function onWheel(evt){if(SVG.locked){return false}evt=evt||window.event;var factor=1;evt.preventDefault();evt.stopPropagation();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.altKey){resize(factor)}else{zoom(factor)}return false}function onClick(evt){if(SVG.locked){return false}if(evt.button===0){if(evt.shiftKey){$("#SVGtoolbar #SVGupdateButton").text("Update");$("#SVGsrc").val(SVG.src);$("#SVGtoolbar").css({top:evt.pageY,left:evt.pageX}).slideDown();SVG.locked=true;evt.stopImmediatePropagation()}else{if(SVG.pan){SVG.drag=[evt.clientX,evt.clientY];document.body.style.cursor="move"}}}return false}function onDrop(evt){if(SVG.drag==null){return false}document.body.style.cursor="default";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){setScales([SVG.xmin+xlen,SVG.xmax+xlen,SVG.ymin+ylen,SVG.ymax+ylen])}return false}function setScales(scales){if(scales){SVG.xmin=scales[0];SVG.xmax=scales[1];SVG.ymin=scales[2];SVG.ymax=scales[3]}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];drawPicture()}function getScales(scales){scales=scales||[];var res=[null,null,null,null,0];if(scales.length==0){res[0]=SVG.xmin;res[1]=SVG.xmax}if(scales.length>1){if(typeof scales[0]=="number"&&typeof scales[1]=="number"&&scales[1]>scales[0]){res[0]=scales[0];res[1]=scales[1];res[4]=4}else{res[0]=SVG.xmin;res[1]=SVG.xmax}}if(scales.length==4){if(typeof scales[2]=="number"&&typeof scales[3]=="number"&&scales[3]>scales[2]){res[2]=scales[2];res[3]=scales[3];res[4]+=8}}return res}function resize(factor){SVG.factor=(SVG.factor*factor).toFixed(3);SVG.width/=factor;SVG.height/=factor;var picture=$("#"+SVG.id);picture.attr("width",SVG.width);picture.attr("height",SVG.height);var parent=picture[0].parentNode;if(parent.nodeName=="DIV"){parent.style.width=SVG.width+"px";parent.style.height=SVG.height+"px"}setScales()}function zoom(factor,center){var px,py;if(center){px=(SVG.xmax+SVG.xmin)*0.5;py=(SVG.ymax+SVG.ymin)*0.5}else{px=SVG.mouse[0];py=SVG.mouse[1]}SVG.factor=(SVG.factor*factor).toFixed(3);var dx=(SVG.xmax-SVG.xmin)*factor;var dy=(SVG.ymax-SVG.ymin)*factor;var xmin=(1-factor)*px+factor*SVG.xmin;var ymin=(1-factor)*py+factor*SVG.ymin;setScales([xmin,xmin+dx,ymin,ymin+dy])}function updateCartesianCoord(){if(!SVG.locked){$("#"+SVG.id+"_Coords").text("("+SVG.mouse[0].toFixed(2)+", "+SVG.mouse[1].toFixed(2)+")")}return false}function updatePolarCoord(){if(!SVG.locked){$("#"+SVG.id+"_Coords").text("("+getDistance().toFixed(2)+", "+getAngle().toFixed(2)+")")}return false}function getPosition(evt){var a=[null,null];var off=$(evt.currentTarget.parentNode).offset();a[0]=(evt.pageX-off.left-SVG.origin[0])/SVG.xunitlength;a[1]=(SVG.height-SVG.origin[1]-evt.pageY+off.top)/SVG.yunitlength;return a}function updatePosition(evt){SVG.mouse=getPosition(evt);return false}function removeCoord(){$("#"+SVG.id+"_Coords").text("");return false}function tracker(pos,options){options=options||{};var coords=options.coords||SVG.coords;var func=(coords=="polar")?updatePolarCoord:updateCartesianCoord;options.id="Coords";options.fixed=true;text(pos,"",options);setAction("mousemove",func);setAction("mouseout",removeCoord)}function exportSVG(){var svg="<?xml version='1.0' encoding='UTF-8' standalone='no'?>\n";svg+=$("#"+SVG.id).parent().html();svg=svg.replace(/&nbsp;/g,"");svg=svg.replace(/><(?!\/)/g,">\n<");$("#SVGtoolbar #SVGupdateButton").text("Edit").attr("title","Edit script");$("#SVGsrc").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){var q=toSVG(p);return q[0]+" "+q[1]}function setStrokeAndFill(node,options,prefix){var attributes=["stroke","strokewidth","strokedasharray","strokeopacity","fill","fillopacity"];var attr=getOptions(attributes,options,prefix);var elem=$(node);elem.attr("stroke",attr.stroke);elem.attr("stroke-width",attr.strokewidth/SVG.factor);elem.attr("stroke-dasharray",attr.strokedasharray);elem.attr("stroke-opacity",attr.strokeopacity);elem.attr("fill",attr.fill);elem.attr("fill-opacity",attr.fillopacity)}function button(p,q,txt,action,options){options=options||{};options.id=(options.id||Math.randomString(8));rect(p,q,options);setAction("click",action,options.id);options.fill=null;options.fillopacity=1;options.id+="_t";text([(p[0]+q[0])*0.5,(p[1]+q[1])*0.5],txt,options);setAction("click",action,options.id)}function setMarkers(obj,options){var markerChars="o*sSx+<>|";var attributes=["marker","size","units","orient","markerstroke","markerstrokewidth","markerstrokeopacity"];var attr=getOptions(attributes,options);var node,node2,i,id,pos=["marker-start","marker-mid","marker-end"];var lim=attr.marker.length;for(i=0;i<lim;i++){var type=attr.marker.charAt(i);if(type=="-"||markerChars.indexOf(type)<0){continue}id=(options.id||Math.randomString(8))+"Marker_"+markerChars.indexOf(type);node=$("#"+SVG.id+"_"+id);if(node.length===0){node=$(getSVGElement(id,"marker").node);node.attr("class","svgMarker");node.attr("viewBox","0 0 10 10");node.attr("refX",5);node.attr("refY",5);node.attr("orient",attr.orient);node.attr("markerUnits",attr.units);switch(type){case"*":case"o":node2=$(createSVGElement("circle"));node2.attr("cx",5);node2.attr("cy",5);node2.attr("r",4);break;case">":node2=$(createSVGElement("path"));node2.attr("d","M0 0 L10 5 L0 10 z");node.attr("refX",10);break;case"<":node2=$(createSVGElement("path"));node2.attr("d","M10 0 L10 10 L0 5 z");node.attr("refX",0);break;case"x":node2=$(createSVGElement("path"));node2.attr("d","M0 0 L10 10 M0 10 L10 0");break;case"+":node2=$(createSVGElement("path"));node2.attr("d","M5 0 L5 10 M0 5 L10 5");break;case"|":node2=$(createSVGElement("path"));node2.attr("d","M5 0 L5 10");break;case"S":case"s":node2=$(createSVGElement("rect"));node2.attr("x",0);node2.attr("y",0);node2.attr("width",10);node2.attr("height",10)}setStrokeAndFill(node2,options,"marker");node2.attr("stroke-width",attr.markerstrokewidth);if("*<>S".indexOf(type)>-1){node2.attr("fill",attr.markerstroke);node2.attr("fill-opacity",attr.markerstrokeopacity)}node.append(node2);$("#"+SVG.id+"_Defs").append(node)}node.attr("markerWidth",attr.size/SVG.factor);node.attr("markerHeight",attr.size/SVG.factor);$(obj).attr(pos[i],"url(#"+SVG.id+"_"+id+")")}}function setLabels(p,options){var i,point=[0,0],pos;var label=(typeof options.label=="string")?[options.label]:options.label;var labelpos=getOptions("pos",options);labelpos=(typeof labelpos=="string")?[labelpos]:labelpos;var poslen=labelpos.length;var size=options.size||SVG.attr.size;var dx=(0.5*size/SVG.xunitlength)/SVG.factor;var dy=(0.5*size/SVG.yunitlength)/SVG.factor;for(i=0;i<label.length;i++){options.isLabel="_label"+i;point[0]=p[i][0];point[1]=p[i][1];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=getOptions("direction",options);var q=[p[0]+direction[0]/SVG.xunitlength,p[1]+direction[1]/SVG.yunitlength];var st="M"+toSVGPair(p)+" "+toSVGPair(q);var elmt=getSVGElement(options.id,"path");var elem=$(elmt.node);elem.attr("d",st);elem.attr("stroke","none");setMarkers(elem,options);appendSVG(elmt);if(options.label){setLabels([p],options)}}function path(list,options,append){options=options||{};var i,elmt=getSVGElement(options.id,"path");var attr=getOptions(["curve","closed"],options);var len=list.length;if(len>0){var node=$(elmt.node);var st=(append&&!elmt.newEl)?elmt.node.getAttribute("d"):"";st+="M"+toSVGPair(list[0])+" "+attr.curve;for(i=1;i<len;i++){st+=toSVGPair(list[i])+" "}if(attr.closed){st+="Z"}node.attr("d",st);setStrokeAndFill(node,options);if(options.marker){setMarkers(node,options)}appendSVG(elmt);if(options.label){setLabels(list,options)}}}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).attr("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).attr("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 attr=getOptions(["largearc","sweep","closed","sector"],options);var radius=options.radius;if(center!=null&&startangle!=null&&endangle!=null&&radius!=null){start=[radius*Math.cos(startangle)+center[0],radius*Math.sin(startangle)+center[1]];end=[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(attr.sector){st+=toSVGPair(center)+" "}st+=toSVGPair(start)+" A"+radius*SVG.xunitlength+","+radius*SVG.yunitlength+" 0 "+attr.largearc+","+attr.sweep+" "+toSVGPair(end);if(attr.sector||attr.closed){st+=" z"}var node=$(elmt.node);node.attr("d",st);setStrokeAndFill(node,options);if(options.marker){setMarkers(node,options)}appendSVG(elmt);if(options.label){setLabels([start,end],options)}}function sector(options){if(!options.center||!options.startangle||!options.endangle||!options.radius){return}options.sector=true;arc(options)}function ellipse(center,rx,ry,options){options=options||{};var elmt=getSVGElement(options.id,"ellipse");center=toSVG(center);var node=$(elmt.node);node.attr("cx",center[0]);node.attr("cy",center[1]);node.attr("rx",rx*SVG.xunitlength);node.attr("ry",ry*SVG.yunitlength);setStrokeAndFill(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");var attr=getOptions(["rx","ry"],options);var node=$(elmt.node);node.attr("x",toSVG(p)[0]);node.attr("y",toSVG(q)[1]);node.attr("width",(q[0]-p[0])*SVG.xunitlength);node.attr("height",(q[1]-p[1])*SVG.yunitlength);node.attr("rx",attr.rx*SVG.xunitlength);node.attr("ry",attr.ry*SVG.yunitlength);setStrokeAndFill(node,options);appendSVG(elmt)}function text(p,st,options){options=options||{};var id=options.id;var attr=getOptions(["fontstyle","fontfamily","fontweight","fontfill","fontsize","fixed","pos"],options);if(id&&options.isLabel){id+=options.isLabel}var pos=attr.pos.toUpperCase();if(!attr.fixed){attr.fontsize/=SVG.factor}var elem,node,dx,dy,latex=false,str=$.trim(st.toString()),q=toSVG(p);if(str.charAt(0)=="$"){str=str.substr(1,str.length-2);latex=true}if(latex){if(p[0]>SVG.xmax||p[0]<SVG.xmin||p[1]>SVG.ymax||p[1]<SVG.ymin){return}node=createElementXHTML("div");node.style.position="absolute";node.style.left="-1000px";node.style.top="-1000px";$("body").append(node);var math=MSVG.parseMath(str,true,attr.fontsize+"px",attr.fontfill);var mathNode=$(node);mathNode.append($(math).clone());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}var width=mathNode.width(),height=mathNode.height();mathNode.remove();q[0]+=dx;q[1]+=dy;var elmt=getSVGElement(id,"foreignObject");elem=$(elmt.node);elem.empty().append(math);elem.attr("width",width);elem.attr("height",height)}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");elem=$(elmt.node);elem.empty().text(str);elem.attr("font-style",attr.fontstyle);elem.attr("font-family",attr.fontfamily);elem.attr("font-weight",attr.fontweight);elem.attr("font-size",attr.fontsize);elem.attr("text-anchor",textanchor);elem.attr("dominant-baseline",baseline);setStrokeAndFill(elem,options,"font")}elem.attr("x",q[0]);elem.attr("y",q[1]);appendSVG(elmt)}function image(url,options){options=options||{};var elmt=getSVGElement(options.id,"image");var elem=$(elmt.node);var height=options.height?options.height/SVG.factor:SVG.height;var width=options.width?options.width/SVG.factor:SVG.width;var origin=toSVG(options.origin||[SVG.xmin,SVG.ymin]);var pos=(options.pos||"").toUpperCase();var x=origin[0]-width*0.5;var y=origin[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}elem.attr("x",x);elem.attr("y",y);elem.attr("width",width);elem.attr("height",height);elem.attr("preserveAspectRatio","none");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;var orig=options.origin||[0,0];var id=options.id||"Grid";options.stroke=options.stroke||"grey";options.strokewidth=(options.strokewidth||SVG.attr.strokewidth*0.5);var coords=options.coords||SVG.coords;var lim=getScales(options.scales);openGroup(id,true);lim[2]=(typeof lim[2]=="number")?lim[2]:SVG.ymin;lim[3]=(typeof lim[3]=="number")?lim[3]:SVG.ymax;if(coords=="polar"){dx=options.dx||1;dy=options.dy||3;var limit=Math.max(Math.abs(lim[0]),Math.abs(lim[1]),Math.abs(lim[2]),Math.abs(lim[3]));for(x=dx;x<limit;x+=dx){circle(orig,x,options)}if(dy>1){for(y=1;y<dy;y++){k=Math.tan(y*Math.PI/(2*dy));line([lim[0],(lim[0]-orig[0])*k+orig[1]],[SVG.xmax,(lim[1]-orig[0])*k+orig[1]],options);line([lim[0],-(lim[0]-orig[0])*k+orig[1]],[SVG.xmax,-(lim[1]-orig[0])*k+orig[1]],options)}}}else{dx=options.dx||1;dy=options.dy||dx;for(x=orig[0];x<SVG.xmax;x+=dx){if(x>lim[0]&&x<lim[1]){line([x,lim[2]],[x,lim[3]],options)}}for(x=orig[0]-dx;x>SVG.xmin;x-=dx){if(x>lim[0]&&x<lim[1]){line([x,lim[2]],[x,lim[3]],options)}}for(y=orig[1];y<SVG.ymax;y+=dy){if(y>lim[2]&&y<lim[3]){line([lim[0],y],[lim[1],y],options)}}for(y=orig[1]-dy;y>SVG.ymin;y-=dy){if(y>lim[2]&&y<lim[3]){line([lim[0],y],[lim[1],y],options)}}}closeGroup()}function axes(options){options=options||{};options.marker="-|"+(options.marker?options.marker.charAt(0):"-");var i,x,y,start,stop,label;var dx=options.dx||1;var dy=options.dy||dx;var id=options.id||"Axes";var fontsize=getOptions("fontsize",options);var coords=options.coords||SVG.coords;var orig=(coords=="polar")?[0,0]:(options.origin||[0,0]);var ddx=options.decx||Math.max(0,-Math.floor(Math.log(dx)/Math.log(10)));var ddy=options.decy||Math.max(0,-Math.floor(Math.log(dy)/Math.log(10)));options.stroke=options.stroke||"black";options.strokewidth=(options.strokewidth||SVG.attr.strokewidth*0.5);options.markerstroke=options.stroke;options.markerstrokewidth=options.strokewidth;openGroup(id,true);var lim=getScales(options.scales);lim[2]=lim[2]||SVG.ymin;lim[3]=lim[3]||SVG.ymax;if($.isArray(options.xticks)){var xticks=options.xticks.sort();var list2=[[lim[0],orig[1]]];label=[""];for(i=0;i<xticks.length;i++){list2.push([xticks[i],orig[1]]);label.push(String(xticks[i].toFixed(ddx)))}list2.push([lim[1],orig[1]]);label.push("")}else{var list1=[],label1=[];var list2=[],label2=[];start=SVG.xmin+0.25*dx;stop=SVG.xmax-0.25*dx;i=1;var cand,leftExit=0,rightExit=0;while(leftExit*rightExit==0){cand=orig[0]+i*dx;if(cand>start){if(cand<stop){list1.push([cand,orig[1]]);label1.push(String(cand.toFixed(ddx)))}else{rightExit=1}}cand=orig[0]-i*dx;if(cand<stop){if(cand>start){list2.push([cand,orig[1]]);label=(coords=="polar")?"":cand.toFixed(ddx);label2.push(String(label))}else{leftExit=1}}i++}list1.push([lim[1],orig[1]]);label1.push("");list2.push([lim[0],orig[1]]);label2.push("");list2.reverse();list2=list2.concat(list1);label2.reverse();label=label2.concat(label1)}if(options.ticklabels!=false){options.label=label;options.pos="S"}path(list2,options);if($.isArray(options.yticks)){var yticks=options.yticks.sort();var list2=[[orig[0],lim[2]]];label=[""];for(i=0;i<yticks.length;i++){list2.push([orig[0],yticks[i]]);label.push(String(yticks[i].toFixed(ddy)))}list2.push([orig[0],lim[3]]);label.push("")}else{list1=[],label1=[];list2=[];label2=[];start=SVG.ymin+0.25*dy;stop=SVG.ymax-0.25*dy;i=1;leftExit=0;rightExit=0;while(leftExit*rightExit==0){cand=orig[1]+i*dy;if(cand>start){if(cand<stop){list1.push([orig[0],cand]);label1.push(String(cand.toFixed(ddy)))}else{rightExit=1}}cand=orig[1]-i*dy;if(cand<stop){if(cand>start){list2.push([orig[0],cand]);label=(coords=="polar")?"":cand.toFixed(ddy);label2.push(String(label))}else{leftExit=1}}i++}list1.push([orig[0],lim[3]]);label1.push("");list2.push([orig[0],lim[2]]);label2.push("");list2.reverse();list2=list2.concat(list1);label2.reverse();label=label2.concat(label1)}if(options.ticklabels!=false){options.label=label;options.pos="W"}options.stroke=options.markerstroke;path(list2,options);closeGroup()}function list(fun,tmin,tmax,options){var inc=(tmax-tmin)/getOptions("points",options);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 append,pth,steps=options.steps||[];var n_steps=steps.length;options.closed=false;options.curve="";var xmin=(options.min==null)?SVG.xmin:Math.max(SVG.xmin,options.min);var xmax=(options.max==null)?SVG.xmax:Math.min(SVG.xmax,options.max);if(n_steps===0){pth=list(["x",fun],xmin,xmax,options);if(pth){path(pth,options)}}else{options.id=options.id||Math.randomString(6);steps.sort();var steps_a=[];steps_a.push(xmin);for(i=0;i<n_steps;i++){if(steps[i]>xmin&&steps[i]<xmax){steps_a.push(steps[i])}}steps_a.push(xmax);n_steps=steps_a.length-1;for(i=0;i<n_steps;i++){xmax=steps_a[i+1];xmin=steps_a[i];pth=list(["x",fun],xmin,xmax,options);append=(i>0);if(pth){path(pth,options,append)}}}}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 pth1=list(["x",fun1],xmin,xmax,options);var pth2=list(["x",fun2],xmin,xmax,options);if(pth1&&pth2){pth1=pth1.concat(pth2.reverse());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 pth=list([fun1,fun2],xmin,xmax,options);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{showFormulaOnMouseOver:false,latexImages:false,latexConverter:"http://chart.apis.google.com/chart?cht=tx&chs=1x0&chf=bg,s,FFFFFF00&chco=000000&chl=",mathColor:"",mathFontSize:"",mathFontFamily:"",define:function(oldstr,newstr){if(MSVG.latexImages){return}if((typeof oldstr)=="string"){oldstr=[oldstr];newstr=[newstr]}var i,len=oldstr.length;if(len!=newstr.length){return}for(i=0;i<len;i++){symbols=symbols.concat([{input:"\\"+oldstr[i],tag:"mo",output:newstr[i],ttype:DEFINITION}])}refreshSymbols()},parseMath:function(str,displaystyle,size,color){if(str===null){return null}str=str.replace(/_([^\{])/gm,"_{$1}");str=str.replace(/\^([^\{])/gm,"^{$1}");var frag=parseExpr(str.replace(/^\s+/g,""),false,false)[0];var node=createMmlNode("mstyle",frag);$(node).attr({displaystyle:displaystyle,mathcolor:color||MSVG.mathColor,mathsize:size||MSVG.mathFontSize,fontfamily:MSVG.mathFontFamily});node=createMmlNode("math",node);if(MSVG.showFormulaOnMouseOver){$(node).attr({title:str.replace(/\s+/g," ")})}return node},parseMathExternal:function(str,displaystyle,size,color){if(str===null){return null}var node=createElementXHTML("img");var snip=MSVG.latexConverter+str;$(node).attr({src:snip});if(MSVG.showFormulaOnMouseOver){$(node).attr({title:str.replace(/\s+/g," ")})}return node},generic:function(){if(!$.browser.mozilla){MSVG.latexImages=true}if(MSVG.latexImages){MSVG.parseMath=MSVG.parseMathExternal}else{refreshSymbols()}if(!document.implementation.hasFeature("http://www.w3.org/TR/SVG11/feature#BasicStructure","1.1")){MSVG.initPictures=MSVG.removePictures}},removePictures:function(obj){var pictures=obj?$(obj):$(".SVGgraph");$(pictures).each(function(){var that=$(this);this.id=null;that.empty();that.css({color:"red",background:"yellow"});that.text("Missing picture: your  browser does not support inline SVG");window.setTimeout(function(){that.remove()},10000)})},initPictures:function(obj){var options,scales,qnode,node,node2,status,elem;var pictures=obj?$(obj):$(".SVGgraph");$(pictures).each(function(){var that=$(this);status=0;SVG=new pictureObject();options=$(this).attr("options");that.removeAttr("id");if(options){with(Math){eval("options={"+options+"}")}setOptions(options)}else{options={}}if(options.pan==false){SVG.pan=false}SVG.coords=options.coords||SVG.coords;SVG.src=$.trim($(this).text());that.empty();if(typeof options.width=="number"&&options.width>0){SVG.width=options.width;status+=1}if(typeof options.height=="number"&&options.height>0){SVG.height=options.height;status+=2}var scales=getScales(options.scales);SVG.xmin=scales[0];SVG.xmax=scales[1];SVG.ymin=scales[2];SVG.ymax=scales[3];status+=scales[4];SVG.height=options.height;if(status%4!=0){SVG.width=options.width}if(!SVG.width){SVG.width=1.6*SVG.height}else{if(!SVG.height){SVG.height=0.625*SVG.width}}if(status<8){SVG.ymax=0.5*SVG.height*(SVG.xmax-SVG.xmin)/SVG.width;SVG.ymin=-SVG.ymax}else{if(status<12){SVG.xmax=0.5*SVG.width*(SVG.ymax-SVG.ymin)/SVG.height;SVG.xmin=-SVG.xmax}}if(status==12||status==13){SVG.height=SVG.width*(SVG.ymax-SVG.ymin)/(SVG.xmax-SVG.xmin)}else{if(status==14){SVG.width=SVG.height*(SVG.xmax-SVG.xmin)/(SVG.ymax-SVG.ymin)}}SVG.id=options.id||Math.randomString(16);qnode=createSVGElement("svg");elem=$(qnode);qnode.id=SVG.id;elem.attr("xmlns","http://www.w3.org/2000/svg");elem.attr("xmlns:ev","http://www.w3.org/2001/xml-events");elem.attr("xmlns:xlink","http://www.w3.org/1999/xlink");elem.attr("version","1.1");elem.attr("baseProfile","full");if(options.border){elem.attr("style","border:"+options.border)}node2=createSVGElement("defs");node2.id=SVG.id+"_Defs";$(qnode).append(node2);node2=createSVGElement("g");node2.id=SVG.id+"_Canvas";$(qnode).append(node2);that.append(qnode);this.style.position="relative";if(!(this.nodeName=="SPAN")){setAction("mousemove",updatePosition);if(SVG.pan){setAction("mouseup",onDrop)}if(window.addEventListener){var evt=$.browser.mozilla?"DOMMouseScroll":"mousewheel";qnode.addEventListener(evt,onWheel,false)}}setAction("mousedown",onClick);setAction("mouseover",switchTo);canvas=$("#"+SVG.id+"_Canvas")[0];resize(1)});if(pictures.length>0&&$("#SVGtoolbar").length===0){node=createElementXHTML("span");node.id="SVGtoolbar";node.style.position="absolute";node.style.textAlign="left";node.style.zIndex=10;node=addButton(node,"X","Close editor",closeEditor);node=addButton(node,"Update","Update picture",updateButton,"SVGupdateButton");node=addButton(node,"SVG","View SVG code",exportSVG);node=addButton(node,"-","Zoom out",function(){zoom(1.25,true)});node=addButton(node,"+","Zoom in",function(){zoom(0.8,true)});node=addButton(node,"\u2191","Enlarge picture",function(){resize(0.8)});node=addButton(node,"\u2193","Reduce picture",function(){resize(1.25)});$(node).append("<br />");node2=createElementXHTML("textarea");$(node2).attr({id:"SVGsrc",rows:8,cols:60});$(node).append(node2);$(node).hide();$("body").append(node)}}}}(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(z) {
  if(z.tiddler && MSVG.noMathTag && jQuery.inArray(MSVG.noMathTag,z.tiddler.tags)>-1) return;
  this.lookaheadRegExp.lastIndex = z.matchStart;
  var lookaheadMatch = this.lookaheadRegExp.exec(z.source);
  if(lookaheadMatch){
    var eq = MSVG.parseMath(lookaheadMatch[1],this.displaystyle);
    if(this.displaystyle){
      var node = createTiddlyElement(z.output,"div");
      node.style.textAlign='center';
      node.appendChild(eq);
      z.output.appendChild(node);
    } else {z.output.appendChild(eq);}
    z.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: /\\\[((?:.|\n)*?)\\\]/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: "latex2",
  match: "\\\\\\\(",
  lookaheadRegExp: /\\\(((?:.|\n)*?)\\\)/mg,
  displaystyle: false,
  handler: config.formatterHelpers.MathSVGHelper
})

config.formatters.push( {
  name: "graph",
  match: "<div",
  lookaheadRegExp: /<div.+SVGgraph.+?>((?:.|\n)*?)<\/div>/mg,
  handler: function(z){
    if(z.tiddler && MSVG.noSvgTag && jQuery.inArray(MSVG.noSvgTag,z.tiddler.tags)>-1) return;
    this.lookaheadRegExp.lastIndex = z.matchStart;
    var lookaheadMatch = this.lookaheadRegExp.exec(z.source);
    if(lookaheadMatch){
      var text = lookaheadMatch[0].replace('<div','<div id="currentGraph"');
      jQuery(z.output).append(text);
      MSVG.initPictures("#currentGraph");
      z.nextMatch = lookaheadMatch.index + lookaheadMatch[0].length;
    }
  }
})

config.formatters.push( {
  name: "inlineGraph",
  match: "<span",
  lookaheadRegExp: /<span.+SVGgraph.+?>((?:.|\n)*?)<\/span>/mg,
  handler: function(z){
    if(z.tiddler && MSVG.noSvgTag && jQuery.inArray(MSVG.noSvgTag,z.tiddler.tags)>-1) return;
    this.lookaheadRegExp.lastIndex = z.matchStart;
    var lookaheadMatch = this.lookaheadRegExp.exec(z.source);
    if(lookaheadMatch){
      var text = lookaheadMatch[0].replace('<span','<span id="currentGraph"');
      jQuery(z.output).append(text);
      MSVG.initPictures("#currentGraph");
      z.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
MSVG.noMathTag = null;
MSVG.noSvgTag = 'noSVG';
//}}}
/***
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);
//}}}
/***
External javascript code can be loaded here:
***/
//{{{
 jQuery.getScript("demo.js");
 var planets = ["Venus", "Earth", "Mars", "Jupiter"];
//}}}
Name: MptwBlack
Background: #000
Foreground: #fff
PrimaryPale: #333
PrimaryLight: #555
PrimaryMid: #888
PrimaryDark: #aaa
SecondaryPale: #111
SecondaryLight: #222
SecondaryMid: #555
SecondaryDark: #888
TertiaryPale: #222
TertiaryLight: #666
TertiaryMid: #888
TertiaryDark: #aaa
Error: #300

Name: MptwBlue
Background: #fff
Foreground: #000
PrimaryPale: #cdf
PrimaryLight: #57c
PrimaryMid: #114
PrimaryDark: #012
SecondaryPale: #ffc
SecondaryLight: #fe8
SecondaryMid: #db4
SecondaryDark: #841
TertiaryPale: #eee
TertiaryLight: #ccc
TertiaryMid: #999
TertiaryDark: #666
Error: #f88

//{{{
// Pretty sure this is incomplete and experimental
// TODO: Fix it or remove it.

(function($){

merge(config.macros,{
  mptwCollapse: {
    handler: function(place,macroName,params) {
      createTiddlyButton(place, params[0] == '+' ? '\u25AD' : '\u25AC', 'collapse/uncollapse', function(){
        $(story.findContainingTiddler(place)).toggleClass('collapsed');
      });
    }
  }
});

/* this doesn't work unless you have a modified ViewTempate */
config.shadowTiddlers["MptwCollapsePluginStyles"] = ""
  +".collapsed .uncollapsedView { display:none;       }"
  +".collapsedView              { display:none;       }"
  +".collapsed .collapsedView   { display:block;      }"
  +".tiddler.collapsed          { padding-bottom:1em; }"
  +".tiddler.collapsed .title   { font-size:100%;     }"
;

store.addNotification("MptwCollapsePluginStyles",refreshStyles);

})(jQuery);

//}}}
/***
|Name:|MptwConfigPlugin|
|Description:|Miscellaneous tweaks used by MPTW|
|Version:|1.0a|
|Date:|27-Jun-2011|
|Source:|http://mptw.tiddlyspot.com/#MptwConfigPlugin|
|Author:|Simon Baird <simon.baird@gmail.com>|
|License:|http://mptw.tiddlyspot.com/#MptwConfigPlugin|
!!Note: instead of editing this you should put overrides in MptwUserConfigPlugin
***/
//{{{
var originalReadOnly = readOnly;
var originalShowBackstage = showBackstage;

config.options.chkHttpReadOnly = false;  // means web visitors can experiment with your site by clicking edit
readOnly = false;                        // needed because the above doesn't work any more post 2.1 (??)
showBackstage = true;                    // show backstage for same reason

config.options.chkInsertTabs = true;     // tab inserts a tab when editing a tiddler
config.views.wikified.defaultText = "";  // don't need message when a tiddler doesn't exist
config.views.editor.defaultText = "";    // don't need message when creating a new tiddler

config.options.chkSaveBackups = true;         // do save backups
config.options.txtBackupFolder = 'twbackup';  // put backups in a backups folder

config.options.chkAutoSave = (window.location.protocol == "file:"); // do autosave if we're in local file

config.mptwVersion = "2.7.3";

config.macros.mptwVersion={handler:function(place){wikify(config.mptwVersion,place);}};

if (config.options.txtTheme == '')
  config.options.txtTheme = 'MptwTheme';

// add to default GettingStarted
config.shadowTiddlers.GettingStarted += "\n\nSee also [[MPTW]].";

// add select theme and palette controls in default OptionsPanel
config.shadowTiddlers.OptionsPanel = config.shadowTiddlers.OptionsPanel.replace(/(\n\-\-\-\-\nAlso see \[\[AdvancedOptions\]\])/, "{{select{<<selectTheme>>\n<<selectPalette>>}}}$1");

// these are used by ViewTemplate
config.mptwDateFormat = 'DD/MM/YY';
config.mptwJournalFormat = 'Journal DD/MM/YY';

//}}}
Name: MptwGreen
Background: #fff
Foreground: #000
PrimaryPale: #9b9
PrimaryLight: #385
PrimaryMid: #031
PrimaryDark: #020
SecondaryPale: #ffc
SecondaryLight: #fe8
SecondaryMid: #db4
SecondaryDark: #841
TertiaryPale: #eee
TertiaryLight: #ccc
TertiaryMid: #999
TertiaryDark: #666
Error: #f88

Name: MptwRed
Background: #fff
Foreground: #000
PrimaryPale: #eaa
PrimaryLight: #c55
PrimaryMid: #711
PrimaryDark: #500
SecondaryPale: #ffc
SecondaryLight: #fe8
SecondaryMid: #db4
SecondaryDark: #841
TertiaryPale: #eee
TertiaryLight: #ccc
TertiaryMid: #999
TertiaryDark: #666
Error: #f88

|Name|MptwRounded|
|Description|Mptw Theme with some rounded corners (Firefox only)|
|ViewTemplate|MptwTheme##ViewTemplate|
|EditTemplate|MptwTheme##EditTemplate|
|PageTemplate|MptwTheme##PageTemplate|
|StyleSheet|##StyleSheet|

!StyleSheet
/*{{{*/

[[MptwTheme##StyleSheet]]

.tiddler,
.sliderPanel,
.button,
.tiddlyLink,
.tabContents
{ -moz-border-radius: 1em; }

.tab {
	-moz-border-radius-topleft: 0.5em;
	-moz-border-radius-topright: 0.5em;
}
#topMenu {
	-moz-border-radius-bottomleft: 2em;
	-moz-border-radius-bottomright: 2em;
}

/*}}}*/

Name: MptwSmoke
Background: #fff
Foreground: #000
PrimaryPale: #aaa
PrimaryLight: #777
PrimaryMid: #111
PrimaryDark: #000
SecondaryPale: #ffc
SecondaryLight: #fe8
SecondaryMid: #db4
SecondaryDark: #841
TertiaryPale: #eee
TertiaryLight: #ccc
TertiaryMid: #999
TertiaryDark: #666
Error: #f88

|Name|MptwStandard|
|Description|Mptw Theme with the default TiddlyWiki PageLayout and Styles|
|ViewTemplate|MptwTheme##ViewTemplate|
|EditTemplate|MptwTheme##EditTemplate|
Name: MptwTeal
Background: #fff
Foreground: #000
PrimaryPale: #B5D1DF
PrimaryLight: #618FA9
PrimaryMid: #1a3844
PrimaryDark: #000
SecondaryPale: #ffc
SecondaryLight: #fe8
SecondaryMid: #db4
SecondaryDark: #841
TertiaryPale: #f8f8f8
TertiaryLight: #bbb
TertiaryMid: #999
TertiaryDark: #888
Error: #f88
|Name|MptwTheme|
|Description|Mptw Theme including custom PageLayout|
|PageTemplate|##PageTemplate|
|ViewTemplate|##ViewTemplate|
|EditTemplate|##EditTemplate|
|StyleSheet|##StyleSheet|

http://mptw.tiddlyspot.com/#MptwTheme ($Rev: 1829 $)

!PageTemplate
<!--{{{-->
<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>
<!--}}}-->

!ViewTemplate
<!--{{{-->
<div class="uncollapsedView">
[[MptwTheme##ViewTemplateToolbar]]

<div class="tagglyTagged" macro="tags"></div>

<div class='titleContainer'>
	<span class='title' macro='view title'></span>
	<span macro="miniTag"></span>
</div>

<div class='subtitle'>
	(updated <span macro='view modified date {{config.mptwDateFormat?config.mptwDateFormat:"MM/0DD/YY"}}'></span>
	by <span macro='view modifier link'></span>)
	<!--
	(<span macro='message views.wikified.createdPrompt'></span>
	<span macro='view created date {{config.mptwDateFormat?config.mptwDateFormat:"MM/0DD/YY"}}'></span>)
	-->
</div>

<div macro="showWhen tiddler.tags.containsAny(['css','html','pre','systemConfig']) && !tiddler.text.match('{{'+'{')">
	<div class='viewer'><pre macro='view text'></pre></div>
</div>
<div macro="else">
	<div class='viewer' macro='view text wikified'></div>
</div>

<div class="tagglyTagging" macro="tagglyTagging"></div>
</div>
<div class="collapsedView">
	<span class='toolbar'>
		<span macro='toolbar closeTiddler'></span>
		<span macro='mptwCollapse +'></span>
	</span>
	<span class='title' macro='view title'></span>
</div>

<!--}}}-->

!ViewTemplateToolbar
<!--{{{-->
<div class='toolbar'>
	<span macro="showWhenTagged systemConfig">
		<span macro="toggleTag systemConfigDisable . '[[disable|systemConfigDisable]]'"></span>
	</span>
	<span macro="showWhenTagged systemTheme"><span macro="applyTheme"></span></span>
	<span macro="showWhenTagged systemPalette"><span macro="applyPalette"></span></span>
	<span macro="showWhen tiddler.tags.contains('css') || tiddler.title == 'StyleSheet'"><span macro="refreshAll"></span></span>
	<span style="padding:1em;"></span>
	<span macro='toolbar closeTiddler closeOthers +editTiddler deleteTiddler > fields syncing permalink references jump'></span> <span macro='newHere label:"new here"'></span>
	<span macro='newJournalHere {{config.mptwJournalFormat?config.mptwJournalFormat:"MM/0DD/YY"}}'></span>
	<!--span macro='mptwCollapse -'></span-->
</div>
<!--}}}-->

!EditTemplate
<!--{{{-->
<div class="toolbar" macro="toolbar +saveTiddler saveCloseTiddler closeOthers -cancelTiddler cancelCloseTiddler deleteTiddler"></div>
<div class="title" macro="view title"></div>
<div class="editLabel">Title</div><div class="editor" macro="edit title"></div>
<div macro='annotations'></div>
<div class="editLabel">Content</div><div class="editor" macro="edit text"></div>
<div class="editLabel">Tags</div><div class="editor" macro="edit tags"></div>
<div class="editorFooter"><span macro="message views.editor.tagPrompt"></span><span macro="tagChooser"></span></div>
<!--}}}-->

!StyleSheet
/*{{{*/

/* a contrasting background so I can see where one tiddler ends and the other begins */
body {
	background: [[ColorPalette::TertiaryLight]];
}

/* sexy colours and font for the header */
.headerForeground {
	color: [[ColorPalette::PrimaryPale]];
}
.headerShadow, .headerShadow a {
	color: [[ColorPalette::PrimaryMid]];
}

/* separate the top menu parts */
.headerForeground, .headerShadow {
	padding: 1em 1em 0;
}

.headerForeground, .headerShadow {
	font-family: 'Trebuchet MS', sans-serif;
	font-weight:bold;
}
.headerForeground .siteSubtitle {
	color: [[ColorPalette::PrimaryLight]];
}
.headerShadow .siteSubtitle {
	color: [[ColorPalette::PrimaryMid]];
}

/* make shadow go and down right instead of up and left */
.headerShadow {
	left: 1px;
	top: 1px;
}

/* prefer monospace for editing */
.editor textarea, .editor input {
	font-family: 'Consolas', monospace;
	background-color:[[ColorPalette::TertiaryPale]];
}


/* sexy tiddler titles */
.title {
	font-size: 250%;
	color: [[ColorPalette::PrimaryLight]];
	font-family: 'Trebuchet MS', sans-serif;
}

/* more subtle tiddler subtitle */
.subtitle {
	padding:0px;
	margin:0px;
	padding-left:1em;
	font-size: 90%;
	color: [[ColorPalette::TertiaryMid]];
}
.subtitle .tiddlyLink {
	color: [[ColorPalette::TertiaryMid]];
}

/* a little bit of extra whitespace */
.viewer {
	padding-bottom:3px;
}

/* don't want any background color for headings */
h1,h2,h3,h4,h5,h6 {
	background-color: transparent;
	color: [[ColorPalette::Foreground]];
}

/* give tiddlers 3d style border and explicit background */
.tiddler {
	background: [[ColorPalette::Background]];
	border-right: 2px [[ColorPalette::TertiaryMid]] solid;
	border-bottom: 2px [[ColorPalette::TertiaryMid]] solid;
	margin-bottom: 1em;
	padding:1em 2em 2em 1.5em;
}

/* make options slider look nicer */
#sidebarOptions .sliderPanel {
	border:solid 1px [[ColorPalette::PrimaryLight]];
}

/* the borders look wrong with the body background */
#sidebar .button {
	border-style: none;
}

/* this means you can put line breaks in SidebarOptions for readability */
#sidebarOptions br {
	display:none;
}
/* undo the above in OptionsPanel */
#sidebarOptions .sliderPanel br {
	display:inline;
}

/* horizontal main menu stuff */
#displayArea {
	margin: 1em 15.7em 0em 1em; /* use the freed up space */
}
#topMenu br {
	display: none;
}
#topMenu {
	background: [[ColorPalette::PrimaryMid]];
	color:[[ColorPalette::PrimaryPale]];
}
#topMenu {
	padding:2px;
}
#topMenu .button, #topMenu .tiddlyLink, #topMenu a {
	margin-left: 0.5em;
	margin-right: 0.5em;
	padding-left: 3px;
	padding-right: 3px;
	color: [[ColorPalette::PrimaryPale]];
	font-size: 115%;
}
#topMenu .button:hover, #topMenu .tiddlyLink:hover {
	background: [[ColorPalette::PrimaryDark]];
}

/* make 2.2 act like 2.1 with the invisible buttons */
.toolbar {
	visibility:hidden;
}
.selected .toolbar {
	visibility:visible;
}

/* experimental. this is a little borked in IE7 with the button 
 * borders but worth it I think for the extra screen realestate */
.toolbar { float:right; }

/* fix for TaggerPlugin. from sb56637. improved by FND */
.popup li .tagger a {
   display:inline;
}

/* makes theme selector look a little better */
#sidebarOptions .sliderPanel .select .button {
  padding:0.5em;
  display:block;
}
#sidebarOptions .sliderPanel .select br {
	display:none;
}

/* make it print a little cleaner */
@media print {
	#topMenu {
		display: none ! important;
	}
	/* not sure if we need all the importants */
	.tiddler {
		border-style: none ! important;
		margin:0px ! important;
		padding:0px ! important;
		padding-bottom:2em ! important;
	}
	.tagglyTagging .button, .tagglyTagging .hidebutton {
		display: none ! important;
	}
	.headerShadow {
		visibility: hidden ! important;
	}
	.tagglyTagged .quickopentag, .tagged .quickopentag {
		border-style: none ! important;
	}
	.quickopentag a.button, .miniTag {
		display: none ! important;
	}
}

/* get user styles specified in StyleSheet */
[[StyleSheet]]

/*}}}*/

|Name|MptwTrim|
|Description|Mptw Theme with a reduced header to increase useful space|
|ViewTemplate|MptwTheme##ViewTemplate|
|EditTemplate|MptwTheme##EditTemplate|
|StyleSheet|MptwTheme##StyleSheet|
|PageTemplate|##PageTemplate|

!PageTemplate
<!--{{{-->

<!-- horizontal MainMenu -->
<div id='topMenu' macro='gradient vert [[ColorPalette::PrimaryLight]] [[ColorPalette::PrimaryMid]]'>
<span refresh='content' tiddler='SiteTitle' style="padding-left:1em;font-weight:bold;"></span>:
<span refresh='content' tiddler='MainMenu'></span>
</div>
<div id='sidebar'>
	<div id='sidebarOptions'>
		<div refresh='content' tiddler='SideBarOptions'></div>
		<div style="margin-left:0.1em;"
			macro='slider chkTabSliderPanel SideBarTabs {{"tabs \u00bb"}} "Show Timeline, All, Tags, etc"'></div>
	</div>
</div>
<div id='displayArea'>
	<div id='messageArea'></div>
	<div id='tiddlerDisplay'></div>
</div>

/***
|Description:|A place to put your config tweaks so they aren't overwritten when you upgrade MPTW|
See http://www.tiddlywiki.org/wiki/Configuration_Options for other options you can set. In some cases where there are clashes with other plugins it might help to rename this to zzMptwUserConfigPlugin so it gets executed last.
***/
//{{{

// example: set your preferred date format
//config.mptwDateFormat = 'MM/0DD/YY';
//config.mptwJournalFormat = 'Journal MM/0DD/YY';

// example: set the theme you want to start with
//config.options.txtTheme = 'MptwRoundTheme';

// example: switch off autosave, switch on backups and set a backup folder
//config.options.chkSaveBackups = true;
//config.options.chkAutoSave = false;
//config.options.txtBackupFolder = 'backups';

// uncomment to disable 'new means new' functionality for the new journal macro
//config.newMeansNewForJournalsToo = false;

//}}}
!Sesión 1
Se acordó que la primera sesión sería asignada para estudio a distancia, debido a solicitud de los estudiantes. Deben examinar todo el material disponible acá sobre el tema y aclarar las dudas vía correo electrónico.

!Sesión 2
#Revisión de Pendientes
#Exposición por parte del profesor sobre la naturaleza de los casos especiales.
#Asignación de problemario a evaluar individualmente. Ver acá el [[problemario de casos especiales|https://sites.google.com/site/omanzanillausb/docencia/ps3161---tecnicas-de-optimizacion/3._Problemas_Solucion_Grafica_Casos_Especiales_EneMar10.pdf?attredirects=0&d=1]].


!¿Cómo resolver un PL mediante el Método de Solución Gráfica?
*[[VideoSoluciónGráfica(EnInglés)]]
*[[AnimaciónDelProcedimiento|http://optlab-server.sce.carleton.ca/POAnimations2007/Graph.html]]
*[[DefinicionesSoluciónGráfica]]
*[[AplicaciónWebParaSoluciónGráfica|http://people.hofstra.edu/stefan_waner/realworld/lpgrapher/lpg.html]]
!Casos de Ejemplo del Método de Solución Gráfica
*[[VideoEjemploSoluciónGráfica]]
!Casos Especiales de Solución de Modelos de Programación Lineal
*[[VideosYPresentaciónResumenDeCasosEspeciales]]
!Práctica
*[[ProblemarioDeSoluciónGráfica]]
*[[ProblemarioDeCasosEspeciales]]
/***
|Name|NestedSlidersPlugin|
|Source|http://www.TiddlyTools.com/#NestedSlidersPlugin|
|Documentation|http://www.TiddlyTools.com/#NestedSlidersPluginInfo|
|Version|2.4.9|
|Author|Eric Shulman|
|License|http://www.TiddlyTools.com/#LegalStatements|
|~CoreVersion|2.1|
|Type|plugin|
|Description|show content in nest-able sliding/floating panels, without creating separate tiddlers for each panel's content|
!!!!!Documentation
>see [[NestedSlidersPluginInfo]]
!!!!!Configuration
<<<
<<option chkFloatingSlidersAnimate>> allow floating sliders to animate when opening/closing
>Note: This setting can cause 'clipping' problems in some versions of InternetExplorer.
>In addition, for floating slider animation to occur you must also allow animation in general (see [[AdvancedOptions]]).
<<<
!!!!!Revisions
<<<
2008.11.15 - 2.4.9 in adjustNestedSlider(), don't make adjustments if panel is marked as 'undocked' (CSS class).  In onClickNestedSlider(), SHIFT-CLICK docks panel (see [[MoveablePanelPlugin]])
|please see [[NestedSlidersPluginInfo]] for additional revision details|
2005.11.03 - 1.0.0 initial public release.  Thanks to RodneyGomes, GeoffSlocock, and PaulPetterson for suggestions and experiments.
<<<
!!!!!Code
***/
//{{{
version.extensions.NestedSlidersPlugin= {major: 2, minor: 4, revision: 9, date: new Date(2008,11,15)};

// options for deferred rendering of sliders that are not initially displayed
if (config.options.chkFloatingSlidersAnimate===undefined)
	config.options.chkFloatingSlidersAnimate=false; // avoid clipping problems in IE

// default styles for 'floating' class
setStylesheet(".floatingPanel { position:absolute; z-index:10; padding:0.5em; margin:0em; \
	background-color:#eee; color:#000; border:1px solid #000; text-align:left; }","floatingPanelStylesheet");

// if removeCookie() function is not defined by TW core, define it here.
if (window.removeCookie===undefined) {
	window.removeCookie=function(name) {
		document.cookie = name+'=; expires=Thu, 01-Jan-1970 00:00:01 UTC; path=/;'; 
	}
}

config.formatters.push( {
	name: "nestedSliders",
	match: "\\n?\\+{3}",
	terminator: "\\s*\\={3}\\n?",
	lookahead: "\\n?\\+{3}(\\+)?(\\([^\\)]*\\))?(\\!*)?(\\^(?:[^\\^\\*\\@\\[\\>]*\\^)?)?(\\*)?(\\@)?(?:\\{\\{([\\w]+[\\s\\w]*)\\{)?(\\[[^\\]]*\\])?(\\[[^\\]]*\\])?(?:\\}{3})?(\\#[^:]*\\:)?(\\>)?(\\.\\.\\.)?\\s*",
	handler: function(w)
		{
			lookaheadRegExp = new RegExp(this.lookahead,"mg");
			lookaheadRegExp.lastIndex = w.matchStart;
			var lookaheadMatch = lookaheadRegExp.exec(w.source)
			if(lookaheadMatch && lookaheadMatch.index == w.matchStart)
			{
				var defopen=lookaheadMatch[1];
				var cookiename=lookaheadMatch[2];
				var header=lookaheadMatch[3];
				var panelwidth=lookaheadMatch[4];
				var transient=lookaheadMatch[5];
				var hover=lookaheadMatch[6];
				var buttonClass=lookaheadMatch[7];
				var label=lookaheadMatch[8];
				var openlabel=lookaheadMatch[9];
				var panelID=lookaheadMatch[10];
				var blockquote=lookaheadMatch[11];
				var deferred=lookaheadMatch[12];

				// location for rendering button and panel
				var place=w.output;

				// default to closed, no cookie, no accesskey, no alternate text/tip
				var show="none"; var cookie=""; var key="";
				var closedtext=">"; var closedtip="";
				var openedtext="<"; var openedtip="";

				// extra "+", default to open
				if (defopen) show="block";

				// cookie, use saved open/closed state
				if (cookiename) {
					cookie=cookiename.trim().slice(1,-1);
					cookie="chkSlider"+cookie;
					if (config.options[cookie]==undefined)
						{ config.options[cookie] = (show=="block") }
					show=config.options[cookie]?"block":"none";
				}

				// parse label/tooltip/accesskey: [label=X|tooltip]
				if (label) {
					var parts=label.trim().slice(1,-1).split("|");
					closedtext=parts.shift();
					if (closedtext.substr(closedtext.length-2,1)=="=")	
						{ key=closedtext.substr(closedtext.length-1,1); closedtext=closedtext.slice(0,-2); }
					openedtext=closedtext;
					if (parts.length) closedtip=openedtip=parts.join("|");
					else { closedtip="show "+closedtext; openedtip="hide "+closedtext; }
				}

				// parse alternate label/tooltip: [label|tooltip]
				if (openlabel) {
					var parts=openlabel.trim().slice(1,-1).split("|");
					openedtext=parts.shift();
					if (parts.length) openedtip=parts.join("|");
					else openedtip="hide "+openedtext;
				}

				var title=show=='block'?openedtext:closedtext;
				var tooltip=show=='block'?openedtip:closedtip;

				// create the button
				if (header) { // use "Hn" header format instead of button/link
					var lvl=(header.length>5)?5:header.length;
					var btn = createTiddlyElement(createTiddlyElement(place,"h"+lvl,null,null,null),"a",null,buttonClass,title);
					btn.onclick=onClickNestedSlider;
					btn.setAttribute("href","javascript:;");
					btn.setAttribute("title",tooltip);
				}
				else
					var btn = createTiddlyButton(place,title,tooltip,onClickNestedSlider,buttonClass);
				btn.innerHTML=title; // enables use of HTML entities in label

				// set extra button attributes
				btn.setAttribute("closedtext",closedtext);
				btn.setAttribute("closedtip",closedtip);
				btn.setAttribute("openedtext",openedtext);
				btn.setAttribute("openedtip",openedtip);
				btn.sliderCookie = cookie; // save the cookiename (if any) in the button object
				btn.defOpen=defopen!=null; // save default open/closed state (boolean)
				btn.keyparam=key; // save the access key letter ("" if none)
				if (key.length) {
					btn.setAttribute("accessKey",key); // init access key
					btn.onfocus=function(){this.setAttribute("accessKey",this.keyparam);}; // **reclaim** access key on focus
				}
				btn.setAttribute("hover",hover?"true":"false");
				btn.onmouseover=function(ev) {
					// optional 'open on hover' handling
					if (this.getAttribute("hover")=="true" && this.sliderPanel.style.display=='none') {
						document.onclick.call(document,ev); // close transients
						onClickNestedSlider(ev); // open this slider
					}
					// mouseover on button aligns floater position with button
					if (window.adjustSliderPos) window.adjustSliderPos(this.parentNode,this,this.sliderPanel);
				}

				// create slider panel
				var panelClass=panelwidth?"floatingPanel":"sliderPanel";
				if (panelID) panelID=panelID.slice(1,-1); // trim off delimiters
				var panel=createTiddlyElement(place,"div",panelID,panelClass,null);
				panel.button = btn; // so the slider panel know which button it belongs to
				btn.sliderPanel=panel; // so the button knows which slider panel it belongs to
				panel.defaultPanelWidth=(panelwidth && panelwidth.length>2)?panelwidth.slice(1,-1):"";
				panel.setAttribute("transient",transient=="*"?"true":"false");
				panel.style.display = show;
				panel.style.width=panel.defaultPanelWidth;
				panel.onmouseover=function(event) // mouseover on panel aligns floater position with button
					{ if (window.adjustSliderPos) window.adjustSliderPos(this.parentNode,this.button,this); }

				// render slider (or defer until shown) 
				w.nextMatch = lookaheadMatch.index + lookaheadMatch[0].length;
				if ((show=="block")||!deferred) {
					// render now if panel is supposed to be shown or NOT deferred rendering
					w.subWikify(blockquote?createTiddlyElement(panel,"blockquote"):panel,this.terminator);
					// align floater position with button
					if (window.adjustSliderPos) window.adjustSliderPos(place,btn,panel);
				}
				else {
					var src = w.source.substr(w.nextMatch);
					var endpos=findMatchingDelimiter(src,"+++","===");
					panel.setAttribute("raw",src.substr(0,endpos));
					panel.setAttribute("blockquote",blockquote?"true":"false");
					panel.setAttribute("rendered","false");
					w.nextMatch += endpos+3;
					if (w.source.substr(w.nextMatch,1)=="\n") w.nextMatch++;
				}
			}
		}
	}
)

function findMatchingDelimiter(src,starttext,endtext) {
	var startpos = 0;
	var endpos = src.indexOf(endtext);
	// check for nested delimiters
	while (src.substring(startpos,endpos-1).indexOf(starttext)!=-1) {
		// count number of nested 'starts'
		var startcount=0;
		var temp = src.substring(startpos,endpos-1);
		var pos=temp.indexOf(starttext);
		while (pos!=-1)  { startcount++; pos=temp.indexOf(starttext,pos+starttext.length); }
		// set up to check for additional 'starts' after adjusting endpos
		startpos=endpos+endtext.length;
		// find endpos for corresponding number of matching 'ends'
		while (startcount && endpos!=-1) {
			endpos = src.indexOf(endtext,endpos+endtext.length);
			startcount--;
		}
	}
	return (endpos==-1)?src.length:endpos;
}
//}}}
//{{{
window.onClickNestedSlider=function(e)
{
	if (!e) var e = window.event;
	var theTarget = resolveTarget(e);
	while (theTarget && theTarget.sliderPanel==undefined) theTarget=theTarget.parentNode;
	if (!theTarget) return false;
	var theSlider = theTarget.sliderPanel;
	var isOpen = theSlider.style.display!="none";

	// if SHIFT-CLICK, dock panel first (see [[MoveablePanelPlugin]])
	if (e.shiftKey && config.macros.moveablePanel) config.macros.moveablePanel.dock(theSlider,e);

	// toggle label
	theTarget.innerHTML=isOpen?theTarget.getAttribute("closedText"):theTarget.getAttribute("openedText");
	// toggle tooltip
	theTarget.setAttribute("title",isOpen?theTarget.getAttribute("closedTip"):theTarget.getAttribute("openedTip"));

	// deferred rendering (if needed)
	if (theSlider.getAttribute("rendered")=="false") {
		var place=theSlider;
		if (theSlider.getAttribute("blockquote")=="true")
			place=createTiddlyElement(place,"blockquote");
		wikify(theSlider.getAttribute("raw"),place);
		theSlider.setAttribute("rendered","true");
	}

	// show/hide the slider
	if(config.options.chkAnimate && (!hasClass(theSlider,'floatingPanel') || config.options.chkFloatingSlidersAnimate))
		anim.startAnimating(new Slider(theSlider,!isOpen,e.shiftKey || e.altKey,"none"));
	else
		theSlider.style.display = isOpen ? "none" : "block";

	// reset to default width (might have been changed via plugin code)
	theSlider.style.width=theSlider.defaultPanelWidth;

	// align floater panel position with target button
	if (!isOpen && window.adjustSliderPos) window.adjustSliderPos(theSlider.parentNode,theTarget,theSlider);

	// if showing panel, set focus to first 'focus-able' element in panel
	if (theSlider.style.display!="none") {
		var ctrls=theSlider.getElementsByTagName("*");
		for (var c=0; c<ctrls.length; c++) {
			var t=ctrls[c].tagName.toLowerCase();
			if ((t=="input" && ctrls[c].type!="hidden") || t=="textarea" || t=="select")
				{ try{ ctrls[c].focus(); } catch(err){;} break; }
		}
	}
	var cookie=theTarget.sliderCookie;
	if (cookie && cookie.length) {
		config.options[cookie]=!isOpen;
		if (config.options[cookie]!=theTarget.defOpen) window.saveOptionCookie(cookie);
		else window.removeCookie(cookie); // remove cookie if slider is in default display state
	}

	// prevent SHIFT-CLICK from being processed by browser (opens blank window... yuck!)
	// prevent clicks *within* a slider button from being processed by browser
	// but allow plain click to bubble up to page background (to close transients, if any)
	if (e.shiftKey || theTarget!=resolveTarget(e))
		{ e.cancelBubble=true; if (e.stopPropagation) e.stopPropagation(); }
	Popup.remove(); // close open popup (if any)
	return false;
}
//}}}
//{{{
// click in document background closes transient panels 
document.nestedSliders_savedOnClick=document.onclick;
document.onclick=function(ev) { if (!ev) var ev=window.event; var target=resolveTarget(ev);

	if (document.nestedSliders_savedOnClick)
		var retval=document.nestedSliders_savedOnClick.apply(this,arguments);
	// if click was inside a popup... leave transient panels alone
	var p=target; while (p) if (hasClass(p,"popup")) break; else p=p.parentNode;
	if (p) return retval;
	// if click was inside transient panel (or something contained by a transient panel), leave it alone
	var p=target; while (p) {
		if ((hasClass(p,"floatingPanel")||hasClass(p,"sliderPanel"))&&p.getAttribute("transient")=="true") break;
		p=p.parentNode;
	}
	if (p) return retval;
	// otherwise, find and close all transient panels...
	var all=document.all?document.all:document.getElementsByTagName("DIV");
	for (var i=0; i<all.length; i++) {
		 // if it is not a transient panel, or the click was on the button that opened this panel, don't close it.
		if (all[i].getAttribute("transient")!="true" || all[i].button==target) continue;
		// otherwise, if the panel is currently visible, close it by clicking it's button
		if (all[i].style.display!="none") window.onClickNestedSlider({target:all[i].button})
		if (!hasClass(all[i],"floatingPanel")&&!hasClass(all[i],"sliderPanel")) all[i].style.display="none";
	}
	return retval;
};
//}}}
//{{{
// adjust floating panel position based on button position
if (window.adjustSliderPos==undefined) window.adjustSliderPos=function(place,btn,panel) {
	if (hasClass(panel,"floatingPanel") && !hasClass(panel,"undocked")) {
		// see [[MoveablePanelPlugin]] for use of 'undocked'
		var rightEdge=document.body.offsetWidth-1;
		var panelWidth=panel.offsetWidth;
		var left=0;
		var top=btn.offsetHeight; 
		if (place.style.position=="relative" && findPosX(btn)+panelWidth>rightEdge) {
			left-=findPosX(btn)+panelWidth-rightEdge; // shift panel relative to button
			if (findPosX(btn)+left<0) left=-findPosX(btn); // stay within left edge
		}
		if (place.style.position!="relative") {
			var left=findPosX(btn);
			var top=findPosY(btn)+btn.offsetHeight;
			var p=place; while (p && !hasClass(p,'floatingPanel')) p=p.parentNode;
			if (p) { left-=findPosX(p); top-=findPosY(p); }
			if (left+panelWidth>rightEdge) left=rightEdge-panelWidth;
			if (left<0) left=0;
		}
		panel.style.left=left+"px"; panel.style.top=top+"px";
	}
}
//}}}
//{{{
// TW2.1 and earlier:
// hijack Slider stop handler so overflow is visible after animation has completed
Slider.prototype.coreStop = Slider.prototype.stop;
Slider.prototype.stop = function()
	{ this.coreStop.apply(this,arguments); this.element.style.overflow = "visible"; }

// TW2.2+
// hijack Morpher stop handler so sliderPanel/floatingPanel overflow is visible after animation has completed
if (version.major+.1*version.minor+.01*version.revision>=2.2) {
	Morpher.prototype.coreStop = Morpher.prototype.stop;
	Morpher.prototype.stop = function() {
		this.coreStop.apply(this,arguments);
		var e=this.element;
		if (hasClass(e,"sliderPanel")||hasClass(e,"floatingPanel")) {
			// adjust panel overflow and position after animation
			e.style.overflow = "visible";
			if (window.adjustSliderPos) window.adjustSliderPos(e.parentNode,e.button,e);
		}
	};
}
//}}}
/***
|Name|NestedSlidersPluginInfo|
|Source|http://www.TiddlyTools.com/#NestedSlidersPlugin|
|Documentation|http://www.TiddlyTools.com/#NestedSlidersPluginInfo|
|Version|2.4.9|
|Author|Eric Shulman|
|License|http://www.TiddlyTools.com/#LegalStatements|
|~CoreVersion|2.1|
|Type|documentation|
|Description|documentation for NestedSlidersPlugin|
This plugin adds new wiki syntax for embedding 'slider' panels directly into tiddler content.
!!!!!Usage
<<<
//{{{
++++(cookiename)!!!!!^width^*@{{class{[label=key|tooltip][altlabel|alttooltip]}}}#panelID:>...
content goes here
===
//}}}
* ''"""+++""" (or """++++""") and """==="""''<br>marks the start and end of the slider definition, respectively.  When the extra {{{+}}} is used, the slider will be open when initially displayed.
* ''"""(cookiename)"""''<br>saves the slider opened/closed state, and restores this state whenever the slider is re-rendered.
* ''"""! through !!!!!"""''<br>displays the slider label using a formatted headline (Hn) style instead of a button/link style
* ''"""^width^ (or just ^)"""''<br>makes the slider 'float' on top of other content rather than shifting that content downward.  'width' must be a valid CSS value (e.g., "30em", "180px", "50%", etc.).  If omitted, the default width is "auto" (i.e., fit to content)
* ''"""*"""''<br>denotes "transient display": when a click occurs elsewhere in the document, the slider/floating panel will be automatically closed.  This is useful for creating 'pulldown menus' that automatically go away after they are used.  //Note: using SHIFT-click on a slider label will open/close that slider without triggering the automatic closing of any transient slider panels that are currently displayed, permitting ''temporary'' display of several transient panels at once.//
* ''"""@"""''<br>denotes "open on hover": the slider/floating panel will be automatically opened as soon as the mouse moves over the slider label, without requiring a click.
* ''"""{{class{[label=key|tooltip][altlabel|alttooltip]}}}"""''<br>uses label/tooltip/accesskey.  """{{class{...}}}""", """=key""", """|tooltip""" and """[altlabel|alttooltip]""" are optional.  'class' is any valid CSS class name, used to style the slider label text.  'key' must be a ''single letter only''.  altlabel/alttooltip specify alternative label/tooltip for use when slider/floating panel is displayed.  //Note: you can use HTML syntax within the label text to include HTML entities (e.g., {{{&raquo;}}} (&raquo;) or {{{&#x25ba;}}} (&#x25ba;), or even embedded images (e.g., {{{<img src="images/eric3.gif">}}}).//
* ''"""#panelID:"""''<br>defines a unique DOM element ID that is assigned to the panel element used to display the slider content.  This ID can then be used later to reposition the panel using the {{{<<DOM move id>>}}} macro (see [[DOMTweaksPlugin]]), or to access/modify the panel element through use of {{{document.getElementById(...)}}}) javascript code in a plugin or inline script.
* ''""">"""''<br>automatically adds blockquote formatting to slider content
* ''"""..."""''<br>defers rendering of closed sliders until the first time they are opened.
Notes:
*You can 'nest' sliders as deep as you like (see complex nesting example below), so that expandable 'tree-like' hierarchical displays can be created.
*Deferred rendering (...) can be used to offset processing overhead until actually needed. However, this may produce unexpected results in some cases.  Use with care.
* To make slider definitions easier to read and recognize when editing a tiddler, newlines immediately following the 'start slider' or preceding the 'end slider' sequences are automatically supressed so that excess whitespace is eliminated from the output.
<<<
!!!!!Examples
<<<
simple in-line slider: 
{{{
+++content===
}}}
+++content===
----
use a custom label and tooltip: 
{{{
+++[label|tooltip]content===
}}}
+++[label|tooltip]content===
----
content automatically blockquoted: 
{{{
+++>content===
}}}
+++>content===
----
all options (except cookie) //(default open, heading, sized floater, transient, open on hover, class, label/tooltip/key, blockquoted, deferred)//
{{{
++++!!!^30em^*@{{big{[label=Z|click or press Alt-Z to open]}}}>...
   content
===
}}}
++++!!!^30em^*@{{big{[label=Z|click or press Alt-Z to open]}}}>...
   content
===
----
complex nesting example:
{{{
+++[get info...=I|click for information or press Alt-I]
	put some general information here,
	plus a floating panel with more specific info:
	+++^10em^[view details...|click for details]
		put some detail here, which could in turn contain a transient panel,
		perhaps with a +++^25em^*[glossary definition]explaining technical terms===
	===
===
}}}
+++[get info...=I|click for information or press Alt-I]
	put some general information here,
	plus a floating panel with more specific info:
	+++^10em^[view details...|click for details]
		put some detail here, which could in turn contain a transient panel,
		perhaps with a +++^25em^*[glossary definition]explaining technical terms===
	===
===
----
embedded image as slider button
{{{
+++[<img src=images/eric3.gif>|click me!]>
	{{big{OUCH!}}}
===
}}}
+++[<img src=images/eric3.gif>|click me!]>
	{{big{OUCH!}}}
===
<<<
!!!!!Revisions
<<<
2008.11.15 2.4.9 in adjustNestedSlider(), don't make adjustments if panel is marked as 'undocked' (CSS class).  In onClickNestedSlider(), SHIFT-CLICK docks panel (see [[MoveablePanelPlugin]])
2008.11.13 2.4.8 in document.onclick(), if transient panel is not a sliderPanel or floatingPanel, hide it via CSS
2008.10.05 2.4.7 in onClickNestedSlider(), added try/catch around focus() call to prevent IE error if input field being focused on is currently not visible.
2008.09.07 2.4.6 added removeCookie() function for compatibility with [[CookieManagerPlugin]]
2008.06.07 2.4.5 in 'onmouseover' handler for 'open on hover' slider buttons, use call() method when invoking document.onclick function (avoids error in IE)
2008.06.07 2.4.4 changed default for chkFloatingSlidersAnimate to FALSE to avoid clipping problem on some browsers (IE).  Updated Morpher hijack (again) to adjust regular sliderPanel styles as well as floatingPanel styles.
2008.05.07 2.4.3 updated Morpher hijack to adjust floatingPanel styles after animation without affecting other animated elements (i.e. popups).  Also, updated adjustSliderPos() to account for scrollwidth and use core findWindowWidth().
2008.04.02 2.4.2 in onClickNestedSlider, handle clicks on elements contained //within// slider buttons (e.g., when using HTML to display an image as a slider button).
2008.04.01 2.4.1 open on hover also triggers document.onclick to close other transient sliders
2008.04.01 2.4.0 re-introduced 'open on hover' feature using "@" symbol
2008.03.26 2.3.5 in document.onclick(), if click is in popup, don't dismiss transient panel (if any)
2008.01.08 [*.*.*] plugin size reduction: documentation moved to ...Info tiddler
2007.12.28 2.3.4 added hijack for Animator.prototype.startAnimating().  Previously, the plugin code simply set the overflow to "visible" after animation.  This code tweak corrects handling of elements that were styled with overflow=hidden/auto/scroll before animation by saving the overflow style and then restoring it after animation has completed.
2007.12.17 2.3.3 use hasClass() instead of direct comparison to test for "floatingPanel" class.  Allows floating panels to have additional classes assigned to them (i.e., by AnimationEffectsPlugin).
2007.11.14 2.3.2 in onClickNestedSlider(), prevent SHIFT-click events from opening a new, empty browser window by setting "cancelBubble=true" and calling "stopPropagation()".  Note: SHIFT-click is still processed as a normal click (i.e., it toggles the slider panel display).  Also, using SHIFT-click will prevent 'transient' sliders from being automatically closed when another slider is opened, allowing you to *temporarily* display several transient sliders at once.
2007.07.26 2.3.1 in document.onclick(), propagate return value from hijacked core click handler to consume OR bubble up click as needed.  Fixes "IE click disease", whereby nearly every mouse click causes a page transition.
2007.07.20 2.3.0 added syntax for setting panel ID (#panelID:).  This allows individual slider panels to be repositioned within tiddler content simply by giving them a unique ID and then moving them to the desired location using the {{{<<DOM move id>>}}} macro.
2007.07.19 2.2.0 added syntax for alttext and alttip (button label and tooltip to be displayed when panel is open)
2007.07.14 2.1.2 corrected use of 'transient' attribute in IE to prevent (non-recursive) infinite loop
2007.07.12 2.1.0 replaced use of "*" for 'open/close on rollover' (which didn't work too well).  "*" now indicates 'transient' panels that are automatically closed if a click occurs somewhere else in the document.  This permits use of nested sliders to create nested "pulldown menus" that automatically disappear after interaction with them has been completed.  Also, in onClickNestedSlider(), use "theTarget.sliderCookie", instead of "this.sliderCookie" to correct cookie state tracking when automatically dismissing transient panels.
2007.06.10 2.0.5 add check to ensure that window.adjustSliderPanel() is defined before calling it (prevents error on shutdown when mouse event handlers are still defined)
2007.05.31 2.0.4 add handling to invoke adjustSliderPanel() for onmouseover events on slider button and panel.  This allows the panel position to be re-synced when the button position shifts due to changes in unrelated content above it on the page.  (thanks to Harsha for bug report)
2007.03.30 2.0.3 added chkFloatingSlidersAnimate (default to FALSE), so that slider animation can be disabled independent of the overall document animation setting (avoids strange rendering and focus problems in floating panels)
2007.03.01 2.0.2 for TW2.2+, hijack Morpher.prototype.stop so that "overflow:hidden" can be reset to "overflow:visible" after animation ends
2007.03.01 2.0.1 in hijack for Slider.prototype.stop, use apply() to pass params to core function
2006.07.28 2.0.0 added custom class syntax around label/tip/key syntax: {{{{{classname{[label=key|tip]}}}}}}
2006.07.25 1.9.3 when parsing slider, save default open/closed state in button element, then in onClickNestedSlider(), if slider state matches saved default, instead of saving cookie, delete it.  Significantly reduces the 'cookie overhead' when default slider states are used.
2006.06.29 1.9.2 in onClickNestedSlider(), when setting focus to first control, skip over type="hidden"
2006.06.22 1.9.1 added panel.defaultPanelWidth to save requested panel width, even after resizing has changed the style value
2006.05.11 1.9.0 added optional '^width^' syntax for floating sliders and '=key' syntax for setting an access key on a slider label
2006.05.09 1.8.0 in onClickNestedSlider(), when showing panel, set focus to first child input/textarea/select element
2006.04.24 1.7.8 in adjustSliderPos(), if floating panel is contained inside another floating panel, subtract offset of containing panel to find correct position
2006.02.16 1.7.7 corrected deferred rendering to account for use-case where show/hide state is tracked in a cookie
2006.02.15 1.7.6 in adjustSliderPos(), ensure that floating panel is positioned completely within the browser window (i.e., does not go beyond the right edge of the browser window)
2006.02.04 1.7.5 add 'var' to unintended global variable declarations to avoid FireFox 1.5.0.1 crash bug when assigning to globals
2006.01.18 1.7.4 only define adjustSliderPos() function if it has not already been provided by another plugin.  This lets other plugins 'hijack' the function even when they are loaded first.
2006.01.16 1.7.3 added adjustSliderPos(place,btn,panel,panelClass) function to permit specialized logic for placement of floating panels.  While it provides improved placement for many uses of floating panels, it exhibits a relative offset positioning error when used within *nested* floating panels.  Short-term workaround is to only adjust the position for 'top-level' floaters.
2006.01.16 1.7.2 added button property to slider panel elements so that slider panel can tell which button it belongs to.  Also, re-activated and corrected animation handling so that nested sliders aren't clipped by hijacking Slider.prototype.stop so that "overflow:hidden" can be reset to "overflow:visible" after animation ends
2006.01.14 1.7.1 added optional "^" syntax for floating panels.  Defines new CSS class, ".floatingPanel", as an alternative for standard in-line ".sliderPanel" styles.
2006.01.14 1.7.0 added optional "*" syntax for rollover handling to show/hide slider without requiring a click (Based on a suggestion by tw4efl)
2006.01.03 1.6.2 When using optional "!" heading style, instead of creating a clickable "Hn" element, create an "A" element inside the "Hn" element.  (allows click-through in SlideShowPlugin, which captures nearly all click events, except for hyperlinks)
2005.12.15 1.6.1 added optional "..." syntax to invoke deferred ('lazy') rendering for initially hidden sliders
removed checkbox option for 'global' application of lazy sliders
2005.11.25 1.6.0 added optional handling for 'lazy sliders' (deferred rendering for initially hidden sliders)
2005.11.21 1.5.1 revised regular expressions: if present, a single newline //preceding// and/or //following// a slider definition will be suppressed so start/end syntax can be place on separate lines in the tiddler 'source' for improved readability.  Similarly, any whitespace (newlines, tabs, spaces, etc.) trailing the 'start slider' syntax or preceding the 'end slider' syntax is also suppressed.
2005.11.20 1.5.0 added (cookiename) syntax for optional tracking and restoring of slider open/close state
2005.11.11 1.4.0 added !!!!! syntax to render slider label as a header (Hn) style instead of a button/link style
2005.11.07 1.3.0 removed alternative syntax {{{(((}}} and {{{)))}}} (so they can be used by other formatting extensions) and simplified/improved regular expressions to trim multiple excess newlines
2005.11.05 1.2.1 changed name to NestedSlidersPlugin
2005.11.04 1.2.0 added alternative character-mode syntax {{{(((}}} and {{{)))}}}
tweaked "eat newlines" logic for line-mode {{{+++}}} and {{{===}}} syntax
2005.11.03 1.1.1 fixed toggling of default tooltips ("more..." and "less...") when a non-default button label is used.  code cleanup, added documentation
2005.11.03 1.1.0 changed delimiter syntax from {{{(((}}} and {{{)))}}} to {{{+++}}} and {{{===}}}.  changed name to EasySlidersPlugin
2005.11.03 1.0.0 initial public release
<<<
/***
|Name:|NewHerePlugin|
|Description:|Creates the new here and new journal macros|
|Version:|3.0a|
|Date:|27-Jun-2011|
|Source:|http://mptw.tiddlyspot.com/#NewHerePlugin|
|Author:|Simon Baird <simon.baird@gmail.com>|
|License|http://mptw.tiddlyspot.com/#TheBSDLicense|
***/
//{{{
merge(config.macros, {
  newHere: {
    handler: function(place,macroName,params,wikifier,paramString,tiddler) {
      wikify("<<newTiddler "+paramString+" tag:[["+tiddler.title+"]]>>",place,null,tiddler);
    }
  },
  newJournalHere: {
    handler: function(place,macroName,params,wikifier,paramString,tiddler) {
      wikify("<<newJournal "+paramString+" tag:[["+tiddler.title+"]]>>",place,null,tiddler);
    }
  }
});

//}}}
/***
|Name:|NewMeansNewPlugin|
|Description:|If 'New Tiddler' already exists then create 'New Tiddler (1)' and so on|
|Version:|1.1.1a|
|Date:|27-Jun-2011|
|Source:|http://mptw.tiddlyspot.com/empty.html#NewMeansNewPlugin|
|Author:|Simon Baird <simon.baird@gmail.com>|
|License|http://mptw.tiddlyspot.com/#TheBSDLicense|
!!Note: I think this should be in the core
***/
//{{{

// change this or set config.newMeansNewForJournalsToo it in MptwUuserConfigPlugin
if (config.newMeansNewForJournalsToo == undefined) config.newMeansNewForJournalsToo = true;

String.prototype.getNextFreeName = function() {
  numberRegExp = / \(([0-9]+)\)$/;
  var match = numberRegExp.exec(this);
  if (match) {
  var num = parseInt(match[1]) + 1;
    return this.replace(numberRegExp," ("+num+")");
  }
  else {
    return this + " (1)";
  }
}

config.macros.newTiddler.checkForUnsaved = function(newName) {
  var r = false;
  story.forEachTiddler(function(title,element) {
    if (title == newName)
      r = true;
  });
  return r;
}

config.macros.newTiddler.getName = function(newName) {
  while (store.getTiddler(newName) || config.macros.newTiddler.checkForUnsaved(newName))
    newName = newName.getNextFreeName();
  return newName;
}


config.macros.newTiddler.onClickNewTiddler = function()
{
  var title = this.getAttribute("newTitle");
  if(this.getAttribute("isJournal") == "true") {
    title = new Date().formatString(title.trim());
  }

  // ---- these three lines should be the only difference between this and the core onClickNewTiddler
  if (config.newMeansNewForJournalsToo || this.getAttribute("isJournal") != "true")
    title = config.macros.newTiddler.getName(title);

  var params = this.getAttribute("params");
  var tags = params ? params.split("|") : [];
  var focus = this.getAttribute("newFocus");
  var template = this.getAttribute("newTemplate");
  var customFields = this.getAttribute("customFields");
  if(!customFields && !store.isShadowTiddler(title))
    customFields = String.encodeHashMap(config.defaultCustomFields);
  story.displayTiddler(null,title,template,false,null,null);
  var tiddlerElem = story.getTiddler(title);
  if(customFields)
    story.addCustomFields(tiddlerElem,customFields);
  var text = this.getAttribute("newText");
  if(typeof text == "string")
    story.getTiddlerField(title,"text").value = text.format([title]);
  for(var t=0;t<tags.length;t++)
    story.setTiddlerTag(title,tags[t],+1);
  story.focusTiddler(title,focus);
  return false;
};

//}}}
$$\mbox{Min } cx\\
\mbox{Sujeto a:}\\
Ax=b\\
x \geq 0$$
!Otras Aplicaciones y problemas en los que puede usarse la I.O.
*[[Detección de Colisiones y Optimización de Trayecto|http://opti-lineal.blogspot.com/2011/10/deteccion-de-colisiones-y-optimizacion.html]]
*[[Optimización del diseño automotríz|http://opti-lineal.blogspot.com/2011/10/optimizacion-del-diseno-automotriz.html]]
*[[Optimización ferroviaria|http://opti-lineal.blogspot.com/2011/10/optimizacion-ferroviaria.html]]
*[[Planificación de ubicación de antentas WLAN|http://opti-lineal.blogspot.com/2011/10/planificacion-de-ubicacion-de-antenas.html]]
*[[Dieta óptima|http://opti-lineal.blogspot.com/2011/10/programacion-lineal-para-una-optima.html]]
*[[Optimización de Tráfico Aéreo|http://opti-lineal.blogspot.com/2011/10/programacion-lineal-de-un-sistema-de_14.html]]
*[[Gossiping|http://opti-lineal.blogspot.com/2011/10/programacion-lineal-de-un-sistema-de.html]]
*[[PL para compra y venta de productos|http://opti-lineal.blogspot.com/2011/10/programacion-lineal-para-la-compra-de.html]]

!Otros métodos de I.O.
*[[Agente Viajero: simple y multiple|http://opti-lineal.blogspot.com/2013/04/agente-viajero-simple-y-multiple-grupo-5.html]]
*[[Flujo Máximo|http://opti-lineal.blogspot.com/2013/04/flujo-maximo.html]]
*[[Simulación (parte 1)|http://opti-lineal.blogspot.com/2013/04/simulacion-grupo-3.html]]
*[[Simulación (parte 2)|http://opti-lineal.blogspot.com/2013/04/simulacion-parte-2-grupo-3.html]]
*[[Teoría de Colas|http://opti-lineal.blogspot.com/2013/03/la-teoria-de-colas-o-linea-de-espera.html]]
*[[Ruta Más Corta y Árbol Mínimo Expandido|http://opti-lineal.blogspot.com/2013/03/ruta-mas-corta-y-arbol-minimo-expandido.html]]
!Tema 13
#[[Introducción a la Planificación de Proyectos (PERT-CPM)|IntroPERT-CPM]]
#[[Solución de Modelos PERT-CPM con el Computador|GuiaPERT-CPM]]
/***
|''Name:''|PasswordOptionPlugin|
|''Description:''|Extends TiddlyWiki options with non encrypted password option.|
|''Version:''|1.0.2|
|''Date:''|Apr 19, 2007|
|''Source:''|http://tiddlywiki.bidix.info/#PasswordOptionPlugin|
|''Author:''|BidiX (BidiX (at) bidix (dot) info)|
|''License:''|[[BSD open source license|http://tiddlywiki.bidix.info/#%5B%5BBSD%20open%20source%20license%5D%5D ]]|
|''~CoreVersion:''|2.2.0 (Beta 5)|
***/
//{{{
version.extensions.PasswordOptionPlugin = {
	major: 1, minor: 0, revision: 2, 
	date: new Date("Apr 19, 2007"),
	source: 'http://tiddlywiki.bidix.info/#PasswordOptionPlugin',
	author: 'BidiX (BidiX (at) bidix (dot) info',
	license: '[[BSD open source license|http://tiddlywiki.bidix.info/#%5B%5BBSD%20open%20source%20license%5D%5D]]',
	coreVersion: '2.2.0 (Beta 5)'
};

config.macros.option.passwordCheckboxLabel = "Save this password on this computer";
config.macros.option.passwordInputType = "password"; // password | text
setStylesheet(".pasOptionInput {width: 11em;}\n","passwordInputTypeStyle");

merge(config.macros.option.types, {
	'pas': {
		elementType: "input",
		valueField: "value",
		eventName: "onkeyup",
		className: "pasOptionInput",
		typeValue: config.macros.option.passwordInputType,
		create: function(place,type,opt,className,desc) {
			// password field
			config.macros.option.genericCreate(place,'pas',opt,className,desc);
			// checkbox linked with this password "save this password on this computer"
			config.macros.option.genericCreate(place,'chk','chk'+opt,className,desc);			
			// text savePasswordCheckboxLabel
			place.appendChild(document.createTextNode(config.macros.option.passwordCheckboxLabel));
		},
		onChange: config.macros.option.genericOnChange
	}
});

merge(config.optionHandlers['chk'], {
	get: function(name) {
		// is there an option linked with this chk ?
		var opt = name.substr(3);
		if (config.options[opt]) 
			saveOptionCookie(opt);
		return config.options[name] ? "true" : "false";
	}
});

merge(config.optionHandlers, {
	'pas': {
 		get: function(name) {
			if (config.options["chk"+name]) {
				return encodeCookie(config.options[name].toString());
			} else {
				return "";
			}
		},
		set: function(name,value) {config.options[name] = decodeCookie(value);}
	}
});

// need to reload options to load passwordOptions
loadOptionsCookie();

/*
if (!config.options['pasPassword'])
	config.options['pasPassword'] = '';

merge(config.optionsDesc,{
		pasPassword: "Test password"
	});
*/
//}}}
``
jsGraph(117,117,-10,10)
stroke = "red"
p = []
with (Math) 
  for (t = 0; t < 10.01; t += 0.05)
    p[p.length] = [t*cos(PI*t), t*sin(PI*t)]
path(p)
``
{{{
``
jsGraph(117,117,-10,10)
stroke = "red"
p = []
with (Math) 
  for (t = 0; t < 10.01; t += 0.05)
    p[p.length] = [t*cos(PI*t), t*sin(PI*t)]
path(p)
``
}}}

``
jsGraph(117, 117, -2,2)
stroke = "blue"
p = []
for (x = -2; x < 2; x += 0.1)
  p[p.length] = [x, (x+1)*x*(x-1)]
path(p)
``
{{{
``
jsGraph(117, 117, -2,2)
stroke = "blue"
p = []
for (x = -2; x < 2; x += 0.1)
  p[p.length] = [x, (x+1)*x*(x-1)]
path(p)
``
}}}
!Bloques
#Inicio
#[[Introducción a Investigación de Operaciones y Programación Lineal|IntroPL]]
#[[Formulación de Modelos de Programación Lineal|FormularPL]]
#[[Conocimientos Básicos de Algebra Lineal|AlgebraLinealBasica]]
#[[Solución Gráfica de Modelos de Programación Lineal|ResolverPLconGrafica]]
#[[Solución de Modelos de Programación Lineal con el Computador|ResolverPLconPC]]
#[[Dualidad|Dualidad]]
#[[Análisis de Sensibilidad|AnálisisDeSensibilidad]]
#Modelo de Transporte
#Modelo de Asignación
#Modelo de Transbordo
#Solución de Modelos de Transporte con el Computador
#[[Planificación de Proyectos (PERT-CPM)|PERT-CPM]]
#[[Otros Métodos y Aplicaciones de Investigación de Operaciones|OtrosMetodosYAplicacionesDeIO]]

[[VER PLAN SEMANAL|https://docs.google.com/spreadsheet/ccc?key=0AhkQdZxlF48HdE1xazg4WmItaWFNeV8tS0lHQjhoTFE&usp=sharing]]
/***
|Name:|PrettyDatesPlugin|
|Description:|Provides a new date format ('pppp') that displays times such as '2 days ago'|
|Version:|1.0a|
|Date:|27-Jun-2011|
|Source:|http://mptw.tiddlyspot.com/#PrettyDatesPlugin|
|Author:|Simon Baird <simon.baird@gmail.com>|
|License:|http://mptw.tiddlyspot.com/#TheBSDLicense|
!!Notes
* If you want to you can rename this plugin. :) Some suggestions: LastUpdatedPlugin, RelativeDatesPlugin, SmartDatesPlugin, SexyDatesPlugin.
* Inspired by http://ejohn.org/files/pretty.js
***/
//{{{
Date.prototype.prettyDate = function() {
  var diff = (((new Date()).getTime() - this.getTime()) / 1000);
  var day_diff = Math.floor(diff / 86400);

  if (isNaN(day_diff))      return "";
  else if (diff < 0)        return "in the future";
  else if (diff < 60)       return "just now";
  else if (diff < 120)      return "1 minute ago";
  else if (diff < 3600)     return Math.floor(diff/60) + " minutes ago";
  else if (diff < 7200)     return "1 hour ago";
  else if (diff < 86400)    return Math.floor(diff/3600) + " hours ago";
  else if (day_diff == 1)   return "Yesterday";
  else if (day_diff < 7)    return day_diff + " days ago";
  else if (day_diff < 14)   return  "a week ago";
  else if (day_diff < 31)   return Math.ceil(day_diff/7) + " weeks ago";
  else if (day_diff < 62)   return "a month ago";
  else if (day_diff < 365)  return "about " + Math.ceil(day_diff/31) + " months ago";
  else if (day_diff < 730)  return "a year ago";
  else                      return Math.ceil(day_diff/365) + " years ago";
}

Date.prototype.formatString_orig_mptw = Date.prototype.formatString;

Date.prototype.formatString = function(template) {
  return this.formatString_orig_mptw(template).replace(/pppp/,this.prettyDate());
}

// for MPTW. otherwise edit your ViewTemplate as required.
// config.mptwDateFormat = 'pppp (DD/MM/YY)';
config.mptwDateFormat = 'pppp';

//}}}
<html><div class="prezi-player"><style type="text/css" media="screen">.prezi-player { width: 550px; } .prezi-player-links { text-align: center; }</style><object id="prezi_r5xjr9aas_d8" name="prezi_r5xjr9aas_d8" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="550" height="400"><param name="movie" value="http://prezi.com/bin/preziloader.swf"/><param name="allowfullscreen" value="true"/><param name="allowFullScreenInteractive" value="true"/><param name="allowscriptaccess" value="always"/><param name="wmode" value="direct"/><param name="bgcolor" value="#ffffff"/><param name="flashvars" value="prezi_id=r5xjr9aas_d8&amp;lock_to_path=0&amp;color=ffffff&amp;autoplay=no&amp;autohide_ctrls=0"/><embed id="preziEmbed_r5xjr9aas_d8" name="preziEmbed_r5xjr9aas_d8" src="http://prezi.com/bin/preziloader.swf" type="application/x-shockwave-flash" allowfullscreen="true" allowFullScreenInteractive="true" allowscriptaccess="always" width="550" height="400" bgcolor="#ffffff" flashvars="prezi_id=r5xjr9aas_d8&amp;lock_to_path=0&amp;color=ffffff&amp;autoplay=no&amp;autohide_ctrls=0"></embed></object><div class="prezi-player-links"><p><a title="Introducción a PERT-CPM" href="http://prezi.com/r5xjr9aas_d8/introduccion-a-pert-cpm/">Introducción a PERT-CPM</a> on <a href="http://prezi.com">Prezi</a></p></div></div></html>
<html><a title="View EjerSGr on Scribd" href="http://www.scribd.com/doc/98887551/EjerSGr" style="margin: 12px auto 6px auto; font-family: Helvetica,Arial,Sans-serif; font-style: normal; font-variant: normal; font-weight: normal; font-size: 14px; line-height: normal; font-size-adjust: none; font-stretch: normal; -x-system-font: none; display: block; text-decoration: underline;">EjerSGr</a><iframe class="scribd_iframe_embed" src="http://www.scribd.com/embeds/98887551/content?start_page=1&view_mode=list&access_key=key-twzz5ohg4sfw7g3s1oc" data-auto-height="true" data-aspect-ratio="0.706697459584296" scrolling="no" id="doc_69780" width="100%" height="600" frameborder="0"></iframe></html>
Esta es una prueba de programación lineal en formato matricial "abreviado":

`min Z(x)=c^T*x`
`s.t.:`
`A*x<=b`
`x>=0`

+++Ahora en formato matricial explícito:

`min Z(x)=[c_1,c_2,"...",c_n]*[(x_1),(x_2),(":"),(x_n)]`
`s.t.:`
`[(a_11,a_12,"...",a_(1n)),(a_21,a_22,"...",a_(2n)),(":",":","...",":"),(a_(m1),a_(m2),"...",a_(mn))]_(mxn)*[(x_1),(x_2),(":"),(x_n)]<=[(b_1),(b_2),(":"),(b_m)]`
`[(x_1),(x_2),(":"),(x_n)]>=0`===

<html><iframe width="420" height="315" src="http://www.youtube.com/embed/yNjTT2rdTgA" frameborder="0" allowfullscreen></iframe></html>
<html><iframe width="640" height="360" src="//www.youtube.com/embed/6qfLRAjGuVc" frameborder="0" allowfullscreen></iframe></html>
<html><iframe width="640" height="360" src="//www.youtube.com/embed/wsywXvBMjso" frameborder="0" allowfullscreen></iframe></html>
/***
|Name:|QuickOpenTagPlugin|
|Description:|Changes tag links to make it easier to open tags as tiddlers|
|Version:|3.0.1a|
|Date:|27-Jun-2011|
|Source:|http://mptw.tiddlyspot.com/#QuickOpenTagPlugin|
|Author:|Simon Baird <simon.baird@gmail.com>|
|License:|http://mptw.tiddlyspot.com/#TheBSDLicense|
***/
//{{{
config.quickOpenTag = {

  dropdownChar: (document.all ? "\u25bc" : "\u25be"), // the little one doesn't work in IE?

  createTagButton: function(place,tag,excludeTiddler) {
    // little hack so we can do this: <<tag PrettyTagName|RealTagName>>
    var splitTag = tag.split("|");
    var pretty = tag;
    if (splitTag.length == 2) {
      tag = splitTag[1];
      pretty = splitTag[0];
    }

    var sp = createTiddlyElement(place,"span",null,"quickopentag");
    createTiddlyText(createTiddlyLink(sp,tag,false),pretty);

    var theTag = createTiddlyButton(sp,config.quickOpenTag.dropdownChar,
                        config.views.wikified.tag.tooltip.format([tag]),onClickTag);
    theTag.setAttribute("tag",tag);
    if (excludeTiddler)
      theTag.setAttribute("tiddler",excludeTiddler);
        return(theTag);
  },

  miniTagHandler: function(place,macroName,params,wikifier,paramString,tiddler) {
    var tagged = store.getTaggedTiddlers(tiddler.title);
    if (tagged.length > 0) {
      var theTag = createTiddlyButton(place,config.quickOpenTag.dropdownChar,
                          config.views.wikified.tag.tooltip.format([tiddler.title]),onClickTag);
      theTag.setAttribute("tag",tiddler.title);
      theTag.className = "miniTag";
    }
  },

  allTagsHandler: function(place,macroName,params) {
    var tags = store.getTags(params[0]);
    var filter = params[1]; // new feature
    var ul = createTiddlyElement(place,"ul");
    if(tags.length == 0)
      createTiddlyElement(ul,"li",null,"listTitle",this.noTags);
    for(var t=0; t<tags.length; t++) {
      var title = tags[t][0];
      if (!filter || (title.match(new RegExp('^'+filter)))) {
        var info = getTiddlyLinkInfo(title);
        var theListItem =createTiddlyElement(ul,"li");
        var theLink = createTiddlyLink(theListItem,tags[t][0],true);
        var theCount = " (" + tags[t][1] + ")";
        theLink.appendChild(document.createTextNode(theCount));
        var theDropDownBtn = createTiddlyButton(theListItem," " +
          config.quickOpenTag.dropdownChar,this.tooltip.format([tags[t][0]]),onClickTag);
        theDropDownBtn.setAttribute("tag",tags[t][0]);
      }
    }
  },

  // todo fix these up a bit
  styles: [
"/*{{{*/",
"/* created by QuickOpenTagPlugin */",
".tagglyTagged .quickopentag, .tagged .quickopentag ",
" { margin-right:1.2em; border:1px solid #eee; padding:2px; padding-right:0px; padding-left:1px; }",
".quickopentag .tiddlyLink { padding:2px; padding-left:3px; }",
".quickopentag a.button { padding:1px; padding-left:2px; padding-right:2px;}",
"/* extra specificity to make it work right */",
"#displayArea .viewer .quickopentag a.button, ",
"#displayArea .viewer .quickopentag a.tiddyLink, ",
"#mainMenu .quickopentag a.tiddyLink, ",
"#mainMenu .quickopentag a.tiddyLink ",
" { border:0px solid black; }",
"#displayArea .viewer .quickopentag a.button, ",
"#mainMenu .quickopentag a.button ",
" { margin-left:0px; padding-left:2px; }",
"#displayArea .viewer .quickopentag a.tiddlyLink, ",
"#mainMenu .quickopentag a.tiddlyLink ",
" { margin-right:0px; padding-right:0px; padding-left:0px; margin-left:0px; }",
"a.miniTag {font-size:150%;} ",
"#mainMenu .quickopentag a.button ",
" /* looks better in right justified main menus */",
" { margin-left:0px; padding-left:2px; margin-right:0px; padding-right:0px; }",
"#topMenu .quickopentag { padding:0px; margin:0px; border:0px; }",
"#topMenu .quickopentag .tiddlyLink { padding-right:1px; margin-right:0px; }",
"#topMenu .quickopentag .button { padding-left:1px; margin-left:0px; border:0px; }",
"/*}}}*/",
    ""].join("\n"),

  init: function() {
    // we fully replace these builtins. can't hijack them easily
    window.createTagButton = this.createTagButton;
    config.macros.allTags.handler = this.allTagsHandler;
    config.macros.miniTag = { handler: this.miniTagHandler };
    config.shadowTiddlers["QuickOpenTagStyles"] = this.styles;
    store.addNotification("QuickOpenTagStyles",refreshStyles);
  }
}

config.quickOpenTag.init();

//}}}
<html><iframe src="https://docs.google.com/a/usb.ve/spreadsheet/embeddedform?formkey=dG1qR2JUMGE1TFdPNm54d0wxdWZFeEE6MQ" width="760" height="1270" frameborder="0" marginheight="0" marginwidth="0">Cargando...</iframe></html>
<html><iframe src="https://docs.google.com/a/usb.ve/spreadsheet/embeddedform?formkey=dEdJUkxWX0pvQlhDYV85Rk5CenV4dkE6MQ" width="760" height="918" frameborder="0" marginheight="0" marginwidth="0">Cargando...</iframe></html>
/***
|Name:|RenameTagsPlugin|
|Description:|Allows you to easily rename or delete tags across multiple tiddlers|
|Version:|3.0a|
|Date:|27-Jun-2011|
|Source:|http://mptw.tiddlyspot.com/#RenameTagsPlugin|
|Author:|Simon Baird <simon.baird@gmail.com>|
|License|http://mptw.tiddlyspot.com/#TheBSDLicense|
Rename a tag and you will be prompted to rename it in all its tagged tiddlers.
***/
//{{{
config.renameTags = {

  prompts: {
    rename: "Rename the tag '%0' to '%1' in %2 tidder%3?",
    remove: "Remove the tag '%0' from %1 tidder%2?"
  },

  removeTag: function(tag,tiddlers) {
    store.suspendNotifications();
    for (var i=0;i<tiddlers.length;i++) {
      store.setTiddlerTag(tiddlers[i].title,false,tag);
    }
    store.resumeNotifications();
    store.notifyAll();
  },

  renameTag: function(oldTag,newTag,tiddlers) {
    store.suspendNotifications();
    for (var i=0;i<tiddlers.length;i++) {
      store.setTiddlerTag(tiddlers[i].title,false,oldTag); // remove old
      store.setTiddlerTag(tiddlers[i].title,true,newTag);  // add new
    }
    store.resumeNotifications();
    store.notifyAll();
  },

  storeMethods: {

    saveTiddler_orig_renameTags: TiddlyWiki.prototype.saveTiddler,

    saveTiddler: function(title,newTitle,newBody,modifier,modified,tags,fields,clearChangeCount,created,creator) {
      if (title != newTitle) {
        var tagged = this.getTaggedTiddlers(title);
        if (tagged.length > 0) {
          // then we are renaming a tag
          if (confirm(config.renameTags.prompts.rename.format([title,newTitle,tagged.length,tagged.length>1?"s":""])))
            config.renameTags.renameTag(title,newTitle,tagged);

          if (!this.tiddlerExists(title) && newBody == "")
            // dont create unwanted tiddler
            return null;
        }
      }
      return this.saveTiddler_orig_renameTags(title,newTitle,newBody,modifier,modified,tags,fields,clearChangeCount,created,creator);
    },

    removeTiddler_orig_renameTags: TiddlyWiki.prototype.removeTiddler,

    removeTiddler: function(title) {
      var tagged = this.getTaggedTiddlers(title);
      if (tagged.length > 0)
        if (confirm(config.renameTags.prompts.remove.format([title,tagged.length,tagged.length>1?"s":""])))
          config.renameTags.removeTag(title,tagged);
      return this.removeTiddler_orig_renameTags(title);
    }

  },

  init: function() {
    merge(TiddlyWiki.prototype,this.storeMethods);
  }
}

config.renameTags.init();

//}}}
<html><iframe width="420" height="315" src="http://www.youtube.com/embed/mRR-_7ABytw" frameborder="0" allowfullscreen></iframe></html>
[[ResolivendoUnModeloDeProgramacionLineal]]
MétodoSoluciónGráfica
CasosEspeciales
/***
|Name:|SaveCloseTiddlerPlugin|
|Description:|Provides two extra toolbar commands, saveCloseTiddler and cancelCloseTiddler|
|Version:|3.0a|
|Date:|27-Jun-2011|
|Source:|http://mptw.tiddlyspot.com/#SaveCloseTiddlerPlugin|
|Author:|Simon Baird <simon.baird@gmail.com>|
|License:|http://mptw.tiddlyspot.com/#TheBSDLicense|
To use these add them to the commands in ToolbarCommands under EditToolbar,
or in the MptwTheme tiddler under EditTemplate.
***/
//{{{
merge(config.commands,{

  saveCloseTiddler: {
    text: 'done/close',
    tooltip: 'Save changes to this tiddler and close it',
    handler: function(ev,src,title) {
      var closeTitle = title;
      var newTitle = story.saveTiddler(title,ev.shiftKey);
      if (newTitle)
        closeTitle = newTitle;
      return config.commands.closeTiddler.handler(ev,src,closeTitle);
    }
  },

  cancelCloseTiddler: {
    text: 'cancel/close',
    tooltip: 'Undo changes to this tiddler and close it',
    handler: function(ev,src,title) {
      // the same as closeTiddler now actually
      return config.commands.closeTiddler.handler(ev,src,title);
    }
  }

});

//}}}
/***
|Name:|SelectThemePlugin|
|Description:|Lets you easily switch theme and palette|
|Version:|1.0.1a|
|Date:|27-Jun-2011|
|Source:|http://mptw.tiddlyspot.com/#SelectThemePlugin|
|Author:|Simon Baird <simon.baird@gmail.com>|
|License:|http://mptw.tiddlyspot.com/#TheBSDLicense|
!Notes
* Borrows largely from ThemeSwitcherPlugin by Martin Budden http://www.martinswiki.com/#ThemeSwitcherPlugin
* Theme is cookie based. But set a default by setting config.options.txtTheme in MptwConfigPlugin (for example)
* Palette is not cookie based. It actually overwrites your ColorPalette tiddler when you select a palette, so beware.
!Usage
* {{{<<selectTheme>>}}} makes a dropdown selector
* {{{<<selectPalette>>}}} makes a dropdown selector
* {{{<<applyTheme>>}}} applies the current tiddler as a theme
* {{{<<applyPalette>>}}} applies the current tiddler as a palette
* {{{<<applyTheme TiddlerName>>}}} applies TiddlerName as a theme
* {{{<<applyPalette TiddlerName>>}}} applies TiddlerName as a palette
***/
//{{{

config.macros.selectTheme = {
  label: {
    selectTheme:"select theme",
    selectPalette:"select palette"
  },
  prompt: {
    selectTheme:"Select the current theme",
    selectPalette:"Select the current palette"
  },
  tags: {
    selectTheme:'systemTheme',
    selectPalette:'systemPalette'
  }
};

config.macros.selectTheme.handler = function(place,macroName)
{
  var btn = createTiddlyButton(place,this.label[macroName],this.prompt[macroName],this.onClick);
  // want to handle palettes and themes with same code. use mode attribute to distinguish
  btn.setAttribute('mode',macroName);
};

config.macros.selectTheme.onClick = function(ev)
{
  var e = ev ? ev : window.event;
  var popup = Popup.create(this);
  var mode = this.getAttribute('mode');
  var tiddlers = store.getTaggedTiddlers(config.macros.selectTheme.tags[mode]);
  // for default
  if (mode == "selectPalette") {
    var btn = createTiddlyButton(createTiddlyElement(popup,'li'),"(default)","default color palette",config.macros.selectTheme.onClickTheme);
    btn.setAttribute('theme',"(default)");
    btn.setAttribute('mode',mode);
  }
  for(var i=0; i<tiddlers.length; i++) {
    var t = tiddlers[i].title;
    var name = store.getTiddlerSlice(t,'Name');
    var desc = store.getTiddlerSlice(t,'Description');
    var btn = createTiddlyButton(createTiddlyElement(popup,'li'), name?name:t, desc?desc:config.macros.selectTheme.label['mode'], config.macros.selectTheme.onClickTheme);
    btn.setAttribute('theme',t);
    btn.setAttribute('mode',mode);
  }
  Popup.show();
  return stopEvent(e);
};

config.macros.selectTheme.onClickTheme = function(ev)
{
  var mode = this.getAttribute('mode');
  var theme = this.getAttribute('theme');
  if (mode == 'selectTheme')
    story.switchTheme(theme);
  else // selectPalette
    config.macros.selectTheme.updatePalette(theme);
  return false;
};

config.macros.selectTheme.updatePalette = function(title)
{
  if (title != "") {
    store.deleteTiddler("ColorPalette");
    if (title != "(default)")
      store.saveTiddler("ColorPalette","ColorPalette",store.getTiddlerText(title),
          config.options.txtUserName,undefined,"");
    refreshAll();
    if(config.options.chkAutoSave)
      saveChanges(true);
  }
};

config.macros.applyTheme = {
  label: "apply",
  prompt: "apply this theme or palette" // i'm lazy
};

config.macros.applyTheme.handler = function(place,macroName,params,wikifier,paramString,tiddler) {
  var useTiddler = params[0] ? params[0] : tiddler.title;
  var btn = createTiddlyButton(place,this.label,this.prompt,config.macros.selectTheme.onClickTheme);
  btn.setAttribute('theme',useTiddler);
  btn.setAttribute('mode',macroName=="applyTheme"?"selectTheme":"selectPalette"); // a bit untidy here
}

config.macros.selectPalette = config.macros.selectTheme;
config.macros.applyPalette = config.macros.applyTheme;

config.macros.refreshAll = { handler: function(place,macroName,params,wikifier,paramString,tiddler) {
  createTiddlyButton(place,"refresh","refresh layout and styles",function() { refreshAll(); });
}};

//}}}
notas electrónicas sobre Técnicas de Optimización en Modelos Organizacionales
WikiPS3161
Esta es la lamina 1
Y esta la 2....
/***
|''Name:''|SlideShowPlugin|
|''Description:''|Creates a slide show from any number of tiddlers|
|''Author:''|Paulo Soares|
|''Contributors:''|John P. Rouillard|
|''Version:''|2.2.6|
|''Date:''|2010-11-17|
|''Source:''|http://www.math.ist.utl.pt/~psoares/addons.html|
|''Documentation:''|[[SlideShowPlugin Documentation|SlideShowPluginDoc]]|
|''License:''|[[Creative Commons Attribution-Share Alike 3.0 License|http://creativecommons.org/licenses/by-sa/3.0/]]|
|''~CoreVersion:''|2.5.0|
***/
//{{{
if(!version.extensions.SlideShowPlugin) { //# ensure that the plugin is only installed once
version.extensions.SlideShowPlugin = {installed: true};

(function($) {
config.macros.slideShow = {maxTOCLength: 30, separator:'-s-'};

config.formatters.push( {
	name: "SlideSeparator",
	match: "^"+config.macros.slideShow.separator+"+$\\n?",
	handler: function(w) {
		createTiddlyElement(w.output,"hr",null,'slideSeparator');
	}
});

config.macros.slideShow.text = {
  label: "slide show", tooltip: "Start slide show",
  quit: {label: "x", tooltip: "Quit the slide show"},
  firstSlide: {label: "<<", tooltip: "Go to first slide"},
  previous: {label: "<", tooltip: "Go back"},
  next: {label: ">", tooltip: "Advance"},
  lastSlide: {label: ">>", tooltip: "Go to last slide"},
  goto: {label: "Go to slide:"},
  resetClock: {tooltip: "Reset the clock"},
  overlay: "overlay"
};

config.macros.slideShow.handler = function(place,macroName,params,wikifier,paramString){
  var args = paramString.parseParams(null,null,false);
  this.label = getParam(args,"label",this.text.label);
  this.tooltip = getParam(args,"tooltip",this.text.tooltip);
  var onclick = function(){config.macros.slideShow.onClick(place,paramString); return false;};
  createTiddlyButton(place,this.label,this.tooltip,onclick);
  return false;
}

config.macros.slideShow.onClick = function(place,paramString) {
  var slide, cm = config.macros.slideShow;
  var title = story.findContainingTiddler(place);
  title = title ? title.getAttribute("tiddler") : null;
  var args = paramString.parseParams(null,null,false);
  title =  getParam(args,"tiddler",title);
  var argsArray = paramString.readMacroParams();
  this.single = ($.inArray('single',argsArray) > -1);
  this.clicks = ($.inArray('noClicks',argsArray) < 0);
  this.keyboard = ($.inArray('noKeyboard',argsArray) < 0);
  this.showAll = ($.inArray('showAll',argsArray) > -1);
  this.cycle = ($.inArray('cycle',argsArray) > -1);
  this.overlays = ($.inArray('noOverlays',argsArray) < 0);
  this.theme = getParam(args,"theme");
  this.tag = getParam(args,"tag");
  this.toc = getParam(args,"toc","headers");
  this.sort = getParam(args,"sort");
  this.clockFormat = getParam(args,"clockFormat",'0hh:0mm:0ss');
  this.auto = getParam(args,"auto",0);
  this.header = getParam(args,"header",title);
  this.footer = getParam(args,"footer","");
  this.clock = getParam(args,"clock");
  this.blocked = 0;
  if(this.clock){
    var startTime = new Date(0);
    this.clockCorrection=startTime.getTimezoneOffset()*60000;
    startTime = new Date();
    this.clockMultiplier = 1;
    this.clockInterval = 0;
    var clockType= parseFloat(this.clock);
    if(clockType < 0) {
      this.clockMultiplier = -1;
      this.clockInterval = -clockType*60000;
    } else if(clockType == 0){
      this.clockCorrection = 0;
      startTime = new Date(0);
    }
    this.clockStartTime=startTime.getTime();
  }
  this.slides = [];
  this.openTiddlers = [];
  $("#tiddlerDisplay > *").each(function(){cm.openTiddlers.push($(this).attr('tiddler'))});
  var count = 0;
  this.slideTOC=[];
  if(this.single){
    if(!store.tiddlerExists(title)) return;
    var newTiddler;
    var content = store.getTiddlerText(title).split(cm.separator);
    $.each(content, function(){
      count++;
      newTiddler = new Tiddler();
      newTiddler.title ="TempSlide" + count;
      newTiddler.tags[0] = "excludeLists";
      newTiddler.text = $.trim(this);
      newTiddler.fields['doNotSave']= true;
      store.addTiddler(newTiddler);
      cm.buildTOC(count,newTiddler.title);
      cm.slides.push(newTiddler.title);
    });
  } else {
    if(this.tag){
      var content = store.getTaggedTiddlers(this.tag,this.sort);
      $.each(content, function(){
        count++;
        cm.buildTOC(count,this.title);
        cm.slides.push(this.title);
      });
    } else {
      story.displayTiddler(null,title);
      var list = $('[tiddler='+title+']').find('.viewer').find('.tiddlyLinkExisting');
      $.each(list,function(){
        if(!$(this).parents().hasClass("exclude")){
          slide = $(this).attr('tiddlylink');
          count++;
          cm.buildTOC(count,slide);
          cm.slides.push(slide);
        }
      });
    }
  }
  this.nSlides = this.slides.length;
  if(this.nSlides==0) return false;
  clearMessage();
  this.toggleSlideStyles();
  if(!this.showAll){
    //Attach the key and mouse listeners
    if(this.keyboard && !$("#tiddlerDisplay").hasClass("noKeyboard")) $(document).keyup(cm.keys);
    if(this.clicks){
      $(document).mouseup(cm.clicker);
      document.oncontextmenu = function(){return false;}
    }
    if(this.clock) this.slideClock=setInterval(this.setClock, 1000);
    if(this.auto>0){
      this.autoAdvance=setInterval(cm.next, this.auto*1000);
    }
    this.showSlide(1);
  } else {
    story.closeAllTiddlers();
    story.displayTiddlers(null,this.slides);
    $(".tiddler").attr("ondblclick",null);
    $(document).keyup(cm.endSlideShow);
  }
  return false;
}

config.macros.slideShow.buildNavigator = function() {
  //Create the navigation bar
  var i, slidefooter = $("#controlBar")[0];
  if(!slidefooter) return;
  $(slidefooter).addClass("slideFooterOff noClicks");
  var navigator = createTiddlyElement(slidefooter,"SPAN","navigator");
  var buttonBar = createTiddlyElement(navigator,"SPAN","buttonBar");
  //Make it so that when the footer is hovered over the class will change to make it visible
  $(slidefooter).bind("mouseenter mouseleave", function(e){$(this).toggleClass("slideFooterOff");});
  //Create the control buttons for the navigation
 
  createTiddlyButton(buttonBar,this.text.firstSlide.label,this.text.firstSlide.tooltip,this.firstSlide,"button");
  createTiddlyButton(buttonBar,this.text.previous.label,this.text.previous.tooltip,this.previous,"button");
  createTiddlyButton(buttonBar,this.text.quit.label,this.text.quit.tooltip,this.endSlideShow,"button");
  createTiddlyButton(buttonBar,this.text.next.label,this.text.next.tooltip,this.next,"button");
  createTiddlyButton(buttonBar,this.text.lastSlide.label,this.text.lastSlide.tooltip,this.lastSlide,"button");
  if(this.clock){
    if(this.clock == 0){
       createTiddlyElement(navigator,"SPAN","slideClock");
    } else {
      createTiddlyButton(navigator," ",this.text.resetClock.tooltip,this.resetClock,"button","slideClock");
    }
    this.setClock();
  }
  var index = createTiddlyElement(slidefooter,"SPAN","slideCounter");
  index.onclick = this.toggleTOC;
  var toc = createTiddlyElement(slidefooter,"SPAN","toc");
  var tocLine;
  for(i=0; i<this.slideTOC.length; i++){
    $(toc).append(this.slideTOC[i][2]);
    tocLine = $(toc.lastChild);
    tocLine.addClass("tocLevel"+this.slideTOC[i][1]).css("cursor", "pointer").hover(function () {
        $(this).addClass("highlight");}, function () {
        $(this).removeClass("highlight");});
    tocLine.attr("slide",this.slideTOC[i][0]);
    tocLine.click(config.macros.slideShow.showSlideFromTOC);
  }
  //Input box to jump to specific slide
  var tocItem = createTiddlyElement(toc,"DIV","jumpItem",null,this.text.goto.label);
  var tocJumpInput = createTiddlyElement(tocItem,"INPUT","jumpInput");
  tocJumpInput.type="text";
  $(tocJumpInput).keyup(config.macros.slideShow.jumpToSlide);
}

//Used to shorten the TOC fields
config.macros.slideShow.abbreviate = function(label){
  if(label.length>this.maxTOCLength) {
    var temp = new Array();
    temp = label.split(' ');
    label = temp[0];
    for(var j=1; j<temp.length; j++){
      if((label.length+temp[j].length)<=this.maxTOCLength){
        label += " " + temp[j];
      } else {
        label += " ...";
        break;
      }
    }
  }
  return label;
}

config.macros.slideShow.buildTOC = function(count,title) {
  var level = 1, text;
  switch(this.toc){
  case "headers":
    var frag = wikifyStatic(store.getTiddlerText(title));
    text = frag.replace(/<div class="comment">.*<\/div>/mg,"");
    var matches =  text.match(/<h[123456]>.*?<\/h[123456]>/mgi);
    if(matches){
      for (var j=0; j<matches.length; j++){
        level = matches[j].charAt(2);
        text = matches[j].replace(/<\/?h[123456]>/gi,"");
        text = this.abbreviate(text);
        this.slideTOC.push([count,level,"<div>"+text+"</div>"]);
      }
    }
    break;
  case "titles":
    text = this.abbreviate(title);
    this.slideTOC.push([count,level,"<div>"+text+"</div>"]);
  }
}

config.macros.slideShow.showSlideFromTOC = function(e) {
  var cm = config.macros.slideShow;
  var slide = parseInt(e.target.getAttribute('slide'));
  $("#toc").hide();
  cm.showSlide(slide);
  return false;
}

config.macros.slideShow.toggleTOC = function(){
  $("#toc").toggle();
  $("#jumpInput").focus().val('');
  return false;
}

config.macros.slideShow.isInteger = function(s){
  for (var i = 0; i < s.length; i++){
    // Check that current character is number
    var c = s.charAt(i);
    if (((c < "0") || (c > "9"))) return false;
  }
  // All characters are numbers
  return true;
}

config.macros.slideShow.jumpToSlide = function(e){
  var cm = config.macros.slideShow;
  if(e.which==13){
    var input= $("#jumpInput").val();
    if(cm.isInteger(input) && input>0 && input<=cm.nSlides){
      $("#toc").hide();
      cm.showSlide(input);
    } else  {$("#jumpInput").val('');}
  }
  return false;
}

config.macros.slideShow.toggleSlideStyles = function(){
  var contentWrapper = $('#contentWrapper');
  if(contentWrapper.hasClass("slideShowMode")){
    refreshPageTemplate();
    removeStyleSheet("SlideShowStyleSheet");
    if(this.theme) removeStyleSheet(this.theme);
  } else {
    $("#displayArea").prepend('<div id="slideBlanker" style="display:none"></div><div id="slideHeader">'+this.header+'</div><div id="slideFooter">'+this.footer+'</div><div id="controlBar"></div>');
    setStylesheet(store.getRecursiveTiddlerText("SlideShowStyleSheet"),"SlideShowStyleSheet");
    if(this.theme && store.tiddlerExists(this.theme)){setStylesheet(store.getRecursiveTiddlerText(this.theme),this.theme);}
    this.buildNavigator();
  }
  contentWrapper.toggleClass("slideShowMode");
  return false;
}

config.macros.slideShow.showSlide = function(n){
  if(this.cycle) {
    if(n>this.nSlides) {
      n = 1;
    } else if(n<1) {
      n = this.nSlides;
    }
  } else {
    if(n>this.nSlides || n<1) return;
  }
  story.closeAllTiddlers();
  if(this.clock=='-'){this.resetClock();}
  story.displayTiddler(null,String(this.slides[n-1]));
  $(".tiddler").attr("ondblclick",null);
  $("body").removeClass("slide"+this.curSlide);
  this.curSlide = n;
  $("body").addClass("slide"+this.curSlide);
  $("#slideCounter").text(this.curSlide+"/"+this.nSlides);
  if(this.overlays){
    var contents = $(".viewer *");
    this.numOverlays = 1;
    while(1){
      if(contents.hasClass(this.text.overlay+this.numOverlays)){
        this.numOverlays++;
      } else {break;}
    }
    this.numOverlays--;
    this.showOverlay(0);
  }
  return false;
}

config.macros.slideShow.showOverlay = function(n){
  var i, set, cm = config.macros.slideShow;
  if(!cm.overlays || cm.numOverlays == 0 || n<0 || n>cm.numOverlays){return;}
  for(i=1; i<n; i++){
    set = $(".viewer "+"."+cm.text.overlay+i);
    set.removeClass("currentOverlay nextOverlay");
    set.addClass("previousOverlay");
  }
  set = $(".viewer "+"."+cm.text.overlay+n);
  set.removeClass("previousOverlay nextOverlay");
  set.addClass("currentOverlay");
  for(i=n; i<config.macros.slideShow.numOverlays; i++){
    set = $(".viewer "+"."+cm.text.overlay+(i+1));
    set.removeClass("previousOverlay currentOverlay");
    set.addClass("nextOverlay");
  }
  cm.curOverlay = n;
}

config.macros.slideShow.firstSlide = function(){
  config.macros.slideShow.showSlide(1);
  return false;
}

config.macros.slideShow.lastSlide = function(){
  config.macros.slideShow.showSlide(config.macros.slideShow.nSlides);
  return false;
}

config.macros.slideShow.next = function(){
  var cm = config.macros.slideShow;
  if(!cm.overlays || cm.numOverlays == 0 || cm.curOverlay == cm.numOverlays) {
    cm.showSlide(cm.curSlide+1);
  } else {
    cm.showOverlay(cm.curOverlay+1);
  }
  return false;
}

config.macros.slideShow.previous = function(){
  var cm = config.macros.slideShow;
  if(!cm.overlays || cm.numOverlays == 0 || cm.curOverlay == 0) {
    cm.showSlide(cm.curSlide-1);
    cm.showOverlay(cm.numOverlays);
  } else {
    cm.showOverlay(cm.curOverlay-1);
  }
  return false;
}

config.macros.slideShow.endSlideShow=function(){
  var cm = config.macros.slideShow;
  if(cm.autoAdvance) {clearInterval(cm.autoAdvance);}
  if(cm.clock) clearInterval(cm.slideClock);
  story.closeAllTiddlers();
  cm.toggleSlideStyles();
  story.displayTiddlers(null,cm.openTiddlers);
  $(document).unbind();
  document.oncontextmenu =  function(){};
  $("body").removeClass("slide"+cm.curSlide);
  return false;
}

// 'keys' code adapted from S5 which in turn was adapted from MozPoint (http://mozpoint.mozdev.org/)
config.macros.slideShow.keys = function(key) {
  var cm = config.macros.slideShow;
  switch(key.which) {
  case 32: // spacebar
    if(cm.auto>0 && cm.blocked==0){
      if(cm.autoAdvance){
        clearInterval(cm.autoAdvance);
        cm.autoAdvance = null;
      } else {
        cm.autoAdvance=setInterval(cm.next, cm.auto*1000);
      }
    } else {
      if(cm.blocked==0) cm.next();
    }
    break;
  case 34: // page down
    if(cm.blocked==0) cm.showSlide(cm.curSlide+1);
    break;
  case 39: // rightkey
    if(cm.blocked==0) cm.next();
    break;
  case 40: // downkey
    if(cm.blocked==0) cm.showOverlay(cm.numOverlays);
    break;
  case 33: // page up
    if(cm.blocked==0) cm.showSlide(cm.curSlide-1);
    break;
  case 37: // leftkey
    if(cm.blocked==0) cm.previous();
    break;
  case 38: // upkey
    if(cm.blocked==0) cm.showOverlay(0);
    break;
  case 36: // home
    if(cm.blocked==0) cm.firstSlide();
    break;
  case 35: // end
    if(cm.blocked==0) cm.lastSlide();
    break;
  case 27: // escape
    cm.endSlideShow();
    break;
  case 66: // B
    $("#slideBlanker").toggle();
    cm.blocked = (cm.blocked +1)%2;
    break;
  }
  return false;
}

config.macros.slideShow.clicker = function(e) {
  var cm = config.macros.slideShow;
  if(cm.blocked==1 || $(e.target).attr('href') || $(e.target).parents().andSelf().hasClass('noClicks')){
    return true;
  }
  if($("#toc").is(':visible')){
    cm.toggleTOC();
  } else {
    if((!e.which && e.button == 1) || e.which == 1) {
      cm.next();
    }
    if((!e.which && e.button == 2) || e.which == 3) {
      cm.previous();
    }
  }
  return false;
}

config.macros.slideShow.setClock = function(){
  var cm = config.macros.slideShow;
  var actualTime = new Date();
  var newTime = actualTime.getTime() - cm.clockStartTime;
  newTime = cm.clockMultiplier*newTime+cm.clockInterval+cm.clockCorrection;
  actualTime.setTime(newTime);
  newTime = actualTime.formatString(cm.clockFormat);
  $("#slideClock").text(newTime);
  return false;
}

config.macros.slideShow.resetClock = function(){
  var cm = config.macros.slideShow;
  if(cm.clock == 0) return;
  var time = new Date(0);
  if(cm.clockStartTime>time){
    var startTime = new Date();
    cm.clockStartTime=startTime.getTime();
  }
  return false;
}

config.shadowTiddlers.SlideShowStyleSheet="/*{{{*/\n.header, #mainMenu, #sidebar, #backstageButton, #backstageArea, .toolbar, .title, .subtitle, .tagging, .tagged, .tagClear, .comment{\n display:none !important\n}\n\n#slideBlanker{\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n z-index: 90; \n background-color: #000;\n opacity: 0.9;\n filter: alpha(opacity=90)\n}\n\n.nextOverlay{\n visibility: hidden\n}\n\n.previousOverlay,.currentOverlay{\n visibility: visible\n}\n\n#displayArea{\n font-size: 250%;\n margin: 0 !important;\n padding: 0\n}\n\n#controlBar{\n position: fixed;\n bottom: 2px;\n right: 2px;\n width: 100%;\n text-align: right\n}\n\n#controlBar .button{\n margin: 0 0.25em;\n padding: 0 0.25em\n}\n\n#slideHeader{\n font-size: 200%;\n font-weight: bold\n}\n\n#slideFooter{\n position: fixed;\n bottom: 2px\n}\n\n.slideFooterOff #navigator{\n visibility: hidden\n}\n\n#slideClock{\n margin: 0 5px 0 5px\n}\n\n#slideCounter{\n cursor: pointer;\n color: #aaa\n}\n\n#toc{\n display: none;\n position: absolute;\n font-size: .75em;\n bottom: 2em;\n right: 0;\n background: #fff;\n border: 1px solid #000;\n text-align: left\n}\n\n#jumpItem{\n padding-left:0.25em\n}\n\n#jumpInput{\n margin-left: 0.25em;\n width: 3em\n}\n\n.tocLevel1{\n font-size: .8em\n}\n\n.tocLevel2{\n margin-left: 1em;\n font-size: .75em\n}\n\n.tocLevel3{\n margin-left: 2em;\n font-size: .7em\n}\n\n.tocLevel4{\n margin-left: 3em;\n font-size: .65em\n}\n\n.tocLevel5{\n margin-left: 4em;\n font-size: .6em\n}\n\n.tocLevel6{\n margin-left: 5em;\n font-size: .55em\n}\n/*}}}*/";

config.shadowTiddlers.SlideShowPluginDoc="The documentation is available [[here|http://www.math.ist.utl.pt/~psoares/addons.html#SlideShowPluginDoc]].";
})(jQuery)
}
//}}}
!Description
This plugin turns any number of tiddlers into a slide show. A single macro provides a flexible way to present a set of tiddlers, including:
#a full screen presentation that hides the TiddlyWiki structure (header, sidebar, main menu);
#a way to navigate through a set of tiddlers keeping the TiddlyWiki structure (similar to the [[NavigationMacro|http://tw.lewcid.org/#NavigationMacro]] by Saq Imtiaz);
#a display of all the selected tiddlers ready to be printed.
!Main features
Most features that are usually found in presentation software are available. 
*Build a slide show from a list of tiddlers' titles or selecting a specific tag with optional sort
*Build a slide show from a single tiddler where slides are divided by a separator
*Fully customizable presentations (CSS knowledge required)
*Auto-advancing slide show (kiosk mode) and looping (circular mode)
*Incremental display (several overlays or layers in a slide)
*Optional clock with 4 different modes:
**local time
**elapsed time of presentation
**elapsed time for each slide
**countdown clock for a given period
*Screen blanking for pauses
!Installation
To install this plugin copy the tiddler SlideShowPlugin to your TiddlyWiki, label it with the ''systemConfig'' tag, save the TW and refresh the browser.
Optionally, you can also copy this documentation tiddler. If you don't, a link to the original one in my site is provided.  
!Quick start
The simplest way to make a slide show is to create a new tiddler with references to all the tiddlers you want to include in your presentation. Any reference or group of references to tiddlers that should be skipped must be wrapped in a {{{exclude}}} class as in the following example:
{{{
MissingSlide
[[First slide|SlideShowExample-1]] {{exclude{(the tiddler SlideShowPluginDoc will not be included in the presentation)}}}
SlideShowExample-2
SlideShowExample-3
SlideShowExample-4
}}}
Add {{{<<slideShow>>}}} anywhere in the tiddler, close the edit form, click the ''slide show'' button and there you are. Move forward/backward in the presentation with the mouse left/right button. If you move the mouse pointer over the bottom of the browser window you will see a few navigation buttons. Click the ''x'' button or press the ''Escape'' key to exit.
!Options
{{{
<<slideShow
  noClicks
  noKeyboard
  noOverlays
  cycle
  showAll
  single
  tiddler:tiddler
  label:string
  tooltip:string
  tag:tag
  sort:field
  theme:tiddler
  toc:string
  auto:time
  clock:type
  clockFormat:string
  header:string
  footer:string
>> 
}}}
''noClicks''
Disables navigation through mouse clicks on the tiddlers. This is useful when there are lots of clickable elements in the presentation.
If you want to keep using the mouse to move around the presentation and there are occasional elements that require mouse clicking, these can be formatted with a {{{noClicks}}} class (read more [[here|http://www.tiddlywiki.com/#CustomCssClass]]).

''noKeyboard''
Disables keyboard navigation.

''noOverlays''
Disables the incremental display of overlays.

''cycle''
The slide shows runs in a continuous loop. 

''showAll''
To print a presentation all the selected tiddlers are opened in the specified order. Press any key to return to the default TiddlyWiki layout.

''single''
Use this if a presentation is defined in a single tiddler.

''tiddler''
Use this option to indicate the tiddler where your slide show is defined when it is not the same one that contains the button that starts the presentation.

''label''
Text to replace the default text in the slide show button.

''tooltip''
Text to be shown when the mouse is over the slide show button.

''tag''
Use this option to create a slide show with the tiddlers with the provided tag instead of providing a list of tiddlers.

''sort''
If the ''tag'' option is used you can use this other option to sort the tiddlers according to a specific field. Valid values are: //created// (default), //modified//, //title// and //text//.

''theme''
A user provided tiddler containing CSS rules that define the style of the slide show. To redefine the default style, edit the SlideShowStyleSheet shadow tiddler. 

''toc''
Choose the type of table of contents. Possible values: ''titles'' will enable the use of the tiddlers titles, ''headers'' (default) to choose html headers (h1, h2,...), anything else will disable the table of contents.  

''auto''
The slide show auto advances after the defined number of seconds. The slide show can be paused by pressing the ''space bar''.

''clock''
Displays a clock near the navigation buttons at the bottom of the screen. Four types of clocks can be defined:
#''clock:0'' -- shows the local time.
#''clock:'+''' -- displays the elapsed time of the presentation. Click the clock display to reset the time.
#''clock:'-''' -- displays the elapsed for each slide. Click the clock display to reset the time.
#''clock:-20'' -- displays a countdown clock for the given (negative) number of minutes. Click the clock display to reset the time.
''clockFormat''
A string that defines the clock format. The default is '0hh:0mm:0ss' where the prefix '0' forces a leading zero. 

''header''
A string to be used as a permanent header for the slide show. By default it's used the title of tiddler that defines the slide show.

''footer''
A string to be used as a permanent footer for the slide show. By default the footer is empty.
!Incremental display
A succession of overlays (or layers) can be defined in each slide by marking blocks of text with
{{{
{{overlay1{...some text...}}}, {{overlay2{...some text...}}}, {{overlay3{...some text...}}}, ...
}}}
The default name of the classes (//overlay//) can be redefined with //config.macros.slideShow.text.overlay = "layer"//, for example. 
To costumize the way overlays are shown you can redefine the following CSS classes
*.previousOverlay 
*.currentOverlay 
*.nextOverlay 
in a ~StyleSheet. The default style simply hides the next overlays and shows the current and the previous ones as normal text.
!Slide show navigation
You can navigate through a slide show using the keyboard or the mouse. 
!!Mouse navigation
Left (right) clicking on a slide jumps to the next (previous) slide or overlay. To move to the first or last slides you must use the navigation bar at the bottom of the browser's window.
!!Keyboard
The following keys are defined:
*Home - first slide
*~PageUp - previous slide
*~PageDown - next slide
*End - last slide
*Escape - exit slide show
*Up arrow - first overlay
*Left arrow - previous overlay/slide
*Pause/Right arrow - next overlay/slide
*Down arrow - last overlay
*Spacebar - pause/resume slide show in auto advance mode, next overlay/slide otherwise
*B - blank screen and block the slide show
!Miscellaneous 
Any block of text marked as
{{{
{{comment{For my eyes only!}}}
}}}
will not be displayed in the slide show.

All translatable strings are defined in //config.macros.slideShow.text// parameter. See SlideShowPluginMsgPT with the portuguese translation as an example.
/***
|Name:|TagglyTaggingPlugin|
|Description:|tagglyTagging macro is a replacement for the builtin tagging macro in your ViewTemplate|
|Version:|3.3.2a|
|Date:|27-Jun-2011|
|Source:|http://mptw.tiddlyspot.com/#TagglyTaggingPlugin|
|Author:|Simon Baird <simon.baird@gmail.com>|
|License:|http://mptw.tiddlyspot.com/#TheBSDLicense|
!Notes
See http://mptw.tiddlyspot.com/#TagglyTagging
***/
//{{{

merge(String.prototype,{

  parseTagExpr: function(debug) {

    if (this.trim() == "")
      return "(true)";

    var anyLogicOp = /(!|&&|\|\||\(|\))/g;
    var singleLogicOp = /^(!|&&|\|\||\(|\))$/;

    var spaced = this.
      // because square brackets in templates are no good
      // this means you can use [(With Spaces)] instead of [[With Spaces]]
      replace(/\[\(/g," [[").
      replace(/\)\]/g,"]] ").
      // space things out so we can use readBracketedList. tricky eh?
      replace(anyLogicOp," $1 ");

    var expr = "";

    var tokens = spaced.readBracketedList(false); // false means don't uniq the list. nice one JR!

    for (var i=0;i<tokens.length;i++)
      if (tokens[i].match(singleLogicOp))
        expr += tokens[i];
      else
        expr += "tiddler.tags.contains('%0')".format([tokens[i].replace(/'/,"\\'")]); // fix single quote bug. still have round bracket bug i think

    if (debug)
      alert(expr);

    return '('+expr+')';
  }

});

merge(TiddlyWiki.prototype,{
  getTiddlersByTagExpr: function(tagExpr,sortField) {

    var result = [];

    var expr = tagExpr.parseTagExpr();

    store.forEachTiddler(function(title,tiddler) {
      if (eval(expr))
        result.push(tiddler);
    });

    if(!sortField)
      sortField = "title";

    result.sort(function(a,b) {return a[sortField] < b[sortField] ? -1 : (a[sortField] == b[sortField] ? 0 : +1);});

    return result;
  }
});

config.taggly = {

  // for translations
  lingo: {
    labels: {
      asc:        "\u2191", // down arrow
      desc:       "\u2193", // up arrow
      title:      "title",
      modified:   "modified",
      created:    "created",
      show:       "+",
      hide:       "-",
      normal:     "normal",
      group:      "group",
      commas:     "commas",
      sitemap:    "sitemap",
      numCols:    "cols\u00b1", // plus minus sign
      label:      "Tagged as '%0':",
      exprLabel:  "Matching tag expression '%0':",
      excerpts:   "excerpts",
      descr:      "descr",
      slices:     "slices",
      contents:   "contents",
      sliders:    "sliders",
      noexcerpts: "title only",
      noneFound:  "(none)"
    },

    tooltips: {
      title:      "Click to sort by title",
      modified:   "Click to sort by modified date",
      created:    "Click to sort by created date",
      show:       "Click to show tagging list",
      hide:       "Click to hide tagging list",
      normal:     "Click to show a normal ungrouped list",
      group:      "Click to show list grouped by tag",
      sitemap:    "Click to show a sitemap style list",
      commas:     "Click to show a comma separated list",
      numCols:    "Click to change number of columns",
      excerpts:   "Click to show excerpts",
      descr:      "Click to show the description slice",
      slices:     "Click to show all slices",
      contents:   "Click to show entire tiddler contents",
      sliders:    "Click to show tiddler contents in sliders",
      noexcerpts: "Click to show entire title only"
    },

    tooDeepMessage: "* //sitemap too deep...//"
  },

  config: {
    showTaggingCounts: true,
    listOpts: {
      // the first one will be the default
      sortBy:     ["title","modified","created"],
      sortOrder:  ["asc","desc"],
      hideState:  ["show","hide"],
      listMode:   ["normal","group","sitemap","commas"],
      numCols:    ["1","2","3","4","5","6"],
      excerpts:   ["noexcerpts","excerpts","descr","slices","contents","sliders"]
    },
    valuePrefix: "taggly.",
    excludeTags: ["excludeLists","excludeTagging"],
    excerptSize: 50,
    excerptMarker: "/%"+"%/",
    siteMapDepthLimit: 25
  },

  getTagglyOpt: function(title,opt) {
    var val = store.getValue(title,this.config.valuePrefix+opt);
    return val ? val : this.config.listOpts[opt][0];
  },

  setTagglyOpt: function(title,opt,value) {
    // create it silently if it doesn't exist
    if (!store.tiddlerExists(title)) {
      store.saveTiddler(title,title,config.views.editor.defaultText.format([title]),config.options.txtUserName,new Date(),"");

      // <<tagglyTagging expr:"...">> creates a tiddler to store its display settings
      // Make those tiddlers less noticeable by tagging as excludeSearch and excludeLists
      // Because we don't want to hide real tags, check that they aren't actually tags before doing so
      // Also tag them as tagglyExpression for manageability
      // (contributed by RA)
      if (!store.getTaggedTiddlers(title).length) {
        store.setTiddlerTag(title,true,"excludeSearch");
        store.setTiddlerTag(title,true,"excludeLists");
        store.setTiddlerTag(title,true,"tagglyExpression");
      }
    }

    // if value is default then remove it to save space
    return store.setValue(title, this.config.valuePrefix+opt, value == this.config.listOpts[opt][0] ? null : value);
  },

  getNextValue: function(title,opt) {
    var current = this.getTagglyOpt(title,opt);
    var pos = this.config.listOpts[opt].indexOf(current);
    // supposed to automagically don't let cols cycle up past the number of items
    // currently broken in some situations, eg when using an expression
    // lets fix it later when we rewrite for jquery
    // the columns thing should be jquery table manipulation probably
    var limit = (opt == "numCols" ? store.getTaggedTiddlers(title).length : this.config.listOpts[opt].length);
    var newPos = (pos + 1) % limit;
    return this.config.listOpts[opt][newPos];
  },

  toggleTagglyOpt: function(title,opt) {
    var newVal = this.getNextValue(title,opt);
    this.setTagglyOpt(title,opt,newVal);
  },

  createListControl: function(place,title,type) {
    var lingo = config.taggly.lingo;
    var label;
    var tooltip;
    var onclick;

    if ((type == "title" || type == "modified" || type == "created")) {
      // "special" controls. a little tricky. derived from sortOrder and sortBy
      label = lingo.labels[type];
      tooltip = lingo.tooltips[type];

      if (this.getTagglyOpt(title,"sortBy") == type) {
        label += lingo.labels[this.getTagglyOpt(title,"sortOrder")];
        onclick = function() {
          config.taggly.toggleTagglyOpt(title,"sortOrder");
          return false;
        }
      }
      else {
        onclick = function() {
          config.taggly.setTagglyOpt(title,"sortBy",type);
          config.taggly.setTagglyOpt(title,"sortOrder",config.taggly.config.listOpts.sortOrder[0]);
          return false;
        }
      }
    }
    else {
      // "regular" controls, nice and simple
      label = lingo.labels[type == "numCols" ? type : this.getNextValue(title,type)];
      tooltip = lingo.tooltips[type == "numCols" ? type : this.getNextValue(title,type)];
      onclick = function() {
        config.taggly.toggleTagglyOpt(title,type);
        return false;
      }
    }

    // hide button because commas don't have columns
    if (!(this.getTagglyOpt(title,"listMode") == "commas" && type == "numCols"))
      createTiddlyButton(place,label,tooltip,onclick,type == "hideState" ? "hidebutton" : "button");
  },

  makeColumns: function(orig,numCols) {
    var listSize = orig.length;
    var colSize = listSize/numCols;
    var remainder = listSize % numCols;

    var upperColsize = colSize;
    var lowerColsize = colSize;

    if (colSize != Math.floor(colSize)) {
      // it's not an exact fit so..
      upperColsize = Math.floor(colSize) + 1;
      lowerColsize = Math.floor(colSize);
    }

    var output = [];
    var c = 0;
    for (var j=0;j<numCols;j++) {
      var singleCol = [];
      var thisSize = j < remainder ? upperColsize : lowerColsize;
      for (var i=0;i<thisSize;i++)
        singleCol.push(orig[c++]);
      output.push(singleCol);
    }

    return output;
  },

  drawTable: function(place,columns,theClass) {
    var newTable = createTiddlyElement(place,"table",null,theClass);
    var newTbody = createTiddlyElement(newTable,"tbody");
    var newTr = createTiddlyElement(newTbody,"tr");
    for (var j=0;j<columns.length;j++) {
      var colOutput = "";
      for (var i=0;i<columns[j].length;i++)
        colOutput += columns[j][i];
      var newTd = createTiddlyElement(newTr,"td",null,"tagglyTagging"); // todo should not need this class
      wikify(colOutput,newTd);
    }
    return newTable;
  },

  createTagglyList: function(place,title,isTagExpr) {
    switch(this.getTagglyOpt(title,"listMode")) {
      case "group":  return this.createTagglyListGrouped(place,title,isTagExpr); break;
      case "normal": return this.createTagglyListNormal(place,title,false,isTagExpr); break;
      case "commas": return this.createTagglyListNormal(place,title,true,isTagExpr); break;
      case "sitemap":return this.createTagglyListSiteMap(place,title,isTagExpr); break;
    }
  },

  getTaggingCount: function(title,isTagExpr) {
    // thanks to Doug Edmunds
    if (this.config.showTaggingCounts) {
      var tagCount = config.taggly.getTiddlers(title,'title',isTagExpr).length;
      if (tagCount > 0)
        return " ("+tagCount+")";
    }
    return "";
  },

  getTiddlers: function(titleOrExpr,sortBy,isTagExpr) {
    return isTagExpr ? store.getTiddlersByTagExpr(titleOrExpr,sortBy) : store.getTaggedTiddlers(titleOrExpr,sortBy);
  },

  getExcerpt: function(inTiddlerTitle,title,indent) {
    if (!indent)
      indent = 1;

    var displayMode = this.getTagglyOpt(inTiddlerTitle,"excerpts");
    var t = store.getTiddler(title);

    if (t && displayMode == "excerpts") {
      var text = t.text.replace(/\n/," ");
      var marker = text.indexOf(this.config.excerptMarker);
      if (marker != -1) {
        return " {{excerpt{<nowiki>" + text.substr(0,marker) + "</nowiki>}}}";
      }
      else if (text.length < this.config.excerptSize) {
        return " {{excerpt{<nowiki>" + t.text + "</nowiki>}}}";
      }
      else {
        return " {{excerpt{<nowiki>" + t.text.substr(0,this.config.excerptSize) + "..." + "</nowiki>}}}";
      }
    }
    else if (t && displayMode == "contents") {
      return "\n{{contents indent"+indent+"{\n" + t.text + "\n}}}";
    }
    else if (t && displayMode == "sliders") {
      return "<slider slide>\n{{contents{\n" + t.text + "\n}}}\n</slider>";
    }
    else if (t && displayMode == "descr") {
      var descr = store.getTiddlerSlice(title,'Description');
      return descr ? " {{excerpt{" + descr  + "}}}" : "";
    }
    else if (t && displayMode == "slices") {
      var result = "";
      var slices = store.calcAllSlices(title);
      for (var s in slices)
        result += "|%0|<nowiki>%1</nowiki>|\n".format([s,slices[s]]);
      return result ? "\n{{excerpt excerptIndent{\n" + result  + "}}}" : "";
    }
    return "";
  },

  notHidden: function(t,inTiddler) {
    if (typeof t == "string")
      t = store.getTiddler(t);
    return (!t || !t.tags.containsAny(this.config.excludeTags) ||
        (inTiddler && this.config.excludeTags.contains(inTiddler)));
  },

  // this is for normal and commas mode
  createTagglyListNormal: function(place,title,useCommas,isTagExpr) {

    var list = config.taggly.getTiddlers(title,this.getTagglyOpt(title,"sortBy"),isTagExpr);

    if (this.getTagglyOpt(title,"sortOrder") == "desc")
      list = list.reverse();

    var output = [];
    var first = true;
    for (var i=0;i<list.length;i++) {
      if (this.notHidden(list[i],title)) {
        var countString = this.getTaggingCount(list[i].title);
        var excerpt = this.getExcerpt(title,list[i].title);
        if (useCommas)
          output.push((first ? "" : ", ") + "[[" + list[i].title + "]]" + countString + excerpt);
        else
          output.push("*[[" + list[i].title + "]]" + countString + excerpt + "\n");

        first = false;
      }
    }

    return this.drawTable(place,
      this.makeColumns(output,useCommas ? 1 : parseInt(this.getTagglyOpt(title,"numCols"))),
      useCommas ? "commas" : "normal");
  },

  // this is for the "grouped" mode
  createTagglyListGrouped: function(place,title,isTagExpr) {
    var sortBy = this.getTagglyOpt(title,"sortBy");
    var sortOrder = this.getTagglyOpt(title,"sortOrder");

    var list = config.taggly.getTiddlers(title,sortBy,isTagExpr);

    if (sortOrder == "desc")
      list = list.reverse();

    var leftOvers = []
    for (var i=0;i<list.length;i++)
      leftOvers.push(list[i].title);

    var allTagsHolder = {};
    for (var i=0;i<list.length;i++) {
      for (var j=0;j<list[i].tags.length;j++) {

        if (list[i].tags[j] != title) { // not this tiddler

          if (this.notHidden(list[i].tags[j],title)) {

            if (!allTagsHolder[list[i].tags[j]])
              allTagsHolder[list[i].tags[j]] = "";

            if (this.notHidden(list[i],title)) {
              allTagsHolder[list[i].tags[j]] += "**[["+list[i].title+"]]"
                    + this.getTaggingCount(list[i].title) + this.getExcerpt(title,list[i].title) + "\n";

              leftOvers.setItem(list[i].title,-1); // remove from leftovers. at the end it will contain the leftovers

            }
          }
        }
      }
    }

    var allTags = [];
    for (var t in allTagsHolder)
      allTags.push(t);

    var sortHelper = function(a,b) {
      if (a == b) return 0;
      if (a < b) return -1;
      return 1;
    };

    allTags.sort(function(a,b) {
      var tidA = store.getTiddler(a);
      var tidB = store.getTiddler(b);
      if (sortBy == "title") return sortHelper(a,b);
      else if (!tidA && !tidB) return 0;
      else if (!tidA) return -1;
      else if (!tidB) return +1;
      else return sortHelper(tidA[sortBy],tidB[sortBy]);
    });

    var leftOverOutput = "";
    for (var i=0;i<leftOvers.length;i++)
      if (this.notHidden(leftOvers[i],title))
        leftOverOutput += "*[["+leftOvers[i]+"]]" + this.getTaggingCount(leftOvers[i]) + this.getExcerpt(title,leftOvers[i]) + "\n";

    var output = [];

    if (sortOrder == "desc")
      allTags.reverse();
    else if (leftOverOutput != "")
      // leftovers first...
      output.push(leftOverOutput);

    for (var i=0;i<allTags.length;i++)
      if (allTagsHolder[allTags[i]] != "")
        output.push("*[["+allTags[i]+"]]" + this.getTaggingCount(allTags[i]) + this.getExcerpt(title,allTags[i]) + "\n" + allTagsHolder[allTags[i]]);

    if (sortOrder == "desc" && leftOverOutput != "")
      // leftovers last...
      output.push(leftOverOutput);

    return this.drawTable(place,
        this.makeColumns(output,parseInt(this.getTagglyOpt(title,"numCols"))),
        "grouped");

  },

  // used to build site map
  treeTraverse: function(title,depth,sortBy,sortOrder,isTagExpr) {

    var list = config.taggly.getTiddlers(title,sortBy,isTagExpr);

    if (sortOrder == "desc")
      list.reverse();

    var indent = "";
    for (var j=0;j<depth;j++)
      indent += "*"

    var childOutput = "";

    if (depth > this.config.siteMapDepthLimit)
      childOutput += indent + this.lingo.tooDeepMessage + "\n";
    else
      for (var i=0;i<list.length;i++)
        if (list[i].title != title)
          if (this.notHidden(list[i].title,this.config.inTiddler))
            childOutput += this.treeTraverse(list[i].title,depth+1,sortBy,sortOrder,false);

    if (depth == 0)
      return childOutput;
    else
      return indent + "[["+title+"]]" + this.getTaggingCount(title) + this.getExcerpt(this.config.inTiddler,title,depth) + "\n" + childOutput;
  },

  // this if for the site map mode
  createTagglyListSiteMap: function(place,title,isTagExpr) {
    this.config.inTiddler = title; // nasty. should pass it in to traverse probably
    var output = this.treeTraverse(title,0,this.getTagglyOpt(title,"sortBy"),this.getTagglyOpt(title,"sortOrder"),isTagExpr);
    return this.drawTable(place,
        this.makeColumns(output.split(/(?=^\*\[)/m),parseInt(this.getTagglyOpt(title,"numCols"))), // regexp magic
        "sitemap"
        );
  },

  macros: {
    tagglyTagging: {
      handler: function (place,macroName,params,wikifier,paramString,tiddler) {
        var parsedParams = paramString.parseParams("tag",null,true);
        var refreshContainer = createTiddlyElement(place,"div");

        // do some refresh magic to make it keep the list fresh - thanks Saq
        refreshContainer.setAttribute("refresh","macro");
        refreshContainer.setAttribute("macroName",macroName);

        var tag = getParam(parsedParams,"tag");
        var expr = getParam(parsedParams,"expr");

        if (expr) {
          refreshContainer.setAttribute("isTagExpr","true");
          refreshContainer.setAttribute("title",expr);
          refreshContainer.setAttribute("showEmpty","true");
        }
        else {
          refreshContainer.setAttribute("isTagExpr","false");
          if (tag) {
                refreshContainer.setAttribute("title",tag);
            refreshContainer.setAttribute("showEmpty","true");
          }
          else {
                refreshContainer.setAttribute("title",tiddler.title);
            refreshContainer.setAttribute("showEmpty","false");
          }
        }
        this.refresh(refreshContainer);
      },

      refresh: function(place) {
        var title = place.getAttribute("title");
        var isTagExpr = place.getAttribute("isTagExpr") == "true";
        var showEmpty = place.getAttribute("showEmpty") == "true";
        jQuery(place).empty()
        addClass(place,"tagglyTagging");
        var countFound = config.taggly.getTiddlers(title,'title',isTagExpr).length
        if (countFound > 0 || showEmpty) {
          var lingo = config.taggly.lingo;
          config.taggly.createListControl(place,title,"hideState");
          if (config.taggly.getTagglyOpt(title,"hideState") == "show") {
            createTiddlyElement(place,"span",null,"tagglyLabel",
                isTagExpr ? lingo.labels.exprLabel.format([title]) : lingo.labels.label.format([title]));
            config.taggly.createListControl(place,title,"title");
            config.taggly.createListControl(place,title,"modified");
            config.taggly.createListControl(place,title,"created");
            config.taggly.createListControl(place,title,"listMode");
            config.taggly.createListControl(place,title,"excerpts");
            config.taggly.createListControl(place,title,"numCols");
            config.taggly.createTagglyList(place,title,isTagExpr);
            if (countFound == 0 && showEmpty)
              createTiddlyElement(place,"div",null,"tagglyNoneFound",lingo.labels.noneFound);
          }
        }
      }
    }
  },

  // todo fix these up a bit
  styles: [
"/*{{{*/",
"/* created by TagglyTaggingPlugin */",
".tagglyTagging { padding-top:0.5em; }",
".tagglyTagging li.listTitle { display:none; }",
".tagglyTagging ul {",
" margin-top:0px; padding-top:0.5em; padding-left:2em;",
" margin-bottom:0px; padding-bottom:0px;",
"}",
".tagglyTagging { vertical-align: top; margin:0px; padding:0px; }",
".tagglyTagging table { margin:0px; padding:0px; }",
".tagglyTagging .button { visibility:hidden; margin-left:3px; margin-right:3px; }",
".tagglyTagging .button, .tagglyTagging .hidebutton {",
" color:[[ColorPalette::TertiaryLight]]; font-size:90%;",
" border:0px; padding-left:0.3em;padding-right:0.3em;",
"}",
".tagglyTagging .button:hover, .hidebutton:hover, ",
".tagglyTagging .button:active, .hidebutton:active  {",
" border:0px; background:[[ColorPalette::TertiaryPale]]; color:[[ColorPalette::TertiaryDark]];",
"}",
".selected .tagglyTagging .button { visibility:visible; }",
".tagglyTagging .hidebutton { color:[[ColorPalette::Background]]; }",
".selected .tagglyTagging .hidebutton { color:[[ColorPalette::TertiaryLight]] }",
".tagglyLabel { color:[[ColorPalette::TertiaryMid]]; font-size:90%; }",
".tagglyTagging ul {padding-top:0px; padding-bottom:0.5em; margin-left:1em; }",
".tagglyTagging ul ul {list-style-type:disc; margin-left:-1em;}",
".tagglyTagging ul ul li {margin-left:0.5em; }",
".editLabel { font-size:90%; padding-top:0.5em; }",
".tagglyTagging .commas { padding-left:1.8em; }",
"/* not technically tagglytagging but will put them here anyway */",
".tagglyTagged li.listTitle { display:none; }",
".tagglyTagged li { display: inline; font-size:90%; }",
".tagglyTagged ul { margin:0px; padding:0px; }",
".excerpt { color:[[ColorPalette::TertiaryDark]]; }",
".excerptIndent { margin-left:4em; }",
"div.tagglyTagging table,",
"div.tagglyTagging table tr,",
"td.tagglyTagging",
" {border-style:none!important; }",
".tagglyTagging .contents { border-bottom:2px solid [[ColorPalette::TertiaryPale]]; padding:0 1em 1em 0.5em;",
"  margin-bottom:0.5em; }",
".tagglyTagging .indent1  { margin-left:3em;  }",
".tagglyTagging .indent2  { margin-left:4em;  }",
".tagglyTagging .indent3  { margin-left:5em;  }",
".tagglyTagging .indent4  { margin-left:6em;  }",
".tagglyTagging .indent5  { margin-left:7em;  }",
".tagglyTagging .indent6  { margin-left:8em;  }",
".tagglyTagging .indent7  { margin-left:9em;  }",
".tagglyTagging .indent8  { margin-left:10em; }",
".tagglyTagging .indent9  { margin-left:11em; }",
".tagglyTagging .indent10 { margin-left:12em; }",
".tagglyNoneFound { margin-left:2em; color:[[ColorPalette::TertiaryMid]]; font-size:90%; font-style:italic; }",
"/*}}}*/",
    ""].join("\n"),

  init: function() {
    merge(config.macros,this.macros);
    config.shadowTiddlers["TagglyTaggingStyles"] = this.styles;
    store.addNotification("TagglyTaggingStyles",refreshStyles);
  }
};

config.taggly.init();

//}}}

/***
InlineSlidersPlugin
By Saq Imtiaz
http://tw.lewcid.org/sandbox/#InlineSlidersPlugin

// syntax adjusted to not clash with NestedSlidersPlugin
// added + syntax to start open instead of closed

***/
//{{{
config.formatters.unshift( {
  name: "inlinesliders",
  // match: "\\+\\+\\+\\+|\\<slider",
  match: "\\<slider",
  // lookaheadRegExp: /(?:\+\+\+\+|<slider) (.*?)(?:>?)\n((?:.|\n)*?)\n(?:====|<\/slider>)/mg,
  lookaheadRegExp: /(?:<slider)(\+?) (.*?)(?:>)\n((?:.|\n)*?)\n(?:<\/slider>)/mg,
  handler: function(w) {
    this.lookaheadRegExp.lastIndex = w.matchStart;
    var lookaheadMatch = this.lookaheadRegExp.exec(w.source)
    if(lookaheadMatch && lookaheadMatch.index == w.matchStart ) {
      var btn = createTiddlyButton(w.output,lookaheadMatch[2] + " "+"\u00BB",lookaheadMatch[2],this.onClickSlider,"button sliderButton");
      var panel = createTiddlyElement(w.output,"div",null,"sliderPanel");
      panel.style.display = (lookaheadMatch[1] == '+' ? "block" : "none");
      wikify(lookaheadMatch[3],panel);
      w.nextMatch = lookaheadMatch.index + lookaheadMatch[0].length;
    }
   },
   onClickSlider : function(e) {
    if(!e) var e = window.event;
    var n = this.nextSibling;
    n.style.display = (n.style.display=="none") ? "block" : "none";
    return false;
  }
});

//}}}
Ubicar en internet contenidos relacionados con PERT-CPM, como por ejemplo:
1) Presentaciones Online (en repositorios "sociales" como SlideShare)
2) Artículos de blogs
3) Artículos académicos gratuitos online
4) Casos reales de aplicación/estudio
5) Libros disponibles online (gratuitos o no)
6) Videos Youtube que expliquen las técnicas
7) Foros, Grupos y organizaciones sobre el tema

Organizar la información y colocarla en el google doc compartido del curso, que estará siendo compartido en el blog del curso.

/***
|Name:|ToggleTagPlugin|
|Description:|Makes a checkbox which toggles a tag in a tiddler|
|Version:|3.1.0a|
|Date:|27-Jun-2011|
|Source:|http://mptw.tiddlyspot.com/#ToggleTagPlugin|
|Author:|Simon Baird <simon.baird@gmail.com>|
|License:|http://mptw.tiddlyspot.com/#TheBSDLicense|
!!Usage
{{{<<toggleTag }}}//{{{TagName TiddlerName LabelText}}}//{{{>>}}}
* TagName - the tag to be toggled, default value "checked"
* TiddlerName - the tiddler to toggle the tag in, default value the current tiddler
* LabelText - the text (gets wikified) to put next to the check box, default value is '{{{[[TagName]]}}}' or '{{{[[TagName]] [[TiddlerName]]}}}'
(If a parameter is '.' then the default will be used)
* TouchMod flag - if non empty then touch the tiddlers mod date. Note, can set config.toggleTagAlwaysTouchModDate to always touch mod date
!!Examples
|Code|Description|Example|h
|{{{<<toggleTag>>}}}|Toggles the default tag (checked) in this tiddler|<<toggleTag>>|
|{{{<<toggleTag TagName>>}}}|Toggles the TagName tag in this tiddler|<<toggleTag TagName>>|
|{{{<<toggleTag TagName TiddlerName>>}}}|Toggles the TagName tag in the TiddlerName tiddler|<<toggleTag TagName TiddlerName>>|
|{{{<<toggleTag TagName TiddlerName 'click me'>>}}}|Same but with custom label|<<toggleTag TagName TiddlerName 'click me'>>|
|{{{<<toggleTag . . 'click me'>>}}}|dot means use default value|<<toggleTag . . 'click me'>>|
!!Notes
* If TiddlerName doesn't exist it will be silently created
* Set label to '-' to specify no label
* See also http://mgtd-alpha.tiddlyspot.com/#ToggleTag2
!!Known issues
* Doesn't smoothly handle the case where you toggle a tag in a tiddler that is current open for editing
* Should convert to use named params
***/
//{{{

if (config.toggleTagAlwaysTouchModDate == undefined) config.toggleTagAlwaysTouchModDate = false;

merge(config.macros,{

  toggleTag: {

    createIfRequired: true,
    shortLabel: "[[%0]]",
    longLabel: "[[%0]] [[%1]]",

    handler: function(place,macroName,params,wikifier,paramString,tiddler) {
      var tiddlerTitle = tiddler ? tiddler.title : '';
      var tag   = (params[0] && params[0] != '.') ? params[0] : "checked";
      var title = (params[1] && params[1] != '.') ? params[1] : tiddlerTitle;
      var defaultLabel = (title == tiddlerTitle ? this.shortLabel : this.longLabel);
      var label = (params[2] && params[2] != '.') ? params[2] : defaultLabel;
      var touchMod = (params[3] && params[3] != '.') ? params[3] : "";
      label = (label == '-' ? '' : label); // dash means no label
      var theTiddler = (title == tiddlerTitle ? tiddler : store.getTiddler(title));
      var cb = createTiddlyCheckbox(place, label.format([tag,title]), theTiddler && theTiddler.isTagged(tag), function(e) {
        if (!store.tiddlerExists(title)) {
          if (config.macros.toggleTag.createIfRequired) {
            var content = store.getTiddlerText(title); // just in case it's a shadow
            store.saveTiddler(title,title,content?content:"",config.options.txtUserName,new Date(),null);
          }
          else
            return false;
        }
        if ((touchMod != "" || config.toggleTagAlwaysTouchModDate) && theTiddler)
            theTiddler.modified = new Date();
        store.setTiddlerTag(title,this.checked,tag);
        return true;
      });
    }
  }
});

//}}}

!Sesión 1
#Revisión de Pendientes
#Definiciones de Modelo de Transporte
#Tablón de Transporte
#Formulación de problemas no balanceados
#Formulación de problemas con rutas "no deseadas"


!Sesión 2
#Revisión de Pendientes.
#Aplicación de Evaluación Individual de Sensibilidad.
#Formulación de problemas con costos de producción distintos en orígenes, y precios de venta distintos en destinos (Maximización).
#Plan de Producción como problema de Transporte. [[Ejemplo|EnunciadoPlanDeProducción]]

!Sesión 3
#Revision de pendientes
#Problema de transbordo
#Ejemplo

!Sesión 4
#Revisión de pendientes
#Problema de ruta más corta
#Asignación de trabajo individual, camino más corto entre ciudad natal y Caracas, o ciudad natal de un familiar y Caracas. http://intranet.mindeporte.gob.ve/intranet/images/stories/PDF/tabla%20de%20distancias%20vzla%20word%202003.pdf (Valor 10 ptos). Asignación de Quiz de Transbordo.



http://books.google.co.ve/books?id=jP6H4xrTBkUC&pg=PA288&lpg=PA288&dq=transshipment+problems&source=bl&ots=5t4_DtMqg6&sig=M2lK2RfFlVGnfiCg19M4elDlDv8&hl=es&ei=0NMbS5zNL4S0tgeeu6zrAw&sa=X&oi=book_result&ct=result&resnum=6&ved=0CB4Q6AEwBTg8#v=onepage&q=transshipment%20problems&f=false

http://www.utdallas.edu/~scniu/OPRE-6201/documents/TP1-Transportation.html

http://130.216.209.237/engsci392/pulp/ATransshipmentProblem
http://www.utdallas.edu/~scniu/OPRE-6201/documents/TP6-Transshipment.pdf
http://web.njit.edu/~yang/teaching/ie439/note7.pdf
/***
Description: Contains the stuff you need to use Tiddlyspot
Note, you also need UploadPlugin, PasswordOptionPlugin and LoadRemoteFileThroughProxy
from http://tiddlywiki.bidix.info for a complete working Tiddlyspot site.
***/
//{{{

// edit this if you are migrating sites or retrofitting an existing TW
config.tiddlyspotSiteId = 'ps3161';

// make it so you can by default see edit controls via http
config.options.chkHttpReadOnly = false;
window.readOnly = false; // make sure of it (for tw 2.2)
window.showBackstage = true; // show backstage too

// disable autosave in d3
if (window.location.protocol != "file:")
	config.options.chkGTDLazyAutoSave = false;

// tweak shadow tiddlers to add upload button, password entry box etc
with (config.shadowTiddlers) {
	SiteUrl = 'http://'+config.tiddlyspotSiteId+'.tiddlyspot.com';
	SideBarOptions = SideBarOptions.replace(/(<<saveChanges>>)/,"$1<<tiddler TspotSidebar>>");
	OptionsPanel = OptionsPanel.replace(/^/,"<<tiddler TspotOptions>>");
	DefaultTiddlers = DefaultTiddlers.replace(/^/,"[[WelcomeToTiddlyspot]] ");
	MainMenu = MainMenu.replace(/^/,"[[WelcomeToTiddlyspot]] ");
}

// create some shadow tiddler content
merge(config.shadowTiddlers,{

'TspotOptions':[
 "tiddlyspot password:",
 "<<option pasUploadPassword>>",
 ""
].join("\n"),

'TspotControls':[
 "| tiddlyspot password:|<<option pasUploadPassword>>|",
 "| site management:|<<upload http://" + config.tiddlyspotSiteId + ".tiddlyspot.com/store.cgi index.html . .  " + config.tiddlyspotSiteId + ">>//(requires tiddlyspot password)//<br>[[control panel|http://" + config.tiddlyspotSiteId + ".tiddlyspot.com/controlpanel]], [[download (go offline)|http://" + config.tiddlyspotSiteId + ".tiddlyspot.com/download]]|",
 "| links:|[[tiddlyspot.com|http://tiddlyspot.com/]], [[FAQs|http://faq.tiddlyspot.com/]], [[blog|http://tiddlyspot.blogspot.com/]], email [[support|mailto:support@tiddlyspot.com]] & [[feedback|mailto:feedback@tiddlyspot.com]], [[donate|http://tiddlyspot.com/?page=donate]]|"
].join("\n"),

'WelcomeToTiddlyspot':[
 "This document is a ~TiddlyWiki from tiddlyspot.com.  A ~TiddlyWiki is an electronic notebook that is great for managing todo lists, personal information, and all sorts of things.",
 "",
 "@@font-weight:bold;font-size:1.3em;color:#444; //What now?// &nbsp;&nbsp;@@ Before you can save any changes, you need to enter your password in the form below.  Then configure privacy and other site settings at your [[control panel|http://" + config.tiddlyspotSiteId + ".tiddlyspot.com/controlpanel]] (your control panel username is //" + config.tiddlyspotSiteId + "//).",
 "<<tiddler TspotControls>>",
 "See also GettingStarted.",
 "",
 "@@font-weight:bold;font-size:1.3em;color:#444; //Working online// &nbsp;&nbsp;@@ You can edit this ~TiddlyWiki right now, and save your changes using the \"save to web\" button in the column on the right.",
 "",
 "@@font-weight:bold;font-size:1.3em;color:#444; //Working offline// &nbsp;&nbsp;@@ A fully functioning copy of this ~TiddlyWiki can be saved onto your hard drive or USB stick.  You can make changes and save them locally without being connected to the Internet.  When you're ready to sync up again, just click \"upload\" and your ~TiddlyWiki will be saved back to tiddlyspot.com.",
 "",
 "@@font-weight:bold;font-size:1.3em;color:#444; //Help!// &nbsp;&nbsp;@@ Find out more about ~TiddlyWiki at [[TiddlyWiki.com|http://tiddlywiki.com]].  Also visit [[TiddlyWiki.org|http://tiddlywiki.org]] for documentation on learning and using ~TiddlyWiki. New users are especially welcome on the [[TiddlyWiki mailing list|http://groups.google.com/group/TiddlyWiki]], which is an excellent place to ask questions and get help.  If you have a tiddlyspot related problem email [[tiddlyspot support|mailto:support@tiddlyspot.com]].",
 "",
 "@@font-weight:bold;font-size:1.3em;color:#444; //Enjoy :)// &nbsp;&nbsp;@@ We hope you like using your tiddlyspot.com site.  Please email [[feedback@tiddlyspot.com|mailto:feedback@tiddlyspot.com]] with any comments or suggestions."
].join("\n"),

'TspotSidebar':[
 "<<upload http://" + config.tiddlyspotSiteId + ".tiddlyspot.com/store.cgi index.html . .  " + config.tiddlyspotSiteId + ">><html><a href='http://" + config.tiddlyspotSiteId + ".tiddlyspot.com/download' class='button'>download</a></html>"
].join("\n")

});
//}}}
| !date | !user | !location | !storeUrl | !uploadDir | !toFilename | !backupdir | !origin |
| 07/02/2014 16:10:51 | OManzanilla | [[/|http://ps3161.tiddlyspot.com/]] | [[store.cgi|http://ps3161.tiddlyspot.com/store.cgi]] | . | [[index.html | http://ps3161.tiddlyspot.com/index.html]] | . | ok |
| 07/02/2014 16:43:07 | OManzanilla | [[/|http://ps3161.tiddlyspot.com/]] | [[store.cgi|http://ps3161.tiddlyspot.com/store.cgi]] | . | [[index.html | http://ps3161.tiddlyspot.com/index.html]] | . |
| 11/02/2014 23:15:11 | OManzanilla | [[/|http://ps3161.tiddlyspot.com/#IntroPL]] | [[store.cgi|http://ps3161.tiddlyspot.com/store.cgi]] | . | [[index.html | http://ps3161.tiddlyspot.com/index.html]] | . |
| 13/02/2014 01:22:36 | OManzanilla | [[/|http://ps3161.tiddlyspot.com/]] | [[store.cgi|http://ps3161.tiddlyspot.com/store.cgi]] | . | [[index.html | http://ps3161.tiddlyspot.com/index.html]] | . |
| 27/02/2014 15:51:17 | OManzanilla | [[/|http://ps3161.tiddlyspot.com/]] | [[store.cgi|http://ps3161.tiddlyspot.com/store.cgi]] | . | [[index.html | http://ps3161.tiddlyspot.com/index.html]] | . |
| 06/05/2014 01:26:59 | OManzanilla | [[/|http://ps3161.tiddlyspot.com/]] | [[store.cgi|http://ps3161.tiddlyspot.com/store.cgi]] | . | [[index.html | http://ps3161.tiddlyspot.com/index.html]] | . |
| 30/06/2014 12:04:39 | OManzanilla | [[/|http://ps3161.tiddlyspot.com/]] | [[store.cgi|http://ps3161.tiddlyspot.com/store.cgi]] | . | [[index.html | http://ps3161.tiddlyspot.com/index.html]] | . |
| 30/06/2014 12:04:44 | OManzanilla | [[/|http://ps3161.tiddlyspot.com/]] | [[store.cgi|http://ps3161.tiddlyspot.com/store.cgi]] | . | [[index.html | http://ps3161.tiddlyspot.com/index.html]] | . |
| 26/03/2015 18:16:59 | OManzanilla | [[/|http://ps3161.tiddlyspot.com/]] | [[store.cgi|http://ps3161.tiddlyspot.com/store.cgi]] | . | [[index.html | http://ps3161.tiddlyspot.com/index.html]] | . | ok |
| 26/03/2015 19:19:15 | OManzanilla | [[/|http://ps3161.tiddlyspot.com/]] | [[store.cgi|http://ps3161.tiddlyspot.com/store.cgi]] | . | [[index.html | http://ps3161.tiddlyspot.com/index.html]] | . |
/***
|''Name:''|UploadPlugin|
|''Description:''|Save to web a TiddlyWiki|
|''Version:''|4.1.3|
|''Date:''|Feb 24, 2008|
|''Source:''|http://tiddlywiki.bidix.info/#UploadPlugin|
|''Documentation:''|http://tiddlywiki.bidix.info/#UploadPluginDoc|
|''Author:''|BidiX (BidiX (at) bidix (dot) info)|
|''License:''|[[BSD open source license|http://tiddlywiki.bidix.info/#%5B%5BBSD%20open%20source%20license%5D%5D ]]|
|''~CoreVersion:''|2.2.0|
|''Requires:''|PasswordOptionPlugin|
***/
//{{{
version.extensions.UploadPlugin = {
	major: 4, minor: 1, revision: 3,
	date: new Date("Feb 24, 2008"),
	source: 'http://tiddlywiki.bidix.info/#UploadPlugin',
	author: 'BidiX (BidiX (at) bidix (dot) info',
	coreVersion: '2.2.0'
};

//
// Environment
//

if (!window.bidix) window.bidix = {}; // bidix namespace
bidix.debugMode = false;	// true to activate both in Plugin and UploadService
	
//
// Upload Macro
//

config.macros.upload = {
// default values
	defaultBackupDir: '',	//no backup
	defaultStoreScript: "store.php",
	defaultToFilename: "index.html",
	defaultUploadDir: ".",
	authenticateUser: true	// UploadService Authenticate User
};
	
config.macros.upload.label = {
	promptOption: "Save and Upload this TiddlyWiki with UploadOptions",
	promptParamMacro: "Save and Upload this TiddlyWiki in %0",
	saveLabel: "save to web", 
	saveToDisk: "save to disk",
	uploadLabel: "upload"	
};

config.macros.upload.messages = {
	noStoreUrl: "No store URL in parmeters or options",
	usernameOrPasswordMissing: "Username or password missing"
};

config.macros.upload.handler = function(place,macroName,params) {
	if (readOnly)
		return;
	var label;
	if (document.location.toString().substr(0,4) == "http") 
		label = this.label.saveLabel;
	else
		label = this.label.uploadLabel;
	var prompt;
	if (params[0]) {
		prompt = this.label.promptParamMacro.toString().format([this.destFile(params[0], 
			(params[1] ? params[1]:bidix.basename(window.location.toString())), params[3])]);
	} else {
		prompt = this.label.promptOption;
	}
	createTiddlyButton(place, label, prompt, function() {config.macros.upload.action(params);}, null, null, this.accessKey);
};

config.macros.upload.action = function(params)
{
		// for missing macro parameter set value from options
		if (!params) params = {};
		var storeUrl = params[0] ? params[0] : config.options.txtUploadStoreUrl;
		var toFilename = params[1] ? params[1] : config.options.txtUploadFilename;
		var backupDir = params[2] ? params[2] : config.options.txtUploadBackupDir;
		var uploadDir = params[3] ? params[3] : config.options.txtUploadDir;
		var username = params[4] ? params[4] : config.options.txtUploadUserName;
		var password = config.options.pasUploadPassword; // for security reason no password as macro parameter	
		// for still missing parameter set default value
		if ((!storeUrl) && (document.location.toString().substr(0,4) == "http")) 
			storeUrl = bidix.dirname(document.location.toString())+'/'+config.macros.upload.defaultStoreScript;
		if (storeUrl.substr(0,4) != "http")
			storeUrl = bidix.dirname(document.location.toString()) +'/'+ storeUrl;
		if (!toFilename)
			toFilename = bidix.basename(window.location.toString());
		if (!toFilename)
			toFilename = config.macros.upload.defaultToFilename;
		if (!uploadDir)
			uploadDir = config.macros.upload.defaultUploadDir;
		if (!backupDir)
			backupDir = config.macros.upload.defaultBackupDir;
		// report error if still missing
		if (!storeUrl) {
			alert(config.macros.upload.messages.noStoreUrl);
			clearMessage();
			return false;
		}
		if (config.macros.upload.authenticateUser && (!username || !password)) {
			alert(config.macros.upload.messages.usernameOrPasswordMissing);
			clearMessage();
			return false;
		}
		bidix.upload.uploadChanges(false,null,storeUrl, toFilename, uploadDir, backupDir, username, password); 
		return false; 
};

config.macros.upload.destFile = function(storeUrl, toFilename, uploadDir) 
{
	if (!storeUrl)
		return null;
		var dest = bidix.dirname(storeUrl);
		if (uploadDir && uploadDir != '.')
			dest = dest + '/' + uploadDir;
		dest = dest + '/' + toFilename;
	return dest;
};

//
// uploadOptions Macro
//

config.macros.uploadOptions = {
	handler: function(place,macroName,params) {
		var wizard = new Wizard();
		wizard.createWizard(place,this.wizardTitle);
		wizard.addStep(this.step1Title,this.step1Html);
		var markList = wizard.getElement("markList");
		var listWrapper = document.createElement("div");
		markList.parentNode.insertBefore(listWrapper,markList);
		wizard.setValue("listWrapper",listWrapper);
		this.refreshOptions(listWrapper,false);
		var uploadCaption;
		if (document.location.toString().substr(0,4) == "http") 
			uploadCaption = config.macros.upload.label.saveLabel;
		else
			uploadCaption = config.macros.upload.label.uploadLabel;
		
		wizard.setButtons([
				{caption: uploadCaption, tooltip: config.macros.upload.label.promptOption, 
					onClick: config.macros.upload.action},
				{caption: this.cancelButton, tooltip: this.cancelButtonPrompt, onClick: this.onCancel}
				
			]);
	},
	options: [
		"txtUploadUserName",
		"pasUploadPassword",
		"txtUploadStoreUrl",
		"txtUploadDir",
		"txtUploadFilename",
		"txtUploadBackupDir",
		"chkUploadLog",
		"txtUploadLogMaxLine"		
	],
	refreshOptions: function(listWrapper) {
		var opts = [];
		for(i=0; i<this.options.length; i++) {
			var opt = {};
			opts.push();
			opt.option = "";
			n = this.options[i];
			opt.name = n;
			opt.lowlight = !config.optionsDesc[n];
			opt.description = opt.lowlight ? this.unknownDescription : config.optionsDesc[n];
			opts.push(opt);
		}
		var listview = ListView.create(listWrapper,opts,this.listViewTemplate);
		for(n=0; n<opts.length; n++) {
			var type = opts[n].name.substr(0,3);
			var h = config.macros.option.types[type];
			if (h && h.create) {
				h.create(opts[n].colElements['option'],type,opts[n].name,opts[n].name,"no");
			}
		}
		
	},
	onCancel: function(e)
	{
		backstage.switchTab(null);
		return false;
	},
	
	wizardTitle: "Upload with options",
	step1Title: "These options are saved in cookies in your browser",
	step1Html: "<input type='hidden' name='markList'></input><br>",
	cancelButton: "Cancel",
	cancelButtonPrompt: "Cancel prompt",
	listViewTemplate: {
		columns: [
			{name: 'Description', field: 'description', title: "Description", type: 'WikiText'},
			{name: 'Option', field: 'option', title: "Option", type: 'String'},
			{name: 'Name', field: 'name', title: "Name", type: 'String'}
			],
		rowClasses: [
			{className: 'lowlight', field: 'lowlight'} 
			]}
};

//
// upload functions
//

if (!bidix.upload) bidix.upload = {};

if (!bidix.upload.messages) bidix.upload.messages = {
	//from saving
	invalidFileError: "The original file '%0' does not appear to be a valid TiddlyWiki",
	backupSaved: "Backup saved",
	backupFailed: "Failed to upload backup file",
	rssSaved: "RSS feed uploaded",
	rssFailed: "Failed to upload RSS feed file",
	emptySaved: "Empty template uploaded",
	emptyFailed: "Failed to upload empty template file",
	mainSaved: "Main TiddlyWiki file uploaded",
	mainFailed: "Failed to upload main TiddlyWiki file. Your changes have not been saved",
	//specific upload
	loadOriginalHttpPostError: "Can't get original file",
	aboutToSaveOnHttpPost: 'About to upload on %0 ...',
	storePhpNotFound: "The store script '%0' was not found."
};

bidix.upload.uploadChanges = function(onlyIfDirty,tiddlers,storeUrl,toFilename,uploadDir,backupDir,username,password)
{
	var callback = function(status,uploadParams,original,url,xhr) {
		if (!status) {
			displayMessage(bidix.upload.messages.loadOriginalHttpPostError);
			return;
		}
		if (bidix.debugMode) 
			alert(original.substr(0,500)+"\n...");
		// Locate the storeArea div's 
		var posDiv = locateStoreArea(original);
		if((posDiv[0] == -1) || (posDiv[1] == -1)) {
			alert(config.messages.invalidFileError.format([localPath]));
			return;
		}
		bidix.upload.uploadRss(uploadParams,original,posDiv);
	};
	
	if(onlyIfDirty && !store.isDirty())
		return;
	clearMessage();
	// save on localdisk ?
	if (document.location.toString().substr(0,4) == "file") {
		var path = document.location.toString();
		var localPath = getLocalPath(path);
		saveChanges();
	}
	// get original
	var uploadParams = new Array(storeUrl,toFilename,uploadDir,backupDir,username,password);
	var originalPath = document.location.toString();
	// If url is a directory : add index.html
	if (originalPath.charAt(originalPath.length-1) == "/")
		originalPath = originalPath + "index.html";
	var dest = config.macros.upload.destFile(storeUrl,toFilename,uploadDir);
	var log = new bidix.UploadLog();
	log.startUpload(storeUrl, dest, uploadDir,  backupDir);
	displayMessage(bidix.upload.messages.aboutToSaveOnHttpPost.format([dest]));
	if (bidix.debugMode) 
		alert("about to execute Http - GET on "+originalPath);
	var r = doHttp("GET",originalPath,null,null,username,password,callback,uploadParams,null);
	if (typeof r == "string")
		displayMessage(r);
	return r;
};

bidix.upload.uploadRss = function(uploadParams,original,posDiv) 
{
	var callback = function(status,params,responseText,url,xhr) {
		if(status) {
			var destfile = responseText.substring(responseText.indexOf("destfile:")+9,responseText.indexOf("\n", responseText.indexOf("destfile:")));
			displayMessage(bidix.upload.messages.rssSaved,bidix.dirname(url)+'/'+destfile);
			bidix.upload.uploadMain(params[0],params[1],params[2]);
		} else {
			displayMessage(bidix.upload.messages.rssFailed);			
		}
	};
	// do uploadRss
	if(config.options.chkGenerateAnRssFeed) {
		var rssPath = uploadParams[1].substr(0,uploadParams[1].lastIndexOf(".")) + ".xml";
		var rssUploadParams = new Array(uploadParams[0],rssPath,uploadParams[2],'',uploadParams[4],uploadParams[5]);
		var rssString = generateRss();
		// no UnicodeToUTF8 conversion needed when location is "file" !!!
		if (document.location.toString().substr(0,4) != "file")
			rssString = convertUnicodeToUTF8(rssString);	
		bidix.upload.httpUpload(rssUploadParams,rssString,callback,Array(uploadParams,original,posDiv));
	} else {
		bidix.upload.uploadMain(uploadParams,original,posDiv);
	}
};

bidix.upload.uploadMain = function(uploadParams,original,posDiv) 
{
	var callback = function(status,params,responseText,url,xhr) {
		var log = new bidix.UploadLog();
		if(status) {
			// if backupDir specified
			if ((params[3]) && (responseText.indexOf("backupfile:") > -1))  {
				var backupfile = responseText.substring(responseText.indexOf("backupfile:")+11,responseText.indexOf("\n", responseText.indexOf("backupfile:")));
				displayMessage(bidix.upload.messages.backupSaved,bidix.dirname(url)+'/'+backupfile);
			}
			var destfile = responseText.substring(responseText.indexOf("destfile:")+9,responseText.indexOf("\n", responseText.indexOf("destfile:")));
			displayMessage(bidix.upload.messages.mainSaved,bidix.dirname(url)+'/'+destfile);
			store.setDirty(false);
			log.endUpload("ok");
		} else {
			alert(bidix.upload.messages.mainFailed);
			displayMessage(bidix.upload.messages.mainFailed);
			log.endUpload("failed");			
		}
	};
	// do uploadMain
	var revised = bidix.upload.updateOriginal(original,posDiv);
	bidix.upload.httpUpload(uploadParams,revised,callback,uploadParams);
};

bidix.upload.httpUpload = function(uploadParams,data,callback,params)
{
	var localCallback = function(status,params,responseText,url,xhr) {
		url = (url.indexOf("nocache=") < 0 ? url : url.substring(0,url.indexOf("nocache=")-1));
		if (xhr.status == 404)
			alert(bidix.upload.messages.storePhpNotFound.format([url]));
		if ((bidix.debugMode) || (responseText.indexOf("Debug mode") >= 0 )) {
			alert(responseText);
			if (responseText.indexOf("Debug mode") >= 0 )
				responseText = responseText.substring(responseText.indexOf("\n\n")+2);
		} else if (responseText.charAt(0) != '0') 
			alert(responseText);
		if (responseText.charAt(0) != '0')
			status = null;
		callback(status,params,responseText,url,xhr);
	};
	// do httpUpload
	var boundary = "---------------------------"+"AaB03x";	
	var uploadFormName = "UploadPlugin";
	// compose headers data
	var sheader = "";
	sheader += "--" + boundary + "\r\nContent-disposition: form-data; name=\"";
	sheader += uploadFormName +"\"\r\n\r\n";
	sheader += "backupDir="+uploadParams[3] +
				";user=" + uploadParams[4] +
				";password=" + uploadParams[5] +
				";uploaddir=" + uploadParams[2];
	if (bidix.debugMode)
		sheader += ";debug=1";
	sheader += ";;\r\n"; 
	sheader += "\r\n" + "--" + boundary + "\r\n";
	sheader += "Content-disposition: form-data; name=\"userfile\"; filename=\""+uploadParams[1]+"\"\r\n";
	sheader += "Content-Type: text/html;charset=UTF-8" + "\r\n";
	sheader += "Content-Length: " + data.length + "\r\n\r\n";
	// compose trailer data
	var strailer = new String();
	strailer = "\r\n--" + boundary + "--\r\n";
	data = sheader + data + strailer;
	if (bidix.debugMode) alert("about to execute Http - POST on "+uploadParams[0]+"\n with \n"+data.substr(0,500)+ " ... ");
	var r = doHttp("POST",uploadParams[0],data,"multipart/form-data; ;charset=UTF-8; boundary="+boundary,uploadParams[4],uploadParams[5],localCallback,params,null);
	if (typeof r == "string")
		displayMessage(r);
	return r;
};

// same as Saving's updateOriginal but without convertUnicodeToUTF8 calls
bidix.upload.updateOriginal = function(original, posDiv)
{
	if (!posDiv)
		posDiv = locateStoreArea(original);
	if((posDiv[0] == -1) || (posDiv[1] == -1)) {
		alert(config.messages.invalidFileError.format([localPath]));
		return;
	}
	var revised = original.substr(0,posDiv[0] + startSaveArea.length) + "\n" +
				store.allTiddlersAsHtml() + "\n" +
				original.substr(posDiv[1]);
	var newSiteTitle = getPageTitle().htmlEncode();
	revised = revised.replaceChunk("<title"+">","</title"+">"," " + newSiteTitle + " ");
	revised = updateMarkupBlock(revised,"PRE-HEAD","MarkupPreHead");
	revised = updateMarkupBlock(revised,"POST-HEAD","MarkupPostHead");
	revised = updateMarkupBlock(revised,"PRE-BODY","MarkupPreBody");
	revised = updateMarkupBlock(revised,"POST-SCRIPT","MarkupPostBody");
	return revised;
};

//
// UploadLog
// 
// config.options.chkUploadLog :
//		false : no logging
//		true : logging
// config.options.txtUploadLogMaxLine :
//		-1 : no limit
//      0 :  no Log lines but UploadLog is still in place
//		n :  the last n lines are only kept
//		NaN : no limit (-1)

bidix.UploadLog = function() {
	if (!config.options.chkUploadLog) 
		return; // this.tiddler = null
	this.tiddler = store.getTiddler("UploadLog");
	if (!this.tiddler) {
		this.tiddler = new Tiddler();
		this.tiddler.title = "UploadLog";
		this.tiddler.text = "| !date | !user | !location | !storeUrl | !uploadDir | !toFilename | !backupdir | !origin |";
		this.tiddler.created = new Date();
		this.tiddler.modifier = config.options.txtUserName;
		this.tiddler.modified = new Date();
		store.addTiddler(this.tiddler);
	}
	return this;
};

bidix.UploadLog.prototype.addText = function(text) {
	if (!this.tiddler)
		return;
	// retrieve maxLine when we need it
	var maxLine = parseInt(config.options.txtUploadLogMaxLine,10);
	if (isNaN(maxLine))
		maxLine = -1;
	// add text
	if (maxLine != 0) 
		this.tiddler.text = this.tiddler.text + text;
	// Trunck to maxLine
	if (maxLine >= 0) {
		var textArray = this.tiddler.text.split('\n');
		if (textArray.length > maxLine + 1)
			textArray.splice(1,textArray.length-1-maxLine);
			this.tiddler.text = textArray.join('\n');		
	}
	// update tiddler fields
	this.tiddler.modifier = config.options.txtUserName;
	this.tiddler.modified = new Date();
	store.addTiddler(this.tiddler);
	// refresh and notifiy for immediate update
	story.refreshTiddler(this.tiddler.title);
	store.notify(this.tiddler.title, true);
};

bidix.UploadLog.prototype.startUpload = function(storeUrl, toFilename, uploadDir,  backupDir) {
	if (!this.tiddler)
		return;
	var now = new Date();
	var text = "\n| ";
	var filename = bidix.basename(document.location.toString());
	if (!filename) filename = '/';
	text += now.formatString("0DD/0MM/YYYY 0hh:0mm:0ss") +" | ";
	text += config.options.txtUserName + " | ";
	text += "[["+filename+"|"+location + "]] |";
	text += " [[" + bidix.basename(storeUrl) + "|" + storeUrl + "]] | ";
	text += uploadDir + " | ";
	text += "[[" + bidix.basename(toFilename) + " | " +toFilename + "]] | ";
	text += backupDir + " |";
	this.addText(text);
};

bidix.UploadLog.prototype.endUpload = function(status) {
	if (!this.tiddler)
		return;
	this.addText(" "+status+" |");
};

//
// Utilities
// 

bidix.checkPlugin = function(plugin, major, minor, revision) {
	var ext = version.extensions[plugin];
	if (!
		(ext  && 
			((ext.major > major) || 
			((ext.major == major) && (ext.minor > minor))  ||
			((ext.major == major) && (ext.minor == minor) && (ext.revision >= revision))))) {
			// write error in PluginManager
			if (pluginInfo)
				pluginInfo.log.push("Requires " + plugin + " " + major + "." + minor + "." + revision);
			eval(plugin); // generate an error : "Error: ReferenceError: xxxx is not defined"
	}
};

bidix.dirname = function(filePath) {
	if (!filePath) 
		return;
	var lastpos;
	if ((lastpos = filePath.lastIndexOf("/")) != -1) {
		return filePath.substring(0, lastpos);
	} else {
		return filePath.substring(0, filePath.lastIndexOf("\\"));
	}
};

bidix.basename = function(filePath) {
	if (!filePath) 
		return;
	var lastpos;
	if ((lastpos = filePath.lastIndexOf("#")) != -1) 
		filePath = filePath.substring(0, lastpos);
	if ((lastpos = filePath.lastIndexOf("/")) != -1) {
		return filePath.substring(lastpos + 1);
	} else
		return filePath.substring(filePath.lastIndexOf("\\")+1);
};

bidix.initOption = function(name,value) {
	if (!config.options[name])
		config.options[name] = value;
};

//
// Initializations
//

// require PasswordOptionPlugin 1.0.1 or better
bidix.checkPlugin("PasswordOptionPlugin", 1, 0, 1);

// styleSheet
setStylesheet('.txtUploadStoreUrl, .txtUploadBackupDir, .txtUploadDir {width: 22em;}',"uploadPluginStyles");

//optionsDesc
merge(config.optionsDesc,{
	txtUploadStoreUrl: "Url of the UploadService script (default: store.php)",
	txtUploadFilename: "Filename of the uploaded file (default: in index.html)",
	txtUploadDir: "Relative Directory where to store the file (default: . (downloadService directory))",
	txtUploadBackupDir: "Relative Directory where to backup the file. If empty no backup. (default: ''(empty))",
	txtUploadUserName: "Upload Username",
	pasUploadPassword: "Upload Password",
	chkUploadLog: "do Logging in UploadLog (default: true)",
	txtUploadLogMaxLine: "Maximum of lines in UploadLog (default: 10)"
});

// Options Initializations
bidix.initOption('txtUploadStoreUrl','');
bidix.initOption('txtUploadFilename','');
bidix.initOption('txtUploadDir','');
bidix.initOption('txtUploadBackupDir','');
bidix.initOption('txtUploadUserName','');
bidix.initOption('pasUploadPassword','');
bidix.initOption('chkUploadLog',true);
bidix.initOption('txtUploadLogMaxLine','10');


// Backstage
merge(config.tasks,{
	uploadOptions: {text: "upload", tooltip: "Change UploadOptions and Upload", content: '<<uploadOptions>>'}
});
config.backstageTasks.push("uploadOptions");


//}}}

!Parte 1
<html><iframe width="420" height="315" src="http://www.youtube.com/embed/lXls4cvjHT4" frameborder="0" allowfullscreen></iframe></html>
!Parte 2
<html><iframe width="420" height="315" src="http://www.youtube.com/embed/XH34SYYXBuE" frameborder="0" allowfullscreen></iframe></html>
<html><iframe width="420" height="315" src="http://www.youtube.com/embed/XEA1pOtyrfo" frameborder="0" allowfullscreen></iframe></html>
Formulación y solución en Solver de Excel de modelo de Programación Lineal
Parte 1/7: https://www.youtube.com/watch?v=OfQMz-9VvOY
Parte 2/7: https://www.youtube.com/watch?v=Y48FPZZUuSo
Parte 3/7: https://www.youtube.com/watch?v=uCVzP3KzBQE
Parte 4/7: https://www.youtube.com/watch?v=-KcJh1OryBM
Parte 5/7: https://www.youtube.com/watch?v=7_SqD5Tjazo
Parte 6/7: https://www.youtube.com/watch?v=qKcCvaDAnGs
Parte 7/7: https://www.youtube.com/watch?v=vDsnzqcDTLE
<html><iframe src='http://xot.asignaturas.usb.ve/play.php?template_id=504' width='800' height='600' frameborder="0" style="float:left; position:relative; top:0px; left:0px; z-index:0;"></></iframe></html>








































Aprenderemos sobre dos métodos (PERT y CPM) que sirven para la planificación y control de proyectos.
Son proyectos que equivalen a un problema de redes, porque implican el cálculo de la "ruta más larga".
Veremos cómo calcular el mínimo tiempo en que puede completar un proyecto (probabilística y determinísticamente), sin utilizar algoritmos clásicos de optimización.
<html>
<iframe style="width:800px;height:500px;border: 1px
solid black" src="http://app.wisemapping.com/c/maps/100932/embed?zoom=1"> </iframe>
</html>
NOTA: puede "arrastrar" el esquema para navegar por el árbol, y usar la rueda del mouse para hacer Zoom (acercar) en caso de necesitarlo.