Our user wondered about using PolynomialIdeals:

1.  If we have n+1 polynomials,  f, g1,...,gn,  how to determine if  f  is in the ideal generated by  g1,...,gn?

2.  If so, how to write  f  as a polynomial combination of   g1,...,gn? 

We suggested that;

The nicest interface to answer the first question is given by the ?PolynomialIdeals,Operators page: you can write

J := <g1, g2, ..., gn>;
f in J; # true or false

To answer the second question, you need to use the lower level Groebner package (which underlies the PolynomialIdeals package). This will also answer the first question for you. In particular the NormalForm command. You can write:

(Edit Feb 1, 2022 - use Q[i] * b[i] instead of Q[i] * G[i] in last line)

G := [g1, g2, ..., gn];
ord := tdeg(x,y,z); # replace x, y, z with the appropriate variables; you can also use other variable orders -- see ?Groebner,MonomialOrders
b := Basis(G, ord);
n := NormalForm(f, b, ord, 'Q');
# if n = 0 then f is in the ideal; Q is the list of coefficients:
f - add(Q[i] * b[i], i = 1 .. numelems(b)); # this will be equal to n.

Please Wait...