Aaltoyhtälö

K3/P3 to 8.12.05

Alustukset

>    restart:

>    with(plots): setoptions3d(orientation=[-120,50],axes=box):

Warning, the name changecoords has been redefined

>    read("e:\\ns05.mpl");

>   

Normaalimoodit

>    u:=(n,x,t)->cos(c*n*Pi*t/L)*sin(n*Pi*x/L);

u := proc (n, x, t) options operator, arrow; cos(c*n*Pi*t/L)*sin(n*Pi*x/L) end proc

>    L:=2: c:=3:

>    plot3d(u(1,x,t),x=0..L,t=0..5,axes=boxed);

[Maple Plot]

>    kuvax:=(n,t)->plot(u(n,x,t),x=0..L):

>    kuvax(1,0);

[Maple Plot]

>    h:=0.05: N:=30:

>    display(seq(kuvax(1,t),t=[seq(j*h,j=0..N)]),insequence=true);

[Maple Plot]

>    h:=0.02: N:=30:

>    display(seq(kuvax(3,t),t=[seq(j*h,j=0..N)]),insequence=true);

[Maple Plot]

>    N:=60:h:=0.01:display(seq(kuvax(5,t),t=[seq(j*h,j=0..N)]),insequence=false);

[Maple Plot]

>    plot3d(u(3,x,t),x=0..L,t=0..1,axes=boxed,grid=[20,70]);

[Maple Plot]

Muuttujien erottelulla saatava ratkaisukaava

Otetaan seuraavaa esimerkkiä varten vain tapaus, jossa alkunopeus =0.

>    restart:

>    with(plots): setoptions3d(orientation=[-120,50],axes=box):

Warning, the name changecoords has been redefined

>    read("e:\\ns05.mpl");

>    un:=cos(c*n*Pi*t/L)*sin(n*Pi*x/L);     

un := cos(c*n*Pi*t/L)*sin(n*Pi*x/L)

>    usarja:=Sum(B[n]*un,n=1..infinity);   

usarja := Sum(B[n]*cos(c*n*Pi*t/L)*sin(n*Pi*x/L),n = 1 .. infinity)

>    Bn:=(2/L)*int(f(x)*sin(n*Pi*x/L),x=0..L);  

Bn := 2/L*int(f(x)*sin(n*Pi*x/L),x = 0 .. L)

Esim :  (KRE Exa 1 s. 593) Komiomainen alkupoikkeutus ilman alkunopeutta.

>    L:=2: f:=x->piecewise(0<x and x < 1,x,1<x and x < 2,2-x);

f := proc (x) options operator, arrow; piecewise(0 < x and x < 1,x,1 < x and x < 2,2-x) end proc

>    Bn;

4*(-sin(n*Pi)+2*sin(1/2*n*Pi))/n^2/Pi^2

>    Bn:=trigsiev(Bn,n);

Bn := 8/n^2/Pi^2*sin(1/2*n*Pi)

>    seq(Bn,n=1..10);

8/Pi^2, 0, -8/9/Pi^2, 0, 8/25/Pi^2, 0, -8/49/Pi^2, 0, 8/81/Pi^2, 0

>    usumma:=(x,t,N)->add(Bn*un,n=1..N);

usumma := proc (x, t, N) options operator, arrow; add(Bn*un,n = 1 .. N) end proc

>    usumma(x,t,10);

8/Pi^2*cos(1/2*c*Pi*t)*sin(1/2*Pi*x)-8/9*1/Pi^2*cos(3/2*c*Pi*t)*sin(3/2*Pi*x)+8/25*1/Pi^2*cos(5/2*c*Pi*t)*sin(5/2*Pi*x)-8/49*1/Pi^2*cos(7/2*c*Pi*t)*sin(7/2*Pi*x)+8/81*1/Pi^2*cos(9/2*c*Pi*t)*sin(9/2*Pi*...
8/Pi^2*cos(1/2*c*Pi*t)*sin(1/2*Pi*x)-8/9*1/Pi^2*cos(3/2*c*Pi*t)*sin(3/2*Pi*x)+8/25*1/Pi^2*cos(5/2*c*Pi*t)*sin(5/2*Pi*x)-8/49*1/Pi^2*cos(7/2*c*Pi*t)*sin(7/2*Pi*x)+8/81*1/Pi^2*cos(9/2*c*Pi*t)*sin(9/2*Pi*...

>    c:=2:animate(usumma(x,t,10),x=0..L,t=0..2,frames=50);

[Maple Plot]

>    plot3d(usumma(x,t,10),x=0..L,t=0..2);

[Maple Plot]

Ratkaisu voidaan esittää ilman sarjaa käyttämällä f-funktion paritonta 2L-jaksoista laajennusta f*  (ftahti).

>    ftahti:=JJ(paritonjatko(f),-L..L);

ftahti := proc (x::algebraic) local y; y := floor(1/2+1/4*x); proc (x) options operator, arrow; piecewise(0 < x,piecewise(-x < 0 and x < 1,x,-x < -1 and x < 2,2-x),x < 0,-piecewise(x < 0 and -x < 1,-x,...
ftahti := proc (x::algebraic) local y; y := floor(1/2+1/4*x); proc (x) options operator, arrow; piecewise(0 < x,piecewise(-x < 0 and x < 1,x,-x < -1 and x < 2,2-x),x < 0,-piecewise(x < 0 and -x < 1,-x,...
ftahti := proc (x::algebraic) local y; y := floor(1/2+1/4*x); proc (x) options operator, arrow; piecewise(0 < x,piecewise(-x < 0 and x < 1,x,-x < -1 and x < 2,2-x),x < 0,-piecewise(x < 0 and -x < 1,-x,...
ftahti := proc (x::algebraic) local y; y := floor(1/2+1/4*x); proc (x) options operator, arrow; piecewise(0 < x,piecewise(-x < 0 and x < 1,x,-x < -1 and x < 2,2-x),x < 0,-piecewise(x < 0 and -x < 1,-x,...
ftahti := proc (x::algebraic) local y; y := floor(1/2+1/4*x); proc (x) options operator, arrow; piecewise(0 < x,piecewise(-x < 0 and x < 1,x,-x < -1 and x < 2,2-x),x < 0,-piecewise(x < 0 and -x < 1,-x,...
ftahti := proc (x::algebraic) local y; y := floor(1/2+1/4*x); proc (x) options operator, arrow; piecewise(0 < x,piecewise(-x < 0 and x < 1,x,-x < -1 and x < 2,2-x),x < 0,-piecewise(x < 0 and -x < 1,-x,...

>    plot(ftahti,-4..4);

[Maple Plot]

>    u:=(x,t)->1/2*(ftahti(x-c*t)+ftahti(x+c*t));

u := proc (x, t) options operator, arrow; 1/2*ftahti(x-c*t)+1/2*ftahti(x+c*t) end proc

>    uoikea:=(x,t)->1/2*(ftahti(x-c*t));

uoikea := proc (x, t) options operator, arrow; 1/2*ftahti(x-c*t) end proc

>    uvasen:=(x,t)->1/2*(ftahti(x+c*t));

uvasen := proc (x, t) options operator, arrow; 1/2*ftahti(x+c*t) end proc

>    oikea:=t->plot(uoikea(x,t),x=0..L,color=blue);

oikea := proc (t) options operator, arrow; plot(uoikea(x,t),x = 0 .. L,color = blue) end proc

>    vasen:=t->plot(uvasen(x,t),x=0..L,color=red);

vasen := proc (t) options operator, arrow; plot(uvasen(x,t),x = 0 .. L,color = red) end proc

>    koko:=t->plot(u(x,t),x=0..L,color=black);

koko := proc (t) options operator, arrow; plot(u(x,t),x = 0 .. L,color = black) end proc

>    koko(0.1);

[Maple Plot]

>    display(oikea(0.1),vasen(0.1),koko(0.1));

[Maple Plot]

>    VOK:=t->display(oikea(t),vasen(t),koko(t));

VOK := proc (t) options operator, arrow; display(oikea(t),vasen(t),koko(t)) end proc

>    N:=40: h:=0.1:display(seq(VOK(t),t=[seq(k*h,k=0..N)]),insequence=true);

[Maple Plot]

>   

>