Question: How to prevent division by zero or deal with division by zero when using NormalForm

DoExist := proc(tau, n)

if rtable_num_elems(tau) >= n then

        return tau[n];

else

        return 0;

end if;

end proc;

 

g1 := [0, y, x];

g2 := [0, y^2-x-y, 0];

g3 := [x, x+y, 0];

g4 := [y, -y, 0];

g5 := [0, x*y+x/2+y/2, 0];

g6 := [0, x^2-x/4-y/4, 0];

 

m1 := Basis(g1, tdeg(x, y, h251, h252, h253, h254, h255, h256));

m2 := Basis(g2, tdeg(x, y, h251, h252, h253, h254, h255, h256));

m3 := Basis(g3, tdeg(x, y, h251, h252, h253, h254, h255, h256));

m4 := Basis(g4, tdeg(x, y, h251, h252, h253, h254, h255, h256));

m5 := Basis(g5, tdeg(x, y, h251, h252, h253, h254, h255, h256));

m6 := Basis(g6, tdeg(x, y, h251, h252, h253, h254, h255, h256));

 

eq1 := Vector(3, {(1) = -h253*x-h254*y, (2) = y^2-x-y-h251*y-h252*(y^2-x-y)-h253*(x+y)+h254*y-h255*(x*y+(1/2)*x+(1/2)*y)-h256*(x^2-(1/4)*x-(1/4)*y), (3) = -h251*x});

 

NormalForm(eq1[1], [DoExist(,1),DoExist(,1),DoExist(,1),DoExist(,1),DoExist(,1),DoExist(,1)],tdeg(x, y, h251, h252, h253, h254, h255, h256), 'Q');

NormalForm(eq1[2], [DoExist(,2),DoExist(,2),DoExist(,2),DoExist(,2),DoExist(,2),DoExist(,2)],tdeg(x, y, h251, h252, h253, h254, h255, h256), 'Q');

error division by zero

Please Wait...