I reflected a moment about your problem.
How do you want to enter the polynomials ?
Copied from somewhere with the mouse, or entered by hand on
keyboard?
Let us assume, the user takes this ordeal to type the polys
with the indexed variables a(i). (Note, that she or he has then also
to enter * and ^ for multplication and expontiation.)
//------------------
So what you could do is the following:
Build an addditiional loop where the input is read line by line.
The user will have to mark explicitly when the input of a polynomial is
finished.
There is one limitation:
Within at most 80 characters per line, no coefficient has to be broken.
A succesive input of three polynomial in variables x(1..4) should work.
Code:
12121212*x(1)^2+3214843131/54641231*x(2)^3*x(4)
+ 2354654*x(2)^5 - 2354343*x(3) + 123*x(4)
#
897*x(2)
-x(3) +561/5646*x(1)^5
+ x(3)
#
x(1) +
x(2) + 123*
x(1)*x(2)^3
#
But it will not work if the
coefficient is longer than 80 characters
so that the user has to break it within the coefficient.
This would result in blanks and newlines that had to be eliminated first.
(May be it is a liitle less restictive: Numerators and denominators are
not allowed to break, but you can break at the / ).
An example which will not work.
Code:
12317631817312988888888782649869168888888888888882983712379
213823012380183103810*x(1)
#
Here is some code. (Not tested, since at the moment I am reading the
forum only on the web without access to a running Singular.)
Code:
for (k=1;k<=g;k++)
{
s="poly f(k) =";
"Enter polynomial", k;
"Do not break the coefficients and ";
"enter a single # when this poly is complete";
s = read(l);
while(answ !="#")
{
s = s + answ;
s = read(l);
}
s = s +";";
execute(s);
I[k] = f(k);
}
Note that I wrote
i[k] = f(k); instead of
i=i+f(k);. The difference is that
+ makes automatically
some simplifications: e.g. multiple and zero generators will be removed.
This does not change the result of primdecGTZ, but when you ouptut
Code:
printf("The ideal is:");
i;
then the user may see something different than the original input.