| Bill Allombert on Mon, 09 May 2022 11:42:09 +0200 |
[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]
| Re: slow factor |
On Wed, May 04, 2022 at 10:33:57PM -0700, Richard Robinson wrote:
> How and when is it to exit that loop? It looks like an infinite loop
> script to me. Or am I missing something?
There is a return() statement!
> > fact(P) =
> > {
> > my(x=variable(P),y=variable(Vec(P)));
> > my(d=poldegree(P,y));
> > my(C=content(P),FC=factor(C));
> > for(i=1,oo,
> > my(R=substpol(factor(subst(P/C,ieta,(x+i)^d)),(x+i)^d,ieta));
> > R= matconcat([FC,R]~);
> > my(F=factorback(R)*C);
> > if(pollead(P)*F==pollead(F)*P,
> > return(R)));
^^^^^^
Cheers,
Bill