Artifact 694ff7029b9a300d69980f13792b221eccb5f7e8ad01efd5437a973e01821788:
- Executable file
r38/packages/groebner/greduo.red
— part of check-in
[f2fda60abd]
at
2011-09-02 18:13:33
on branch master
— Some historical releases purely for archival purposes
git-svn-id: https://svn.code.sf.net/p/reduce-algebra/code/trunk/historical@1375 2bfe0521-f11c-4a00-b80e-6202646ff360 (user: arthurcnorman@users.sourceforge.net, size: 1785) [annotate] [blame] [check-ins using] [more...]
module greduo; % Compute 'greduce' with several orders for the minimal polynomial. global'(gorder gorders greduce_result); share gorder; share gorders; share greduce_result; if null gorders then gorders:='(list revgradlex gradlex lex); symbolic procedure greduce!-orders!-eval u; % 'Greduce_orders(p,g)'; the result is the (minimal) reduction of 'p' % corresponding to the global variable '*orders', eventually '0'. begin scalar b,g,l,o,p,r,rr,s,ss,v,x; l:=length u; if 2>l or 3<l then rederr('groe4,1,"groe4 must have 2 or 3 parameters."); p:=reval car u;u:=cdr u; if eqexpr p then p:=!*eqn2a p; g:=reval car u;u:=cdr u; if not eqcar(g,'list) then rederr('groe4,2,"groe4: 2nd parameter must be a list."); for each gg in cdr g do if null x and eqexpr gg then x:=t; if x then g:='list.for each gg in cdr g collect if eqexpr gg then !*eqn2a gg else gg; if u then<<v:=reval car u; if not eqcar(v,'list) then rederr('groe4,3,"groe4: 3rd par. must be a list (or it must be omitted).")>>; v:='list.groebnervars(cdr g,v); for each oo in cdr gorders do if null b then <<o:=oo;oo:=if eqcar(oo,'list)then cdr oo else oo.nil;torder(v.oo); rr:=greduceeval{p,g};ss:=greduce!-orders!-size rr; if null r or ss<s then <<gorder:=o;r:=rr;s:=ss;greduce_result:=rr>>; if rr=0 then b:=t>>;return r end; put('greduce_orders,'psopfn,'greduce!-orders!-eval); symbolic procedure greduce!-orders!-size p; % Compute the size of the polynomial 'p'. if atom p then 1 else if eqcar(p,'expt)then(1+greduce!-orders!-size cadr p+2*x where x=if fixp caddr p and caddr p>1 and caddr p<30 then caddr p else 5*greduce!-orders!-size caddr p)else for each x in p sum greduce!-orders!-size x; endmodule;;end;