%mathpiper,def="Monic"

10 # Monic(UniVariate(_var,_first,_coefs)) <--
[
  DropEndZeroes(coefs);
  UniVariate(var,first,coefs/coefs[Length(coefs)]);
];
20 # Monic(poly_CanBeUni) <-- NormalForm(Monic(MakeUni(poly)));

30 # Monic(_poly,_var)_CanBeUni(poly,var) <-- NormalForm(Monic(MakeUni(poly,var)));

%/mathpiper



%mathpiper_docs,name="Monic",categories="User Functions;Polynomials (Operations)"
*CMD Monic --- monic part of a polynomial
*STD
*CALL
	Monic(poly)
	Monic(poly, var)

*PARMS

{poly} -- a polynomial

{var} -- a variable

*DESC

This function returns the monic part of "poly", regarded as a
polynomial in the variable "var". The monic part of a polynomial is
the quotient of this polynomial by its leading coefficient. So the
leading coefficient of the monic part is always one. If only one
variable appears in the expression "poly", it is obvious that it
should be regarded as a polynomial in this variable and the first
calling sequence may be used.

*E.G.

In> poly := 2*x^2 + 4*x;
Result: 2*x^2+4*x;
In> lc := LeadingCoef(poly);
Result: 2;
In> m := Monic(poly);
Result: x^2+2*x;
In> Expand(lc*m);
Result: 2*x^2+4*x;
	
In> Monic(2*a^2 + 3*a*b^2 + 5, a);
Result: a^2+(a*3*b^2)/2+5/2;
In> Monic(2*a^2 + 3*a*b^2 + 5, b);
Result: b^2+(2*a^2+5)/(3*a);

*SEE LeadingCoef
%/mathpiper_docs