# $Source: /u/maple/research/lib/algcurves/src/RCS/homogeneous,v $ # $Notify: mvanhoei@daisy.uwaterloo.ca $ # 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::name,y::name,z::name,what) local i,j,n,f; option `Copyright (c) 1996 Waterloo Maple Inc. All rights reserved. Author: M. van Hoeij`; if nargs>4 and what='ratfunction' then f:=evala(Normal(ff,'expanded'),'independent'); i,j:=numer(f),denom(f); 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; f:=collect(ff,{x,y},'distributed'); n:=degree(f,{x,y}); add(add(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`'):