# $Source: /u/maple/research/lib/algcurves/src/RCS/homogeneous,v $ # $Notify: hoeij@sci.kun.nl $ # f is a polynomial or a rational function in x and y. # Output: the corresponding homogeneous rational function or polynomial `algcurves/homogeneous`:=proc(ff,x,y,z,what) local i,j,n,f; option `Copyright (c) 1996 Waterloo Maple Inc. All rights reserved.`; f:=collect(ff,{x,y},'distributed'); if nargs>4 and what='ratfunction' then i:=collect(numer(f),{x,y},'distributed'); j:=collect(denom(f),{x,y},'distributed'); n:=degree(i,{x,y})-degree(j,{x,y}); if n<0 then i:=i*z^(-n) elif n>0 then j:=j*z^n fi; RETURN(procname(i,x,y,z,polynom) /procname(j,x,y,z,polynom)) fi; n:=degree(f,{x,y}); convert([seq(seq(coeff(coeff(f,x,i),y,j)*x^i*y^j*z^(n-i-j) ,i=0..n-j),j=0..n)],`+`) end: #savelib ('`algcurves/homogeneous`','`algcurves/homogeneous.m`'):