question on setminus(set,element)

American Citizen <[email protected]>
Newsgroups gmane.comp.mathematics.pari.user
Message-ID <[email protected]>
Can anyone explain why setminus(Set,element) won't work the first time, 
but works the second time?

{point_on_conic(C,pt)=
my(a,b,c,d,e,f,r,s);
if(matsize(C)[2]!=6,return(););
[a,b,c,d,e,f]=C;
[r,s]=pt;
return(a*r^2+b*r*s+c*s^2+d*r+e*s+f);
}

{parameterize_conic(conic,pt)=
my(k,x1,y1,P,R,rsz,S,T);
if(matsize(conic)[2]!=6,return(););
x1=pt[1];y1=pt[2];
k=point_on_conic(conic,pt);
if(k!=0,print("Point not on conic!");return(););
y=t*(x-x1)+y1;
P=point_on_conic(conic,[x,y]);
print("P=",P);
R=factor(P);
print("Factored P =",R);
rsz=matsize(R)[1];
S=Set();
for(i=1,rsz,
   xt=-polcoef(R[i,1],0)/polcoef(R[i,1],1);
   yt=t*(xt-x1)+y1;
   print("at root #",i," xt,yt = ",xt,",",yt);
   print("type xt  = ",type(xt)," type yt = ",type(yt));
   S=setunion(S,[[xt,yt]]);
   \\if(type(xt)!="t_POL",S=setunion(S,[xt,yt]););
);
print("S=",S);
print("Attemting to remove point ",pt," from S");
print("T=setminus(S,[",pt,"])");
T=setminus(S,[pt]);
print("T=",T);
print("we now define S again");
S=[[1, 0], [(t^2 - 1)/(t^2 + 1), -2*t/(t^2 + 1)]];
print("S = ",S);
print("remove ",pt);
T=setminus(S,[pt]);
print("new T = ",T," which is what we want");
print("why cannot the point be removed the first time?");

if(matsize(T)[2]==1,T=T[1];);
return(T);
}
c=[1,0,1,0,0,-1]
pt=[1,0]
parameterize_conic(c,pt)
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.