<!--{{{-->
<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>>
! Linear Response
Class notes [[here|http://homepages.spa.umn.edu/~vinals/classes/phys8702/notes/phys8702_notes.pdf]]. @@color(green): Last updated: Fri Mar 31 11:15:05 CDT 2017@@.
! Miscellaneous notes
* [[Functional Derivatives|http://homepages.spa.umn.edu/~vinals/tspot_files/phys8702/2016/Functional_Derivatives.pdf]]. The first set of pages is from Arken, "Mathematical Methods for Physicists". The second, equivalent, but with a slightly different language is from Chaikin and Lubensky, "Principles of Condensed Matter Physics".
* Broken symmetries, equilibrium correlation functions and Goldstone Theorem: see Chapter 6 in PHYS 5201 [[notes|http://homepages.spa.umn.edu/~vinals/classes/phys8702/notes/phys559_notes.pdf]].
* Approximate ~Wilson-Fisher renormalization calculation for $\phi^{4}$ [[theory|http://homepages.spa.umn.edu/~vinals/tspot_files/phys5201/2017/WilsonFisherRG.pdf]].
* [[On the Hohenberg-Mermin-Wagner Theorem|https://arxiv.org/abs/1812.00220]], by Bert Halperin (2018).
[[Home]]
[img(100%+,auto)[http://homepages.spa.umn.edu/~vinals/images/PANO_20130902_180940_rotated2.jpg]]

!General Information
* [[Homework 1|Homework 1 2017]]. Due on Wednesday, February 8, 2017.
* [[Homework 2|Homework 2 2017]]. Due on Wednesday, February 22, 2017.
* [[Homework 3|Homework 3 2017]]. Due on Friday, March 10, 2017.
* [[Homework 4|Homework 4 2017]]. Due on Wednesday, March 29, 2017.
* [[Homework 5|Homework 5, 2017]]. Due on Wednesday, April 19, 2017.
* [[Homework 6|Homework 6, 2017]]. Due on Wednesday, May 3, 2017.
{{justifyright{
''Due Wednesday, February 10, 2016''
}}}

!!! Question 1. Correlation function of the so called XY model in two dimensions. 
Consider a set of spins on a two dimensional plane such that they can have a continuous distribution of orientations $\vec{S}(\vec{r}) = S_{0}(\cos \theta(\vec{r}), \sin \theta(\vec{r}))$, with $S_{0}$ a constant, and $\theta \in (0, 2 \pi)$ is the orientation of the spin located at $\vec{r}$. The energy of a given distribution of spins is given in the continuum limit by
\begin{equation}
E = \frac{\rho_{s}}{2} \int d^{2}r \left( \nabla \theta \right)^{2},
\end{equation}
with $\rho_{s}$ a known constant.
# The order parameter for this system is $\psi = S_{0} e^{i \theta}$, and we wish to calculate its correlation function: $$
G(\vec{r}) = \langle \psi^{*}(0) \psi(\vec{r}) \rangle.
$$
Given that the energy is quadratic in $\theta$, the angle $\theta$ is Gaussianly distributed. By using the expression for the average of the exponential of a Gaussian variable (Eq. (2.50) in the notes), $$
\langle e^{i \vec{g}\cdot\vec{u}} \rangle = e^{-\frac{1}{2}\langle (\vec{g}  \cdot \vec{u})^{2} \rangle},
$$
show that $$
G(\vec{r}) = S_{0}^{2} e^{- \left( \langle \theta^{2} \rangle - \langle
\theta(0) \theta(\vec{r}) \rangle \right) }
$$

# Given the energy of the spin configurations above, show that $$
\left( \langle \theta^{2} \rangle - \langle \theta(0) \theta(\vec{r}) \rangle \right) = \frac{k_{B}T}{\rho_{s}} \int \frac{d^{2}k}{(2\pi)^{2}} \frac{1-e^{i \vec{k}\cdot\vec{r}}}{k^{2}}.
$$

# In order to compute the resulting integral, introduce polar variables on the $\vec{k}$ plane, and show that at long distances $\Lambda r \gg 1$, where $\Lambda$ is a high wavenumber cut-off, $$
G(r) = \frac{S_{0}^{2}}{r^{\eta}}, \quad {\rm with} \quad \eta =
\frac{k_{B}T}{ 2 \pi \rho_{s}}.
$$

# The result of part (3) indicates that the correlation function decays as a power law of space for ''any'' temperature. Does that make sense ?
# What would be the dependence of $G(\vec{r})$ at long distances in d=3 dimensions ?

!!!!! Note:
You will need the following two results: $$
\frac{1}{2 \pi} \int_{0}^{2 \pi} d \phi e^{i z \cos \phi} = J_{0}(z),
$$
the Bessel function of order zero. Its asymptotic behavior as $z \rightarrow \infty$ is
$$
J_{0}(z) \sim \sqrt{\frac{2}{\pi z}}
$$

!!! Question 2. Free energy scaling
Near its critical point, the free energy of a ferromagnet, as a function of the reduced temperature $t$ and the magnetic field $H$, satisfies the following scaling relation (in $d$ spatial dimensions)
$$
F(t,H) = b^{-d} F(b^{1/\nu}t,b^{x}H)
$$
where $b$ is a scaling factor, and $\nu$ and $x$ are constant critical exponents.
#  Let $\beta$ be the critical exponent for the magnetization, $M = - \partial F/\partial H$. Show that at zero field, $$
\beta = \nu(d - x).
$$

# Differentiating the free energy twice with respect to the temperature yields the heat capacity at constant volume $C_{V}$. Near the critical point, the asymptotic behavior of $C_{V}$ is characterized by the exponent $\alpha$. Show that $$
\alpha = 2 - \nu d.
$$

# Differentiating the magnetization with respect to the magnetic field leads to the isothermal susceptibility $\chi_{T}$, which diverges near the critical point with an exponent $\gamma$. Show that $$
\gamma = 2 \nu x - d \nu 
$$

# The combination of the three equalities just derived leads to the "Rushbrooke equality" $$
\alpha + 2 \beta + \gamma = 2.
$$
It is interesting to note that scaling equalities that involve only exponents of thermodynamic quantities (e.g., do not include the exponents associated with correlations) do not depend on the dimensionality $d$. Why is that ?

!!! Question 3. Anisotropic scaling
Near its critical point, the spin correlation function of a magnet with crystalline anisotropies of strength $P$ has the scaling form,$$ C(r,t,H,P) = \frac{1}{r^{d-2+\eta}}{\tilde{C}}\,(rt^{\nu},
Ht^{-\frac{1}{2}(\nu d +\gamma)}, Pt^{-y}),
$$
where $t= |T-T_c|$, and the critical point is reached at $t=H=P=0$. In terms of the exponents defined by this scaling relation, obtain the exponents $\beta$, $\delta$, and $x$ that give from the asymptotic dependence of the magnetization is near the critical point $$
M_{H=P=0} \sim t^{\beta},
$$
$$
M_{t=P=0} \sim H^{\frac{1}{\delta}},
$$
and,
$$
M_{t=H=0} \sim P^{x}.
$$



{{justifyright{
''Due Wednesday, February 8, 2017''
}}}
!!! Question 1. Representation of distributions
# Prove that: \begin{equation}
{\cal H}(t)= \int_{-\infty}^\infty \frac{d\omega}{2\pi i}\frac{e^{i\omega t}}
{\omega-i\eta}
\end{equation}
where ${\cal H}(x)$ is the Heaviside step function, and $\eta$ is a positive infinitesimal quantity.
# Prove that inside an integral one has \begin{equation}
\frac{1}{\omega\mp i\eta}={\cal P}\frac{1}{\omega}\pm i\pi\delta(\omega)
\end{equation}
where ${\cal P}$ denotes the Cauchy principal value, and $\delta(\omega)$ is the Dirac delta function.
!!! Question 2. "Sum Rules"
Equal time correlation functions specify initial or instantaneous values of the time dependent correlation functions. It is also possible to derive relations for the time derivatives at the origin, and hence to obtain constraints on short time behavior. Integrals of the type,
\begin{equation}
W_{A,B}(n) = \int \frac{d\omega}{\pi}\omega^n\chi_{A,B}^{\prime \prime}(\omega)
\end{equation}
are called "sum rules". Show that $W_{A,B}(n)$ can be evaluated in terms of commutators of $A$ and $B$ with the Hamiltonian by noting that such integrals are Fourier transforms of
\begin{equation}
[i\frac{\partial}{\partial t}]^n\chi_{A,B}^{\prime \prime}(t-t^\prime)
\end{equation}
at $t=t'$.
!!! Question 3. Quantum mechanical harmonic oscillator
Consider the quantum harmonic oscillator,
$$
H = \frac{\hat{p}^{2}}{2m} + \frac{k}{2} \hat{x}^{2},
$$
under the following external interaction,
$$
H_{I} = - \hat{x} h(t).
$$
Linear response theory indicates that
$$
\langle \hat{x}(\omega) \rangle_{ne} = \chi_{xx}(\omega) h(\omega),
$$
where $\chi_{xx}(\omega)$ is the dynamic susceptibility, which is related to the response function,
$$
\chi_{xx}^{\prime\prime}(t-t') = \frac{1}{2 \hbar} \Big\langle \Big[ \hat{x}(t), \hat{x}(t') \Big] \Big\rangle_{eq}.
$$
# Solve the Heisenberg equations of motion for the harmonic oscillator to show, \begin{eqnarray}
\hat{x}(t) & = & \hat{x}(0) \cos(\omega_{0} t) + \frac{\hat{p}(0)}{m \omega_{0}} \sin(\omega_{0} t) \\
\hat{p}(t) & = & - m \omega_{0} \hat{x}(0) \sin(\omega_{0} t) + \hat{p}(0) \cos(\omega_{0} t)
\end{eqnarray}
and find the value of $\omega_{0}$.
# Show that the response function of the oscillator is, $$
\chi_{xx}^{\prime\prime}(\omega) = \frac{\pi}{2m \omega_{0}} \left[  \delta(\omega - \omega_{0}) - \delta(\omega + \omega_{0}) \right].
$$
Is this function even or odd under $\omega \rightarrow - \omega$ ? Is this the expected result ?
# Show that the response function $$
\chi_{xp}^{\prime\prime}(\omega) = \frac{i\pi}{2} \left[ \delta(\omega + \omega_{0})  + \delta(\omega - \omega_{0}) \right].
$$
This function is imaginary and even or odd under $\omega \rightarrow -  \omega$ ?
!!! Question 4.
We define the Laplace transform of complex frequency $z$ of a function $f(t)$ as,
\begin{equation}
f(z) = \int_{0}^{\infty} f(t) e^{izt} dt,
\end{equation}
where the complex frequency $z$ must lie in the upper half of the complex plane $\Im(z) > 0$. Sometimes this transform is referred to as the one sided Fourier transform. The corresponding inverse Laplace transform is
\begin{equation}
f(t) = \int_{-\infty+ic}^{\infty+ic} dz f(z) e^{-izt},
\end{equation}
along a contour in the upper half plane ($c$ is any real number). Show that the inverse Laplace transform of $i/(z+iDk^{2})$ is $\exp(-Dk^{2}t)$.

----

[[pdf version|http://homepages.spa.umn.edu/~vinals/tspot_files/phys8702/2017/hwk1.pdf]]
{{justifyright{
''Due Friday, February 26, 2016''
}}}

!!! RG for the Ising model: 1+$\epsilon$ expansion
The Ising model can be approximately solved by using the Renormalization Group and expanding near 1 dimension: $\mathbf{d} = 1 + \epsilon$. The recursion relations for the temperature $T(l)$ and the field $h(l)$ written in differential form are,
\begin{eqnarray}
\frac{dT}{dl} & = & - \epsilon T + \frac{1}{2} T^{2}\\
\frac{dh}{dl} & = & \mathbf{d} \; h.
\end{eqnarray}
The iteration index $l$ is related to the scaling factor $b$ by $b=e^{l}$.
# Sketch the renormalization flows in the $(T,h)$ plane for increasing $l$ (and $\epsilon > 0$), and identify the fixed points.
# Near the fixed point, the recursion relation is diagonal and can be written in the standard form as \begin{equation}
\left( \begin{array}{c} \delta T^{\prime} \\ \delta h^{\prime}
\end{array}\right) = \left( \begin{array}{cc} b^{y_{t}} & 0 \\
0 & b^{y_{h}} \end{array} \right) \left( \begin{array}{c} \delta T \\
\delta h \end{array} \right)
\end{equation}
Show by taking the derivative with respect to $b$ of the recursion relation that it can be written in the form of the differential equations above, the latter also linearized around the fixed point. Find the two critical exponents $y_{t}$ and $y_{h}$ to order $\epsilon$.
# Under rescaling, the correlation length satisfies the following relation, $$
\xi(t,h) = b \xi(b^{y_{t}}t, b^{y_{h}}h).
$$
Derive from this relation the standard scaling form for the correlation length, $$
\xi(t,h) \sim t^{-\nu} g\left( h/|t|^{\Delta} \right),
$$
and find the values of the exponents $\nu$ and $\Delta$.
# From hyperscaling, the free energy can be related to the correlation length through, $$
f(t,h) \sim \xi(t,h)^{-\mathbf{d}} = t^{\mathbf{d} \nu} g_{f}(h/|t|^{\Delta}).
$$
Find the exponent $\alpha$ for the heat capacity.
# Find the exponents $\beta$ and $\gamma$ for the singular behaviors of the magnetization and susceptibility respectively.

!!! Functional derivatives
# Read the definition and basic properties of functional derivatives in the following [[notes|http://homepages.spa.umn.edu/~vinals/tspot_files/phys8702/2016/Functional_Derivatives.pdf]].
# Given the problem in Homework 1, with an energy \begin{equation}
E = \frac{\rho_{s}}{2} \int d^{2}r \left( \nabla \theta \right)^{2},
\end{equation}
find the functional derivative $\delta E/\delta \theta(\mathbf{r})$
# Given the ~Ginzburg-Landau free energy functional $$
{\cal F}[\psi(\mathbf{r})] = \int d^{3} x \left[ \frac{K}{2} |\nabla \psi|^{2} + \frac{r}{2} \psi^{2} + \frac{u}{4} \psi^{4} \right]
$$
Find a one dimensional solution to the differential equation that results from the equilibrium conditions $\delta {\cal F}/\delta \psi(\mathbf{r}) = 0$ with boundary conditions $\psi(z \rightarrow -\infty) = - \psi_{0}$ and $\psi(z \rightarrow \infty) = \psi_{0}$

!!! Vortex interaction energies
As in Homework 1, we consider a system of spins in two dimensions with energy 
$$
E = \frac{\rho_{s}}{2} \int d^{2} \mathbf{r} | \nabla \theta |^{2}
$$
and define $\mathbf{v}_{s} = \nabla \theta$. The existence of vortices imples,
$$
\oint \nabla \theta \cdot d \mathbf{l} = \oint \mathbf{v}_{s} \cdot d \mathbf{l} = 2 \pi \sum n_{\alpha}
$$
where the integration contour includes several vortices of charge $n_{\alpha}$.

We introduce a vortex density $\mathbf{m}$ defined by
$$
\oint \mathbf{v}_{s} \cdot d \mathbf{l} = \int_{S} \mathbf{m} \cdot d \mathbf{S}.
$$

# Show that $\nabla \times \mathbf{v}_{s} = \mathbf{m}$. That is, the curl of a gradient does not vanish due to the existence of a density of singularities.
# From the condition of equilibrium, show that $\nabla \cdot  \mathbf{v}_{s} = 0$.
# By using the identity $\nabla \times (\nabla \times \mathbf{A}) = \nabla (\nabla \cdot \mathbf{A}) - \nabla^{2} \mathbf{A}$ show that $$
\mathbf{v}_{s}(\mathbf{r}) = \int d\mathbf{r}' G(\mathbf{r},\mathbf{r}') \nabla \times \mathbf{m}(\mathbf{r}')
$$
where $G$ is the Green's function of the Laplacian; $G(\mathbf{q}) = 1/q^{2}$ in Fourier space.
#This is the solution for $\mathbf{v}_{s}(\mathbf{r})$ corresponding to a given density of vortices $\mathbf{m}(\mathbf{r})$. By substituting this result in the energy, show that $$
E = \frac{\rho_{s}}{2} \int \frac{d^{2}q}{(2 \pi)^{2}} \frac{1}{q^{2}} \mathbf{m}(\mathbf{q}) \cdot  \mathbf{m}(\mathbf{-q})
$$
It is useful to write $\nabla \times \mathbf{A} = i \epsilon_{ijk} q_{j} A_{k}$ in Fourier space, where $\epsilon_{ijk}$ is the antisymmetric ~Levi-Civita symbol, and summation over repeated indices is assumed. Also recall that $\epsilon_{ijk} \epsilon_{iln} = \delta_{jl}\delta_{kn}-\delta_{jn}\delta_{kl}$. Since the two dimensional Green's function of the Laplace operator is a logarithm, this expression shows the logarithmic interaction between vortices in two dimensions (e.g., assume point vortices and take $\mathbf{m}$ to be a sum of delta functions in space).


[[pdf version|http://homepages.spa.umn.edu/~vinals/tspot_files/phys8702/2016/hwk2.pdf]]
{{justifyright{
''Due Wednesday, February 22, 2017''
}}}
!!! Question 1
Let $\vec{u}(x,y,z)$ be the displacement field in three different phases of matter: crystals, columnar phases, and smectic liquid crystals, all in three dimensions. A crystalline phase has a broken translational symmetry in all three directions. A columnar phase can be viewed as a crystal along two dimensions, and a fluid along the third. A smectic phase in a liquid crystal can be viewed as a sequence of stacked planes perpendicular to the so called director of the liquid crystal molecule. If $C$ is the elastic modulus of each material, the energy of all three phases can be approximately written as
$$
E_{crystal} = \frac{C}{2} \int d^{3}x \left( \nabla \cdot \vec{u} \right)^{2}, \quad \vec{u}=(u_{x},u_{y},u_{z}),
$$
$$
E_{columnar} = \frac{C}{2} \int d^{3}x \left[ \left(\nabla_{\perp} \cdot \vec{u}_{\perp}\right)^{2}  + \lambda^{2} \left( \partial_{z}^{2} \vec{u}_{\perp} \right)^{2} \right], \quad \vec{u}_{\perp}=(u_{x},u_{y}), \quad \nabla_{\perp} = (\partial_{x},\partial_{y})
$$
$$
E_{smectic} =  \frac{C}{2} \int d^{3}x \left[ \left( \partial_{z}u \right)^{2} + \lambda^{2} \left( \nabla_{\perp}^{2}u \right)^{2} \right], \quad \nabla_{\perp}u = (\partial_{x}u,\partial_{y}u). 
$$
In these equations, $\vec{u}$ is the three dimensional displacement field in a crystal, $\vec{u}_{\perp}$ is a two dimensional displacement field of the columnar phase on the plane where there is crystalline order, whereas $u$ is a scalar field that describes the modulation of the smectic planes.

Show that the fluctuations in the component of the displacement parallel to the wavevector of the fluctuation ($u = \hat{k}\cdot\vec{u}$ where appropriate):
\begin{eqnarray}
\langle u^{2} \rangle & = & \frac{k_{B}T q_{c}}{2 \pi^{2} C} \quad\quad\quad
{\rm crystals,} \\
\langle u^{2} \rangle & = & \frac{k_{B}T \sqrt{q_{c}/\lambda}}{2 \pi^{2} C}
\quad {\rm columnar ~ phases,}  \\
\langle u^{2} \rangle & \approx & \frac{k_{B}T \ln (q_{c}L)}{4 \pi
\lambda C} 
\quad {\rm smectics.} 
\end{eqnarray}
We have introduced a large wavenumber cut-off $q_{c}$ beyond which this simplified descriptions break down, and $L$ is the linear size of the sample.

See http://barrett-group.mcgill.ca/tutorials/liquid_crystal/LC05.htm for an image of a columnar phase. The columns align along $z$, and form a hexagonal lattice on the $(x,y)$ plane. The displacement $u_{\perp}$ measures the distortions of the columns on this plane, as a function of position. The columns are disordered along $z$.

An illustration of an smectic phase can be seen in http://www.personal.kent.edu/~bisenyuk/liquidcrystals/smectics1.html 
!!! Question 2
The absence of long range order along the $z$-direction in a given phase is described by the following model energy,
$$ 
E = \frac{C}{2} \int d^{3}x \left[ \left(\nabla_{\perp}
\cdot \vec{u}_{\perp}\right)^{2}  + \lambda^{2} \left( \partial_{z}^{2} u_{x} \right)^{2}
+ \lambda^{2} \left( \partial_{z}^{2} u_{y} \right)^{2}
\right] + \frac{C_{1}}{2} \int d^{3}x \left( \partial_{z} u_{z} \right)^2,
$$
where $\nabla_{\perp} = (\partial_{x}, \partial_{y})$ and $\vec{u}_{\perp} = (u_{x}, u_{y})$.

# Write the energy in Fourier space, and show that the $\mathbf{z}$ component of the displacement in Fourier space satisfies,$$
\langle | u_{z}^{2}(\vec{k})| \rangle = \frac{k_{B}T}{C_{1}k_{z}^{2}}.
$$

# From this equation show that the variance of the fluctuations in $u_{z}$ is given by, $$
\langle u_{z}^{2} \rangle = \frac{k_{B}T}{8 \pi^{2} C_{1}} q_{c}^{2}L,
$$
with $q_{c}$ a large wavenumber cut-off, and $L$ the linear size of the system in the $z$ direction. Why does this last result imply that the phase in question cannot have long range order along the $z$ axis ?

----

[[pdf version|http://homepages.spa.umn.edu/~vinals/tspot_files/phys8702/2017/hwk2.pdf]]
{{justifyright{
''Due Friday, March 11, 2016''
}}}
!!! Question 1. Representation of distributions
# Prove that: \begin{equation}
{\cal H}(t)= \int_{-\infty}^\infty \frac{d\omega}{2\pi i}\frac{e^{i\omega t}}
{\omega-i\eta}
\end{equation}
where ${\cal H}(x)$ is the Heaviside step function, and $\eta$ is a positive infinitesimal quantity.
# Prove that inside an integral one has \begin{equation}
\frac{1}{\omega\mp i\eta}={\cal P}\frac{1}{\omega}\pm i\pi\delta(\omega)
\end{equation}
where ${\cal P}$ denotes the Cauchy principal value, and $\delta(\omega)$ is the Dirac delta function.
!!! Question 2. "Sum Rules"
Equal time correlation functions specify initial or instantaneous values of the time dependent correlation functions. It is also possible to derive relations for the time derivatives at the origin, and hence to obtain constraints on short time behavior. Integrals of the type,
\begin{equation}
W_{A,B}(n) = \int \frac{d\omega}{\pi}\omega^n\chi_{A,B}^{\prime \prime}(\omega)
\end{equation}
are called "sum rules". Show that $W_{A,B}(n)$ can be evaluated in terms of commutators of $A$ and $B$ with the Hamiltonian by noting that such integrals are Fourier transforms of
\begin{equation}
[i\frac{\partial}{\partial t}]^n\chi_{A,B}^{\prime \prime}(t-t^\prime)
\end{equation}
at $t=t'$.

!!! Question 3. Quantum mechanical harmonic oscillator
Consider the quantum harmonic oscillator,
$$
H = \frac{\hat{p}^{2}}{2m} + \frac{k}{2} \hat{x}^{2},
$$
under the following external interaction,
$$
H_{I} = - \hat{x} h(t).
$$
Linear response theory indicates that
$$
\langle \hat{x}(\omega) \rangle_{ne} = \chi_{xx}(\omega) h(\omega),
$$
where $\chi_{xx}(\omega)$ is the dynamic susceptibility, which is related to the response function,
$$
\chi_{xx}^{\prime\prime}(t-t') = \frac{1}{2 \hbar} \Big\langle \Big[ \hat{x}(t), \hat{x}(t') \Big] \Big\rangle_{eq}.
$$
# Solve the Heisenberg equations of motion for the harmonic oscillator to show, \begin{eqnarray}
\hat{x}(t) & = & \hat{x}(0) \cos(\omega_{0} t) + \frac{\hat{p}(0)}{m \omega_{0}} \sin(\omega_{0} t) \\
\hat{p}(t) & = & - m \omega_{0} \hat{x}(0) \sin(\omega_{0} t) + \hat{p}(0) \cos(\omega_{0} t)
\end{eqnarray}
and find the value of $\omega_{0}$.
# Show that the response function of the oscillator is, $$
\chi_{xx}^{\prime\prime}(\omega) = \frac{\pi}{2m \omega_{0}} \left[  \delta(\omega - \omega_{0}) - \delta(\omega + \omega_{0}) \right].
$$
Is this function even or odd under $\omega \rightarrow - \omega$ ? Is this the expected result ?
# Show that the response function $$
\chi_{xp}^{\prime\prime}(\omega) = \frac{i\pi}{2} \left[ \delta(\omega + \omega_{0})  + \delta(\omega - \omega_{0}) \right].
$$
This function is imaginary and even or odd under $\omega \rightarrow -  \omega$ ?
!!! Question 4. Final presentation
Please propose two titles of possible topics for your final presentation. In each, include one paragraph stating your interest in the topic and the relationship to this class.



[[pdf version|http://homepages.spa.umn.edu/~vinals/tspot_files/phys8702/2016/hwk3.pdf]]
{{justifyright{
''Due Friday, March 10, 2017''
}}}
!!! Generalized homogeneous functions
A generalized homogeneous function is defined as one that satisfies
\begin{equation}
f(\lambda^{\alpha_{1}} x_{1}, \lambda^{\alpha_{2}} x_{2}, \ldots, \lambda^{\alpha_{n}} x_{n}) = \lambda^{\alpha} f(x_{1}, x_{2}, \ldots , x_{n}),
\end{equation}
for all positive lambdas, and where the $\alpha$ are constant, characteristic exponents. Show that this definition can be written in the so called scaling form
\begin{equation}
 f(x_{1}, x_{2}, \ldots , x_{n}) = x_{1}^{\alpha/\alpha_{1}} g \left( \frac{x_{2}}{x_{1}^{\alpha_{2}/\alpha_{1}}}, \ldots , \frac{x_{n}}{x_{1}^{\alpha_{n}/\alpha_{1}}} \right),
\end{equation}
where $g$ is the "scaling function".

!!! Exponent equalities
The scaling form of the correlation function for the Ising model is,
\begin{equation}
G(x,t,h) = \frac{1}{\xi^{d-2+\eta}} \tilde{G}(xt^{\nu}, h/t^{\Delta} )
\end{equation}
where $x$ is distance in $d$ dimensions, $\xi$ the correlation length, $t$ is the reduced temperature, $h$ the magnetic field, and $\nu$ and $\Delta$ two characteristic exponents. The equilibrium susceptibility is defined as
\begin{equation}
\chi = \int d^{d}x G(x,t,h),
\end{equation}
Given the critical exponent definition of $\gamma$, $\chi \sim t^{- \gamma}$ is the divergence of the susceptibility near the critical point, show that $\gamma = (2 - \eta) \nu$. Is this equality satisfied for the mean field value of these exponents ?

!!! RG for the Ising model: 1+$\epsilon$ expansion
The Ising model can be approximately solved by using the Renormalization Group and expanding near 1 dimension: $\mathbf{d} = 1 + \epsilon$. The recursion relations for the temperature $T(l)$ and the field $h(l)$ written in differential form are,
\begin{eqnarray}
\frac{dT}{dl} & = & - \epsilon T + \frac{1}{2} T^{2}\\
\frac{dh}{dl} & = & \mathbf{d} \; h.
\end{eqnarray}
The iteration index $l$ is related to the scaling factor $b$ by $b=e^{l}$.
# Sketch the renormalization flows in the $(T,h)$ plane for increasing $l$ (and $\epsilon > 0$), and identify the fixed points.
# Near the fixed point, the recursion relation is diagonal and can be written in the standard form as \begin{equation}
\left( \begin{array}{c} \delta T^{\prime} \\ \delta h^{\prime}
\end{array}\right) = \left( \begin{array}{cc} b^{y_{t}} & 0 \\
0 & b^{y_{h}} \end{array} \right) \left( \begin{array}{c} \delta T \\
\delta h \end{array} \right)
\end{equation}
Show by taking the derivative with respect to $b$ of the recursion relation that it can be written in the form of the differential equations above, the latter also linearized around the fixed point. Find the two critical exponents $y_{t}$ and $y_{h}$ to order $\epsilon$.
# Under rescaling, the correlation length satisfies the following relation, $$
\xi(t,h) = b \xi(b^{y_{t}}t, b^{y_{h}}h).
$$
Derive from this relation the standard scaling form for the correlation length, $$
\xi(t,h) \sim t^{-\nu} g\left( h/|t|^{\Delta} \right),
$$
and find the values of the exponents $\nu$ and $\Delta$.
# From hyperscaling, the free energy can be related to the correlation length through, $$
f(t,h) \sim \xi(t,h)^{-\mathbf{d}} = t^{\mathbf{d} \nu} g_{f}(h/|t|^{\Delta}).
$$
Find the exponent $\alpha$ for the heat capacity.
# Find the exponents $\beta$ and $\gamma$ for the singular behaviors of the magnetization and susceptibility respectively.


----

[[pdf version|http://homepages.spa.umn.edu/~vinals/tspot_files/phys8702/2017/hwk3.pdf]]
{{justifyright{
''Due Monday, April 4, 2016''
}}}

!!! Galilean transformation
Another requirement on transport equations beyond those impose by symmetries of the phases, is the requirement that the transport equations be invariant under Galilean transformations. Consider two reference frames, one attached to the local center of mass of a moving element of fluid, called the local rest frame (denoted by $^{0}$), and the laboratory frame of reference. The transformation that relates the position vectors in both frames is 
$$
\mathbf{r}^{0} = \mathbf{r} - \mathbf{v} t,
$$
where $\mathbf{v}$ is the center of mass velocity of the moving fluid element. Show that,
# The mass density is invariant under the transformation.
# Derive the transformation of the momentum density.
# Derive the transformation of the energy density.
# Derive the transformation of the momentum density current (stress tensor).
# Is the entropy invariant under a Galilean transformation ? Why ?

!!! Second Law of Thermodynamics involving momentum density
For a normal fluid there are three conserved quantities: mass, momentum, and energy. Hence one argues that the entropy density must be a function of all three $s=s(\rho, g_{i},e)$ and writes the Second Law in the following form in the laboratory frame,
$$
Td(\rho s) = d(\rho e) - v_{i}dg_{i} - \mu d\rho,
$$
where $s$, $e$ and $\mu$ are the entropy, energy and chemical potential per unit mass. Show that this expression is equivalent to writing the Second Law in the standard way,
$$
T ds = du + p d (1/\rho)
$$
in the locally moving frame. ''Note'': you will have to consider the transformation of the chemical potential between both frames (noting its dependence on the energy).


[[pdf version|http://homepages.spa.umn.edu/~vinals/tspot_files/phys8702/2016/hwk4.pdf]]
{{justifyright{
''Due Wednesday, March 29, 2017''
}}}
!!! Question 1. Correlation function of the XY model in two dimensions. 
Consider a set of spins on a two dimensional plane such that they can have a continuous distribution of orientations $\vec{S}(\vec{r}) = S_{0}(\cos \theta(\vec{r}), \sin \theta(\vec{r}))$, with $S_{0}$ a constant, and $\theta \in (0, 2 \pi)$ is the orientation of the spin located at $\vec{r}$. The energy of a given distribution of spins is given in the continuum limit by
\begin{equation}
E = \frac{\rho_{s}}{2} \int d^{2}r \left( \nabla \theta \right)^{2},
\end{equation}
with $\rho_{s}$ a known constant.
# The order parameter for this system is $\psi = S_{0} e^{i \theta}$, and we wish to calculate its correlation function: $$
G(\vec{r}) = \langle \psi^{*}(0) \psi(\vec{r}) \rangle.
$$
Given that the energy is quadratic in $\theta$, the angle $\theta$ is Gaussianly distributed. By using the expression for the average of the exponential of a Gaussian variable (Eq. (2.50) in the notes), $$
\langle e^{i \vec{g}\cdot\vec{u}} \rangle = e^{-\frac{1}{2}\langle (\vec{g}  \cdot \vec{u})^{2} \rangle},
$$
show that $$
G(\vec{r}) = S_{0}^{2} e^{- \left( \langle \theta^{2} \rangle - \langle
\theta(0) \theta(\vec{r}) \rangle \right) }
$$

# Given the energy of the spin configurations above, show that $$
\left( \langle \theta^{2} \rangle - \langle \theta(0) \theta(\vec{r}) \rangle \right) = \frac{k_{B}T}{\rho_{s}} \int \frac{d^{2}k}{(2\pi)^{2}} \frac{1-e^{i \vec{k}\cdot\vec{r}}}{k^{2}}.
$$

# In order to compute the resulting integral, introduce polar variables on the $\vec{k}$ plane, and show that at long distances $\Lambda r \gg 1$, where $\Lambda$ is a high wavenumber cut-off, $$
G(r) = \frac{S_{0}^{2}}{r^{\eta}}, \quad {\rm with} \quad \eta =
\frac{k_{B}T}{ 2 \pi \rho_{s}}.
$$
!!!!! Note:
You will need the following two results: $$
\frac{1}{2 \pi} \int_{0}^{2 \pi} d \phi e^{i z \cos \phi} = J_{0}(z),
$$
the Bessel function of order zero. Its asymptotic behavior as $z \rightarrow \infty$ is
$$
J_{0}(z) \sim \sqrt{\frac{2}{\pi z}}
$$

!!! Question 2. Vortex interaction energies
We consider a system of spins in two dimensions with energy 
$$
E = \frac{\rho_{s}}{2} \int d^{2} \mathbf{r} | \nabla \theta |^{2}
$$
and define $\mathbf{v}_{s} = \nabla \theta$. The existence of vortices implies,
$$
\oint \nabla \theta \cdot d \mathbf{l} = \oint \mathbf{v}_{s} \cdot d \mathbf{l} = 2 \pi \sum n_{\alpha}
$$
where the integration contour includes several vortices of charge $n_{\alpha}$.

We introduce a vortex density $\mathbf{m}$ defined by
$$
\oint \mathbf{v}_{s} \cdot d \mathbf{l} = \int_{S} \mathbf{m} \cdot d \mathbf{S}.
$$

# Show that $\nabla \times \mathbf{v}_{s} = \mathbf{m}$. That is, the curl of a gradient does not vanish due to the existence of a density of singularities.
# From the condition of equilibrium, show that $\nabla \cdot  \mathbf{v}_{s} = 0$.
# By using the identity $\nabla \times (\nabla \times \mathbf{A}) = \nabla (\nabla \cdot \mathbf{A}) - \nabla^{2} \mathbf{A}$ show that $$
\mathbf{v}_{s}(\mathbf{r}) = \int d\mathbf{r}' G(\mathbf{r},\mathbf{r}') \nabla \times \mathbf{m}(\mathbf{r}')
$$
where $G$ is the Green's function of the Laplacian; $G(\mathbf{q}) = 1/q^{2}$ in Fourier space.
#This is the solution for $\mathbf{v}_{s}(\mathbf{r})$ corresponding to a given density of vortices $\mathbf{m}(\mathbf{r})$. By substituting this result in the energy, show that $$
E = \frac{\rho_{s}}{2} \int \frac{d^{2}q}{(2 \pi)^{2}} \frac{1}{q^{2}} \mathbf{m}(\mathbf{q}) \cdot  \mathbf{m}(\mathbf{-q})
$$
In order to obtain this result, it is useful to write $\nabla \times \mathbf{A} = i \epsilon_{ijk} q_{j} A_{k}$ in Fourier space, where $\epsilon_{ijk}$ is the antisymmetric ~Levi-Civita symbol, and summation over repeated indices is assumed. Also recall that $\epsilon_{ijk} \epsilon_{iln} = \delta_{jl}\delta_{kn}-\delta_{jn}\delta_{kl}$. 

Since the two dimensional Green's function of the Laplace operator is a logarithm, the expression just derived shows a logarithmic interaction between vortices in two dimensions (e.g., assume point vortices and take $\mathbf{m}$ to be a sum of delta functions in space).


-----
[[pdf version|http://homepages.spa.umn.edu/~vinals/tspot_files/phys8702/2017/hw4.pdf]]
{{justifyright{
''Due Wednesday, April 13, 2016''
}}}

!!! Generalized Onsager reciprocity theorem
The so-called Onsager reciprocity or symmetry relations is one of the fundamental results of transport theory. There exists, in linear response theory, a general relation between nonequilibrium fluxes (or currents) and a linear combinations of the corresponding thermodynamic forces that originate the fluxes. The matrix formed by the coefficients of the linear combination (the so called Onsager coefficients) is symmetric.

Let $\{m_{\alpha}(\mathbf{x},t)\}$ be a complete set of slow variables describing a given system, as well as their thermodynamically conjugate variables $\{h_{\alpha}(\mathbf{x},t)\}$ and assume that they are conserved, i.e.,
\begin{equation}
\frac{\partial}{\partial t} m_{\alpha}(\mathbf{x},t) + \partial_{j} J^{\alpha}_{j}(\mathbf{x},t) =  0,
\end{equation}
where $\mathbf{J}^{\alpha}$ is the current of $m_{\alpha}$.

# By using the conservation law given (and in analogy with the derivation of the ~Green-Kubo relation in class), show that, $$ 
\partial_{t} \chi^{\prime\prime}_{J^{\alpha}_{i} m_{\beta}} (\mathbf{x}, \mathbf{x'}, t, t') =  - \partial_{t'} \chi^{\prime\prime}_{J^{\alpha}_{i} m_{\beta}} (\mathbf{x}, \mathbf{x'}, t, t') = \partial^{\prime}_{j} \chi^{\prime\prime}_{J^{\alpha}_{i} J^{\beta}_{j}} (\mathbf{x}, \mathbf{x'}, t, t').
$$

# Use this relation to show, $$
\partial_{t} \Big\langle J^{\alpha}_{i} ( \mathbf{x},t) \Big\rangle =  \sum_{\beta} \left\{ \int_{-\infty}^{t} dt' \left[ -2i
  \int d^{d} x' \chi^{\prime\prime}_{J^{\alpha}_{i} J^{\beta}_{j}}  (\mathbf{x} - \mathbf{x'}, t-t') \partial^{\prime}_{j}
  h_{\beta}(\mathbf{x'},t') \right] \right. +  $$
$$
+ \left. 2i \int d^{d} x' \chi^{\prime\prime}_{J^{\alpha}_{i} m_{\beta}} (\mathbf{x} - \mathbf{x'}, 0) h_{\beta}(\mathbf{x'},t) \right\}.
$$
This expression relates the currents at $\mathbf{x}$ and $t$ linearly to the gradients of the conjugate variables at $\mathbf{x'}$ and $t'$ (in addition to the instantaneous contribution at equal time from the second line). The quantities $\partial^{\prime}_{j} h_{\beta}(\mathbf{x'},t')$ are thermodynamic forces, which are related to the fluxes $ \Big\langle J^{\alpha}_{i} ( \mathbf{x},t) \Big\rangle$ through the kernel containing the response function. In the classical thermodynamics of fluids, for example, the driving forc[[pdf version|http://homepages.spa.umn.edu/~vinals/tspot_files/phys8702/2016/hwk4.pdf]]es are $\nabla(1/T)$ where $T$ is the temperature, $\nabla p$, where $p$ is the hydrostatic pressure, or $\nabla \mu$, where $\mu$ is the chemical potential.
# We focus now on the limits $k \rightarrow 0$ and $\omega \rightarrow 0$, and assume that we can neglect nonlocality and retardation of the response, so that $h_{\beta}(\mathbf{x'},t') \approx h_{\beta}(\mathbf{x},t)$. Show that, \begin{eqnarray}
\Big\langle J^{\alpha}_{i} ( \mathbf{x},\omega) \Big\rangle & = & 
\frac{1}{i \omega} \sum_{\beta j} \left[ \chi_{J^{\alpha}_{i}
    J^{\beta}_{j}} (\mathbf{q} = 0, \omega) - \chi_{J^{\alpha}_{i}
    J^{\beta}_{j}}(\mathbf{q}=0, \omega=0) \right]
\partial_{j}h_{\beta}(\mathbf{x}, \omega) \\
& = & \sum_{\beta j} \int \frac{d \omega^{\prime}}{i \pi} \frac{
\chi^{\prime\prime}_{J^{\alpha}_{i} J^{\beta}_{j}}
(0,\omega^{\prime})}{\omega^{\prime} ( \omega^{\prime} - \omega)}
\partial_{j}h_{\beta}(\mathbf{x}, \omega) \\
& = & {\cal L}^{\alpha \beta}_{ij}(\omega)
\partial_{j}h_{\beta}(\mathbf{x}, \omega)
\end{eqnarray}
where the last line is the explicit definition of the generalized Onsager coefficients ${\cal L}^{\alpha \beta}_{ij}(\omega)$. This last result explicitly relates each current to a linear combination of the thermodynamic forces (the gradients of the conjugate variables).
# We finally proceed to study the symmetry of the matrix ${\cal L}^{\alpha \beta}_{ij}(\omega)$. If $\mathbf{J}^{\alpha}$ and $\mathbf{J}^{\beta}$ have the same signature under time reversal, the Onsager coefficients are real and given by, $$
\lambda^{\alpha\beta}_{ij} = \Re ({\cal L}^{\alpha \beta}_{ij}) = \lim_{\omega \rightarrow 0} \lim_{\mathbf{q} \rightarrow 0} \frac{1}{\omega} \chi^{\prime\prime}_{J^{\alpha}_{i}J^{\beta}_{j}} (\mathbf{q}, \omega)
$$
By using the fluctuation dissipation theorem show that $$
\lambda^{\alpha\beta}_{ij} = \beta \int_{0}^{\infty} dt \int d^{d}x  \Big\langle J^{\alpha}_{i}(\mathbf{x},t) J^{\beta}_{j}(0,0) \Big\rangle.
$$
This is a general ~Green-Kubo relation that gives the transport coefficients as a function of the corresponding correlation function of the fluxes. This expression also proves the symmetry relation $\lambda^{\alpha\beta}_{ij} = \lambda^{\beta\alpha}_{ji}$. Note that if the system is spatially isotropic $\lambda^{\alpha\beta}_{ij} = \lambda^{\alpha\beta} \delta_{ij}$, then one recovers the expression conventionally given in textbooks: $ \lambda^{\alpha\beta} = \lambda^{\beta\alpha}$.
# If, instead, $m_{\alpha}$ and $m_{\beta}$ have the opposite signature under time reversal, show that ${\cal L}^{\alpha \beta}_{ij}$ is imaginary an antisymmetric. In other words, the matrix $\lambda$ is symmetric for those pairs of terms with the same invariance under time reversal, and anti adjoint for those that have different signature under time reversal. 


[[pdf version|http://homepages.spa.umn.edu/~vinals/tspot_files/phys8702/2016/hwk5.pdf]]
{{justifyright{
''Due Monday, Wednesday, April 19, 2017''
}}}

!!! Galilean transformation
Another requirement on transport equations beyond those impose by symmetries of the phases, is the requirement that the transport equations be invariant under Galilean transformations. Consider two reference frames, one attached to the local center of mass of a moving element of fluid, called the local rest frame (denoted by $^{0}$), and the laboratory frame of reference. The transformation that relates the position vectors in both frames is 
$$
\mathbf{r}^{0} = \mathbf{r} - \mathbf{v} t,
$$
where $\mathbf{v}$ is the center of mass velocity of the moving fluid element. Show that,
# The mass density is invariant under the transformation. the chemical potential between both frames (noting its dependence on the energy).


[[pdf version|http://homepages.spa.umn.edu/~vinals/tspot_files/phys8702/2016/hwk4.pdf]]
# Derive the transformation of the momentum density.
# Derive the transformation of the energy density.
# Derive the transformation of the momentum density current (stress tensor).
# Is the entropy invariant under a Galilean transformation ? Why ?

!!! Second Law of Thermodynamics involving momentum density
For a normal fluid there are three conserved quantities: mass, momentum, and energy. Hence one argues that the entropy density must be a function of all three $s=s(\rho, g_{i},e)$ and writes the Second Law in the following form in the laboratory frame,
$$
Td(\rho s) = d(\rho e) - v_{i}dg_{i} - \mu d\rho,
$$
where $s$, $e$ and $\mu$ are the entropy, energy and chemical potential per unit mass. Show that this expression is equivalent to writing the Second Law in the standard way,
$$
T ds = du + p d (1/\rho)
$$
in the locally moving frame. ''Note'': you will have to consider the transformation of  the chemical potential between both frames (noting its dependence on the energy).


[[pdf version|http://homepages.spa.umn.edu/~vinals/tspot_files/phys8702/2017/hwk5.pdf]]
 {{justifyright{
''Due Monday, May 3, 2017''
}}}

!!! Generalized Onsager reciprocity theorem
The so-called Onsager reciprocity or symmetry relations is one of the fundamental results of transport theory. There exists, in linear response theory, a general relation between nonequilibrium fluxes (or currents) and a linear combinations of the corresponding thermodynamic forces that originate the fluxes. The matrix formed by the coefficients of the linear combination (the so called Onsager coefficients) is symmetric.

Let $\{m_{\alpha}(\mathbf{x},t)\}$ be a complete set of slow variables describing a given system, as well as their thermodynamically conjugate variables $\{h_{\alpha}(\mathbf{x},t)\}$ and assume that they are conserved, i.e.,
\begin{equation}
\frac{\partial}{\partial t} m_{\alpha}(\mathbf{x},t) + \partial_{j} J^{\alpha}_{
j}(\mathbf{x},t) =  0,
\end{equation}
where $\mathbf{J}^{\alpha}$ is the current of $m_{\alpha}$. @@color(red): You will now show that, quite generally, $J^{\alpha}_{j} = \lambda_{ij}^{\alpha \beta} \partial_{j} h_{\beta}$ @@ where $h_{\beta}$ is the conjugate variable to $m_{\beta}$, and the matrix $\lambda$ is a matrix of transport coefficients that satisfy a ~Green-Kubo relation. Contrast this result with the "ordinary" diffusion equation.

# By using the conservation law given (and in analogy with the derivation of the ~Green-Kubo relation in class), show that, $$ 
\partial_{t} \chi^{\prime\prime}_{J^{\alpha}_{i} m_{\beta}} (\mathbf{x}, \mathbf{x'}, t, t') =  - \partial_{t'} \chi^{\prime\prime}_{J^{\alpha}_{i} m_{\beta}} (\mathbf{x}, \mathbf{x'}, t, t') = \partial^{\prime}_{j} \chi^{\prime\prime}_{J^{\alpha}_{i} J^{\beta}_{j}} (\mathbf{x}, \mathbf{x'}, t, t').
$$

# Use this relation to show, $$
\partial_{t} \Big\langle J^{\alpha}_{i} ( \mathbf{x},t) \Big\rangle =  \sum_{\beta} \left\{ \int_{-\infty}^{t} dt' \left[ -2i
  \int d^{d} x' \chi^{\prime\prime}_{J^{\alpha}_{i} J^{\beta}_{j}}  (\mathbf{x} - \mathbf{x'}, t-t') \partial^{\prime}_{j}
  h_{\beta}(\mathbf{x'},t') \right] \right. +  $$
$$
+ \left. 2i \int d^{d} x' \chi^{\prime\prime}_{J^{\alpha}_{i} m_{\beta}} (\mathbf{x} - \mathbf{x'}, 0) h_{\beta}(\mathbf{x'},t) \right\}.
$$
This expression relates the currents at $\mathbf{x}$ and $t$ linearly to the gradients of the conjugate variables at $\mathbf{x'}$ and $t'$ (in addition to the instantaneous contribution at equal time from the second line). The quantities $\partial^{\prime}_{j} h_{\beta}(\mathbf{x'},t')$ are thermodynamic forces, which are related to the fluxes $ \Big\langle J^{\alpha}_{i} ( \mathbf{x},t) \Big\rangle$ through the kernel containing the response function. In the classical thermodynamics of fluids, for example, the driving forces are $\nabla(1/T)$ where $T$ is the temperature, $\nabla p$, where $p$ is the hydrostatic pressure, or $\nabla \mu$, where $\mu$ is the chemical potential.
# We focus now on the limits $k \rightarrow 0$ and $\omega \rightarrow 0$, and assume that we can neglect nonlocality and retardation of the response, so that $h_{\beta}(\mathbf{x'},t') \approx h_{\beta}(\mathbf{x},t)$. Show that, \begin{eqnarray}
\Big\langle J^{\alpha}_{i} ( \mathbf{x},\omega) \Big\rangle & = & 
\frac{1}{i \omega} \sum_{\beta j} \left[ \chi_{J^{\alpha}_{i}
    J^{\beta}_{j}} (\mathbf{q} = 0, \omega) - \chi_{J^{\alpha}_{i}
    J^{\beta}_{j}}(\mathbf{q}=0, \omega=0) \right]
\partial_{j}h_{\beta}(\mathbf{x}, \omega) \\
& = & \sum_{\beta j} \int \frac{d \omega^{\prime}}{i \pi} \frac{
\chi^{\prime\prime}_{J^{\alpha}_{i} J^{\beta}_{j}}
(0,\omega^{\prime})}{\omega^{\prime} ( \omega^{\prime} - \omega)}
\partial_{j}h_{\beta}(\mathbf{x}, \omega) \\
& = & {\cal L}^{\alpha \beta}_{ij}(\omega)
\partial_{j}h_{\beta}(\mathbf{x}, \omega)
\end{eqnarray}
where the last line is the explicit definition of the generalized Onsager coefficients ${\cal L}^{\alpha \beta}_{ij}(\omega)$. This last result explicitly relates each current to a linear combination of the thermodynamic forces (the gradients of the conjugate variables).
# We finally proceed to study the symmetry of the matrix ${\cal L}^{\alpha \beta}_{ij}(\omega)$. If $\mathbf{J}^{\alpha}$ and $\mathbf{J}^{\beta}$ have the same signature under time reversal, the Onsager coefficients are real and given by, $$
\lambda^{\alpha\beta}_{ij} = \Re ({\cal L}^{\alpha \beta}_{ij}) = \lim_{\omega \rightarrow 0} \lim_{\mathbf{q} \rightarrow 0} \frac{1}{\omega} \chi^{\prime\prime}_{J^{\alpha}_{i}J^{\beta}_{j}} (\mathbf{q}, \omega)
$$
By using the fluctuation dissipation theorem show that $$
\lambda^{\alpha\beta}_{ij} = \beta \int_{0}^{\infty} dt \int d^{d}x  \Big\langle J^{\alpha}_{i}(\mathbf{x},t) J^{\beta}_{j}(0,0) \Big\rangle.
$$
This is a general ~Green-Kubo relation that gives the transport coefficients as a function of the corresponding correlation function of the fluxes. This expression also proves the symmetry relation $\lambda^{\alpha\beta}_{ij} = \lambda^{\beta\alpha}_{ji}$. Note that if the system is spatially isotropic $\lambda^{\alpha\beta}_{ij} = \lambda^{\alpha\beta} \delta_{ij}$, then one recovers the expression conventionally given in textbooks: $ \lambda^{\alpha\beta} = \lambda^{\beta\alpha}$.
# If, instead, $m_{\alpha}$ and $m_{\beta}$ have the opposite signature under time reversal, show that ${\cal L}^{\alpha \beta}_{ij}$ is imaginary an antisymmetric. In other words, the matrix $\lambda$ is symmetric for those pairs of terms with the same invariance under time reversal, and anti adjoint for those that have different signature under time reversal. 

!!! Transport equations for the isotropic ferromagnet
Let $m_{i}(\mathbf{x},t)$ be the local, time dependent magnetization as a coarse grained average of the local spin, $\mathbf{S}^{\alpha}$ at lattice site $\alpha$. First show that the ''total'' spin is a conserved quantity under Hamiltonian evolution. The Hamiltonian is $$ 
{\cal H} = - \frac{1}{2} \sum_{\alpha \beta} J_{\alpha \beta} S_{i}^{\alpha} S_{j}^{\beta} $$  where $i$ denotes Cartesian component and the Greek index is a lattice site. Define the total magnetization $S_{T,i} = \sum_{\alpha} S_{i}^{\alpha}$. Given the commutator $$
\left[ S_{i}^{\alpha},S_{j}^{\beta} \right] = i \hbar \delta_{\alpha\beta} \epsilon_{ijk} S_{k}^{\alpha}
$$
1. show that $$
i \hbar \dot{S}_{T,i} = \left[ S_{T,i},{\cal H} \right] = 0.
$$

To study dissipative transport, assume that the coarse grained magnetization is a classical variable. It satisfies a Langevin equation $$
\partial_{t} m_{i}(\mathbf{x},t) = i \Omega_{i}(\mathbf{m}) - \partial_{j} \sigma_{ij}^{D} + \xi_{i}
$$
where we have explicitly separated the reversible and dissipative contributions, and introduced the dissipative magnetization current $\sigma_{ij}^{D}$ (as corresponds to a conserved variable). In what follows, we will derive the hydrodynamic equations for the averages and eliminate the random source as $\langle \xi_{i} \rangle = 0$. We also omit the $\langle . \rangle$. 

The reversible part of the evolution is argued to follow from the Quantum evolution equation by the standard replacement of the commutator by a Poisson bracket $$
i \Omega = \left\{ m_{i}, {\cal H} \right\}.
$$
In magnetic systems the Poisson bracket is defined as $$
\left\{ A,B \right\} = \int dx' \frac{\partial A}{\partial m_{i}(x')} \frac{\partial B}{\partial m_{j}(x')} \epsilon_{ijk} m_{k}(x') $$ 

2. With this definition, show that $$
i \mathbf{\Omega} = \frac{\delta {\cal H}}{\delta \mathbf{m}} \times \mathbf{m}
$$

The fundamental thermodynamic relation for a ferromagnet is $$
T ds = d e - \mathbf{h} \cdot d \mathbf{m}, \quad\quad \mathbf{h} = -T \left( \frac{\partial s}{\partial \mathbf{m}} \right)_{e} = \left( \frac{\partial e}{\partial \mathbf{m}} \right)_{s}.
$$ 
For the entropy in this classical, coarse grained description, we take the entropy density that follows from the ~Ginzburg-Landau phenomenological Hamiltonian. Even simpler, we linearize the Hamiltonian as a function of magnetization  around some uniform state $\mathbf{m} = (0,0,m_{0})$. We write for the entropy density $$
s(e,\mathbf{m}) = - \frac{1}{2T} \chi_{\parallel}^{-1} m_{z}^{2} - \frac{\rho_{s}}{2T m_{0}^{2}} \left[ (\nabla m_{x})^{2} + (\nabla m_{y})^{2} \right] $$
where $\chi_{\parallel}$ is a susceptibility.

3. Show that, indeed, the reversible part of the equation of motion does not lead to entropy change.

4. By writing the entropy production, obtain the transport equations \begin{eqnarray}
\partial_{t} e & = & \kappa C^{-1} \nabla^{2} e \\
\partial_{t} m_{z}  & = &  \Gamma \chi_{\parallel}^{-1} \nabla^{2} m_{z} \\
\partial_{t} m_{x}  & = & - \frac{\rho_{s}}{m_{0}^{2}} \nabla^{2} m_{y} - \Gamma \frac{\rho_{s}}{m_{0}^{2}}\nabla^{4} m_{x} \\
\partial_{t} m_{y}  & = & \frac{\rho_{s}}{m_{0}^{2}} \nabla^{2} m_{x} - \Gamma \frac{\rho_{s}}{m_{0}^{2}} \nabla^{4} m_{y}
\end{eqnarray}
where the specific heat $C$ has been introduced as done with the rotor in class.
## We have four modes, two of them diffusive, which ones ? 
## The other two, give damped spin waves. Show that the dispersion relation of the spin waves is $$
\omega = \pm \frac{\rho_{s}}{m_{0}^{2}} q^{2} + i \frac{\Gamma \rho_{s}}{m_{0}^{2}} q^{4}
$$

[[pdf version|http://homepages.spa.umn.edu/~vinals/tspot_files/phys8702/2017/hwk6.pdf]]
/***
|Name|ImageSizePlugin|
|Source|http://www.TiddlyTools.com/#ImageSizePlugin|
|Version|1.2.3|
|Author|Eric Shulman|
|License|http://www.TiddlyTools.com/#LegalStatements|
|~CoreVersion|2.1|
|Type|plugin|
|Description|adds support for resizing images|
This plugin adds optional syntax to scale an image to a specified width and height and/or interactively resize the image with the mouse.
!!!!!Usage
<<<
The extended image syntax is:
{{{
[img(w+,h+)[...][...]]
}}}
where ''(w,h)'' indicates the desired width and height (in CSS units, e.g., px, em, cm, in, or %). Use ''auto'' (or a blank value) for either dimension to scale that dimension proportionally (i.e., maintain the aspect ratio). You can also calculate a CSS value 'on-the-fly' by using a //javascript expression// enclosed between """{{""" and """}}""". Appending a plus sign (+) to a dimension enables interactive resizing in that dimension (by dragging the mouse inside the image). Use ~SHIFT-click to show the full-sized (un-scaled) image. Use ~CTRL-click to restore the starting size (either scaled or full-sized).
<<<
!!!!!Examples
<<<
{{{
[img(100px+,75px+)[images/meow2.jpg]]
}}}
[img(100px+,75px+)[images/meow2.jpg]]
{{{
[<img(34%+,+)[images/meow.gif]]
[<img(21% ,+)[images/meow.gif]]
[<img(13%+, )[images/meow.gif]]
[<img( 8%+, )[images/meow.gif]]
[<img( 5% , )[images/meow.gif]]
[<img( 3% , )[images/meow.gif]]
[<img( 2% , )[images/meow.gif]]
[img(  1%+,+)[images/meow.gif]]
}}}
[<img(34%+,+)[images/meow.gif]]
[<img(21% ,+)[images/meow.gif]]
[<img(13%+, )[images/meow.gif]]
[<img( 8%+, )[images/meow.gif]]
[<img( 5% , )[images/meow.gif]]
[<img( 3% , )[images/meow.gif]]
[<img( 2% , )[images/meow.gif]]
[img(  1%+,+)[images/meow.gif]]
{{tagClear{
}}}
<<<
!!!!!Revisions
<<<
2011.09.03 [1.2.3] bypass addStretchHandlers() if no '+' suffix is used (i.e., not resizable)
2010.07.24 [1.2.2] moved tip/dragtip text to config.formatterHelpers.imageSize object to enable customization
2009.02.24 [1.2.1] cleanup width/height regexp, use '+' suffix for resizing
2009.02.22 [1.2.0] added stretchable images
2008.01.19 [1.1.0] added evaluated width/height values
2008.01.18 [1.0.1] regexp for "(width,height)" now passes all CSS values to browser for validation
2008.01.17 [1.0.0] initial release
<<<
!!!!!Code
***/
//{{{
version.extensions.ImageSizePlugin= {major: 1, minor: 2, revision: 3, date: new Date(2011,9,3)};
//}}}
//{{{
var f=config.formatters[config.formatters.findByField("name","image")];
f.match="\\[[<>]?[Ii][Mm][Gg](?:\\([^,]*,[^\\)]*\\))?\\[";
f.lookaheadRegExp=/\[([<]?)(>?)[Ii][Mm][Gg](?:\(([^,]*),([^\)]*)\))?\[(?:([^\|\]]+)\|)?([^\[\]\|]+)\](?:\[([^\]]*)\])?\]/mg;
f.handler=function(w) {
	this.lookaheadRegExp.lastIndex = w.matchStart;
	var lookaheadMatch = this.lookaheadRegExp.exec(w.source)
	if(lookaheadMatch && lookaheadMatch.index == w.matchStart) {
		var floatLeft=lookaheadMatch[1];
		var floatRight=lookaheadMatch[2];
		var width=lookaheadMatch[3];
		var height=lookaheadMatch[4];
		var tooltip=lookaheadMatch[5];
		var src=lookaheadMatch[6];
		var link=lookaheadMatch[7];

		// Simple bracketted link
		var e = w.output;
		if(link) { // LINKED IMAGE
			if (config.formatterHelpers.isExternalLink(link)) {
				if (config.macros.attach && config.macros.attach.isAttachment(link)) {
					// see [[AttachFilePluginFormatters]]
					e = createExternalLink(w.output,link);
					e.href=config.macros.attach.getAttachment(link);
					e.title = config.macros.attach.linkTooltip + link;
				} else
					e = createExternalLink(w.output,link);
			} else 
				e = createTiddlyLink(w.output,link,false,null,w.isStatic);
			addClass(e,"imageLink");
		}

		var img = createTiddlyElement(e,"img");
		if(floatLeft) img.align="left"; else if(floatRight) img.align="right";
		if(width||height) {
			var x=width.trim(); var y=height.trim();
			var stretchW=(x.substr(x.length-1,1)=='+'); if (stretchW) x=x.substr(0,x.length-1);
			var stretchH=(y.substr(y.length-1,1)=='+'); if (stretchH) y=y.substr(0,y.length-1);
			if (x.substr(0,2)=="{{")
				{ try{x=eval(x.substr(2,x.length-4))} catch(e){displayMessage(e.description||e.toString())} }
			if (y.substr(0,2)=="{{")
				{ try{y=eval(y.substr(2,y.length-4))} catch(e){displayMessage(e.description||e.toString())} }
			img.style.width=x.trim(); img.style.height=y.trim();
			if (stretchW||stretchH) config.formatterHelpers.addStretchHandlers(img,stretchW,stretchH);
		}
		if(tooltip) img.title = tooltip;

		// GET IMAGE SOURCE
		if (config.macros.attach && config.macros.attach.isAttachment(src))
			src=config.macros.attach.getAttachment(src); // see [[AttachFilePluginFormatters]]
		else if (config.formatterHelpers.resolvePath) { // see [[ImagePathPlugin]]
			if (config.browser.isIE || config.browser.isSafari) {
				img.onerror=(function(){
					this.src=config.formatterHelpers.resolvePath(this.src,false);
					return false;
				});
			} else
				src=config.formatterHelpers.resolvePath(src,true);
		}
		img.src=src;
		w.nextMatch = this.lookaheadRegExp.lastIndex;
	}
}

config.formatterHelpers.imageSize={
	tip: 'SHIFT-CLICK=show full size, CTRL-CLICK=restore initial size',
	dragtip: 'DRAG=stretch/shrink, '
}

config.formatterHelpers.addStretchHandlers=function(e,stretchW,stretchH) {
	e.title=((stretchW||stretchH)?this.imageSize.dragtip:'')+this.imageSize.tip;
	e.statusMsg='width=%0, height=%1';
	e.style.cursor='move';
	e.originalW=e.style.width;
	e.originalH=e.style.height;
	e.minW=Math.max(e.offsetWidth/20,10);
	e.minH=Math.max(e.offsetHeight/20,10);
	e.stretchW=stretchW;
	e.stretchH=stretchH;
	e.onmousedown=function(ev) { var ev=ev||window.event;
		this.sizing=true;
		this.startX=!config.browser.isIE?ev.pageX:(ev.clientX+findScrollX());
		this.startY=!config.browser.isIE?ev.pageY:(ev.clientY+findScrollY());
		this.startW=this.offsetWidth;
		this.startH=this.offsetHeight;
		return false;
	};
	e.onmousemove=function(ev) { var ev=ev||window.event;
		if (this.sizing) {
			var s=this.style;
			var currX=!config.browser.isIE?ev.pageX:(ev.clientX+findScrollX());
			var currY=!config.browser.isIE?ev.pageY:(ev.clientY+findScrollY());
			var newW=(currX-this.offsetLeft)/(this.startX-this.offsetLeft)*this.startW;
			var newH=(currY-this.offsetTop )/(this.startY-this.offsetTop )*this.startH;
			if (this.stretchW) s.width =Math.floor(Math.max(newW,this.minW))+'px';
			if (this.stretchH) s.height=Math.floor(Math.max(newH,this.minH))+'px';
			clearMessage(); displayMessage(this.statusMsg.format([s.width,s.height]));
		}
		return false;
	};
	e.onmouseup=function(ev) { var ev=ev||window.event;
		if (ev.shiftKey) { this.style.width=this.style.height=''; }
		if (ev.ctrlKey)  { this.style.width=this.originalW; this.style.height=this.originalH; }
		this.sizing=false;
		clearMessage();
		return false;
	};
	e.onmouseout=function(ev) { var ev=ev||window.event;
		this.sizing=false;
		clearMessage();
		return false;
	};
}
//}}}
/***
|''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);
}
//}}}
[[Home]]
[[Syllabus]]
[[Class Notes]]
[[Homework]]
[[Supplementary Material]]
[[Possible projects]]

[[Tag Cloud]]

[[WelcomeToTiddlyspot]] [[GettingStarted]]
/***
|''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"
	});
*/
//}}}
/***
|Name|Plugin: Scientific Notation|
|Created by|BobMcElrath|
|Email|my first name at my last name dot org|
|Location|http://bob.mcelrath.org/tiddlyjsmath-2.0.3.html|
|Version|1.0|
|Requires|[[TiddlyWiki|http://www.tiddlywiki.com]] &ge; 2.0.3, [[jsMath|http://www.math.union.edu/~dpvc/jsMath/]] &ge; 3.0, [[Plugin: jsMath]]|
!Description
This plugin will render numbers expressed in scientific notation, such as {{{3.5483e12}}} using the jsMath plugin to display it in an intuitive way such as 3.5483e12.  You may customize the number of significant figures displayed, as well as "normalize" numbers so that {{{47392.387e9}}} is displayed as 47392.387e9.
!Installation
Install the Requirements, above, add this tiddler to your tiddlywiki, and give it the {{{systemConfig}}} tag.
!History
* 1-Feb-06, version 1.0, Initial release
!Code
***/
//{{{
config.formatters.push({
  name: "scientificNotation",
  match: "\\b[0-9]+\\.[0-9]+[eE][+-]?[0-9]+\\b",
  element: "span",
  className: "math",
  normalize: true,                          // set to 'true' to convert numbers to X.XXX \times 10^{y}
  sigfigs: 3,                               // with this many digits in the mantissa
  handler: function(w) {
    var snRegExp = new RegExp("\\b([0-9]+(?:\\.[0-9]+)?)[eE]([-0-9+]+)\\b");
    var mymatch = snRegExp.exec(w.matchText);
    var mantissa = mymatch[1];
    var exponent = parseInt(mymatch[2]);
    // normalize the number.
    if(this.normalize) {
      mantissa = parseFloat(mantissa);
      while(mantissa > 10.0) {
        mantissa = mantissa / 10.0;
        exponent++; 
      }
      while(mantissa < 1.0) {
        mantissa = mantissa * 10.0;
        exponent--;
      }
      var sigfigsleft = this.sigfigs;
      mantissa = parseInt(mantissa) + "." + (Math.round(Math.pow(10,this.sigfigs-1)*mantissa)+"").substr(1,this.sigfigs-1);
    }
    var e = document.createElement(this.element);
    e.className = this.className;
    if(exponent == 0) {
      e.appendChild(document.createTextNode(mantissa));
    } else {
      e.appendChild(document.createTextNode(mantissa + "\\times 10^{" + exponent + "}"));
    }
    w.output.appendChild(e);
  }
});
//}}}
/***
|Name|Plugin: arXiv Links|
|Created by|BobMcElrath|
|Email|my first name at my last name dot org|
|Location|http://bob.mcelrath.org/tiddlyjsmath-2.0.3.html|
|Version|1.0|
|Requires|[[TiddlyWiki|http://www.tiddlywiki.com]] &ge; 2.0.3|
!Description
This formatting plugin will render links to the [[arXiv|http://www.arxiv.org]] preprint system.  If you type a paper reference such as hep-ph/0509024, it will be rendered as an external link to the abstract of that paper.
!Installation
Add this tiddler to your tiddlywiki, and give it the {{{systemConfig}}} tag.
!History
* 1-Feb-06, version 1.0, Initial release
!Code
***/
//{{{
config.formatters.push({
  name: "arXivLinks",
  match: "\\b(?:astro-ph|cond-mat|hep-ph|hep-th|hep-lat|gr-qc|nucl-ex|nucl-th|quant-ph|(?:cs|math|nlin|physics|q-bio)(?:\\.[A-Z]{2})?)/[0-9]{7}\\b",
  element: "a",
  handler: function(w) {
    var e = createExternalLink(w.output, "http://arxiv.org/abs/"+w.matchText);
    e.target = "_blank"; // open in new window
    w.outputText(e,w.matchStart,w.nextMatch);
  }
});
//}}}
/***
|Name|Plugin: jsMath|
|Created by|BobMcElrath|
|Email|my first name at my last name dot org|
|Location|http://bob.mcelrath.org/tiddlyjsmath.html|
|Version|1.6|
|Requires|[[TiddlyWiki|http://www.tiddlywiki.com]] &ge; 2.0.3, [[jsMath|http://www.math.union.edu/~dpvc/jsMath/]] &ge; 3.0|
!Description
LaTeX is the world standard for specifying, typesetting, and communicating mathematics among scientists, engineers, and mathematicians.  For more information about LaTeX itself, visit the [[LaTeX Project|http://www.latex-project.org/]].  This plugin typesets math using [[jsMath|http://www.math.union.edu/~dpvc/jsMath/]], which is an implementation of the TeX math rules and typesetting in javascript, for your browser.  Notice the small button in the lower right corner which opens its control panel.
!Installation
In addition to this plugin, you must also [[install jsMath|http://www.math.union.edu/~dpvc/jsMath/download/jsMath.html]] on the same server as your TiddlyWiki html file.  If you're using TiddlyWiki without a web server, then the jsMath directory must be placed in the same location as the TiddlyWiki html file.

I also recommend modifying your StyleSheet use serif fonts that are slightly larger than normal, so that the math matches surrounding text, and \\small fonts are not unreadable (as in exponents and subscripts).
{{{
.viewer {
  line-height: 125%;
  font-family: serif;
  font-size: 12pt;
}
}}}

You may also optionally add the following code to load jsMath in [[MarkupPostHead]] if you desire.
{{{
<!--{{{-->
<script src="jsMath/jsMath.js"></script>
<!--}}}-->
}}}
[[Plugin: jsMath]] will normally load jsMath dynamically using AJAX, but adding the above in [[MarkupPostHead]] may be useful if you have jsMath stored in a non-standard location, or if your browser's cross-site origin policy forbids loading files from file URL's using AJAX.  (e.g. Google Chrome)  
!History
* 11-Nov-05, version 1.0, Initial release
* 22-Jan-06, version 1.1, updated for ~TW2.0, tested with jsMath 3.1, editing tiddlywiki.html by hand is no longer necessary.
* 24-Jan-06, version 1.2, fixes for Safari, Konqueror
* 27-Jan-06, version 1.3, improved error handling, detect if ajax was already defined (used by ZiddlyWiki)
* 12-Jul-06, version 1.4, fixed problem with not finding image fonts
* 26-Feb-07, version 1.5, fixed problem with Mozilla "unterminated character class".
* 27-Feb-07, version 1.5.1, Runs compatibly with TW 2.1.0+, by Bram Chen
* 5-May-11, version 1.6, Use a script tag to load in Chrome, use jQuery for ajax
!Examples
|!Source|!Output|h
|{{{The variable $x$ is real.}}}|The variable $x$ is real.|
|{{{The variable \(y\) is complex.}}}|The variable \(y\) is complex.|
|{{{This \[\int_a^b x = \frac{1}{2}(b^2-a^2)\] is an easy integral.}}}|This \[\int_a^b x = \frac{1}{2}(b^2-a^2)\] is an easy integral.|
|{{{This $$\int_a^b \sin x = -(\cos b - \cos a)$$ is another easy integral.}}}|This $$\int_a^b \sin x = -(\cos b - \cos a)$$ is another easy integral.|
|{{{Block formatted equations may also use the 'equation' environment \begin{equation}  \int \tan x = -\ln \cos x \end{equation} }}}|Block formatted equations may also use the 'equation' environment \begin{equation}  \int \tan x = -\ln \cos x \end{equation}|
|{{{Equation arrays are also supported \begin{eqnarray} a &=& b \\ c &=& d \end{eqnarray} }}}|Equation arrays are also supported \begin{eqnarray} a &=& b \\ c &=& d \end{eqnarray} |
|{{{I spent \$7.38 on lunch.}}}|I spent \$7.38 on lunch.|
|{{{I had to insert a backslash (\\) into my document}}}|I had to insert a backslash (\\) into my document|
!Code
***/
//{{{

// Load jsMath
if(typeof jsMath == 'undefined') {
  jsMath = {
    Setup: {inited: 1},          // don't run jsMath.Setup.Body() yet
    Autoload: {root: new String(document.location).replace(/[^\/]*$/,'jsMath/')}  // URL to jsMath directory, change if necessary
  };
  try {
    jQuery.ajax({url: jsMath.Autoload.root+"jsMath.js", dataType: 'script',
                 async: false, error: function(j, s, e) { throw(e); } });
    jsMath.Setup.inited=0;  //  allow jsMath.Setup.Body() to run again
  } catch(e) {
    if(navigator.userAgent.toLowerCase().indexOf('chrome') > -1
        && document.location.toString().indexOf('file') == 0) {
      var jsMathScript = '<!--{{{-->\n<script src="jsMath/jsMath.js"></script>\n<!--}}}-->';
      var MarkupPostHead = store.fetchTiddler("MarkupPostHead");
      if(MarkupPostHead && !MarkupPostHead.match(jsMathScript)) {
        MarkupPostHead.text += jsMathScript;
      } else {
        MarkupPostHead = store.createTiddler("MarkupPostHead");
        MarkupPostHead.text = jsMathScript;
      }
      throw("jsMath added to MarkupPostHead: now save and reload (Google Chrome cross origin file:/// URL workaround)");
    } else {
      alert("jsMath was not found: you must place the 'jsMath' directory in the same place as this file.  "
           +"The error was:\n"+e.name+": "+e.message);
      throw(e);  // abort eval
    }
  }
}

// Define wikifers for latex
config.formatterHelpers.mathFormatHelper = function(w) {
    var e = document.createElement(this.element);
    e.className = this.className;
    var endRegExp = new RegExp(this.terminator, "mg");
    endRegExp.lastIndex = w.matchStart+w.matchLength;
    var matched = endRegExp.exec(w.source);
    if(matched) {
        var txt = w.source.substr(w.matchStart+w.matchLength, 
            matched.index-w.matchStart-w.matchLength);
        if(this.keepdelim) {
          txt = w.source.substr(w.matchStart, matched.index+matched[0].length-w.matchStart);
        }
        e.appendChild(document.createTextNode(txt));
        w.output.appendChild(e);
        w.nextMatch = endRegExp.lastIndex;
    }
}

config.formatters.push({
  name: "displayMath1",
  match: "\\\$\\\$",
  terminator: "\\\$\\\$\\n?", // 2.0 compatability
  termRegExp: "\\\$\\\$\\n?",
  element: "div",
  className: "math",
  handler: config.formatterHelpers.mathFormatHelper
});

config.formatters.push({
  name: "inlineMath1",
  match: "\\\$", 
  terminator: "\\\$", // 2.0 compatability
  termRegExp: "\\\$",
  element: "span",
  className: "math",
  handler: config.formatterHelpers.mathFormatHelper
});

var backslashformatters = new Array(0);

backslashformatters.push({
  name: "inlineMath2",
  match: "\\\\\\\(",
  terminator: "\\\\\\\)", // 2.0 compatability
  termRegExp: "\\\\\\\)",
  element: "span",
  className: "math",
  handler: config.formatterHelpers.mathFormatHelper
});

backslashformatters.push({
  name: "displayMath2",
  match: "\\\\\\\[",
  terminator: "\\\\\\\]\\n?", // 2.0 compatability
  termRegExp: "\\\\\\\]\\n?",
  element: "div",
  className: "math",
  handler: config.formatterHelpers.mathFormatHelper
});

backslashformatters.push({
  name: "displayMath3",
  match: "\\\\begin\\{equation\\}",
  terminator: "\\\\end\\{equation\\}\\n?", // 2.0 compatability
  termRegExp: "\\\\end\\{equation\\}\\n?",
  element: "div",
  className: "math",
  handler: config.formatterHelpers.mathFormatHelper
});

// These can be nested.  e.g. \begin{equation} \begin{array}{ccc} \begin{array}{ccc} ...
backslashformatters.push({
  name: "displayMath4",
  match: "\\\\begin\\{eqnarray\\}",
  terminator: "\\\\end\\{eqnarray\\}\\n?", // 2.0 compatability
  termRegExp: "\\\\end\\{eqnarray\\}\\n?",
  element: "div",
  className: "math",
  keepdelim: true,
  handler: config.formatterHelpers.mathFormatHelper
});

// The escape must come between backslash formatters and regular ones.
// So any latex-like \commands must be added to the beginning of
// backslashformatters here.
backslashformatters.push({
    name: "escape",
    match: "\\\\.",
    handler: function(w) {
        w.output.appendChild(document.createTextNode(w.source.substr(w.matchStart+1,1)));
        w.nextMatch = w.matchStart+2;
    }
});

config.formatters=backslashformatters.concat(config.formatters);

window.wikify = function(source,output,highlightRegExp,tiddler)
{
    if(source && source != "") {
        if(version.major == 2 && version.minor > 0) {
            var wikifier = new Wikifier(source,getParser(tiddler),highlightRegExp,tiddler);
            wikifier.subWikifyUnterm(output);
        } else {
            var wikifier = new Wikifier(source,formatter,highlightRegExp,tiddler);
            wikifier.subWikify(output,null);
        }
        jsMath.ProcessBeforeShowing();
    }
}
//}}}
* RG for the ~Kosterlitz-Thouless transition. Mehran Kardar, "Statistical Physics of Fields". Page 168. David Nelson, Mike Kosterlitz. Phys. Rev. Lett. 39, 1201 (1977).
* Numerical methods for the implementation of thermostats in nonequilibrium simulations. William Graham Hoover, Julien Clinton Sprott, Carol Griswold Hoover. "A Tutorial: Adaptive ~Runge-Kutta Integration for Stiff Systems : Comparing the Nose and ~Nose-Hoover Oscillator Dynamics". [[arXiv:1602.08652|http://arxiv.org/abs/1602.08652]] (2016). Also, Singly Thermostated Ergodicity in Gibbs' Canonical Ensemble, [[arXiv:1701.06905 [nlin.CD]|https://arxiv.org/abs/1701.06905]].
* Models and numerical methods for the ~Landau-Gilbert [[equation|http://link.springer.com/article/10.1007/BF03024947]] of micro-magnetism. [[Correlation effects in the stochastic Landau-Lifshitz-Gilbert equation|http://journals.aps.org/prb/abstract/10.1103/PhysRevB.81.104413]].
* Chaos in dissipative systems, and [[estimating|https://arxiv.org/abs/1604.01859#]] the dimensionality of the Hamiltonian manifold.
* Fluctuation-dissipation theorem deviations in quantum systems [[Fujikura and Simizu|http://journals.aps.org/prl/abstract/10.1103/PhysRevLett.117.010402]] (2016).
* Fluctuations and correlations in non-equilibrium steady states. References in: T.R. Kirkpatrick, J.R. Dorfman, J.V. Sengers. "Work, work fluctuations, and the work distribution in a thermal non-equilibrium steady state". [[arXiv:1606.06505 [cond-mat.stat-mech]|https://arxiv.org/abs/1606.06505#]].
* Masato Itami, Shin-ichi Sasa. "Universal Form of Stochastic Evolution for Slow Variables in Equilibrium Systems". [[arXiv:1608.00371v1 [cond-mat.stat-mech]|https://arxiv.org/abs/1608.00371]].
* Quantum tunneling in a dissipative system. [[Caldeira and Leggett|http://www.sciencedirect.com/science/article/pii/0003491683902026]]. See also discussion on dissipation in Bosonic systems in http://journals.aps.org/prb/abstract/10.1103/PhysRevB.48.3316 .
* Hydrodynamics of quasycrystals. [[Lubensky, Ramaswamy and Toner|https://journals.aps.org/prb/abstract/10.1103/PhysRevB.32.7444]]
* The nature of the [[nematic-smectic transition|https://arxiv.org/abs/1901.08837]]. Milchev and Binder, (2019).
* [[Nonequilibrium Thermodynamics|https://arxiv.org/abs/1901.08821]]. Gallavotti (2019).
~PHYS8702. Statistical Mechanics and Transport Theory. Spring Semester 2017
University of Minnesota &nbsp; School of Physics and Astronomy <br>
A:link {text-decoration: none}
A:visited {text-decoration: none}
A:active {text-decoration: none}
A:hover {text-decoration: underline;}
/* A:hover {text-decoration: underline; font-weight:bold}*/

@media print {#mainMenu {display: none ! important;}}
@media print {#topMenu {display: none ! important;}}
@media print {#sidebar {display: none ! important;}}
@media print {#messageArea {display: none ! important;}} 
@media print {#toolbar {display: none ! important;}}
@media print {.header {display: none ! important;}}
@media print {.tiddler .subtitle {display: none ! important;}}
@media print {.tiddler .toolbar {display; none ! important; }}
@media print {.tiddler .tagging {display; none ! important; }}
@media print {.tiddler .tagged {display; none ! important; }}

.justifyright {
  text-align: right;
}
!!! Scale invariance in the Ising model at the critical point
Single image:
<html>
<iframe src="http://www.youtube.com/embed/lQxD1PinDbs"
  width="450" height="315" frameborder="0" allowfullscreen/>
</html>
and now the kinetic evolution at different levels of resolution
<html>
<iframe src="http://www.youtube.com/embed/PlvisNlAcfo"
  width="450" height="315" frameborder="0" allowfullscreen/>
</html>
!!! Monte Carlo Renormalization Group
A couple of elegant papers on how to compute critical exponents and renormalized coupling constants by direct blocking of spatial configurations generated by the Monte Carlo method.
# Robert H. Swendsen. Monte Carlo Renormalization Group. Phys.Rev. Lett. 42, [[859|http://journals.aps.org/prl/abstract/10.1103/PhysRevLett.42.859]] (1978).
# Robert H. Swendsen. Monte Carlo Calculation of Renormalized Coupling Parameters. Phys. Rev. Lett. 52, [[1165|http://journals.aps.org/prl/abstract/10.1103/PhysRevLett.52.1165]] (1984).

!!! Unstable interface motion (non conserved order parameter)

First a numerical simulation of the Ising model in d=2 at a temperature below its phase transition point.
<html>
<iframe src="http://www.youtube.com/embed/_m8kaUDTXi0/"
  width="450" height="315" frameborder="0" allowfullscreen/>
</html>


Numerical solution of model A for a scalar field with equilibrium values $\pm 1$.
<html>
<iframe src="http://www.youtube.com/embed/oalJkDSrDco/"
  width="450" height="315" frameborder="0" allowfullscreen/>
</html>

And now, remove the bulk domains and focus on the boundaries
<html><iframe width="420" height="315" src="http://www.youtube.com/embed/fuP9AyaOrKg" frameborder="0" allowfullscreen></iframe></html>

[img(75%+,auto)[http://homepages.spa.umn.edu/~vinals/tspot_files/gam0-NGQ-Zrotate.gif]]

!!! Conserved order parameter

Spinodal decomposition, with about the same amount of both phases
<html>
<iframe src="http://www.youtube.com/embed/95NYPyx6QrA/"
  width="450" height="315" frameborder="0" allowfullscreen/>
</html>

Fluctuations leading to nucleation
<html>
<iframe src="http://www.youtube.com/embed/AA10nOv6WRY/"
  width="450" height="315" frameborder="0" allowfullscreen/>
</html>

And now a larger system showing longer times as domains coarsen
<html>
<iframe src="http://www.youtube.com/embed/REcr2l7miVg/"
  width="450" height="315" frameborder="0" allowfullscreen/>
</html>

!! Other reference material
# B.C. Eu, Kinetic Theory of Nonequilibrium Ensembles, Irreversible Thermodynamics, and Generalized Hydrodynamics. Vol. 1: Nonrelativistic Theories. Springer, 2016. ISBN 978-3-319-41146-0
# Joel Mabillard, Pierre Gaspard. [[Microscopic approach to the macrodynamics of matter with broken symmetries|https://arxiv.org/abs/2005.14012]]. arxiv.org: 2005.14012
# N. Dupuis, L. Canet, A. Eichhorn, W. Metzner, J. M. Pawlowski, M. Tissier, N. Wschebor. [[The nonperturbative functional renormalization group and its applications|https://arxiv.org/abs/2006.04853]]. Exhaustive review of the Functional Renormalization Group (June 2020).
# Pedro Garrido. [[Notes about the Macroscopic Fluctuating Theory|https://arxiv.org/abs/2006.08261]]. June 15, 2020.
# Jim Dufty, [[Generalized Hydrodynamics revisited|https://arxiv.org/abs/2002.01549]]
!Course Information
''Instructor:'' Jorge Vi&ntilde;als
''Office:'' ~McNamara Alumni Center 148-3 (in suite 160)
''Contact Information:'' vin&#97;ls&#64;&#117;mn.ed&#117;
''Office Hours: '' WF, 11:30 a.m. - 12:30 p.m.
''Lecture schedule: '' MWF  12:40 p.m. - 1:30  p.m., PAN 210. 

''TA:'' Mike Sammon. Office: Shepherd Lab 196. Contact: sammo017&#64;&#117;mn.ed&#117;
''Office Hours: '' Tuesday, 2:30 - 3:30 p.m.

''Class web site: '' http://phys8702.tiddlyspot.com

!Exams and Final
There are no exams in this class. There will be several homework assignments during the semester. Typically, the homework will be due one week after being assigned, and may include reading of relevant material. There will be reduced credit for late homeworks: 75% for up to one week late, 50% for up to two weeks late. No credit after that. 

In lieu of a final exam, each student will be required to give a brief (20-30 min) presentation on an appropriate topic at the end of the semester. The topic will be related to the material covered in class and chosen by the student, but must be approved by the instructor. The presentation can be lecture style (blackboard), or conference style (overhead projector). Students may be asked to submit a copy of the presentation for evaluation.

!Required Materials
There is no specific textbook for this class. It will be based on lecture notes (sometimes available online), supplemented by the following textbooks:
* N. Goldenfeld, “Lectures on Phase Transitions and the Renormalisation Group". (~Addison-Wesley, Reading, Mass., 1992). Covers in great detail the theory of equilibrium phase transitions and critical phenomena.
* P.M. Chaikin and T.C. Lubensky, “Principles of Condensed Matter Physics". (Cambridge University Press, New York, 1995). This will be the basic book for linear response theory and nonequilibrium phenomena. It is available in the bookstore if you wish to purchase it. 
* D. Forster, "Hydrodynamic Fluctuations, Broken Symmetry, and Correlation Functions".  Westview Press, 1995.
* A.N. Beris and B.J. Edwards, "Thermodynamics of Flowing Systems with internal microstructure". Oxford University Press, 1994.
!Course goals and objectives
This course is a continuation of PHYS 5201 (Thermal and Statistical Physics). It continues the treatment of phase transitions and critical phenomena, including the Renormalization Group. It introduces Linear Response Theory and the basic concepts and tools of nonequilibrium physics. The goal is to reach a level that is sufficient to read, understand, and work on current research papers that address transport and nonequilibrium phenomena.  Specifically, the class will cover:
!!!Topics
# Review of fluctuations near equilibrium: equilibrium linear response theory. Time dependent perturbation theory and formal dynamic linear response.  Symmetry properties of response functions, time reversal and dissipation. Fluctuation-dissipation theorem. Scattering experiments and dynamic correlation functions.
# Relaxation, transport coefficients, ~Green-Kubo formulae. Examples: conductivity, magnetization diffusion, transverse waves.
# Fluctuations and dimensionality: a fluctuating interface.  ~Kosterlitz-Thouless transition. Spontaneously broken symmetries, long ranged correlations and slow modes. Goldstone theorem and hydrodynamic Goldstone modes.
# Generalized hydrodynamics. Example: the XY model. Conservation laws, entropy inequality, reactive and dissipative fluxes, and transport equations. Hydrodynamics of a simple fluid. Reactive modes and Euler's equation. Dissipation, Newtonian fluids and the Navier Stokes equation. Linear hydrodynamic modes. Liquid crystal hydrodynamics.
# Systems far from equilibrium. Introduction to stochastic processes and Langevin dynamics. Temporal correlation functions. Projection operators and generalized Langevin equation. ~Fokker-Planck equation. Nonlinear transport models. 
!Grading
| Oral presentation | 40% |
| Homework assignments | 50 % |
| Class participation | 10 % |

!Attendance policy
Class attendance is required.

!Departamental policies
''ATHLETES'' must provide their official University of Minnesota athletic letter containing the approved competition schedule to their instructor and the staff in the Physics office. Away exams will be arranged with the athletic adviser traveling with the team. Accommodations will be made for official university sports only (i.e. no accommodations will be made for intramurals, club sports, etc.)
''DISABILITY SERVICES:'' If you have accommodations for this course, please provide the staff in the Physics office with a copy of your accommodation letter for the current semester. Exams will be arranged according to accommodations and sent to the testing center for administration.

!Mandatory policy information
!!!Student Conduct Code
The University seeks an environment that promotes academic achievement and integrity, that is protective of free inquiry, and that serves the educational mission of the University. Similarly, the University seeks a community that is free from violence, threats, and intimidation; that is respectful of the rights, opportunities, and welfare of students, faculty, staff, and guests of the University; and that does not threaten the physical or mental health or safety of members of the University community. As a student at the University you are expected adhere to Board of Regents Policy: Student Conduct Code. To review the Student Conduct Code, please see: [[Regents Student Conduct Code|http://regents.umn.edu/sites/default/files/policies/Student_Conduct_Code.pdf]]

Note that the conduct code specifically addresses disruptive classroom conduct, which means "engaging in behavior that substantially or repeatedly interrupts either the instructor's ability to teach or student learning. The classroom extends to any setting where a student is engaged in work toward academic credit or satisfaction of program-based requirements or related activities."

!!!Scholastic dishonesty
You are expected to do your own academic work and cite sources as necessary. Failing to do so is scholastic dishonesty. Scholastic dishonesty means plagiarizing; cheating on assignments or examinations; engaging in unauthorized collaboration on academic work; taking, acquiring, or using test materials without faculty permission; submitting false or incomplete records of academic achievement; acting alone or in cooperation with another to falsify records or to obtain dishonestly grades, honors, awards, or professional endorsement; altering, forging, or misusing a University academic record; or fabricating or falsifying data, research procedures, or data analysis ([[Student Conduct Code|http://regents.umn.edu/sites/default/files/policies/Student_Conduct_Code.pdf]]).

If it is determined that a student has cheated, he or she may be given an "F" or an "N" for the course, and may face additional sanctions from the University. For additional information, please see: http://policy.umn.edu/Policies/Education/Education/INSTRUCTORRESP.html.
The Office for Student Conduct and Academic Integrity has compiled a useful list of Frequently Asked Questions pertaining to scholastic dishonesty: http://www1.umn.edu/oscai/integrity/student/index.html. If you have additional questions, please clarify with your instructor for the course. Your instructor can respond to your specific questions regarding what would constitute scholastic dishonesty in the context of a particular class-e.g., whether collaboration on assignments is permitted, requirements and methods for citing sources, if electronic aids are permitted or prohibited during an exam.

!!!Disability Accommodations
The University is committed to providing quality education to all students regardless of ability. Determining appropriate disability accommodations is a collaborative process. You as a student must register with Disability Services and provide documentation of your disability. The course instructor must provide information regarding a course's content, methods, and essential components. The combination of this information will be used by Disability Services to determine appropriate accommodations for a particular student in a particular course. For more information, please reference Disability Services: https://diversity.umn.edu/disability/

!!!Use of Personal Electronic Devices in the Classroom
Using personal electronic devices in the classroom setting can hinder instruction and learning, not only for the student using the device but also for other students in the class. To this end, the University establishes the right of each faculty member to determine if and how personal electronic devices are allowed to be used in the classroom. For complete information, please reference: http://www.policy.umn.edu/Policies/Education/Education/STUDENTRESP.html

!!!Makeup Work for Legitimate Absences
Students will not be penalized for absence during the semester due to unavoidable or legitimate circumstances. Such circumstances include verified illness, participation in intercollegiate athletic events, subpoenas, jury duty, military service, bereavement, and religious observances. Such circumstances do not include voting in local, state, or national elections. For complete information, please see: http://policy.umn.edu/Policies/Education/Education/MAKEUPWORK.html.

!!!Appropriate Student Use of Class Notes and Course Materials
Taking notes is a means of recording information but more importantly of personally absorbing and integrating the educational experience. However, broadly disseminating class notes beyond the classroom community or accepting compensation for taking and distributing classroom notes undermines instructor interests in their intellectual work product while not substantially furthering instructor and student interests in effective learning. Such actions violate shared norms and standards of the academic community. For additional information, please see: http://policy.umn.edu/education/studentresp .

!!!Grading and Transcripts
The University utilizes plus and minus grading on a 4.000 cumulative grade point scale in accordance with the following:
|A |4.000 - Represents achievement that is outstanding relative to the level necessary to meet course requirements|
|A- |3.667 |
|B+ |3.333 |
|B |3.000 - Represents achievement that is significantly above the level necessary to meet course requirements |
|B- |2.667 |
|C+ |2.333 |
|C |2.000 - Represents achievement that meets the course requirements in every respect |
|C- |1.667 |
|D+ |1.333 |
|D |1.000 - Represents achievement that is worthy of credit even though it fails to meet fully the course requirements |
|S |Represents achievement that is satisfactory, which is equivalent to a C- or better. |

For additional information, please refer to: http://policy.umn.edu/Policies/Education/Education/GRADINGTRANSCRIPTS.html.

!!!Sexual Harassment
"Sexual harassment" means unwelcome sexual advances, requests for sexual favors, and/or other verbal or physical conduct of a sexual nature. Such conduct has the purpose or effect of unreasonably interfering with an individual's work or academic performance or creating an intimidating, hostile, or offensive working or academic environment in any University activity or program. Such behavior is not acceptable in the University setting. For additional information, please consult Board of Regents Policy: 
http://regents.umn.edu/sites/regents.umn.edu/files/policies/SexHarassment.pdf

!!!Equity, Diversity, Equal Opportunity, and Affirmative Action
The University will provide equal access to and opportunity in its programs and facilities, without regard to race, color, creed, religion, national origin, gender, age, marital status, disability, public assistance status, veteran status, sexual orientation, gender identity, or gender expression. For more information, please consult Board of Regents Policy: http://regents.umn.edu/sites/regents.umn.edu/files/policies/Equity_Diversity_EO_AA.pdf

!!!Mental Health and Stress Management
As a student you may experience a range of issues that can cause barriers to learning, such as strained relationships, increased anxiety, alcohol/drug problems, feeling down, difficulty concentrating and/or lack of motivation. These mental health concerns or stressful events may lead to diminished academic performance and may reduce your ability to participate in daily activities. University of Minnesota services are available to assist you. You can learn more about the broad range of confidential mental health services available on campus via the Student Mental Health Website: http://www.mentalhealth.umn.edu.
<<timeline modified 20>>
<<cloud systemConfig systemTiddlers DiscoveryPackage IconPackage NavigationPackage>>
/***
|Name|TagCloudPlugin|
|Source|http://www.TiddlyTools.com/#TagCloudPlugin|
|Version|1.7.0|
|Author|Eric Shulman|
|Original Author|Clint Checketts|
|License|http://www.TiddlyTools.com/#LegalStatements|
|~CoreVersion|2.1|
|Type|plugin|
|Description|present a 'cloud' of tags (or links) using proportional font display|
!Usage
<<<
{{{
<<cloud type action:... limit:... tag tag tag ...>>
<<cloud type action:... limit:... +TiddlerName>>
<<cloud type action:... limit:... -TiddlerName>>
<<cloud type action:... limit:... =tagvalue>>
}}}
where:
* //type// is a keyword, one of:
** ''tags'' (default) - displays a cloud of tags, based on frequency of use
** ''links'' - displays a cloud of tiddlers, based on number of links //from// each tiddler
** ''references'' - displays a cloud of tiddlers, based on number of links //to// each tiddler
* ''action:popup'' (default) - clicking a cloud item shows a popup with links to related tiddlers<br>//or//<br> ''action:goto'' - clicking a cloud item immediately opens the tiddler corresponding to that item
* ''limit:N'' (optional) - restricts the cloud display to only show the N most popular tags/links
* ''tag tag tag...'' (or ''title title title'' if ''links''/''references'' is used)<br>shows all tags/links in the document //except// for those listed as macro parameters
* ''+TiddlerName''<br>show only tags/links read from a space-separated, bracketed list stored in a separate tiddler.
* ''-TiddlerName''<br>show all tags/links //except// those read from a space-separated, bracketed list stored in a separate tiddler.
* ''=tagvalue'' (//only if type=''tags''//)<br>shows only tags that are themselves tagged with the indicated tag value (i.e., ~TagglyTagging usage)
//note: for backward-compatibility, you can also use the macro {{{<<tagCloud ...>>}}} in place of {{{<<cloud ...>>}}}//
<<<
!Examples
<<<
//all tags excluding<<tag systemConfig>>, <<tag excludeMissing>> and <<tag script>>//
{{{<<cloud systemConfig excludeMissing script>>}}}
{{groupbox{<<cloud systemConfig excludeMissing script>>}}}
//top 10 tags excluding<<tag systemConfig>>, <<tag excludeMissing>> and <<tag script>>//
{{{<<cloud limit:10 systemConfig excludeMissing script>>}}}
{{groupbox{<<cloud limit:10 systemConfig excludeMissing script>>}}}
//tags listed in// [[FavoriteTags]]
{{{<<cloud +FavoriteTags>>}}}
{{groupbox{<<cloud +FavoriteTags>>}}}
//tags NOT listed in// [[FavoriteTags]]
{{{<<cloud -FavoriteTags>>}}}
{{groupbox{<<cloud -FavoriteTags>>}}}
//links to tiddlers tagged with 'package'//
{{{<<cloud action:goto =package>>}}}
{{groupbox{<<cloud action:goto =package>>}}}
//top 20 most referenced tiddlers//
{{{<<cloud references limit:20>>}}}
{{groupbox{<<cloud references limit:20>>}}}
//top 20 tiddlers that contain the most links//
{{{<<cloud links limit:20>>}}}
{{groupbox{<<cloud links limit:20>>}}}
<<<
!Revisions
<<<
2009.07.17 [1.7.0] added {{{-TiddlerName}}} parameter to exclude tags that are listed in the indicated tiddler
2009.02.26 [1.6.0] added {{{action:...}}} parameter to apply popup vs. goto action when clicking cloud items
2009.02.05 [1.5.0] added ability to show links or back-links (references) instead of tags and renamed macro to {{{<<cloud>>}}} to reflect more generalized usage.
2008.12.16 [1.4.2] corrected group calculation to prevent 'group=0' error
2008.12.16 [1.4.1] revised tag filtering so excluded tags don't affect calculations
2008.12.15 [1.4.0] added {{{limit:...}}} parameter to restrict the number of tags displayed to the top N most popular
2008.11.15 [1.3.0] added {{{+TiddlerName}}} parameter to include only tags that are listed in the indicated tiddler
2008.09.05 [1.2.0] added '=tagname' parameter to include only tags that are themselves tagged with the specified value (i.e., ~TagglyTagging usage)
2008.07.03 [1.1.0] added 'segments' property to macro object.  Extensive code cleanup
<<<
!Code
***/
//{{{
version.extensions.TagCloudPlugin= {major: 1, minor: 7 , revision: 0, date: new Date(2009,7,17)};
//Originally created by Clint Checketts, contributions by Jonny Leroy and Eric Shulman
//Currently maintained and enhanced by Eric Shulman
//}}}
//{{{
config.macros.cloud = {
	tagstip: "%1 tiddlers tagged with '%0'",
	refslabel: " (%0 references)",
	refstip: "%1 tiddlers have links to '%0'",
	linkslabel: " (%0 links)",
	linkstip: "'%0' has links to %1 other tiddlers",
	groups: 9,
	init: function() {
		config.macros.tagCloud=config.macros.cloud; // for backward-compatibility
		config.shadowTiddlers.TagCloud='<<cloud>>';
		config.shadowTiddlers.StyleSheetTagCloud=
			'/*{{{*/\n'
			+'.tagCloud span {line-height: 3.5em; margin:3px;}\n'
			+'.tagCloud1{font-size: 80%;}\n'
			+'.tagCloud2{font-size: 100%;}\n'
			+'.tagCloud3{font-size: 120%;}\n'
			+'.tagCloud4{font-size: 140%;}\n'
			+'.tagCloud5{font-size: 160%;}\n'
			+'.tagCloud6{font-size: 180%;}\n'
			+'.tagCloud7{font-size: 200%;}\n'
			+'.tagCloud8{font-size: 220%;}\n'
			+'.tagCloud9{font-size: 240%;}\n'
			+'/*}}}*/\n';
		setStylesheet(store.getTiddlerText('StyleSheetTagCloud'),'tagCloudsStyles');
	},
	getLinks: function(tiddler) { // get list of links to existing tiddlers and shadows
		if (!tiddler.linksUpdated) tiddler.changed();
		var list=[]; for (var i=0; i<tiddler.links.length; i++) {
			var title=tiddler.links[i];
			if (store.isShadowTiddler(title)||store.tiddlerExists(title))
				list.push(title);
		}
		return list;
	},
	handler: function(place,macroName,params) {
		// unpack params
		var inc=[]; var ex=[]; var limit=0; var action='popup';
		var links=(params[0]&&params[0].toLowerCase()=='links'); if (links) params.shift();
		var refs=(params[0]&&params[0].toLowerCase()=='references'); if (refs) params.shift();
		if (params[0]&&params[0].substr(0,7).toLowerCase()=='action:')
			action=params.shift().substr(7).toLowerCase();
		if (params[0]&&params[0].substr(0,6).toLowerCase()=='limit:')
			limit=parseInt(params.shift().substr(6));
		while (params.length) {
			if (params[0].substr(0,1)=='+') { // read taglist from tiddler
				inc=inc.concat(store.getTiddlerText(params[0].substr(1),'').readBracketedList());
			} else if (params[0].substr(0,1)=='-') { // exclude taglist from tiddler
				ex=ex.concat(store.getTiddlerText(params[0].substr(1),'').readBracketedList());
			} else if (params[0].substr(0,1)=='=') { // get tag list using tagged tags
				var tagged=store.getTaggedTiddlers(params[0].substr(1));
				for (var t=0; t<tagged.length; t++) inc.push(tagged[t].title);
			} else ex.push(params[0]); // exclude params
			params.shift();
		}
		// get all items, include/exclude specific items
		var items=[];
		var list=(links||refs)?store.getTiddlers('title','excludeLists'):store.getTags();
		for (var t=0; t<list.length; t++) {
			var title=(links||refs)?list[t].title:list[t][0];
			if (links)	var count=this.getLinks(list[t]).length;
			else if (refs)	var count=store.getReferringTiddlers(title).length;
			else 		var count=list[t][1];
			if ((!inc.length||inc.contains(title))&&(!ex.length||!ex.contains(title)))
				items.push({ title:title, count:count });
		}
		if(!items.length) return;
		// sort by decending count, limit results (optional)
		items=items.sort(function(a,b){return(a.count==b.count)?0:(a.count>b.count?-1:1);});
		while (limit && items.length>limit) items.pop();
		// find min/max and group size
		var most=items[0].count;
		var least=items[items.length-1].count;
		var groupSize=(most-least+1)/this.groups;
		// sort by title and draw the cloud of items
		items=items.sort(function(a,b){return(a.title==b.title)?0:(a.title>b.title?1:-1);});
		var cloudWrapper = createTiddlyElement(place,'div',null,'tagCloud',null);
		for (var t=0; t<items.length; t++) {
			cloudWrapper.appendChild(document.createTextNode(' '));
			var group=Math.ceil((items[t].count-least)/groupSize)||1;
			var className='tagCloudtag tagCloud'+group;
			var tip=refs?this.refstip:links?this.linkstip:this.tagstip;
			tip=tip.format([items[t].title,items[t].count]);
			if (action=='goto') { // TAG/LINK/REFERENCES GOTO
				var btn=createTiddlyLink(cloudWrapper,items[t].title,true,className);
				btn.title=tip;
				btn.style.fontWeight='normal';
			} else if (!links&&!refs) { // TAG POPUP
				var btn=createTiddlyButton(cloudWrapper,items[t].title,tip,onClickTag,className);
				btn.setAttribute('tag',items[t].title);
			} else { // LINK/REFERENCES POPUP
				var btn=createTiddlyButton(cloudWrapper,items[t].title,tip,
					function(ev) { var e=ev||window.event; var cmt=config.macros.cloud;
						var popup = Popup.create(this);
						var title = this.getAttribute('tiddler');
						var count = this.getAttribute('count');
						var refs  = this.getAttribute('refs')=='T';
						var links = this.getAttribute('links')=='T';
						var label = (refs?cmt.refslabel:cmt.linkslabel).format([count]);
						createTiddlyLink(popup,title,true);
						createTiddlyText(popup,label);
						createTiddlyElement(popup,'hr');
						if (refs) {
							popup.setAttribute('tiddler',title);
							config.commands.references.handlePopup(popup,title);
						}
						if (links) {
							var tiddler = store.fetchTiddler(title);
							var links=config.macros.cloud.getLinks(tiddler);
							for(var i=0;i<links.length;i++)
								createTiddlyLink(createTiddlyElement(popup,'li'),
									links[i],true);
						}
						Popup.show();
						e.cancelBubble=true; if(e.stopPropagation) e.stopPropagation();
						return false;
					}, className);
				btn.setAttribute('tiddler',items[t].title);
				btn.setAttribute('count',items[t].count);
				btn.setAttribute('refs',refs?'T':'F');
				btn.setAttribute('links',links?'T':'F');
				btn.title=tip;
			}
		}
	}
};
//}}}
/***
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 = 'phys8702';

// 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,{

'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"),

'TspotOptions':[
 "tiddlyspot password:",
 "<<option pasUploadPassword>>",
 ""
].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"),

'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")

});
//}}}
| !date | !user | !location | !storeUrl | !uploadDir | !toFilename | !backupdir | !origin |
| 26/04/2017 11:28:09 | Jorge | [[/|http://phys8702.tiddlyspot.com/]] | [[store.cgi|http://phys8702.tiddlyspot.com/store.cgi]] | . | [[index.html | http://phys8702.tiddlyspot.com/index.html]] | . |
| 25/05/2017 09:03:22 | Jorge | [[/|http://phys8702.tiddlyspot.com/]] | [[store.cgi|http://phys8702.tiddlyspot.com/store.cgi]] | . | [[index.html | http://phys8702.tiddlyspot.com/index.html]] | . |
| 07/12/2018 12:10:05 | Jorge | [[/|http://phys8702.tiddlyspot.com/]] | [[store.cgi|http://phys8702.tiddlyspot.com/store.cgi]] | . | [[index.html | http://phys8702.tiddlyspot.com/index.html]] | . |
| 28/01/2019 10:05:22 | Jorge | [[/|http://phys8702.tiddlyspot.com/]] | [[store.cgi|http://phys8702.tiddlyspot.com/store.cgi]] | . | [[index.html | http://phys8702.tiddlyspot.com/index.html]] | . | ok |
| 28/01/2019 10:07:01 | Jorge | [[/|http://phys8702.tiddlyspot.com/]] | [[store.cgi|http://phys8702.tiddlyspot.com/store.cgi]] | . | [[index.html | http://phys8702.tiddlyspot.com/index.html]] | . | ok |
| 28/01/2019 10:12:57 | Jorge | [[/|http://phys8702.tiddlyspot.com/]] | [[store.cgi|http://phys8702.tiddlyspot.com/store.cgi]] | . | [[index.html | http://phys8702.tiddlyspot.com/index.html]] | . |
| 29/05/2020 08:28:05 | Jorge | [[/|http://phys8702.tiddlyspot.com/]] | [[store.cgi|http://phys8702.tiddlyspot.com/store.cgi]] | . | [[index.html | http://phys8702.tiddlyspot.com/index.html]] | . |
| 11/06/2020 12:48:42 | Jorge | [[/|http://phys8702.tiddlyspot.com/]] | [[store.cgi|http://phys8702.tiddlyspot.com/store.cgi]] | . | [[index.html | http://phys8702.tiddlyspot.com/index.html]] | . |
| 16/06/2020 09:02:38 | Jorge | [[/|http://phys8702.tiddlyspot.com/]] | [[store.cgi|http://phys8702.tiddlyspot.com/store.cgi]] | . | [[index.html | http://phys8702.tiddlyspot.com/index.html]] | . |
| 16/09/2021 14:19:33 | vinals | [[/|http://phys8702.tiddlyspot.com/]] | [[store.cgi|http://phys8702.tiddlyspot.com/store.cgi]] | . | [[index.html | http://phys8702.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");


//}}}