problem 3.2

eq=x''[t]+2x'[t]+3x[t]==Sin[t]+DiracDelta[t-Pi];
sol=DSolve[{eq,x[0]==0,x'[0]==1},x[t],t]

sol=x[t]/.First[sol]
Simplify[sol]

Plot[sol,{t,0,15}]

p1=Plot[{Sin[t],sol},{t,0,15},Frame->True,FrameLabel->{"time t","x(t)",Solution}];
p2=Graphics[Arrow[ {{Pi,0},{Pi,.8}}]];
Show[p1,p2]

x[t_]:=Exp[-t]((1/4)Cos[(Sqrt[2])t]+(1/(Sqrt[2]))Sin[(Sqrt[2])t])-(1/4)Cos[t]+(1/4)Sin[t]+(1/(Sqrt[2]))Exp[-(t-π)]Sin[(Sqrt[2])(t-π)]UnitStep[t-π]

p1=Plot[{Sin[t],x[t]},{t,0,15},Frame->True,FrameLabel->{"time t","x(t)",Solution}];
p2=Graphics[Arrow[ {{Pi,0},{Pi,.8}}]];
Show[p1,p2]

Problem 3.16

eq=3 x''[t]+6x'[t]+12x[t]==3DiracDelta[t]-DiracDelta[t-1];
sol=DSolve[{eq,x[0]==1/100,x'[0]==1},x[t],t]
sol=x[t]/.First[sol]
Simplify[sol]
Plot[sol,{t,0,15},PlotRange->All]

eq= x''[t]+2x'[t]+4x[t]==DiracDelta[t]-(1/3)DiracDelta[t-1];
mysol=Exp[-t]((1/100)Cos[(Sqrt[3])t]+(1/(100(Sqrt[3])))Sin[(Sqrt[3])t])+(1/(Sqrt[3]))Exp[-t]Sin[(Sqrt[3])t]-(1/3)((1/(Sqrt[3])))Exp[-(t-1)]Sin[(Sqrt[3])(t-1)]UnitStep[t-1]
p1=Plot[mysol,{t,0,15},Frame->True,FrameLabel->{"time t","x(t)","solution to"eq},PlotRange->{{-1,15},{-.32,1}}];

Plot[mysol,{t,0,15},Frame->True,FrameLabel->{"time t","x(t)","solution to"eq},PlotRange->All]

p2=Graphics[Arrow[ {{0,0},{0,1}}]];
p3=Graphics[Arrow[ {{1,0},{1,-1/3}}]];
Show[p1,p2,p3]

eq= x''[t]+x'[t]+x[t]==DiracDelta[t];
sol=DSolve[{eq,x[0]==1,x'[0]==0},x[t],t]
sol=x[t]/.First[sol]

Problem 3.21

y[t_]:=Piecewise[{{2.5 t,0≤ t≤0.2},{0.75-1.25 t,0.2<t≤ 0.6},{0,t>0.6}}]
Plot[y[t],{t,0,1}]

w=Sqrt[1500/5000]//N
sol[t_]:=Piecewise[{{2.5 t-(2.5/w) Sin[w t],0≤ t<0.2},
{0.75-1.25 t+((3.75/w)) Sin[w(t-0.2)]-((2.5/w)) Sin[w t],0.2≤ t≤ 0.6},{((3.75/w)) Sin[w(t-0.2)]-((2.5/w))  Sin[w t]-((1.25/w)) Sin[w(t-0.6)],t>0.6}}]

Plot[{y[t],sol[t]},{t,0,10},PlotRange->{{0,10},{-.1,.6}},Frame->True,FrameLabel->{"time t","x(t),y(t)","Solution"}]

Input y(t)

w=Sqrt[1500/5000]//N
sol2[t_]:=Piecewise[{{2.5 w Integrate[tao Sin[w(t-tao)],{tao,0,t}]//Chop,0≤ t≤0.2},
{2.5 w Integrate[tao Sin[w(t-tao)],{tao,0,.2}]+w Integrate[(0.75-1.25 tao)Sin[w(t-tao)],{tao,0.2,t}]//Chop,0.2<t≤ 0.6},{2.5 w Integrate[tao Sin[w(t-tao)],{tao,0,.2}]+w Integrate[(0.75-1.25 tao)Sin[w(t-tao)],{tao,0.2,0.6}]//Chop,t>0.6}}]

data=Table[sol2[t],{t,0,10,.1}]
ListPlot[data,PlotRange->All,AxesOrigin->{0,0}]

w=Sqrt[1500/5000]//N
sol3[t_]:=Piecewise[{{2.5t-w Sin[w t],0≤ t≤0.2},
{0.75-0.5 Cos[w(t-0.2)]-1.25 t+2.28 Sin[w(t-0.2)],0.2<t≤ 0.6},{-0.5 Cos[w(t-0.2)]-2.28 Sin[w(t-0.6)]+2.28 Sin[w(t-0.2)],t>0.6}}]
Plot[sol3[t],{t,0,10},PlotRange->All]

Plot[0.75-0.5 Cos[w(t-0.2)]-1.25 t+2.28 Sin[w(t-0.2)]-(0.75-1.25 t+6.8466 Sin[w(t-0.2)]-4.5644 Sin[w t]),{t,0,30}]

w=Sqrt[1500/5000]//N
foo=(2.5 w Integrate[tao Sin[w(t-tao)],{tao,0,.2}]+w Integrate[(0.75-1.25 tao)Sin[w(t-tao)],{tao,0.2,t}]//Chop)
Plot[0.75-0.5 Cos[w(t-0.2)]-1.25 t+2.28 Sin[w(t-0.2)]-foo,{t,0,30}]

w=Sqrt[1500/5000]//N
foo=(2.5 w Integrate[tao Sin[w(t-tao)],{tao,0,.2}]+w Integrate[(0.75-1.25 tao)Sin[w(t-tao)],{tao,0.2,t}]//Chop)
Plot[0.75-0.5 Cos[w(t-0.2)]-1.25 t+2.28 Sin[w(t-0.2)]-foo,{t,0,30}]

?Piecwise

?Pie*

m=5000; k=1500;
eq=m x''[t]+k x[t]==k y[t]

sol=First[DSolve[{eq,x[0]==0,x'[0]==0},x[t],t]]

x2=0.7499999999999999`-1.2499999999999998` t-0.7485008997428999` Cos[0.5477225575051661` t]+2.241139193888961` Sin[0.5477225575051661` t];
x3=-0.011928186919133109` Cos[0.5477225575051662` t]+0.08109429341657293` Sin[0.5477225575051662` t];

w=0.5477225575051661`;
myx2=0.75-1.25 t+6.8466 Sin[w(t-0.2)]-4.5644 Sin[w t];
diff=myx2-x2//Chop

FullSimplify[diff]//Chop

2.5 w Integrate[tao Sin[w(t-tao)],{tao,0,.2}]+w Integrate[(0.75-1.25 tao)Sin[w(t-tao)],{tao,0.2,0.6}]//Expand//Chop

2.5 w Integrate[tao Sin[w(t-tao)],{tao,0,.2}]//Expand//Chop

x2=0.75`-1.2499999999999998` t-0.7485008997429` Cos[0.5477225575051661` t]+2.241139193888962` Sin[0.5477225575051661` t]

myx2-x2//FullSimplify//Chop

problem 3.29

T=2 Pi
Assuming[Element[n,Integers],(2/T)Integrate[(t/T)Cos[n t],{t,0,T}]]

f[t_]:=

Plot[SawtoothWave[x],{x,0,4Pi}]

?Saw*

Plot[SawtoothWave[x],{x,0,2}]

Plot[SawtoothWave[x/(2 Pi)],{x,0,3 Pi}]

f[t_]:=SawtoothWave[t/(2 Pi)]

?Fou*

PlotForn[n_]:=Plot[Evaluate[{f[t],FourierTrigSeries[f[t],t,n]}],{t,0,6 Pi},PlotLabel->"n="<>ToString[n],AxesLabel->{t,"(OverTilde[f])(t)"}]

FourierTrigSeries[f[t],t,4]

Grid[{   {PlotForn[2],PlotForn[3]},{PlotForn[4],PlotForn[5]},{PlotForn[6],PlotForn[7]}},Spacings->.1]

y[t_]:=Piecewise[{{f Sin[Pi t/t1],0≤ t≤t1},{0,t>t1}}]
h[t_]:=(1/(w m))Sin[w t]
x=Assuming[0<t≤t1&&t1>0,Integrate[F0 Sin[Pi tao/t1]*h[t-tao],{tao,0,t1}]]

eq=D[x,t]==0
Assuming[t>t1,Reduce[%,t]]

Problem 3.44

tp=((2 n Pi)/(wn+w))
x[t_]:=((f/k)/((1-((((w/wn)))^2))))(Sin[w t]-((w/wn))Sin[wn t])

sol=x[tp]

Assuming[Element[n,Integers]&&w>0&&wn>0,FullSimplify[sol]]