SetDirectory[$HomeDirectory<>"/Documents/handouts/math467/SwingingChain"]

Swinging Chain

nsoln=First[NDSolve[{u[0,t]==0,u[x,0]==x,-D[u[x,t],x]+(1-x)D[u[x,t],x,x]==D[u[x,t],t,t]},u,{x,0,1},{t,0,5}]]

Plot3D[u[x,t]/.nsoln,{x,0,1},{t,0,5},AxesLabel->{"x","t","u(x,t)"}]

ParametricPlot[{{u[x,t]/.nsoln/.t->0,-x},{u[x,t]/.nsoln/.t->5/4,-x},{u[x,t]/.nsoln/.t->5/2,-x},{u[x,t]/.nsoln/.t->15/4,-x},{u[x,t]/.nsoln/.t->5,-x}},{x,0,1},Ticks->{Automatic,Table[{z,-z},{z,0,-1,-0.2}]},AxesLabel->{"\!\(\*TemplateBox[<|"boxes" -> FormBox[
RowBox[{
StyleBox["u", "TI"], "(", 
RowBox[{
StyleBox["x", "TI"], ",", 
StyleBox["t", "TI"]}], ")"}], TraditionalForm], "errors" -> {}, "input" -> "u(x,t)", "state" -> "Boxes"|>,"TeXAssistantTemplate"]\)","\!\(\*TemplateBox[<|"boxes" -> FormBox[
StyleBox["x", "TI"], TraditionalForm], "errors" -> {}, "input" -> "x", "state" -> "Boxes"|>,"TeXAssistantTemplate"]\)"},Epilog->{Text["\!\(\*TemplateBox[<|"boxes" -> FormBox[
RowBox[{
StyleBox["u", "TI"], "(", 
RowBox[{
StyleBox["x", "TI"], ",", "0"}], ")"}], TraditionalForm], "errors" -> {}, "input" -> "u(x, 0)", "state" -> "Boxes"|>,"TeXAssistantTemplate"]\)",{0.55,-0.6},Background->White],Text["\!\(\*TemplateBox[<|"boxes" -> FormBox[
RowBox[{
StyleBox["u", "TI"], "(", 
RowBox[{
StyleBox["x", "TI"], ",", "5", "/", "4"}], ")"}], TraditionalForm], "errors" -> {}, "input" -> "u(x,5/4)", "state" -> "Boxes"|>,"TeXAssistantTemplate"]\)",{0.3,-0.95},Background->White],Text["\!\(\*TemplateBox[<|"boxes" -> FormBox[
RowBox[{
StyleBox["u", "TI"], "(", 
RowBox[{
StyleBox["x", "TI"], ",", "5", "/", "2"}], ")"}], TraditionalForm], "errors" -> {}, "input" -> "u(x,5/2)", "state" -> "Boxes"|>,"TeXAssistantTemplate"]\)",{-1.1,-0.8},Background->White],Text["\!\(\*TemplateBox[<|"boxes" -> FormBox[
RowBox[{
StyleBox["u", "TI"], "(", 
RowBox[{
StyleBox["x", "TI"], ",", "15", "/", "4"}], ")"}], TraditionalForm], "errors" -> {}, "input" -> "u (x, 15/4)", "state" -> "Boxes"|>,"TeXAssistantTemplate"]\)",{-0.3,-0.9},Background->White],Text["\!\(\*TemplateBox[<|"boxes" -> FormBox[
RowBox[{
StyleBox["u", "TI"], "(", 
RowBox[{
StyleBox["x", "TI"], ",", "5"}], ")"}], TraditionalForm], "errors" -> {}, "input" -> "u (x, 5)", "state" -> "Boxes"|>,"TeXAssistantTemplate"]\)",{1.0,-0.7},Background->White]},BaseStyle->FontSize->12]

Export["chain.eps",%,"EPS"]

Export["chain.pdf",%%,"PDF"]