(*********************************************************************** Mathematica-Compatible Notebook This notebook can be used on any computer system with Mathematica 3.0, MathReader 3.0, or any compatible application. The data for the notebook starts with the line of stars above. To get the notebook into a Mathematica-compatible application, do one of the following: * Save the data starting with the line of stars above into a file with a name ending in .nb, then open the file inside the application; * Copy the data starting with the line of stars above to the clipboard, then use the Paste menu command inside the application. Data for notebooks contains only printable 7-bit ASCII and can be sent directly in email or through ftp in text mode. Newlines can be CR, LF or CRLF (Unix, Macintosh or MS-DOS style). NOTE: If you modify the data for this notebook not in a Mathematica- compatible application, you must delete the line below containing the word CacheID, otherwise Mathematica-compatible applications may try to use invalid cache data. For more information on notebooks and Mathematica-compatible applications, contact Wolfram Research: web: http://www.wolfram.com email: info@wolfram.com phone: +1-217-398-0700 (U.S.) Notebook reader applications are available free of charge from Wolfram Research. ***********************************************************************) (*CacheID: 232*) (*NotebookFileLineBreakTest NotebookFileLineBreakTest*) (*NotebookOptionsPosition[ 30470, 1889]*) (*NotebookOutlinePosition[ 31522, 1923]*) (* CellTagsIndexPosition[ 31478, 1919]*) (*WindowFrame->Normal*) Notebook[{ Cell[CellGroupData[{ Cell[TextData["Coefficients Functions"], "Title", Evaluatable->False, CellHorizontalScrolling->False, TextAlignment->Center], Cell[TextData["With the Coefficients.m package"], "Subtitle", Evaluatable->False, CellHorizontalScrolling->False, TextAlignment->Center], Cell[TextData[ "Roberto Colistete J\[UAcute]nior\n\n11/95"], "Subsubtitle", Evaluatable->False, CellHorizontalScrolling->False, TextAlignment->Center] }, Open ]], Cell[CellGroupData[{ Cell[TextData["Commands"], "Section", Evaluatable->False], Cell[CellGroupData[{ Cell[TextData[ "The Coefficients.m package provides some additional functions to deal with \ coefficients of low order multivariable polynomials, without any \"dominant \ variable\" :"], "Text", Evaluatable->False], Cell[TextData["<Infinity], Cell[CellGroupData[{ Cell[TextData["?Coefficients`*"], "Input", PageWidth->Infinity, FontFamily->"Courier New", FontSize->8, FontWeight->"Bold", FontColor->GrayLevel[0], Background->GrayLevel[1]], Cell[OutputFormData[ "\<\ CoefficientListToPolynomial ExpandCoefficients MapCoefficients CollectCoefficients FactorCoefficients SimplifyCoefficients \ \>", "\<\ CoefficientListToPolynomial ExpandCoefficients \ MapCoefficients CollectCoefficients FactorCoefficients SimplifyCoefficients \ \>"], "Print", PageWidth->Infinity, Evaluatable->False, LineSpacing->{1, 1}] }, Closed]] }, Closed]], Cell[CellGroupData[{ Cell[TextData[ "The main function of the package, CoefficientListToPolynomial, inverts the \ operation of CoefficientList :"], "Text", Evaluatable->False, FontFamily->"Times New Roman", FontSize->12, FontWeight->"Plain", FontSlant->"Plain", FontTracking->"Plain", FontColor->GrayLevel[0], Background->GrayLevel[1], FontVariations->{"Underline"->False, "Outline"->False, "Shadow"->False}], Cell[CellGroupData[{ Cell[TextData["?CoefficientListToPolynomial"], "Input", PageWidth->Infinity, FontFamily->"Courier New", FontSize->8, FontWeight->"Bold", FontColor->GrayLevel[0], Background->GrayLevel[1]], Cell[OutputFormData[ "\<\ CoefficientListToPolynomial [coef, x] inverts the operation of \ CoefficientList and returns a polynomial, so that coef is the list returned by \ CoefficientList. The polynomial is returned with terms of the same powers of x collected \ together. CoefficientListToPolynomial [coef, {x1, x2, ...}] does the same thing to xi, \ but without any 'dominant variable' xi, and it is necessary that the number of \ variables xi be compatible with coef. \ \>", "\<\ CoefficientListToPolynomial [coef, x] inverts the operation of \ CoefficientList and returns a polynomial, so that coef is the list returned by \ CoefficientList. The polynomial is returned with terms of the same powers of x collected \ together. CoefficientListToPolynomial [coef, {x1, x2, ...}] does the same thing to xi, \ but without any 'dominant variable' xi, and it is necessary that the number of \ variables xi be compatible with coef.\ \>"], "Print", PageWidth->Infinity, Evaluatable->False, LineSpacing->{1, 1}] }, Closed]] }, Closed]], Cell[CellGroupData[{ Cell[TextData[ "By using CoefficientList and CoefficientListToPolynomial, the function \ MapCoefficients allows to apply any function to the coefficients in a \ straightforward way :"], "Text", Evaluatable->False, FontFamily->"Times New Roman", FontSize->12, FontWeight->"Plain", FontSlant->"Plain", FontTracking->"Plain", FontColor->GrayLevel[0], Background->GrayLevel[1], FontVariations->{"Underline"->False, "Outline"->False, "Shadow"->False}], Cell[CellGroupData[{ Cell[TextData["?MapCoefficients"], "Input", PageWidth->Infinity], Cell[OutputFormData[ "\<\ MapCoefficients[f, poly, x] applies the function f to each coefficient \ of the polynomial poly in x. MapCoefficients[f, poly, {x1, x2, ...}] does the same thing to xi, but \ without any 'dominant variable' xi. MapCoefficients[f, {poly1, poly2, ...}, x] and MapCoefficients[f, {poly1, poly2, ...}, {x1, x2, ...}] are for lists of \ polynomials. \ \>", "\<\ MapCoefficients[f, poly, x] applies the function f to each \ coefficient of the polynomial poly in x. MapCoefficients[f, poly, {x1, x2, ...}] does the same thing to xi, but \ without any 'dominant variable' xi. MapCoefficients[f, {poly1, poly2, ...}, x] and MapCoefficients[f, {poly1, poly2, ...}, {x1, x2, ...}] are for lists of \ polynomials.\ \>"], "Print", PageWidth->Infinity, Evaluatable->False, LineSpacing->{1, 1}] }, Closed]] }, Closed]], Cell[CellGroupData[{ Cell[TextData[ "The other functions are just simple applications of MapCoefficients. One \ interesting result from using CoefficientList / CoefficientListToPoynomial \ (or MapCoefficients) is the absence of a \"dominant variable\" in \ multivariable polynomials :"], "Text", Evaluatable->False], Cell[CellGroupData[{ Cell[TextData["?ExpandCoefficients"], "Input", PageWidth->Infinity], Cell[OutputFormData[ "\<\ ExpandCoefficients [poly, x, (opts)] applies the Expand function to the \ coefficients of the polynomial poly in x, collecting together terms involving the same \ powers of x. ExpandCoefficients [poly, {x1, x2, ...}] does the same thing to xi, but \ without any 'dominant variable' xi. ExpandCoefficients [{poly1, poly2, ...}, x] and ExpandCoefficients [{poly1, poly2, ...}, {x1, x2, ...}] are for lists of \ polynomials. \ \>", "\<\ ExpandCoefficients [poly, x, (opts)] applies the Expand function \ to the coefficients of the polynomial poly in x, collecting together terms involving the same \ powers of x. ExpandCoefficients [poly, {x1, x2, ...}] does the same thing to xi, but \ without any 'dominant variable' xi. ExpandCoefficients [{poly1, poly2, ...}, x] and ExpandCoefficients [{poly1, poly2, ...}, {x1, x2, ...}] are for lists of \ polynomials.\ \>"], "Print", PageWidth->Infinity, Evaluatable->False, LineSpacing->{1, 1}] }, Closed]], Cell[CellGroupData[{ Cell[TextData["?FactorCoefficients"], "Input", PageWidth->Infinity, FontFamily->"Courier New", FontSize->8, FontWeight->"Bold", FontColor->GrayLevel[0], Background->GrayLevel[1]], Cell[OutputFormData[ "\<\ FactorCoefficients [poly, x, (opts)] applies the Factor function to the \ coefficients of the polynomial poly in x, collecting together terms involving the same \ powers of x. FactorCoefficients [poly, {x1, x2, ...}] does the same thing to xi, but \ without any 'dominant variable' xi. FactorCoefficients [{poly1, poly2, ...}, x] and FactorCoefficients [{poly1, poly2, ...}, {x1, x2, ...}] are for lists of \ polynomials. \ \>", "\<\ FactorCoefficients [poly, x, (opts)] applies the Factor function \ to the coefficients of the polynomial poly in x, collecting together terms involving the same \ powers of x. FactorCoefficients [poly, {x1, x2, ...}] does the same thing to xi, but \ without any 'dominant variable' xi. FactorCoefficients [{poly1, poly2, ...}, x] and FactorCoefficients [{poly1, poly2, ...}, {x1, x2, ...}] are for lists of \ polynomials.\ \>"], "Print", PageWidth->Infinity, Evaluatable->False, LineSpacing->{1, 1}] }, Closed]], Cell[CellGroupData[{ Cell[TextData["?CollectCoefficients"], "Input", PageWidth->Infinity, FontFamily->"Courier New", FontSize->8, FontWeight->"Bold", FontColor->GrayLevel[0], Background->GrayLevel[1]], Cell[OutputFormData[ "\<\ CollectCoefficients [poly, x] collects together terms involving the same \ powers of x, in the polynomial poly. CollectCoefficients [poly, {x1, x2, ...}] does the same thing to xi, but \ without any 'dominant variable' xi. CollectCoefficients [{poly1, poly2, ...}, x] and CollectCoefficients [{poly1, poly2, ...}, {x1, x2, ...}] are for lists of \ polynomials. \ \>", "\<\ CollectCoefficients [poly, x] collects together terms involving \ the same powers of x, in the polynomial poly. CollectCoefficients [poly, {x1, x2, ...}] does the same thing to xi, but \ without any 'dominant variable' xi. CollectCoefficients [{poly1, poly2, ...}, x] and CollectCoefficients [{poly1, poly2, ...}, {x1, x2, ...}] are for lists of \ polynomials.\ \>"], "Print", PageWidth->Infinity, Evaluatable->False, LineSpacing->{1, 1}] }, Closed]], Cell[CellGroupData[{ Cell[TextData["?SimplifyCoefficients"], "Input", PageWidth->Infinity, FontFamily->"Courier New", FontSize->8, FontWeight->"Bold", FontColor->GrayLevel[0], Background->GrayLevel[1]], Cell[OutputFormData[ "\<\ SimplifyCoefficients [poly, x, (opts)] applies the Simplify function to \ the coefficients of the polynomial poly in x, collecting together terms involving the same \ powers of x. SimplifyCoefficients [poly, {x1, x2, ...}] does the same thing to xi, but \ without any 'dominant variable' xi. SimplifyCoefficients [{poly1, poly2, ...}, x] and SimplifyCoefficients [{poly1, poly2, ...}, {x1, x2, ...}] are for lists of \ polynomials. \ \>", "\<\ SimplifyCoefficients [poly, x, (opts)] applies the Simplify \ function to the coefficients of the polynomial poly in x, collecting together terms involving the same \ powers of x. SimplifyCoefficients [poly, {x1, x2, ...}] does the same thing to xi, but \ without any 'dominant variable' xi. SimplifyCoefficients [{poly1, poly2, ...}, x] and SimplifyCoefficients [{poly1, poly2, ...}, {x1, x2, ...}] are for lists of \ polynomials.\ \>"], "Print", PageWidth->Infinity, Evaluatable->False, LineSpacing->{1, 1}] }, Closed]] }, Closed]] }, Open ]], Cell[CellGroupData[{ Cell[TextData["Examples"], "Section", Evaluatable->False], Cell[CellGroupData[{ Cell[TextData["CoefficientListToPolynomial"], "Subsection", Evaluatable->False], Cell[CellGroupData[{ Cell[TextData[ "p1 = a + b*x + c*y + d*x*y + e*x^2 + f*y^2 + g*x^2*y + h*x*y^2 + i*x^2*y^2"], "Input", PageWidth->Infinity], Cell[OutputFormData[ "\<\ a + b*x + e*x^2 + c*y + d*x*y + g*x^2*y + f*y^2 + h*x*y^2 + i*x^2*y^2 \ \>", "\<\ 2 2 2 2 2 2 a + b x + e x + c y + d x y + g x y + f y + h x y + i x y\ \>"], "Output",\ PageWidth->Infinity, Evaluatable->False] }, Closed]], Cell[CellGroupData[{ Cell[TextData["coef1 = CoefficientList[p1, {x, y}]"], "Input", PageWidth->Infinity], Cell[OutputFormData["\<\ {{a, c, f}, {b, d, h}, {e, g, i}} \ \>", "\<\ {{a, c, f}, {b, d, h}, {e, g, i}}\ \>"], "Output", PageWidth->Infinity, Evaluatable->False] }, Closed]], Cell[CellGroupData[{ Cell[TextData["CoefficientListToPolynomial[coef1, {x, y}]"], "Input", PageWidth->Infinity], Cell[OutputFormData[ "\<\ a + b*x + e*x^2 + c*y + d*x*y + g*x^2*y + f*y^2 + h*x*y^2 + i*x^2*y^2 \ \>", "\<\ 2 2 2 2 2 2 a + b x + e x + c y + d x y + g x y + f y + h x y + i x y\ \>"], "Output",\ PageWidth->Infinity, Evaluatable->False] }, Closed]], Cell[CellGroupData[{ Cell[TextData["p2 = (1 + a)^2 + (1 + b)^2*x //Expand"], "Input", PageWidth->Infinity], Cell[OutputFormData["\<\ 1 + 2*a + a^2 + x + 2*b*x + b^2*x \ \>", "\<\ 2 2 1 + 2 a + a + x + 2 b x + b x\ \>"], "Output", PageWidth->Infinity, Evaluatable->False] }, Closed]], Cell[CellGroupData[{ Cell[TextData["coef2 = CoefficientList[p2, x]"], "Input", PageWidth->Infinity, FontFamily->"Courier New", FontSize->8, FontWeight->"Bold", FontColor->GrayLevel[0], Background->GrayLevel[1]], Cell[OutputFormData["\<\ {1 + 2*a + a^2, 1 + 2*b + b^2} \ \>", "\<\ 2 2 {1 + 2 a + a , 1 + 2 b + b }\ \>"], "Output", PageWidth->Infinity, Evaluatable->False] }, Closed]], Cell[CellGroupData[{ Cell[TextData["CoefficientListToPolynomial[coef2, x]"], "Input", PageWidth->Infinity, FontFamily->"Courier New", FontSize->8, FontWeight->"Bold", FontColor->GrayLevel[0], Background->GrayLevel[1]], Cell[OutputFormData["\<\ 1 + 2*a + a^2 + (1 + 2*b + b^2)*x \ \>", "\<\ 2 2 1 + 2 a + a + (1 + 2 b + b ) x\ \>"], "Output", PageWidth->Infinity, Evaluatable->False] }, Closed]], Cell[CellGroupData[{ Cell[TextData["p3 = 1 + x^5 + y^5"], "Input", PageWidth->Infinity, FontFamily->"Courier New", FontSize->8, FontWeight->"Bold", FontColor->GrayLevel[0], Background->GrayLevel[1]], Cell[OutputFormData["\<\ 1 + x^5 + y^5 \ \>", "\<\ 5 5 1 + x + y\ \>"], "Output", PageWidth->Infinity, Evaluatable->False] }, Closed]], Cell[CellGroupData[{ Cell[TextData["coef3 = CoefficientList[p3, {x, y}]"], "Input", PageWidth->Infinity], Cell[OutputFormData[ "\<\ {{1, 0, 0, 0, 0, 1}, {}, {}, {}, {}, {1, 0, 0, 0, 0, 0}} \ \>", "\<\ {{1, 0, 0, 0, 0, 1}, {}, {}, {}, {}, {1, 0, 0, 0, 0, 0}}\ \>"], "Output", PageWidth->Infinity, Evaluatable->False] }, Closed]], Cell[CellGroupData[{ Cell[TextData["CoefficientListToPolynomial[coef3, {x,y}]"], "Input", PageWidth->Infinity], Cell[OutputFormData["\<\ 1 + x^5 + y^5 \ \>", "\<\ 5 5 1 + x + y\ \>"], "Output", PageWidth->Infinity, Evaluatable->False] }, Closed]], Cell[CellGroupData[{ Cell[TextData["coef4 = Array[a, {2, 3}]"], "Input", PageWidth->Infinity], Cell[OutputFormData[ "\<\ {{a[1, 1], a[1, 2], a[1, 3]}, {a[2, 1], a[2, 2], a[2, 3]}} \ \>", "\<\ {{a[1, 1], a[1, 2], a[1, 3]}, {a[2, 1], a[2, 2], a[2, 3]}}\ \>"], "Output", PageWidth->Infinity, Evaluatable->False] }, Closed]], Cell[CellGroupData[{ Cell[TextData["CoefficientListToPolynomial[coef4, {x, y}]"], "Input", PageWidth->Infinity, FontFamily->"Courier New", FontSize->8, FontWeight->"Bold", FontColor->GrayLevel[0], Background->GrayLevel[1]], Cell[OutputFormData[ "\<\ a[1, 1] + y*a[1, 2] + y^2*a[1, 3] + x*a[2, 1] + x*y*a[2, 2] + x*y^2*a[2, \ 3] \ \>", "\<\ 2 2 a[1, 1] + y a[1, 2] + y a[1, 3] + x a[2, 1] + x y a[2, 2] + x y a[2, \ 3]\ \>"], "Output", PageWidth->Infinity, Evaluatable->False] }, Closed]] }, Closed]], Cell[CellGroupData[{ Cell[TextData["MapCoefficients"], "Subsection", Evaluatable->False], Cell[CellGroupData[{ Cell[TextData["p1 = (1 + a)^2 + (1 + b)^2*x //Expand"], "Input", PageWidth->Infinity, FontFamily->"Courier New", FontSize->8, FontWeight->"Bold", FontColor->GrayLevel[0], Background->GrayLevel[1]], Cell[OutputFormData["\<\ 1 + 2*a + a^2 + x + 2*b*x + b^2*x \ \>", "\<\ 2 2 1 + 2 a + a + x + 2 b x + b x\ \>"], "Output", PageWidth->Infinity, Evaluatable->False] }, Closed]], Cell[CellGroupData[{ Cell[TextData["MapCoefficients[f, p1, x]"], "Input", PageWidth->Infinity], Cell[OutputFormData["\<\ f[1 + 2*a + a^2] + x*f[1 + 2*b + b^2] \ \>", "\<\ 2 2 f[1 + 2 a + a ] + x f[1 + 2 b + b ]\ \>"], "Output", PageWidth->Infinity, Evaluatable->False] }, Closed]], Cell[CellGroupData[{ Cell[TextData["MapCoefficients[Factor, p1, x]"], "Input", PageWidth->Infinity, FontFamily->"Courier New", FontSize->8, FontWeight->"Bold", FontColor->GrayLevel[0], Background->GrayLevel[1]], Cell[OutputFormData["\<\ (1 + a)^2 + (1 + b)^2*x \ \>", "\<\ 2 2 (1 + a) + (1 + b) x\ \>"], "Output", PageWidth->Infinity, Evaluatable->False] }, Closed]], Cell[CellGroupData[{ Cell[TextData["MapCoefficients[Sqrt, p1, x]"], "Input", PageWidth->Infinity, FontFamily->"Courier New", FontSize->8, FontWeight->"Bold", FontColor->GrayLevel[0], Background->GrayLevel[1]], Cell[OutputFormData["\<\ (1 + 2*a + a^2)^(1/2) + (1 + 2*b + b^2)^(1/2)*x \ \>", "\<\ 2 2 Sqrt[1 + 2 a + a ] + Sqrt[1 + 2 b + b ] x\ \>"], "Output", PageWidth->Infinity, Evaluatable->False] }, Closed]], Cell[CellGroupData[{ Cell[TextData["p2 = (1 + x + y)^2 //Expand"], "Input", PageWidth->Infinity], Cell[OutputFormData["\<\ 1 + 2*x + x^2 + 2*y + 2*x*y + y^2 \ \>", "\<\ 2 2 1 + 2 x + x + 2 y + 2 x y + y\ \>"], "Output", PageWidth->Infinity, Evaluatable->False] }, Closed]], Cell[CellGroupData[{ Cell[TextData["MapCoefficients[f, p2, x]"], "Input", PageWidth->Infinity], Cell[OutputFormData["\<\ x^2*f[1] + x*f[2 + 2*y] + f[1 + 2*y + y^2] \ \>", "\<\ 2 2 x f[1] + x f[2 + 2 y] + f[1 + 2 y + y ]\ \>"], "Output", PageWidth->Infinity, Evaluatable->False] }, Closed]], Cell[CellGroupData[{ Cell[TextData["MapCoefficients[f, p2, y]"], "Input", PageWidth->Infinity, FontFamily->"Courier New", FontSize->8, FontWeight->"Bold", FontColor->GrayLevel[0], Background->GrayLevel[1]], Cell[OutputFormData["\<\ y^2*f[1] + y*f[2 + 2*x] + f[1 + 2*x + x^2] \ \>", "\<\ 2 2 y f[1] + y f[2 + 2 x] + f[1 + 2 x + x ]\ \>"], "Output", PageWidth->Infinity, Evaluatable->False] }, Closed]], Cell[CellGroupData[{ Cell[TextData["MapCoefficients[f, p2, {x, y}]"], "Input", PageWidth->Infinity, FontFamily->"Courier New", FontSize->8, FontWeight->"Bold", FontColor->GrayLevel[0], Background->GrayLevel[1]], Cell[OutputFormData[ "\<\ x^2*y*f[0] + x*y^2*f[0] + x^2*y^2*f[0] + f[1] + x^2*f[1] + y^2*f[1] + \ x*f[2] + y*f[2] + x*y*f[2] \ \>", "\<\ 2 2 2 2 2 2 x y f[0] + x y f[0] + x y f[0] + f[1] + x f[1] + y f[1] + x f[2] + y \ f[2] + x y f[2]\ \>"], "Output", PageWidth->Infinity, Evaluatable->False] }, Closed]] }, Closed]], Cell[CellGroupData[{ Cell[TextData["ExpandCoefficients "], "Subsection", Evaluatable->False], Cell[CellGroupData[{ Cell[TextData["p1 = (1 + a)^2 + (1 + b)^2*x"], "Input", PageWidth->Infinity, FontFamily->"Courier New", FontSize->8, FontWeight->"Bold", FontColor->GrayLevel[0], Background->GrayLevel[1]], Cell[OutputFormData["\<\ (1 + a)^2 + (1 + b)^2*x \ \>", "\<\ 2 2 (1 + a) + (1 + b) x\ \>"], "Output", PageWidth->Infinity, Evaluatable->False] }, Closed]], Cell[CellGroupData[{ Cell[TextData["Expand[p1]"], "Input", PageWidth->Infinity], Cell[OutputFormData["\<\ 1 + 2*a + a^2 + x + 2*b*x + b^2*x \ \>", "\<\ 2 2 1 + 2 a + a + x + 2 b x + b x\ \>"], "Output", PageWidth->Infinity, Evaluatable->False] }, Closed]], Cell[CellGroupData[{ Cell[TextData["ExpandCoefficients[p1, x]"], "Input", PageWidth->Infinity], Cell[OutputFormData["\<\ 1 + 2*a + a^2 + (1 + 2*b + b^2)*x \ \>", "\<\ 2 2 1 + 2 a + a + (1 + 2 b + b ) x\ \>"], "Output", PageWidth->Infinity, Evaluatable->False] }, Closed]], Cell[CellGroupData[{ Cell[TextData[ "p2 = (1 + a)^2 + (1 + b)^3*x*y + (1 + c)^2*x^2 + (1 + d)^4*y^2"], "Input", PageWidth->Infinity, FontFamily->"Courier New", FontSize->8, FontWeight->"Bold", FontColor->GrayLevel[0], Background->GrayLevel[1]], Cell[OutputFormData[ "\<\ (1 + a)^2 + (1 + c)^2*x^2 + (1 + b)^3*x*y + (1 + d)^4*y^2 \ \>", "\<\ 2 2 2 3 4 2 (1 + a) + (1 + c) x + (1 + b) x y + (1 + d) y\ \>"], "Output", PageWidth->Infinity, Evaluatable->False] }, Closed]], Cell[CellGroupData[{ Cell[TextData["\nExpand[p2]"], "Input", PageWidth->Infinity, FontFamily->"Courier New", FontSize->8, FontWeight->"Bold", FontColor->GrayLevel[0], Background->GrayLevel[1]], Cell[OutputFormData[ "\<\ 1 + 2*a + a^2 + x^2 + 2*c*x^2 + c^2*x^2 + x*y + 3*b*x*y + 3*b^2*x*y + \ b^3*x*y + y^2 + 4*d*y^2 + 6*d^2*y^2 + 4*d^3*y^2 + d^4*y^2 \ \>", "\<\ 2 2 2 2 2 2 \ 3 2 2 1 + 2 a + a + x + 2 c x + c x + x y + 3 b x y + 3 b x y + b x y + y + \ 4 d y + 2 2 3 2 4 2 6 d y + 4 d y + d y\ \>"], "Output", PageWidth->Infinity, Evaluatable->False] }, Closed]], Cell[CellGroupData[{ Cell[TextData["ExpandCoefficients[p2, {x, y}]"], "Input", PageWidth->Infinity, FontFamily->"Courier New", FontSize->8, FontWeight->"Bold", FontColor->GrayLevel[0], Background->GrayLevel[1]], Cell[OutputFormData[ "\<\ 1 + 2*a + a^2 + (1 + 2*c + c^2)*x^2 + (1 + 3*b + 3*b^2 + b^3)*x*y + (1 + 4*d + 6*d^2 + 4*d^3 + d^4)*y^2 \ \>", "\<\ 2 2 2 2 3 1 + 2 a + a + (1 + 2 c + c ) x + (1 + 3 b + 3 b + b ) x y + 2 3 4 2 (1 + 4 d + 6 d + 4 d + d ) y\ \>"], "Output", PageWidth->Infinity, Evaluatable->False] }, Closed]] }, Closed]], Cell[CellGroupData[{ Cell[TextData["FactorCoefficients"], "Subsection", Evaluatable->False], Cell[CellGroupData[{ Cell[TextData["p1 = (1 + a)^2 + (1 + b)^2*x //Expand"], "Input", PageWidth->Infinity, FontFamily->"Courier New", FontSize->8, FontWeight->"Bold", FontColor->GrayLevel[0], Background->GrayLevel[1]], Cell[OutputFormData["\<\ 1 + 2*a + a^2 + x + 2*b*x + b^2*x \ \>", "\<\ 2 2 1 + 2 a + a + x + 2 b x + b x\ \>"], "Output", PageWidth->Infinity, Evaluatable->False] }, Closed]], Cell[CellGroupData[{ Cell[TextData["Factor[p1]"], "Input", PageWidth->Infinity, FontFamily->"Courier New", FontSize->8, FontWeight->"Bold", FontColor->GrayLevel[0], Background->GrayLevel[1]], Cell[OutputFormData["\<\ 1 + 2*a + a^2 + x + 2*b*x + b^2*x \ \>", "\<\ 2 2 1 + 2 a + a + x + 2 b x + b x\ \>"], "Output", PageWidth->Infinity, Evaluatable->False] }, Closed]], Cell[CellGroupData[{ Cell[TextData["FactorCoefficients[p1, x]"], "Input", PageWidth->Infinity, FontFamily->"Courier New", FontSize->8, FontWeight->"Bold", FontColor->GrayLevel[0], Background->GrayLevel[1]], Cell[OutputFormData["\<\ (1 + a)^2 + (1 + b)^2*x \ \>", "\<\ 2 2 (1 + a) + (1 + b) x\ \>"], "Output", PageWidth->Infinity, Evaluatable->False] }, Closed]], Cell[CellGroupData[{ Cell[TextData[ "p2 = (1 + a)^2 + (1 + b)^3*x*y + (1 + c)^2*x^2 + (1 + d)^4*y^2 //Expand"], "Input", PageWidth->Infinity, FontFamily->"Courier New", FontSize->8, FontWeight->"Bold", FontColor->GrayLevel[0], Background->GrayLevel[1]], Cell[OutputFormData[ "\<\ 1 + 2*a + a^2 + x^2 + 2*c*x^2 + c^2*x^2 + x*y + 3*b*x*y + 3*b^2*x*y + \ b^3*x*y + y^2 + 4*d*y^2 + 6*d^2*y^2 + 4*d^3*y^2 + d^4*y^2 \ \>", "\<\ 2 2 2 2 2 2 \ 3 2 2 1 + 2 a + a + x + 2 c x + c x + x y + 3 b x y + 3 b x y + b x y + y + \ 4 d y + 2 2 3 2 4 2 6 d y + 4 d y + d y\ \>"], "Output", PageWidth->Infinity, Evaluatable->False] }, Closed]], Cell[CellGroupData[{ Cell[TextData["Factor[p2]"], "Input", PageWidth->Infinity, FontFamily->"Courier New", FontSize->8, FontWeight->"Bold", FontColor->GrayLevel[0], Background->GrayLevel[1]], Cell[OutputFormData[ "\<\ 1 + 2*a + a^2 + x^2 + 2*c*x^2 + c^2*x^2 + x*y + 3*b*x*y + 3*b^2*x*y + \ b^3*x*y + y^2 + 4*d*y^2 + 6*d^2*y^2 + 4*d^3*y^2 + d^4*y^2 \ \>", "\<\ 2 2 2 2 2 2 \ 3 2 2 1 + 2 a + a + x + 2 c x + c x + x y + 3 b x y + 3 b x y + b x y + y + \ 4 d y + 2 2 3 2 4 2 6 d y + 4 d y + d y\ \>"], "Output", PageWidth->Infinity, Evaluatable->False] }, Closed]], Cell[CellGroupData[{ Cell[TextData["FactorCoefficients[p2, {x, y}]"], "Input", PageWidth->Infinity], Cell[OutputFormData[ "\<\ (1 + a)^2 + (1 + c)^2*x^2 + (1 + b)^3*x*y + (1 + d)^4*y^2 \ \>", "\<\ 2 2 2 3 4 2 (1 + a) + (1 + c) x + (1 + b) x y + (1 + d) y\ \>"], "Output", PageWidth->Infinity, Evaluatable->False] }, Closed]] }, Closed]], Cell[CellGroupData[{ Cell[TextData["CollectCoefficients"], "Subsection", Evaluatable->False], Cell[CellGroupData[{ Cell[TextData["p1 = Expand[(1 + x + 2y + 3z)^3]"], "Input", PageWidth->Infinity], Cell[OutputFormData[ "\<\ 1 + 3*x + 3*x^2 + x^3 + 6*y + 12*x*y + 6*x^2*y + 12*y^2 + 12*x*y^2 + \ 8*y^3 + 9*z + 18*x*z + 9*x^2*z + 36*y*z + 36*x*y*z + 36*y^2*z + 27*z^2 + 27*x*z^2 + \ 54*y*z^2 + 27*z^3 \ \>", "\<\ 2 3 2 2 2 \ 3 1 + 3 x + 3 x + x + 6 y + 12 x y + 6 x y + 12 y + 12 x y + 8 y + 9 z + \ 18 x z + 2 2 2 2 2 3 9 x z + 36 y z + 36 x y z + 36 y z + 27 z + 27 x z + 54 y z + 27 \ z\ \>"], "Output", PageWidth->Infinity, Evaluatable->False, LineSpacing->{1, 1}] }, Closed]], Cell[CellGroupData[{ Cell[TextData["Collect[p1, {x, y}]"], "Input", PageWidth->Infinity, FontFamily->"Courier New", FontSize->8, FontWeight->"Bold", FontColor->GrayLevel[0], Background->GrayLevel[1]], Cell[OutputFormData[ "\<\ 1 + x^3 + 8*y^3 + 9*z + 27*z^2 + 27*z^3 + x^2*(3 + 6*y + 9*z) + y^2*(12 \ + 36*z) + y*(6 + 36*z + 54*z^2) + x*(3 + 12*y^2 + 18*z + 27*z^2 + y*(12 + 36*z)) \ \>", "\<\ 3 3 2 3 2 2 1 + x + 8 y + 9 z + 27 z + 27 z + x (3 + 6 y + 9 z) + y (12 + 36 z) + 2 2 2 y (6 + 36 z + 54 z ) + x (3 + 12 y + 18 z + 27 z + y (12 + 36 z))\ \>"], "Output", PageWidth->Infinity, Evaluatable->False, LineSpacing->{1, 1}] }, Closed]], Cell[CellGroupData[{ Cell[TextData["CollectCoefficients[p1, {x, y}]"], "Input", PageWidth->Infinity, FontFamily->"Courier New", FontSize->8, FontWeight->"Bold", FontColor->GrayLevel[0], Background->GrayLevel[1]], Cell[OutputFormData[ "\<\ 1 + x^3 + 6*x^2*y + 12*x*y^2 + 8*y^3 + 9*z + 27*z^2 + 27*z^3 + x^2*(3 + \ 9*z) + x*y*(12 + 36*z) + y^2*(12 + 36*z) + x*(3 + 18*z + 27*z^2) + y*(6 + 36*z + \ 54*z^2) \ \>", "\<\ 3 2 2 3 2 3 2 1 + x + 6 x y + 12 x y + 8 y + 9 z + 27 z + 27 z + x (3 + 9 z) + 2 2 \ 2 x y (12 + 36 z) + y (12 + 36 z) + x (3 + 18 z + 27 z ) + y (6 + 36 z + 54 \ z )\ \>"], "Output", PageWidth->Infinity, Evaluatable->False, LineSpacing->{1, 1}] }, Closed]] }, Closed]], Cell[CellGroupData[{ Cell[TextData["SimplifyCoefficients "], "Subsection", Evaluatable->False], Cell[CellGroupData[{ Cell[TextData[ "p1 = 1/((3 + 2w)^2)*((3 - 2w)/2)x*y + 1/((3 + 2w)^2)*2w*x*y + x^2 + y^2 + \ a"], "Input", PageWidth->Infinity], Cell[OutputFormData[ "\<\ a + x^2 + ((3 - 2*w)*x*y)/(2*(3 + 2*w)^2) + (2*w*x*y)/(3 + 2*w)^2 + y^2 \ \>", "\<\ 2 (3 - 2 w) x y 2 w x y 2 a + x + ------------- + ---------- + y 2 2 2 (3 + 2 w) (3 + 2 w)\ \>"], "Output", PageWidth->Infinity, Evaluatable->False] }, Closed]], Cell[CellGroupData[{ Cell[TextData["Simplify[p1]"], "Input", PageWidth->Infinity], Cell[OutputFormData[ "\<\ a + x^2 + (3*x*y)/(2*(3 + 2*w)^2) + (w*x*y)/(3 + 2*w)^2 + y^2 \ \>", "\<\ 2 3 x y w x y 2 a + x + ------------ + ---------- + y 2 2 2 (3 + 2 w) (3 + 2 w)\ \>"], "Output", PageWidth->Infinity, Evaluatable->False] }, Closed]], Cell[CellGroupData[{ Cell[TextData["SimplifyCoefficients[p1, {x, y}]"], "Input", PageWidth->Infinity], Cell[OutputFormData["\<\ a + x^2 + (x*y)/(6 + 4*w) + y^2 \ \>", "\<\ 2 x y 2 a + x + ------- + y 6 + 4 w\ \>"], "Output", PageWidth->Infinity, Evaluatable->False] }, Closed]] }, Closed]] }, Open ]], Cell[CellGroupData[{ Cell[TextData["Limitations"], "Section", Evaluatable->False], Cell[TextData[ "The user should be wary about high order polynomials, since CoefficientList \ may return large arrays in such cases - for example, the simple polynomial 1 \ + x^1000 + y^1000 yields an array with about 3000 elements !\nThus, as all \ the functions defined here work with CoefficientList (or \ CoefficientListToPolynomial), the main shortcoming of the package is its \ limitation to low and medium order polynomials."], "Text", Evaluatable->False] }, Open ]] }, FrontEndVersion->"Macintosh 3.0", ScreenRectangle->{{0, 832}, {0, 604}}, WindowToolbars->{}, CellGrouping->Manual, WindowSize->{520, 509}, WindowMargins->{{16, Automatic}, {Automatic, 8}}, PrivateNotebookOptions->{"ColorPalette"->{RGBColor, -1}}, ShowCellLabel->True, ShowCellTags->False, RenderingOptions->{"ObjectDithering"->True, "RasterDithering"->False}, MacintoshSystemPageSetup->"\<\ 00<0001804P000000]P2:?oQon82n@960dL5:0?l0080001804P000000]P2:001 0000I00000400`<300000BL?00400@00000000000000060001T1T00000000000 00000000000000000000000000000000\>" ] (*********************************************************************** Cached data follows. If you edit this Notebook file directly, not using Mathematica, you must remove the line containing CacheID at the top of the file. The cache data will then be recreated when you save this file from within Mathematica. ***********************************************************************) (*CellTagsOutline CellTagsIndex->{} *) (*CellTagsIndex CellTagsIndex->{} *) (*NotebookFileOutline Notebook[{ Cell[CellGroupData[{ Cell[1731, 51, 130, 3, 99, "Title", Evaluatable->False], Cell[1864, 56, 142, 3, 62, "Subtitle", Evaluatable->False], Cell[2009, 61, 180, 5, 89, "Subsubtitle", Evaluatable->False] }, Open ]], Cell[CellGroupData[{ Cell[2226, 71, 59, 1, 51, "Section", Evaluatable->False], Cell[CellGroupData[{ Cell[2310, 76, 216, 4, 46, "Text", Evaluatable->False], Cell[2529, 82, 65, 1, 27, "Input"], Cell[CellGroupData[{ Cell[2619, 87, 186, 6, 24, "Input"], Cell[2808, 95, 442, 33, 35, "Print", Evaluatable->False] }, Closed]] }, Closed]], Cell[CellGroupData[{ Cell[3299, 134, 409, 13, 49, "Text", Evaluatable->False], Cell[CellGroupData[{ Cell[3733, 151, 199, 6, 24, "Input"], Cell[3935, 159, 1056, 48, 91, "Print", Evaluatable->False] }, Closed]] }, Closed]], Cell[CellGroupData[{ Cell[5040, 213, 468, 14, 68, "Text", Evaluatable->False], Cell[CellGroupData[{ Cell[5533, 231, 66, 1, 27, "Input"], Cell[5602, 234, 850, 44, 91, "Print", Evaluatable->False] }, Closed]] }, Closed]], Cell[CellGroupData[{ Cell[6501, 284, 296, 5, 59, "Text", Evaluatable->False], Cell[CellGroupData[{ Cell[6822, 293, 69, 1, 27, "Input"], Cell[6894, 296, 1002, 46, 91, "Print", Evaluatable->False] }, Closed]], Cell[CellGroupData[{ Cell[7933, 347, 190, 6, 24, "Input"], Cell[8126, 355, 1002, 46, 91, "Print", Evaluatable->False] }, Closed]], Cell[CellGroupData[{ Cell[9165, 406, 191, 6, 24, "Input"], Cell[9359, 414, 880, 44, 91, "Print", Evaluatable->False] }, Closed]], Cell[CellGroupData[{ Cell[10276, 463, 192, 6, 24, "Input"], Cell[10471, 471, 1020, 46, 91, "Print", Evaluatable->False] }, Closed]] }, Closed]] }, Open ]], Cell[CellGroupData[{ Cell[11552, 524, 59, 1, 31, "Section", Evaluatable->False], Cell[CellGroupData[{ Cell[11636, 529, 81, 1, 46, "Subsection", Evaluatable->False], Cell[CellGroupData[{ Cell[11742, 534, 128, 3, 27, "Input"], Cell[11873, 539, 302, 14, 34, "Output", Evaluatable->False] }, Closed]], Cell[CellGroupData[{ Cell[12212, 558, 85, 1, 27, "Input"], Cell[12300, 561, 170, 11, 25, "Output", Evaluatable->False] }, Closed]], Cell[CellGroupData[{ Cell[12507, 577, 92, 1, 27, "Input"], Cell[12602, 580, 302, 14, 34, "Output", Evaluatable->False] }, Closed]], Cell[CellGroupData[{ Cell[12941, 599, 87, 1, 27, "Input"], Cell[13031, 602, 198, 12, 34, "Output", Evaluatable->False] }, Closed]], Cell[CellGroupData[{ Cell[13266, 619, 201, 6, 24, "Input"], Cell[13470, 627, 190, 12, 34, "Output", Evaluatable->False] }, Closed]], Cell[CellGroupData[{ Cell[13697, 644, 208, 6, 24, "Input"], Cell[13908, 652, 197, 12, 34, "Output", Evaluatable->False] }, Closed]], Cell[CellGroupData[{ Cell[14142, 669, 189, 6, 24, "Input"], Cell[14334, 677, 139, 12, 34, "Output", Evaluatable->False] }, Closed]], Cell[CellGroupData[{ Cell[14510, 694, 85, 1, 27, "Input"], Cell[14598, 697, 220, 13, 25, "Output", Evaluatable->False] }, Closed]], Cell[CellGroupData[{ Cell[14855, 715, 91, 1, 27, "Input"], Cell[14949, 718, 139, 12, 34, "Output", Evaluatable->False] }, Closed]], Cell[CellGroupData[{ Cell[15125, 735, 74, 1, 27, "Input"], Cell[15202, 738, 224, 13, 25, "Output", Evaluatable->False] }, Closed]], Cell[CellGroupData[{ Cell[15463, 756, 213, 6, 24, "Input"], Cell[15679, 764, 323, 15, 34, "Output", Evaluatable->False] }, Closed]] }, Closed]], Cell[CellGroupData[{ Cell[16051, 785, 69, 1, 30, "Subsection", Evaluatable->False], Cell[CellGroupData[{ Cell[16145, 790, 208, 6, 24, "Input"], Cell[16356, 798, 213, 27, 34, "Output", Evaluatable->False] }, Closed]], Cell[CellGroupData[{ Cell[16606, 830, 75, 1, 27, "Input"], Cell[16684, 833, 226, 27, 34, "Output", Evaluatable->False] }, Closed]], Cell[CellGroupData[{ Cell[16947, 865, 201, 6, 24, "Input"], Cell[17151, 873, 183, 27, 34, "Output", Evaluatable->False] }, Closed]], Cell[CellGroupData[{ Cell[17371, 905, 199, 6, 24, "Input"], Cell[17573, 913, 246, 27, 34, "Output", Evaluatable->False] }, Closed]], Cell[CellGroupData[{ Cell[17856, 945, 77, 1, 27, "Input"], Cell[17936, 948, 214, 27, 34, "Output", Evaluatable->False] }, Closed]], Cell[CellGroupData[{ Cell[18187, 980, 75, 1, 27, "Input"], Cell[18265, 983, 241, 27, 34, "Output", Evaluatable->False] }, Closed]], Cell[CellGroupData[{ Cell[18543, 1015, 196, 6, 24, "Input"], Cell[18742, 1023, 241, 27, 34, "Output", Evaluatable->False] }, Closed]], Cell[CellGroupData[{ Cell[19020, 1055, 201, 6, 24, "Input"], Cell[19224, 1063, 373, 32, 43, "Output", Evaluatable->False] }, Closed]] }, Closed]], Cell[CellGroupData[{ Cell[19646, 1101, 73, 1, 30, "Subsection", Evaluatable->False], Cell[CellGroupData[{ Cell[19744, 1106, 199, 6, 24, "Input"], Cell[19946, 1114, 183, 27, 34, "Output", Evaluatable->False] }, Closed]], Cell[CellGroupData[{ Cell[20166, 1146, 60, 1, 27, "Input"], Cell[20229, 1149, 213, 27, 34, "Output", Evaluatable->False] }, Closed]], Cell[CellGroupData[{ Cell[20479, 1181, 75, 1, 27, "Input"], Cell[20557, 1184, 212, 27, 34, "Output", Evaluatable->False] }, Closed]], Cell[CellGroupData[{ Cell[20806, 1216, 234, 7, 24, "Input"], Cell[21043, 1225, 279, 28, 34, "Output", Evaluatable->False] }, Closed]], Cell[CellGroupData[{ Cell[21359, 1258, 183, 6, 32, "Input"], Cell[21545, 1266, 483, 34, 52, "Output", Evaluatable->False] }, Closed]], Cell[CellGroupData[{ Cell[22065, 1305, 201, 6, 24, "Input"], Cell[22269, 1313, 412, 31, 52, "Output", Evaluatable->False] }, Closed]] }, Closed]], Cell[CellGroupData[{ Cell[22730, 1350, 72, 1, 30, "Subsection", Evaluatable->False], Cell[CellGroupData[{ Cell[22827, 1355, 208, 6, 24, "Input"], Cell[23038, 1363, 213, 27, 34, "Output", Evaluatable->False] }, Closed]], Cell[CellGroupData[{ Cell[23288, 1395, 181, 6, 24, "Input"], Cell[23472, 1403, 213, 27, 34, "Output", Evaluatable->False] }, Closed]], Cell[CellGroupData[{ Cell[23722, 1435, 196, 6, 24, "Input"], Cell[23921, 1443, 183, 27, 34, "Output", Evaluatable->False] }, Closed]], Cell[CellGroupData[{ Cell[24141, 1475, 246, 8, 24, "Input"], Cell[24390, 1485, 483, 34, 52, "Output", Evaluatable->False] }, Closed]], Cell[CellGroupData[{ Cell[24910, 1524, 181, 6, 24, "Input"], Cell[25094, 1532, 483, 34, 52, "Output", Evaluatable->False] }, Closed]], Cell[CellGroupData[{ Cell[25614, 1571, 80, 1, 27, "Input"], Cell[25697, 1574, 279, 28, 34, "Output", Evaluatable->False] }, Closed]] }, Closed]], Cell[CellGroupData[{ Cell[26025, 1608, 73, 1, 30, "Subsection", Evaluatable->False], Cell[CellGroupData[{ Cell[26123, 1613, 82, 1, 27, "Input"], Cell[26208, 1616, 630, 37, 67, "Output", Evaluatable->False] }, Closed]], Cell[CellGroupData[{ Cell[26875, 1658, 190, 6, 24, "Input"], Cell[27068, 1666, 564, 34, 67, "Output", Evaluatable->False] }, Closed]], Cell[CellGroupData[{ Cell[27669, 1705, 202, 6, 24, "Input"], Cell[27874, 1713, 607, 36, 67, "Output", Evaluatable->False] }, Closed]] }, Closed]], Cell[CellGroupData[{ Cell[28530, 1755, 75, 1, 30, "Subsection", Evaluatable->False], Cell[CellGroupData[{ Cell[28630, 1760, 128, 3, 27, "Input"], Cell[28761, 1765, 342, 30, 52, "Output", Evaluatable->False] }, Closed]], Cell[CellGroupData[{ Cell[29140, 1800, 62, 1, 27, "Input"], Cell[29205, 1803, 328, 30, 52, "Output", Evaluatable->False] }, Closed]], Cell[CellGroupData[{ Cell[29570, 1838, 82, 1, 27, "Input"], Cell[29655, 1841, 209, 28, 43, "Output", Evaluatable->False] }, Closed]] }, Closed]] }, Open ]], Cell[CellGroupData[{ Cell[29925, 1876, 62, 1, 31, "Section", Evaluatable->False], Cell[29990, 1879, 464, 7, 110, "Text", Evaluatable->False] }, Open ]] } ] *) (*********************************************************************** End of Mathematica Notebook file. ***********************************************************************)