kill(all)$

laplace equation 2D (numerical molecule)
peter.vlasschaert@gmail.com,02/11/2017

2D laplace equation : ∂/∂x(∂/∂x(u)) +  ∂/∂y(∂/∂y(u)) = 0,u=u(x,y)
rem: 
1D laplace equation : ∂/∂x(∂/∂x(u)) = 0,u=u(x)
2D laplace equation : ∂/∂x(∂/∂x(u)) +  ∂/∂y(∂/∂y(u)) = 0,u=u(x,y)
3D laplace equation : ∂/∂x(∂/∂x(u)) +  ∂/∂y(∂/∂y(u)) +∂/∂z(∂/∂z(u))= 0,u=u(x,y,z)

nu :2;

∂/∂x(∂/∂x(u))  ' numerical scheme '

y(x,nu):=sum(a_[k]*x^k, k, 0,nu);

' x - direction '   =>  x0-h1,x0,x0+h1
grid spacing 'x' = h1

p1:ya=y(x0-h1,nu);
p2:yb=y(x0,nu);
p3:yc=y(x0+h1,nu);

p4:ev(solve([p1,p2,p3],[a_[0],a_[1],a_[2]]),x0=0)[1];
p5:p4[3];

p6:'diff(u,x,2) = rhs(p5);

p6a:ya=u(i-1,j);
p6b:yb=u(i,j);
p6c:yc =u(i+1,j);

p7:ev(p6,p6a,p6b,p6c);

∂/∂y(∂/∂y(u))  ' numerical scheme '

' y - direction '   =>  y0-h2,y0,y0+h2
 grid spacing 'y' = h2

p8:yaa=y(y0-h2,nu);
p9:ybb=y(x0,nu);
p10:ycc=y(x0+h2,nu);

p11a:ya=u(i,j-1);
p11b:yb=u(i,j);
p11c:yc =u(i,j+1);

p11:'diff(u,y,2) = ev(rhs(p5),p11a,p11b,p11c,h1=h2);

laplace equation : diff(u,x,2)+diff(u,y,2) =0

symbolic representation : ' laplace equation '

p12:lhs(p7+p11) = 0;

numerical representation : ' laplace equation '
grid spacing ' x direction ' = h1
grid spacing ' y direction ' = h2

p13:rhs(p7+p11)=0;

simplify 'p13'

p13aa : part(p13,1,1,2,1);

laplace equation : for 'general gridpoint ' => inside domain

p14:p13aa*rhs(p7)$
p15:p13aa*rhs(p11)$
p16:p14+p15 = 0;

numerical representation : ' laplace equation '
grid spacing ' x direction ' = h1 = h
grid spacing ' y direction ' = h2 = h

p17a:h1=h;
p17b:h2=h;

p18:ev(p16,p17a,p17b)$
p19:radcan(p18);

representation laplace equation with ' indices notation '

p20:uu(i,j):=uu[i,j];

p21:ev(p19,u=uu)$
p22:ev(p21,uu=u);

four directions : seen from the center point = u(i,j) 'red color Figure 2  '
                            North  = u(i,j+1)
                            South = u(i,j-1)
                            West  = u(i-1,j)
                            East   = u(i+1,j)         
rem : four surrounding points ,distance 'h' away from the center point.          'p19'
=>   see :  Figure 1 , Figure 2

3D laplace equation : ∂/∂x(∂/∂x(u)) +  ∂/∂y(∂/∂y(u)) +∂/∂z(∂/∂z(u))= 0,u=u(x,y,z)
' z - direction '   =>  z0-h3,z0,z0+h3 = 'bottom,center,top'
 =>    grid spacing 'x' = h1
 =>    grid spacing 'y' = h2
 =>    grid spacing 'z' = h3 
top        =  above the plane of Figure 2.
bottom =  below the plane of Figure 2.
=>  representation :3D dimensional laplace equation.
rem : point red 3D  '(x0,y0,z0)'