m12.mws

heat1-6.mws Poisson's Equation  -  4 non-homogeneous boundary conditions (Dirichlet)

>    restart;

boundaries:  y=0  f1,  y=M  f2,  x=0  f3,  x=L  f4

>    f[1](x):=x*(L-x);f[2](x):=x*(L-x);f[3](y):=y*(M-y);f[4](y):=y*(M-y);

f[1](x) := x*(L-x)

f[2](x) := x*(L-x)

f[3](y) := y*(M-y)

f[4](y) := y*(M-y)

Volumetric sorce function:

>    F(x,y):=-x*y*(L-x)*(M-y)/50;

F(x,y) := -1/50*x*y*(L-x)*(M-y)

Fourier coefficients:

>    b1[n]:=2/L*int(f[1](x)*sin(n*Pi*x/L),x=0..L);

b1[n] := -2*L^2*(n*Pi*sin(n*Pi)+2*cos(n*Pi)-2)/n^3/Pi^3

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

b2[n] := -2*L^2*(n*Pi*sin(n*Pi)+2*cos(n*Pi)-2)/n^3/Pi^3

>    b3[n]:=2/M*int(f[3](y)*sin(n*Pi*y/M),y=0..M);

b3[n] := -2*M^2*(n*Pi*sin(n*Pi)+2*cos(n*Pi)-2)/n^3/Pi^3

>    b4[n]:=2/M*int(f[4](y)*sin(n*Pi*y/M),y=0..M);

b4[n] := -2*M^2*(n*Pi*sin(n*Pi)+2*cos(n*Pi)-2)/n^3/Pi^3

>    b5[n,m]:=factor(int(int(F(x,y)*sin(n*Pi*x/L)*sin(m*Pi*y/M),x=0..L),y=0..M));

b5[n,m] := -1/50*M^3*L^3*(m*Pi*sin(m*Pi)-2+2*cos(m*Pi))*(n*Pi*sin(n*Pi)+2*cos(n*Pi)-2)/m^3/Pi^6/n^3

>    b5[n,m]:=factor(subs({sin(n*Pi)=0,cos(n*Pi)=(-1)^n,sin(m*Pi)=0,cos(m*Pi)=(-1)^m},b5[n,m]));

b5[n,m] := -2/25*M^3*L^3*(-1+(-1)^m)*(-1+(-1)^n)/m^3/Pi^6/n^3

>    b1[n]:=simplify(factor(subs({sin(n*Pi)=0,cos(n*Pi)=(-1)^n},b1[n])));

b1[n] := -4*L^2*(-1+(-1)^n)/n^3/Pi^3

>    b2[n]:=simplify(factor(subs({sin(n*Pi)=0,cos(n*Pi)=(-1)^n},b2[n])));

b2[n] := -4*L^2*(-1+(-1)^n)/n^3/Pi^3

>    b3[n]:=simplify(factor(subs({sin(n*Pi)=0,cos(n*Pi)=(-1)^n},b3[n])));

b3[n] := -4*M^2*(-1+(-1)^n)/n^3/Pi^3

>    b4[n]:=simplify(factor(subs({sin(n*Pi)=0,cos(n*Pi)=(-1)^n},b4[n])));

b4[n] := -4*M^2*(-1+(-1)^n)/n^3/Pi^3

>    a1[n]:=-b1[n]/sinh(n*Pi*M/L);

a1[n] := 4*L^2*(-1+(-1)^n)/n^3/Pi^3/sinh(n*Pi*M/L)

>    a2[n]:=b2[n]/sinh(n*Pi*M/L);

a2[n] := -4*L^2*(-1+(-1)^n)/n^3/Pi^3/sinh(n*Pi*M/L)

>    a3[n]:=-b3[n]/sinh(n*Pi*L/M);

a3[n] := 4*M^2*(-1+(-1)^n)/n^3/Pi^3/sinh(n*Pi*L/M)

>    a4[n]:=b4[n]/sinh(n*Pi*L/M);

a4[n] := -4*M^2*(-1+(-1)^n)/n^3/Pi^3/sinh(n*Pi*L/M)

>    a5[n,m]:=-4*b5[n,m]/Pi^2/(n^2/L^2+m^2/M^2);

a5[n,m] := 8/25*M^3*L^3*(-1+(-1)^m)*(-1+(-1)^n)/m^3/Pi^8/n^3/(n^2/L^2+m^2/M^2)

Fourier series terms:

>    u1[n](x,y):=a1[n]*sin(n*Pi*x/L)*sinh(n*Pi*(y-M)/L);

u1[n](x,y) := 4*L^2*(-1+(-1)^n)/n^3/Pi^3/sinh(n*Pi*M/L)*sin(n*Pi*x/L)*sinh(n*Pi*(-M+y)/L)

>    u2[n](x,y):=a2[n]*sin(n*Pi*x/L)*sinh(n*Pi*y/L);

u2[n](x,y) := -4*L^2*(-1+(-1)^n)/n^3/Pi^3/sinh(n*Pi*M/L)*sin(n*Pi*x/L)*sinh(n*Pi*y/L)

>    u3[n](x,y):=a3[n]*sinh(n*Pi*(x-L)/M)*sin(n*Pi*y/M);

u3[n](x,y) := 4*M^2*(-1+(-1)^n)/n^3/Pi^3/sinh(n*Pi*L/M)*sinh(n*Pi*(x-L)/M)*sin(n*Pi*y/M)

>    u4[n](x,y):=a4[n]*sinh(n*Pi*x/M)*sin(n*Pi*y/M);

u4[n](x,y) := -4*M^2*(-1+(-1)^n)/n^3/Pi^3/sinh(n*Pi*L/M)*sinh(n*Pi*x/M)*sin(n*Pi*y/M)

>    u5[n,m](x,y):=a5[n,m]*sin(n*Pi*x/L)*sin(m*Pi*y/M);

u5[n,m](x,y) := 8/25*M^3*L^3*(-1+(-1)^m)*(-1+(-1)^n)/m^3/Pi^8/n^3/(n^2/L^2+m^2/M^2)*sin(n*Pi*x/L)*sin(m*Pi*y/M)

>    L:=4;M:=3;

L := 4

M := 3

Solution of supplemental problems:

>    u1(x,y):=sum(u1[n](x,y),n=1..40):

>    u2(x,y):=sum(u2[n](x,y),n=1..40):

>    u3(x,y):=sum(u3[n](x,y),n=1..40):

>    u4(x,y):=sum(u4[n](x,y),n=1..40):

>    u5(x,y):=sum(sum(u5[n,m](x,y),n=1..4),m=1..40):

SOLUTION:

>    u(x,y):=u1(x,y)+u2(x,y)+u3(x,y)+u4(x,y)+u5(x,y):

>    plot3d(u(x,y),x=0..L,y=0..M,axes=boxed,projection=0.9);

[Maple Plot]

>    plot3d(F(x,y),x=0..L,y=0..M,axes=boxed,projection=0.9);

[Maple Plot]

>    with(plots):

Warning, the name changecoords has been redefined

>    densityplot(u(x,y),x=0..L,y=0..M,grid=[50,50],scaling=constrained,axes=none,style=patchnogrid);

[Maple Plot]

>    contourplot(u(x,y),x=0..L,y=0..M,grid=[50,50],scaling=constrained,axes=boxed,filled=true,contours=10,coloring=[white,blue],grid=[100,100]);

[Maple Plot]

>   

>