m17.mws 020 4.6.4 1) wave-1-DR.mws WAVE EQUATION X(0)=0, X'(L)+HX(L)=0 (Dirichlet-Robin)
> | restart; |
> | L:=10;H[2]:=3;a:=2; |
characteristic equation:
> | w(x):=x*cos(x*L)+H[2]*sin(x*L); |
> | plot(w(x),x=0..2); |
Eigenvalues:
> | lambda:=array(1..100); |
> | n:=1: for m from 1 to 100 do z:=fsolve(w(x)=0,x=m/5..(m+1)/5): if type(z,float) then lambda[n]:=z: n:=n+1 fi od: |
> | for i to 5 do lambda[i] od; |
> | N:=n-1; |
> | n:='n':i:='i': |
Eigenfunctions:
> | X[n]:=sin(lambda[n]*x); |
Squared norm:
> | NX2[n]:=int(X[n]^2,x=0..L); |
Initial conditions:
sinusoidal:
> | u0(x):=sin(x/L);u1(x):=sin(2*x/L); |
impulse:
> | u0(x):=(Heaviside(x-6)-Heaviside(x-7));u1(x):=0; |
parabolic:
> | u0(x):=x*(L-x);u1(x):=1; |
Fourier coefficients:
> | b[n]:=int(u0(x)*X[n],x=0..L)/NX2[n]; |
> | d[n]:=int(u1(x)*X[n],x=0..L)/NX2[n]/lambda[n]/a; |
Solution:
> | u(x,t):=sum(X[n]*(b[n]*cos(lambda[n]*a*t)+d[n]*sin(lambda[n]*a*t)),n=1..N): |
> | plot3d({u(x,t)},x=0..L,t=0..21,axes=boxed,style=wireframe,projection=0.9,color=black); |
> | with(plots): |
Warning, the name changecoords has been redefined
> | animate({u(x,t),u0(x)},x=0..L,t=0..21,axes=boxed,frames=500); |
> |
SINGLE WAVE:
> | u0(x):=(Heaviside(x-6)-Heaviside(x-7));u1(x):=0; |
Fourier coefficients:
> | b[n]:=int(u0(x)*X[n],x=0..L)/NX2[n]; |
> | d[n]:=int(u1(x)*X[n],x=0..L)/NX2[n]/lambda[n]/a; |
Solution:
> | u(x,t):=sum(X[n]*(b[n]*cos(lambda[n]*a*t)+d[n]*sin(lambda[n]*a*t)),n=1..N): |
> | plot3d({u(x,t)},x=0..L,t=0..12,axes=boxed,projection=0.9,style=wireframe,grid=[150,150]); |
> | with(plots): |
> | animate({u(x,t),u0(x)},x=0..L,t=0..21,axes=boxed,frames=300,numpoints=500); |
NORMAL MODES:
fundamental mode:
> | m1:=subs(n=1,X[n]*(b[n]*cos(lambda[n]*a*t)+d[n]*sin(lambda[n]*a*t))): |
> | animate({m1},x=0..L,t=0..9); |
1st overtone:
> | m2:=subs(n=2,X[n]*(b[n]*cos(lambda[n]*a*t)+d[n]*sin(lambda[n]*a*t))): |
> | animate({m2},x=0..L,t=0..9); |
2nd overtone:
> | m3:=subs(n=3,X[n]*(b[n]*cos(lambda[n]*a*t)+d[n]*sin(lambda[n]*a*t))): |
> | animate({m3},x=0..L,t=0..9); |
3rd overtone:
> | m4:=subs(n=4,X[n]*(b[n]*cos(lambda[n]*a*t)+d[n]*sin(lambda[n]*a*t))): |
> | animate({m4},x=0..L,t=0..9); |
> |
Standing Waves: initial condition is in the form of overtone:
> | u0(x):=subs(n=8,X[n]*(b[n]*cos(lambda[n]*a*t)+d[n]*sin(lambda[n]*a*t))):u1(x):=0; |
Fourier coefficients:
> | b[n]:=int(u0(x)*X[n],x=0..L)/NX2[n]; |
> | d[n]:=int(u1(x)*X[n],x=0..L)/NX2[n]/lambda[n]/a; |
Solution:
> | u(x,t):=sum(X[n]*(b[n]*cos(lambda[n]*a*t)+d[n]*sin(lambda[n]*a*t)),n=1..N): |
> | with(plots): |
> | animate({u(x,t),u0(x)},x=0..L,t=0..21,axes=boxed,frames=300,numpoints=500); |