Assignment 8 Wave Equation
Spring 2021

uzero[x_]=(Sin[x]-1.5 Sin[3x])/4;

Show[Plot[(Sin[x]-1.5 Sin[3x])/4,{x,0,Pi},PlotStyle->Black,AspectRatio->Automatic,Ticks->None],ParametricPlot[{1.3,t},{t,0,uzero[1.3]},PlotStyle->Black]]

u[x_]=x (x-1) + x;

Plot[u[x],{x,0,1}]

stringpoints=Table[{k/10,0},{k,0,10}]

ListPlot[stringpoints,PlotStyle->{AbsolutePointSize[8],Black},Ticks->None]

imagestring=Table[{u[k/10],0},{k,0,10}];

ListPlot[imagestring,PlotStyle->{AbsolutePointSize[8],Black},Ticks->None]

Plot[TriangleWave[x],{x,0,1}]

Plot[TriangleWave[t+1/4]/4,{t,0,2}]

middleheight[t_]=1/8+TriangleWave[t+1/4]/8;

Plot[middleheight[t],{t,0,2},AspectRatio->Automatic]

Plot[Abs[TriangleWave[x/2]/4],{x,0,1},AspectRatio->Automatic]

Plot[Sign[TriangleWave[t/2+1/4]],{t,-1,2}]

rightu[x_,t_]=x+Min[middleheight[t],Abs[TriangleWave[x/2]/4]] Sign[TriangleWave[t/2+1/4]];

Plot[rightu[x,1/4],{x,0,1}]

Animate[Plot[rightu[x,t],{x,0,1},PlotRange->{{0,1},{0,1}},AspectRatio->Automatic],{t,0,2}]

Plot3D[rightu[x,t],{x,0,1},{t,0,2}]

Animate[Show[ListPlot[Table[{rightu[k/10,t],0},{k,0,10}],PlotStyle->AbsolutePointSize[6]],ListPlot[Table[{rightu[k/10,t],0},{k,5,5}],PlotStyle->{AbsolutePointSize[8],Red}]],{t,0,2}]

nuzero[x_]=Piecewise[{{3 x/2, x ≤ 1/2},{(x-1/2)/2+3/4,x>1/2}}]

Plot[nuzero[x],{x,0,1},AspectRatio->Automatic,PlotStyle->Black]

nimagestring=Table[{nuzero[k/10],0},{k,0,10}];

ListPlot[nimagestring,PlotStyle->{AbsolutePointSize[8],Black},Ticks->None]

initri=Plot[-Abs[x-1/2]+1/2,{x,0,1},PlotStyle->Black,PlotRange->{0,1},AspectRatio->Automatic]

Show[initri,Plot[1/2-x,{x,0,1/2},PlotStyle->{Black,Dashed}],Plot[-1/2+x,{x,1/2,1},PlotStyle->{Black,Dashed}]]

Show[initri,Plot[1/2-x,{x,0,1/2},PlotStyle->{Black,Dashed}],Plot[-1/2+x,{x,1/2,1},PlotStyle->{Black,Dashed}],ListPlot[{{0.15,0.3}},PlotStyle->{AbsolutePointSize[6],Black}],Plot[{Abs[x-0.15/2]+0.15/2,-Abs[x-0.15]+0.3},{x,0,0.45/2},PlotStyle->{{Black,Dashed},{Black,Dashed}},Filling->{1->{2}},FillingStyle->GrayLevel[0.9]],PlotRange->{{0,1/2},{0,1/2}}]

inter=Show[Plot[rightu[x,1/8],{x,0,1},PlotStyle->Black],ParametricPlot[{1/2-1/8,t},{t,0,rightu[1/2-1/8,1/8]},PlotStyle->{Black,Dashed}],ParametricPlot[{1/2+1/8,t},{t,0,rightu[1/2+1/8,1/8]},PlotStyle->{Black,Dashed}],AspectRatio->Automatic]

Show[inter,Plot[nuzero[x],{x,0,1},AspectRatio->Automatic,PlotStyle->{Black,Dashed}]]