4.6.2 heat1-1.mws Laplace's equation, 3 homogenous boundary conditions (Dirichlet) (example1)
> | restart; |
Non-homogeneous boundary condition:
> | f(y):=1; |
Fourier coefficients:
> | b[n]:=2*int(f(y)*sin(n*Pi*y/M),y=0..M)/M; |
> | b[n]:=factor(subs({sin(n*Pi)=0,cos(n*Pi)=(-1)^n},b[n])); |
> | a[n]:=-b[n]/sinh(n*Pi*L/M); |
> | u[n](x,y):=a[n]*sinh(n*Pi*(x-L)/M)*sin(n*Pi*y/M); |
> | L:=2;M:=3; |
> | plot(f(y),y=0..M); |
VISUALIZATION OF THE SOLUTION:
> | u(x,y):=sum(u[n](x,y),n=1..100): |
surface with fixed boundaries:
> | plot3d(u(x,y),x=0..L,y=0..M,axes=boxed,projection=0.9); |
> | with(plots): |
Warning, the name changecoords has been redefined
stationary distribution of density field:
> | densityplot(u(x,y),x=0..L,y=0..M,axes=none,grid=[100,100],style=patchnogrid); |
countourplot with level curves:
> | contourplot(u(x,y),x=0..L,y=0..M,axes=boxed,filled=true,contours=10,coloring=[white,blue],grid=[100,100]); |
> |