| LIB "findifs.lib";
findifs_example();
==> * Equation: u_tt - A^2 u_xx -B^2 u_yy = 0; A,B are constants
==> * we employ three central differences
==> * the vector we act on is (u_xx, u_yy, u_tt, u)^T
==> * Set up the ring:
==> ring r = (0,A,B,dt,dx,dy),(Tx,Ty,Tt),(c,dp);
==> * Set up the matrix with equation and approximations:
==> matrix M[4][4] =
==> // direct equation:
==> -A^2, -B^2, 1, 0,
==> // central difference u_tt
==> 0, 0, -dt^2*Tt, (Tt-1)^2,
==> // central difference u_xx
==> -dx^2*Tx, 0, 0, (Tx-1)^2,
==> // central difference u_yy
==> 0, -dy^2*Ty, 0, (Ty-1)^2;
==> * Print the differential form of equations:
==> (-A^2)*Uxx+(-B^2)*Uyy+Utt,
==> (-dt^2*Tt)*Utt+(Tt^2-2*Tt+1)*U,
==> (-dx^2*Tx)*Uxx+(Tx^2-2*Tx+1)*U,
==> (-dy^2*Ty)*Uyy+(Ty^2-2*Ty+1)*U
==> * Perform the elimination of module components:
==> module R = transpose(M);
==> module S = std(R);
==> * See the result of Groebner bases: generators are columns
==> print(S);
==> 0, 0, 0, 0, 0, (A^2),
==> 0, 0, 0, (dy^2)*Ty, S[2,5], (B^2),
==> 0, (dt^2)*Tt, S[3,3],0, (-dx^2)*Tx,-1,
==> S[4,1],-Tt^2+2*Tt-1,S[4,3],-Ty^2+2*Ty-1,S[4,5], 0
==> * So, only the first column has its nonzero element in the last componen\
t
==> * Hence, this polynomial is the scheme
==> poly p = S[4,1];
==> print(p);
==> (A^2*dt^2*dy^2)*Tx^2*Ty*Tt+(B^2*dt^2*dx^2)*Tx*Ty^2*Tt+(-dx^2*dy^2)*Tx*Ty*\
Tt^2+(-2*A^2*dt^2*dy^2-2*B^2*dt^2*dx^2+2*dx^2*dy^2)*Tx*Ty*Tt+(-dx^2*dy^2)\
*Tx*Ty+(B^2*dt^2*dx^2)*Tx*Tt+(A^2*dt^2*dy^2)*Ty*Tt
==> * Create the nodal of the scheme in TeX format:
==> ideal I = decoef(p,dt);
==> difpoly2tex(I,L);
==> \frac{1}{\tri t^{2}}\cdot (u^{n+2}_{j+1,k+1}+(-2) u^{n+1}_{j+1,k+1}+u^{n}\
_{j+1,k+1})+ \frac{-\lambda^{2}}{\tri x^{2}}\cdot (u^{n+1}_{j+2,k+1}+\fra\
c{B^{2}\tri x^{2}}{\lambda^{2}\tri y^{2}} u^{n+1}_{j+1,k+2}+\frac{-(2\lam\
bda^{2}\tri y^{2}+2B^{2}\tri x^{2}}{\lambda^{2}\tri y^{2}} u^{n+1}_{j+1,k\
+1}+\frac{B^{2}\tri x^{2}}{\lambda^{2}\tri y^{2}} u^{n+1}_{j+1}+u^{n+1}_{\
j,k+1})
==> * Preparations for the semi-factorized form:
==> poly pi1 = subst(I[2],B,0);
==> poly pi2 = I[2] - pi1;
==> * Show the semi-factorized form of the scheme: 1st summand
==> factorize(I[1]);
==> [1]:
==> _[1]=(-dx^2*dy^2)
==> _[2]=Tx
==> _[3]=Ty
==> _[4]=Tt-1
==> [2]:
==> 1,1,1,2
==> * Show the semi-factorized form of the scheme: 2nd summand
==> factorize(pi1);
==> [1]:
==> _[1]=(A^2*dt^2*dy^2)
==> _[2]=Tx-1
==> _[3]=Ty
==> _[4]=Tt
==> [2]:
==> 1,2,1,1
==> * Show the semi-factorized form of the scheme: 3rd summand
==> factorize(pi1);
==> [1]:
==> _[1]=(B^2*dt^2*dx^2)
==> _[2]=Tx
==> _[3]=Ty-1
==> _[4]=Tt
==> [2]:
==> 1,1,2,1
|