(*^ ::[ Information = "This is a Mathematica Notebook file. It contains ASCII text, and can be transferred by email, ftp, or other text-file transfer utility. It should be read or edited using a copy of Mathematica or MathReader. If you received this as email, use your mail application or copy/paste to save everything from the line containing (*^ down to the line containing ^*) into a plain text file. On some systems you may have to give the file a name ending with ".ma" to allow Mathematica to recognize it as a Notebook. The line below identifies what version of Mathematica created this file, but it can be opened using any other version as well."; FrontEndVersion = "Macintosh Mathematica Notebook Front End Version 2.2"; MacintoshStandardFontEncoding; keywords = "Expand, Factor, Simplify, ExpandAll, Together, Apart, Replacements, Assignments, AlgebraicRules, Collect, FactorTerms, FactorSquareFree, ExpandNumerator, ExpandDenominator, Cancel, Coefficient, CoefficientList, Exponent, Variables, Numerator, Denominator, Part, PolynomialQuotient, PolynomialRemainder, PolynomialGCD, PolynomialLCM, PolynomialMod, Resultant, Decompose, ComplexExpand, Output`suppressing, Short, Sin, Cos, Tan, Csc, Sec, Cot, ArcSin, ArcCos, ArcTan, ArcCsc, ArcSec, ArcCot"; fontset = title, Text, formatAsCurrentKernel, evaluateAsCurrentKernel, inactive, noPageBreakBelow, nohscroll, noKeepOnOnePage, preserveAspect, groupLikeTitle, M7, bold, e8, 24, "Helvetica"; fontset = subtitle, Text, formatAsCurrentKernel, evaluateAsCurrentKernel, inactive, noPageBreakBelow, nohscroll, noKeepOnOnePage, preserveAspect, groupLikeTitle, M7, bold, italic, e6, 24, "Helvetica"; fontset = subsubtitle, Text, formatAsCurrentKernel, evaluateAsCurrentKernel, inactive, noPageBreakBelow, nohscroll, noKeepOnOnePage, preserveAspect, groupLikeTitle, M7, italic, e50, 24, "Helvetica"; fontset = section, Text, formatAsCurrentKernel, evaluateAsCurrentKernel, inactive, noPageBreakBelow, nohscroll, noKeepOnOnePage, preserveAspect, groupLikeSection, blackBox, M22, bold, a20, 18, "Helvetica"; fontset = subsection, Text, formatAsCurrentKernel, evaluateAsCurrentKernel, inactive, noPageBreakBelow, nohscroll, noKeepOnOnePage, preserveAspect, groupLikeSection, grayBox, M19, bold, a15, 14, "Helvetica"; fontset = subsubsection, Text, formatAsCurrentKernel, evaluateAsCurrentKernel, inactive, noPageBreakBelow, nohscroll, noKeepOnOnePage, preserveAspect, groupLikeSection, whiteBox, M18, bold, a12, 12, "Helvetica"; fontset = text, Text, formatAsCurrentKernel, evaluateAsCurrentKernel, inactive, nohscroll, noKeepOnOnePage, preserveAspect, M17, 14, "Times"; fontset = smalltext, Text, formatAsCurrentKernel, evaluateAsCurrentKernel, inactive, nohscroll, noKeepOnOnePage, preserveAspect, M61, 14, "Times"; fontset = input, Text, formatAsCurrentKernel, evaluateAsCurrentKernel, noPageBreakInGroup, nowordwrap, preserveAspect, groupLikeInput, N23, bold, B65535, 12, "Courier"; fontset = output, Text, formatAsCurrentKernel, evaluateAsCurrentKernel, output, inactive, noPageBreakInGroup, nowordwrap, preserveAspect, groupLikeOutput, N23, R17381, G28866, B53247, L-5, 12, "Courier"; fontset = message, Text, formatAsCurrentKernel, evaluateAsCurrentKernel, inactive, noPageBreakInGroup, nowordwrap, preserveAspect, groupLikeOutput, M42, N23, 12, "Courier"; fontset = print, Text, formatAsCurrentKernel, evaluateAsCurrentKernel, inactive, noPageBreakInGroup, nowordwrap, preserveAspect, groupLikeOutput, M42, N23, 12, "Courier"; fontset = info, Text, formatAsCurrentKernel, evaluateAsCurrentKernel, inactive, noPageBreakInGroup, nowordwrap, preserveAspect, groupLikeOutput, M42, N23, 12, "Courier"; fontset = postscript, PostScript, formatAsPostScript, evaluateAsCurrentKernel, output, inactive, noPageBreakInGroup, nowordwrap, preserveAspect, groupLikeGraphics, M7, l37, w282, h287, 12, "Courier"; fontset = name, Text, formatAsCurrentKernel, evaluateAsCurrentKernel, inactive, nohscroll, noKeepOnOnePage, preserveAspect, M7, italic, 10, "Geneva"; fontset = header, Text, formatAsCurrentKernel, evaluateAsCurrentKernel, inactive, nohscroll, noKeepOnOnePage, preserveAspect, right, M7, 12, "Palatino"; fontset = leftheader, Text, formatAsCurrentKernel, evaluateAsCurrentKernel, nohscroll, L2, 12, "Palatino"; fontset = footer, Text, formatAsCurrentKernel, evaluateAsCurrentKernel, inactive, nohscroll, noKeepOnOnePage, preserveAspect, center, M7, 12, "Palatino"; fontset = leftfooter, Text, formatAsCurrentKernel, evaluateAsCurrentKernel, center, L2, 12, "Palatino"; fontset = help, Text, formatAsCurrentKernel, evaluateAsCurrentKernel, inactive, nohscroll, noKeepOnOnePage, preserveAspect, M7, 10, "Geneva"; fontset = clipboard, Text, formatAsCurrentKernel, evaluateAsCurrentKernel, inactive, nohscroll, noKeepOnOnePage, preserveAspect, M7, 12, "New York"; fontset = completions, Text, formatAsCurrentKernel, evaluateAsCurrentKernel, inactive, nohscroll, noKeepOnOnePage, preserveAspect, M7, 12, "Courier"; fontset = special1, Text, formatAsCurrentKernel, evaluateAsCurrentKernel, inactive, nohscroll, noKeepOnOnePage, preserveAspect, grayDot, M19, N7, bold, 12, "Helvetica"; fontset = special2, Text, formatAsCurrentKernel, evaluateAsCurrentKernel, inactive, nohscroll, noKeepOnOnePage, preserveAspect, M18, bold, 12, "Courier"; fontset = special3, Text, formatAsCurrentKernel, evaluateAsCurrentKernel, inactive, nohscroll, noKeepOnOnePage, preserveAspect, M18, bold, 12, "Helvetica"; fontset = special4, Text, formatAsCurrentKernel, evaluateAsCurrentKernel, inactive, nohscroll, noKeepOnOnePage, preserveAspect, M7, 12, "Palatino"; fontset = special5, Text, formatAsCurrentKernel, evaluateAsCurrentKernel, inactive, nohscroll, noKeepOnOnePage, preserveAspect, M7, 12, "Palatino"; paletteColors = 128; automaticGrouping; ] :[font = title; inactive; preserveAspect; startGroup] Algebra :[font = section; inactive; Cclosed; preserveAspect; startGroup] Index :[font = text; inactive; dontPreserveAspect] This index gives a list of keywords that are associated with various cells in this Notebook. If you Command-Double-click one of the keywords below, Mathematica will find the cell associated with that keyword, select it, and display it in the center of your window. ;[s] 3:0,0;149,1;160,0;268,-1; 2:2,16,12,Times,0,14,0,0,0;1,16,12,Times,2,14,0,0,0; :[font = smalltext; inactive; preserveAspect; endGroup] AlgebraicRules Apart ArcCos ArcCot ArcCsc ArcSec ArcSin ArcTan Assignments Cancel Coefficient CoefficientList Collect ComplexExpand Cos Cot Csc Decompose Denominator Expand ExpandAll ExpandDenominator ExpandNumerator Exponent Factor FactorSquareFree FactorTerms Numerator Output`suppressing Part PolynomialGCD PolynomialLCM PolynomialMod PolynomialQuotient PolynomialRemainder Replacements Resultant Sec Short Simplify Sin Tan Together Variables :[font = section; inactive; Cclosed; preserveAspect; startGroup] Basic Algebraic Operations :[font = subsubsection; inactive; Cclosed; preserveAspect; startGroup] Syntax (see pages 76 and 591) :[font = special2; inactive; preserveAspect; keywords = "Expand"] Expand :[font = smalltext; inactive; preserveAspect] Expand[poly ] expands out products and positive integer powers in poly. ;[s] 6:0,1;7,2;12,1;13,0;67,2;71,0;73,-1; 3:2,16,12,Times,0,14,0,0,0;2,13,10,Courier,1,12,0,0,0;2,16,12,Times,2,14,0,0,0; :[font = special2; inactive; preserveAspect; keywords = "Factor"] Factor :[font = smalltext; inactive; preserveAspect] Factor[poly ] factors a polynomial over the integers. ;[s] 4:0,1;7,2;12,1;13,0;55,-1; 3:1,16,12,Times,0,14,0,0,0;2,13,10,Courier,1,12,0,0,0;1,16,12,Times,2,14,0,0,0; :[font = special2; inactive; preserveAspect; keywords = "Simplify"] Simplify :[font = smalltext; inactive; preserveAspect] Simplify[expr ] performs a sequence of algebraic transformations on expr , and returns the simplest one it finds. ;[s] 6:0,2;9,1;14,2;16,0;68,1;73,0;114,-1; 3:2,16,12,Times,0,14,0,0,0;2,16,12,Times,2,14,0,0,0;2,13,10,Courier,1,12,0,0,0; :[font = special2; inactive; preserveAspect; keywords = "ExpandAll"] ExpandAll :[font = smalltext; inactive; preserveAspect] ExpandAll[expr ] expands numerators and denominators completely. ;[s] 4:0,1;10,2;15,1;17,0;66,-1; 3:1,16,12,Times,0,14,0,0,0;2,13,10,Courier,1,12,0,0,0;1,16,12,Times,2,14,0,0,0; :[font = special2; inactive; preserveAspect; keywords = "Together"] Together :[font = smalltext; inactive; preserveAspect] Together[expr ] combines all terms over a common denominator, and cancels factors in the result. ;[s] 4:0,1;9,2;14,1;15,0;98,-1; 3:1,16,12,Times,0,14,0,0,0;2,13,10,Courier,1,12,0,0,0;1,16,12,Times,2,14,0,0,0; :[font = special2; inactive; preserveAspect; keywords = "Apart"] Apart :[font = smalltext; inactive; preserveAspect; endGroup] Apart[expr ] writes expr as a sum of terms with simple denominators. ;[s] 6:0,1;6,2;11,1;12,0;21,2;25,0;71,-1; 3:2,16,12,Times,0,14,0,0,0;2,13,10,Courier,1,12,0,0,0;2,16,12,Times,2,14,0,0,0; :[font = subsubsection; inactive; Cclosed; preserveAspect; startGroup] Expanding Out Products and Powers :[font = input; Cclosed; preserveAspect; startGroup] Expand[(x + y )^3] :[font = output; output; inactive; preserveAspect; endGroup; endGroup] x^3 + 3*x^2*y + 3*x*y^2 + y^3 ;[o] 3 2 2 3 x + 3 x y + 3 x y + y :[font = subsubsection; inactive; Cclosed; preserveAspect; startGroup] Factoring :[font = input; Cclosed; preserveAspect; startGroup] Factor[x^2 - 9] :[font = output; output; inactive; preserveAspect; endGroup; endGroup] (-3 + x)*(3 + x) ;[o] (-3 + x) (3 + x) :[font = subsubsection; inactive; Cclosed; preserveAspect; startGroup] Simplifying :[font = input; Cclosed; preserveAspect; startGroup] Simplify[x^2 + 2x +1] :[font = output; output; inactive; preserveAspect; endGroup] (1 + x)^2 ;[o] 2 (1 + x) :[font = input; Cclosed; preserveAspect; startGroup] Simplify[x^4 - 1] :[font = output; output; inactive; preserveAspect; endGroup; endGroup] -1 + x^4 ;[o] 4 -1 + x :[font = subsubsection; inactive; Cclosed; preserveAspect; startGroup] Expanding Both Numerator and Denominator :[font = input; Cclosed; preserveAspect; startGroup] ExpandAll [(x+1)^2/ (x - 1)^2] :[font = output; output; inactive; preserveAspect; endGroup; endGroup] (1 - 2*x + x^2)^(-1) + (2*x)/(1 - 2*x + x^2) + x^2/(1 - 2*x + x^2) ;[o] 2 1 2 x x ------------ + ------------ + ------------ 2 2 2 1 - 2 x + x 1 - 2 x + x 1 - 2 x + x :[font = subsubsection; inactive; Cclosed; preserveAspect; startGroup] Combining Terms over a Common Denominator :[font = input; Cclosed; preserveAspect; startGroup] Together[ 1/(2x) + 3 x^2/(x-1)] :[font = output; output; inactive; preserveAspect; endGroup; endGroup] (-1 + x + 6*x^3)/(2*(-1 + x)*x) ;[o] 3 -1 + x + 6 x ------------- 2 (-1 + x) x :[font = subsubsection; inactive; Cclosed; preserveAspect; startGroup] Separating into Terms with Simple Denominators :[font = input; Cclosed; preserveAspect; startGroup] Apart[(x - 1) / (x^2 + 2x +1)] :[font = output; output; inactive; preserveAspect; endGroup; endGroup] -2/(1 + x)^2 + (1 + x)^(-1) ;[o] -2 1 -------- + ----- 2 1 + x (1 + x) :[font = subsubsection; inactive; Cclosed; preserveAspect; startGroup] Expanding Noninteger Powers :[font = input; Cclosed; preserveAspect; startGroup] PowerExpand[(x y)^3.2] :[font = output; output; inactive; preserveAspect; endGroup; endGroup] x^3.2*y^3.2 ;[o] 3.2 3.2 x y :[font = subsubsection; inactive; Cclosed; preserveAspect; startGroup] A Note on Expanding Noninteger Powers :[font = text; inactive; preserveAspect; endGroup; endGroup] Mathematica does not automatically expand out expressions of the form (a b )^c , except when c is an integer. In general, it is only correct to do this expansion if a and b are positive reals. Sometimes it is useful to perform transformations that are correct only if certain assuptions are made about the possible values of symbolic variables. One such transformation is done by PowerExpand. It effectively assumes that a and b are positive reals. ;[s] 19:0,1;11,0;81,2;82,1;86,2;88,1;89,0;104,1;105,0;177,1;178,0;184,1;185,0;394,2;405,0;436,1;437,0;443,1;444,0;466,-1; 3:8,16,12,Times,0,14,0,0,0;8,16,12,Times,2,14,0,0,0;3,13,10,Courier,1,12,0,0,0; :[font = section; inactive; Cclosed; preserveAspect; startGroup] Replacements and Assignments :[font = subsubsection; inactive; Cclosed; preserveAspect; startGroup] Syntax (see pages 74, 243 and 622) :[font = special3; inactive; preserveAspect; keywords = "Replacements"] Replacements :[font = smalltext; inactive; preserveAspect] expr /. x -> value replaces x by value in expr . ;[s] 16:0,1;4,0;6,2;8,0;9,1;10,0;12,2;14,0;15,1;20,0;32,1;34,0;38,1;43,0;48,1;53,0;55,-1; 3:8,16,12,Times,0,14,0,0,0;6,16,12,Times,2,14,0,0,0;2,13,10,Courier,1,12,0,0,0; :[font = smalltext; inactive; preserveAspect] expr /. {x -> xval, y ->yval } performs several replacements. ;[s] 17:0,1;4,0;6,2;8,0;9,2;10,1;11,0;13,2;15,0;16,1;20,2;22,1;23,0;25,2;27,1;32,2;34,0;65,-1; 3:6,16,12,Times,0,14,0,0,0;5,16,12,Times,2,14,0,0,0;6,13,10,Courier,1,12,0,0,0; :[font = special3; inactive; preserveAspect; keywords = "Assignments"] Assignments :[font = smalltext; inactive; preserveAspect] x = value assigns a value for x that will always be used. ;[s] 6:0,1;1,0;5,1;10,0;33,1;34,0;62,-1; 2:3,16,12,Times,0,14,0,0,0;3,16,12,Times,2,14,0,0,0; :[font = smalltext; inactive; preserveAspect] x =. removes any value defined for x . ;[s] 6:0,1;1,0;4,2;5,0;37,1;39,0;41,-1; 3:3,16,12,Times,0,14,0,0,0;2,16,12,Times,2,14,0,0,0;1,13,10,Courier,1,12,0,0,0; :[font = special2; inactive; preserveAspect; keywords = "AlgebraicRules"] AlgebraicRules :[font = smalltext; inactive; preserveAspect] AlgebraicRules[eqns , {x1 , x2 , ...}] generates a set of algebraic rules that replace variables earlier in the list of xi with ones later in the list, according to the equations eqns . ;[s] 16:0,2;15,1;20,2;23,1;26,2;27,0;28,1;31,2;32,0;33,3;36,2;39,0;121,1;123,0;182,1;187,0;189,-1; 4:5,16,12,Times,0,14,0,0,0;5,16,12,Times,2,14,0,0,0;5,13,10,Courier,1,12,0,0,0;1,16,12,Times,3,14,0,0,0; :[font = smalltext; inactive; preserveAspect; endGroup] expr /. algrules applies algebraic rules to a particular expression. ;[s] 5:0,1;4,0;6,2;9,1;17,0;71,-1; 3:2,16,12,Times,0,14,0,0,0;2,16,12,Times,2,14,0,0,0;1,13,10,Courier,1,12,0,0,0; :[font = subsubsection; inactive; Cclosed; preserveAspect; startGroup] Replacing a Variable with a Number :[font = input; Cclosed; preserveAspect; startGroup] 1 + 2x /. x -> 3 :[font = output; output; inactive; preserveAspect; endGroup; endGroup] 7 ;[o] 7 :[font = subsubsection; inactive; Cclosed; preserveAspect; startGroup] Assigning a Numerical Value to a Variable :[font = input; Cclosed; preserveAspect; startGroup] x = 3 :[font = output; input; inactive; preserveAspect; endGroup] 3 :[font = input; Cclosed; preserveAspect; startGroup] 1 + 2x :[font = output; input; inactive; preserveAspect; endGroup; endGroup] 7 :[font = subsubsection; inactive; Cclosed; preserveAspect; startGroup] A Note on Replacements and Assignments :[font = text; inactive; preserveAspect; endGroup] The replacement operator /. allows you to apply transformation rules to a particular expression. Sometimes, however, you will want to define transformation rules that should always be applied. In this case, you would use an assignment such as x = 3. You should understand that explicit definitions such as x = 3 have a global effect. On the other hand, a replacement such as expr /.x -> 3 affects only the specific expression expr . It is usually much easier to keep things straight if you avoid using explicit definitions except when absolutely necessary. Probably the single most common mistake in using Mathematica is to make an assignment for a variable like x at one point in your session, and later using x having forgotten about the assignment you made. ;[s] 21:0,0;25,2;27,0;245,1;247,0;309,1;310,0;380,1;384,0;386,2;388,1;391,2;393,0;434,1;439,0;614,1;625,0;672,1;673,0;721,1;722,0;772,-1; 3:10,16,12,Times,0,14,0,0,0;8,16,12,Times,2,14,0,0,0;3,13,10,Courier,1,12,0,0,0; :[font = subsubsection; inactive; Cclosed; preserveAspect; startGroup] Replacing a Variable by an Expression :[font = input; Cclosed; preserveAspect; startGroup] 1 + x + x^2 /. x -> 2 - y :[font = output; output; inactive; preserveAspect; endGroup; endGroup] 3 + (2 - y)^2 - y ;[o] 2 3 + (2 - y) - y :[font = subsubsection; inactive; Cclosed; preserveAspect; startGroup] Making Several Replacements :[font = input; Cclosed; preserveAspect; startGroup] (x + y) (x - y)^2 /. {x -> 3, y -> 1 - a} :[font = output; output; inactive; preserveAspect; endGroup; endGroup] (4 - a)*(2 + a)^2 ;[o] 2 (4 - a) (2 + a) :[font = subsubsection; inactive; Cclosed; preserveAspect; startGroup] Giving a Name to a Transformation Rule :[font = input; Cclosed; preserveAspect; startGroup] transrule = x -> 2 - y :[font = output; output; inactive; preserveAspect; endGroup] ;[o] x -> 2 - y :[font = input; Cclosed; preserveAspect; startGroup] 1 + x + x^2 /. transrule :[font = output; output; inactive; preserveAspect; endGroup; endGroup] ;[o] 2 3 + (2 - y) - y :[font = subsubsection; inactive; Cclosed; preserveAspect; startGroup] Assigning an Expression to a Variable :[font = input; Cclosed; preserveAspect; startGroup] x = a + 1 :[font = output; output; inactive; preserveAspect; endGroup] 1 + a ;[o] 1 + a :[font = input; Cclosed; preserveAspect; startGroup] x ^2 - 1 :[font = output; output; inactive; preserveAspect; endGroup; endGroup] -1 + (1 + a)^2 ;[o] 2 -1 + (1 + a) :[font = subsubsection; inactive; Cclosed; preserveAspect; startGroup] Removing an Assigned Value :[font = input; Cclosed; preserveAspect; startGroup] x = a + 1 :[font = output; output; inactive; preserveAspect; endGroup] ;[o] 1 + a :[font = input; Cclosed; preserveAspect; startGroup] x ^2 - 1 :[font = output; output; inactive; preserveAspect; endGroup] -1 + (1 + a)^2 ;[o] 2 -1 + (1 + a) :[font = input; preserveAspect] x = . :[font = input; Cclosed; preserveAspect; startGroup] x ^2 - 1 :[font = output; output; inactive; preserveAspect; endGroup; endGroup] -1 + x^2 ;[o] 2 -1 + x :[font = subsubsection; inactive; Cclosed; preserveAspect; startGroup] Using Algebraic Rules :[font = input; Cclosed; preserveAspect; startGroup] ar = AlgebraicRules[ x^2 == a, {x, a}] :[font = output; output; inactive; preserveAspect; endGroup] AlgebraicRulesData[{Solve`SolvVar[x], Solve`SolvVar[a]}, {x, a}, -Solve`SolvVar[a] + Solve`SolvVar[x]^2 == 0, {{{2, {{0, 1}}}, {0, {{1, -1}}}}}, {x, a}, {x^2 -> a}, Rational] ;[o] 2 {x -> a} :[font = input; Cclosed; preserveAspect; startGroup] 1 + x^2 + x^4 /. ar :[font = output; output; inactive; preserveAspect; endGroup; endGroup] 1 + a + a^2 ;[o] 2 1 + a + a :[font = subsubsection; inactive; Cclosed; preserveAspect; startGroup] A Note on Algebraic Rules :[font = text; inactive; preserveAspect; endGroup] Transformation rules in Mathematica are usually based on the structure of expressions, not their algebraic meaning. Thus, the transformation rule x^2 -> a says nothing about objects like x^4 that are algebraically related to x^2. The previous example shows how to use AlgebraicRules to make transformations based on algebraic relationships. ;[s] 19:0,0;24,1;35,0;156,4;157,3;158,4;160,3;162,4;164,0;199,4;200,3;201,4;202,0;237,4;238,3;239,4;240,0;280,2;294,0;354,-1; 5:6,16,12,Times,0,14,0,0,0;1,16,12,Times,2,14,0,0,0;1,13,10,Courier,1,12,0,0,0;4,13,9,Times,1,12,0,0,0;7,13,9,Times,0,12,0,0,0; :[font = subsubsection; inactive; Cclosed; preserveAspect; startGroup] Algebraic Rules in Several Variables :[font = input; Cclosed; preserveAspect; startGroup] ar2 = AlgebraicRules[ { a == x+y, b == x y}, {x, y, a, b}] :[font = output; output; inactive; preserveAspect; endGroup] AlgebraicRulesData[{Solve`SolvVar[x], Solve`SolvVar[y], Solve`SolvVar[a], Solve`SolvVar[b]}, {x, y, a, b}, Solve`SolvVar[a] - Solve`SolvVar[x] - Solve`SolvVar[y] == 0 && Solve`SolvVar[b] - Solve`SolvVar[x]*Solve`SolvVar[y] == 0, {{{0, {{2, {{0, {{0, -1}}}}}, {1, {{1, {{0, 1}}}}}, {0, {{0, {{1, -1}}}}}}}}, {{1, {{0, {{0, {{0, -1}}}}}}}, {0, {{1, {{0, {{0, -1}}}}}, {0, {{1, {{0, 1}}}}}}}}}, {x, y, a, b}, {y^2 -> -b + a*y, x -> a - y}, Rational] ;[o] 2 {y -> -b + a y, x -> a - y} :[font = input; Cclosed; preserveAspect; startGroup] x^5 + y^5 /. ar2 :[font = output; output; inactive; preserveAspect; endGroup; endGroup; endGroup] a^5 - 5*a^3*b + 5*a*b^2 ;[o] 5 3 2 a - 5 a b + 5 a b :[font = section; inactive; Cclosed; preserveAspect; startGroup] Transforming Polynomials :[font = subsubsection; inactive; Cclosed; preserveAspect; startGroup] Syntax (see pages 78 and 591) :[font = special2; inactive; preserveAspect; keywords = "Expand"] Expand :[font = smalltext; inactive; preserveAspect] Expand[poly ] expands out products and positive integer powers in poly . ;[s] 6:0,1;7,2;12,1;13,0;66,2;71,0;73,-1; 3:2,16,12,Times,0,14,0,0,0;2,13,10,Courier,1,12,0,0,0;2,16,12,Times,2,14,0,0,0; :[font = smalltext; inactive; preserveAspect] Expand[poly , patt ] expands out poly avoiding those parts which do not contain terms matching patt . ;[s] 11:0,1;7,2;12,1;13,0;14,2;19,1;21,0;33,2;38,0;96,2;101,0;104,-1; 3:4,16,12,Times,0,14,0,0,0;3,13,10,Courier,1,12,0,0,0;4,16,12,Times,2,14,0,0,0; :[font = special2; inactive; preserveAspect; keywords = "Factor"] Factor :[font = smalltext; inactive; preserveAspect] Factor[poly ] factors a polynomial over the integers. ;[s] 4:0,1;7,2;12,1;13,0;54,-1; 3:1,16,12,Times,0,14,0,0,0;2,13,10,Courier,1,12,0,0,0;1,16,12,Times,2,14,0,0,0; :[font = smalltext; inactive; preserveAspect] Factor[poly , GaussianIntegers -> True] factors a polynomial, allowing coefficients that are complex numbers with rational real and imaginary parts. ;[s] 6:0,1;7,2;12,1;13,0;14,1;40,0;149,-1; 3:2,16,12,Times,0,14,0,0,0;3,13,10,Courier,1,12,0,0,0;1,16,12,Times,2,14,0,0,0; :[font = special2; inactive; preserveAspect; keywords = "Simplify"] Simplify :[font = smalltext; inactive; preserveAspect] Simplify[poly ] performs a sequence of algebraic transformations on expr , and returns the simplest one it finds. ;[s] 6:0,1;9,2;14,1;15,0;68,2;73,0;114,-1; 3:2,16,12,Times,0,14,0,0,0;2,13,10,Courier,1,12,0,0,0;2,16,12,Times,2,14,0,0,0; :[font = special2; inactive; preserveAspect; keywords = "Collect"] Collect :[font = smalltext; inactive; preserveAspect] Collect[poly , x ] collects together terms involving the same power of x . ;[s] 9:0,1;8,2;13,1;14,0;15,2;17,1;19,0;71,2;73,0;75,-1; 3:3,16,12,Times,0,14,0,0,0;3,13,10,Courier,1,12,0,0,0;3,16,12,Times,2,14,0,0,0; :[font = smalltext; inactive; preserveAspect] Collect[poly , {x1 , x2 , ...}] collects together terms involving the same powers of x1 , x2 , ... . ;[s] 15:0,1;8,2;13,1;16,2;19,1;20,0;22,2;25,1;26,0;27,1;33,0;86,2;88,0;91,2;94,0;102,-1; 3:5,16,12,Times,0,14,0,0,0;5,13,10,Courier,1,12,0,0,0;5,16,12,Times,2,14,0,0,0; :[font = special2; inactive; preserveAspect; keywords = "FactorTerms"] FactorTerms :[font = smalltext; inactive; preserveAspect] FactorTerms[poly ] factors out any overall numerical factor. ;[s] 4:0,1;12,2;17,1;19,0;61,-1; 3:1,16,12,Times,0,14,0,0,0;2,13,10,Courier,1,12,0,0,0;1,16,12,Times,2,14,0,0,0; :[font = special2; inactive; preserveAspect; keywords = "FactorSquareFree"] FactorSquareFree :[font = smalltext; inactive; preserveAspect; endGroup] FactorSquareFree[poly ] pulls out any square-free factors in poly . ;[s] 6:0,1;17,2;22,1;23,0;62,2;67,0;69,-1; 3:2,16,12,Times,0,14,0,0,0;2,13,10,Courier,1,12,0,0,0;2,16,12,Times,2,14,0,0,0; :[font = subsubsection; inactive; Cclosed; preserveAspect; startGroup] Expanding Out Products and Powers :[font = input; Cclosed; preserveAspect; startGroup] Expand[(x + y )^3] :[font = output; output; inactive; preserveAspect; endGroup; endGroup] x^3 + 3*x^2*y + 3*x*y^2 + y^3 ;[o] 3 2 2 3 x + 3 x y + 3 x y + y :[font = subsubsection; inactive; Cclosed; preserveAspect; startGroup] Expanding Only Certain Forms :[font = input; Cclosed; preserveAspect; startGroup] Expand[(x+1)^2 (y +1)^2, x] :[font = output; output; inactive; preserveAspect; endGroup; endGroup] (1 + y)^2 + 2*x*(1 + y)^2 + x^2*(1 + y)^2 ;[o] 2 2 2 2 (1 + y) + 2 x (1 + y) + x (1 + y) :[font = subsubsection; inactive; Cclosed; preserveAspect; startGroup] Factoring :[font = input; Cclosed; preserveAspect; startGroup] Factor[x^2 - 9] :[font = output; output; inactive; preserveAspect; endGroup; endGroup] (-3 + x)*(3 + x) ;[o] (-3 + x) (3 + x) :[font = subsubsection; inactive; Cclosed; preserveAspect; startGroup] Factoring with Gaussian Integers :[font = input; Cclosed; preserveAspect; startGroup] Factor[ x^2 + 1, GaussianIntegers -> True] ;[s] 3:0,0;41,1;42,0;44,-1; 2:2,13,10,Courier,1,12,0,0,65535;1,12,9,Courier,1,10,0,0,65535; :[font = output; output; inactive; preserveAspect; endGroup] (-I + x)*(I + x) ;[o] (-I + x) (I + x) :[font = input; Cclosed; preserveAspect; startGroup] Factor[ x^2 - 2I, GaussianIntegers -> True] ;[s] 3:0,0;42,1;43,0;45,-1; 2:2,13,10,Courier,1,12,0,0,65535;1,12,9,Courier,1,10,0,0,65535; :[font = output; output; inactive; preserveAspect; endGroup; endGroup] (-1 - I + x)*(1 + I + x) ;[o] (-1 - I + x) (1 + I + x) :[font = subsubsection; inactive; Cclosed; preserveAspect; startGroup] Simplifying :[font = input; Cclosed; preserveAspect; startGroup] Simplify[x^2 + 2x +1] :[font = output; output; inactive; preserveAspect; endGroup] (1 + x)^2 ;[o] 2 (1 + x) :[font = input; Cclosed; preserveAspect; startGroup] Simplify[x^4 - 1] :[font = output; output; inactive; preserveAspect; endGroup; endGroup] -1 + x^4 ;[o] 4 -1 + x :[font = subsubsection; inactive; Cclosed; preserveAspect; startGroup] A Note on Simplifying :[font = text; inactive; preserveAspect; endGroup] There are many situations where you want to write a particular algebraic expression in the simplest possible form. Although it is difficult to know exactly what one means in all cases by the "simplest form", a worthwhile practical procedure is to look at many different forms of an expression, and pick out the one that involves the smallest number of parts. This is essentially what Simplify does. For many simple algebraic calculations, you may find it convenient to use Simplify routinely on your results. In more complicated calculations, however, you often need to exercise more control over the exact form of the answer that you get. In addition, when your expressions are complicated, Simplify may spend a long time testing a large number of possible forms in its attempt to find the simplest one. ;[s] 7:0,0;384,1;392,0;474,1;482,0;694,1;702,0;807,-1; 2:4,16,12,Times,0,14,0,0,0;3,13,10,Courier,1,12,0,0,0; :[font = subsubsection; inactive; Cclosed; preserveAspect; startGroup] Collecting Terms :[font = input; Cclosed; preserveAspect; startGroup] Collect[x + n x + m, x] :[font = output; output; inactive; preserveAspect; endGroup; endGroup] m + (1 + n)*x ;[o] m + (1 + n) x :[font = subsubsection; inactive; Cclosed; preserveAspect; startGroup] Collecting Terms in Several Variables :[font = input; Cclosed; preserveAspect; startGroup] Collect[ x^2 y + x^2 + y z + z, {x,z}] :[font = output; output; inactive; preserveAspect; endGroup; endGroup] x^2*(1 + y) + (1 + y)*z ;[o] 2 x (1 + y) + (1 + y) z :[font = subsubsection; inactive; Cclosed; preserveAspect; startGroup] Pulling Out a Numerical Factor :[font = input; Cclosed; preserveAspect; startGroup] FactorTerms[2 x^2 + 6 y^2 - 12] :[font = output; output; inactive; preserveAspect; endGroup; endGroup] -2*(6 - x^2 - 3*y^2) ;[o] 2 2 -2 (6 - x - 3 y ) :[font = subsubsection; inactive; Cclosed; preserveAspect; startGroup] Pulling Out Squared Factors :[font = input; Cclosed; preserveAspect; startGroup] FactorSquareFree[Expand[(1 + x)^2 (2 +x) (3 + x)]] :[font = output; output; inactive; preserveAspect; endGroup; endGroup; endGroup] (1 + x)^2*(6 + 5*x + x^2) ;[o] 2 2 (1 + x) (6 + 5 x + x ) :[font = section; inactive; Cclosed; preserveAspect; startGroup] Transforming Rational Expressions :[font = subsubsection; inactive; Cclosed; preserveAspect; startGroup] Syntax (see pages 78 and 594) :[font = special2; inactive; preserveAspect; keywords = "Expand"] Expand :[font = smalltext; inactive; preserveAspect] Expand[expr ] expands out products and positive integer powers in the numerator of expr , dividing the denominator into each term. ;[s] 6:0,1;7,2;12,1;13,0;84,2;89,0;132,-1; 3:2,16,12,Times,0,14,0,0,0;2,13,10,Courier,1,12,0,0,0;2,16,12,Times,2,14,0,0,0; :[font = smalltext; inactive; preserveAspect] Expand[expr , patt ] expands expr avoiding those parts which do not contain terms matching patt . ;[s] 10:0,1;7,2;12,1;14,2;19,1;21,0;29,2;34,0;92,2;97,0;99,-1; 3:3,16,12,Times,0,14,0,0,0;3,13,10,Courier,1,12,0,0,0;4,16,12,Times,2,14,0,0,0; :[font = special2; inactive; preserveAspect; keywords = "ExpandNumerator"] ExpandNumerator :[font = smalltext; inactive; preserveAspect] ExpandNumerator[expr ] expands the numerator only. ;[s] 4:0,1;16,2;21,1;22,0;51,-1; 3:1,16,12,Times,0,14,0,0,0;2,13,10,Courier,1,12,0,0,0;1,16,12,Times,2,14,0,0,0; :[font = special2; inactive; preserveAspect; keywords = "ExpandDenominator"] ExpandDenominator :[font = smalltext; inactive; preserveAspect] ExpandDenominator[expr ] expands the denominator only. ;[s] 4:0,1;18,2;23,1;25,0;55,-1; 3:1,16,12,Times,0,14,0,0,0;2,13,10,Courier,1,12,0,0,0;1,16,12,Times,2,14,0,0,0; :[font = special2; inactive; preserveAspect; keywords = "ExpandAll"] ExpandAll :[font = smalltext; inactive; preserveAspect] ExpandAll[expr ] expands the numerator and denominator completely. ;[s] 4:0,1;10,2;15,1;16,0;67,-1; 3:1,16,12,Times,0,14,0,0,0;2,13,10,Courier,1,12,0,0,0;1,16,12,Times,2,14,0,0,0; :[font = smalltext; inactive; preserveAspect] ExpandAll[expr , patt ] expands the numerator and denominators avoiding those parts that do not contain terms matching patt . ;[s] 9:0,1;10,2;15,1;16,0;18,2;23,1;25,0;120,2;125,0;127,-1; 3:3,16,12,Times,0,14,0,0,0;3,13,10,Courier,1,12,0,0,0;3,16,12,Times,2,14,0,0,0; :[font = special2; inactive; preserveAspect; keywords = "Factor"] Factor :[font = smalltext; inactive; preserveAspect] Factor[expr ] puts all terms over a common denominator and factors the result. ;[s] 4:0,1;7,2;12,1;13,0;79,-1; 3:1,16,12,Times,0,14,0,0,0;2,13,10,Courier,1,12,0,0,0;1,16,12,Times,2,14,0,0,0; :[font = special2; inactive; preserveAspect; keywords = "Together"] Together :[font = smalltext; inactive; preserveAspect] Together[expr ] combines all terms over a common denominator, and cancels factors in the result. ;[s] 4:0,1;9,2;14,1;15,0;97,-1; 3:1,16,12,Times,0,14,0,0,0;2,13,10,Courier,1,12,0,0,0;1,16,12,Times,2,14,0,0,0; :[font = special2; inactive; preserveAspect; keywords = "Apart"] Apart :[font = smalltext; inactive; preserveAspect] Apart[expr ] writes expr as a sum of terms with simple denominators. ;[s] 4:0,1;6,2;11,1;12,0;69,-1; 3:1,16,12,Times,0,14,0,0,0;2,13,10,Courier,1,12,0,0,0;1,16,12,Times,2,14,0,0,0; :[font = special2; inactive; preserveAspect; keywords = "Cancel"] Cancel :[font = smalltext; inactive; preserveAspect; endGroup] Cancel[expr ] cancels out common factors in the numerator and denominator of expr . ;[s] 6:0,1;7,2;12,1;13,0;77,2;82,0;85,-1; 3:2,16,12,Times,0,14,0,0,0;2,13,10,Courier,1,12,0,0,0;2,16,12,Times,2,14,0,0,0; :[font = subsubsection; inactive; Cclosed; preserveAspect; startGroup] Expanding :[font = text; inactive; preserveAspect] Note that Expand leaves the denominator in factored form and divides the denominator into each term. ;[s] 3:0,0;10,1;16,0;101,-1; 2:2,16,12,Times,0,14,0,0,0;1,13,10,Courier,1,12,0,0,0; :[font = input; Cclosed; preserveAspect; startGroup] Expand[(x+1)^2/ (x - 1)^2] :[font = output; output; inactive; preserveAspect; endGroup; endGroup] (-1 + x)^(-2) + (2*x)/(-1 + x)^2 + x^2/(-1 + x)^2 ;[o] 2 -2 2 x x (-1 + x) + --------- + --------- 2 2 (-1 + x) (-1 + x) :[font = subsubsection; inactive; Cclosed; preserveAspect; startGroup] Expanding Both Numerator and Denominator :[font = input; Cclosed; preserveAspect; startGroup] ExpandAll [(x+1)^2/ (x - 1)^2] :[font = output; output; inactive; preserveAspect; endGroup; endGroup] ;[o] 2 1 2 x x ------------ + ------------ + ------------ 2 2 2 1 - 2 x + x 1 - 2 x + x 1 - 2 x + x :[font = subsubsection; inactive; Cclosed; preserveAspect; startGroup] Expanding Just the Numerator :[font = input; Cclosed; preserveAspect; startGroup] ExpandNumerator[(x+1)^2/ (x - 1)^2] :[font = output; output; inactive; preserveAspect; endGroup; endGroup] (1 + 2*x + x^2)/(-1 + x)^2 ;[o] 2 1 + 2 x + x ------------ 2 (-1 + x) :[font = subsubsection; inactive; Cclosed; preserveAspect; startGroup] Expanding Just the Denominator :[font = input; Cclosed; preserveAspect; startGroup] ExpandDenominator[(x+1)^2/ (x - 1)^2] :[font = output; output; inactive; preserveAspect; endGroup; endGroup] (1 + x)^2/(1 - 2*x + x^2) ;[o] 2 (1 + x) ------------ 2 1 - 2 x + x :[font = subsubsection; inactive; Cclosed; preserveAspect; startGroup] Expanding Only Certain Forms :[font = text; inactive; preserveAspect] Terms that do not contain y are not expanded. ;[s] 3:0,0;27,1;30,0;49,-1; 2:2,16,12,Times,0,14,0,0,0;1,16,12,Times,2,14,0,0,0; :[font = input; Cclosed; preserveAspect; startGroup] ExpandAll[(1+x)^2 / (y+1)^2 + (y + 1)^2 / y^2, y] :[font = output; output; inactive; preserveAspect; endGroup; endGroup] 1 + y^(-2) + 2/y + (1 + x)^2/(1 + 2*y + y^2) ;[o] 2 -2 2 (1 + x) 1 + y + - + ------------ y 2 1 + 2 y + y :[font = subsubsection; inactive; Cclosed; preserveAspect; startGroup] Factoring :[font = input; Cclosed; preserveAspect; startGroup] Factor[1 / (x^2 -1) + x^3 / (x +1)] :[font = output; output; inactive; preserveAspect; endGroup; endGroup] (1 - x^3 + x^4)/((-1 + x)*(1 + x)) ;[o] 3 4 1 - x + x ---------------- (-1 + x) (1 + x) :[font = subsubsection; inactive; Cclosed; preserveAspect; startGroup] Combining Terms over a Common Denominator :[font = input; Cclosed; preserveAspect; startGroup] Together[ 1/(2x) + 3 x^2/(x-1)] :[font = output; output; inactive; preserveAspect; endGroup; endGroup] (-1 + x + 6*x^3)/(2*(-1 + x)*x) ;[o] 3 -1 + x + 6 x ------------- 2 (-1 + x) x :[font = subsubsection; inactive; Cclosed; preserveAspect; startGroup] Separating into Terms with Simple Denominators :[font = input; Cclosed; preserveAspect; startGroup] Apart[(x - 1) / (x^2 + 2x +1)] :[font = output; output; inactive; preserveAspect; endGroup; endGroup] -2/(1 + x)^2 + (1 + x)^(-1) ;[o] -2 1 -------- + ----- 2 1 + x (1 + x) :[font = subsubsection; inactive; Cclosed; preserveAspect; startGroup] A Partial Fraction :[font = input; Cclosed; preserveAspect; startGroup] Apart[1/(x^2 - 1)] :[font = output; output; inactive; preserveAspect; endGroup; endGroup] 1/(2*(-1 + x)) - 1/(2*(1 + x)) ;[o] 1 1 ---------- - --------- 2 (-1 + x) 2 (1 + x) :[font = subsubsection; inactive; Cclosed; preserveAspect; startGroup] Canceling Common Factors :[font = input; Cclosed; preserveAspect; startGroup] Cancel[(x^2 - 1) / (x^2 + 2x +1)] :[font = output; output; inactive; preserveAspect; endGroup; endGroup; endGroup] (-1 + x)/(1 + x) ;[o] -1 + x ------ 1 + x :[font = section; inactive; Cclosed; preserveAspect; startGroup] Picking Out Pieces of Algebraic Expressions :[font = subsubsection; inactive; Cclosed; preserveAspect; startGroup] Syntax (see pages 82 and 593) :[font = special2; inactive; preserveAspect; keywords = "Coefficient"] Coefficient :[font = smalltext; inactive; preserveAspect] Coefficient[poly , expr ] gives the coefficient of expr in poly . ;[s] 11:0,1;12,2;17,1;18,0;19,2;24,1;26,0;51,2;56,0;60,2;65,0;67,-1; 3:4,16,12,Times,0,14,0,0,0;3,13,10,Courier,1,12,0,0,0;4,16,12,Times,2,14,0,0,0; :[font = smalltext; inactive; preserveAspect] Coefficient[poly , expr , n ] gives the coefficient of expr ^n in poly . ;[s] 16:0,1;12,2;17,1;18,0;19,2;24,1;25,0;26,2;28,1;29,0;55,2;60,1;61,2;64,0;69,2;74,0;76,-1; 3:5,16,12,Times,0,14,0,0,0;5,13,10,Courier,1,12,0,0,0;6,16,12,Times,2,14,0,0,0; :[font = smalltext; inactive; preserveAspect] Coefficient[poly , expr, 0] gives the term in poly that is independent of expr . ;[s] 13:0,1;12,2;17,1;18,0;19,2;23,1;24,0;26,1;27,0;47,2;52,0;76,2;81,0;83,-1; 3:5,16,12,Times,0,14,0,0,0;4,13,10,Courier,1,12,0,0,0;4,16,12,Times,2,14,0,0,0; :[font = special2; inactive; preserveAspect; keywords = "CoefficientList"] CoefficientList :[font = smalltext; inactive; preserveAspect] CoefficientList[poly , {x1, x2 , ...}] gives a matrix of the coefficients of x1 , x2 , ... in poly . ;[s] 17:0,1;16,2;21,1;24,2;26,1;27,0;28,2;31,1;32,0;36,1;39,0;77,2;80,0;82,2;85,0;95,2;100,0;102,-1; 3:6,16,12,Times,0,14,0,0,0;5,13,10,Courier,1,12,0,0,0;6,16,12,Times,2,14,0,0,0; :[font = special2; inactive; preserveAspect; keywords = "Exponent"] Exponent :[font = smalltext; inactive; preserveAspect] Exponent[poly , x ] gives the maximum power of x in poly . ;[s] 11:0,1;9,2;14,1;15,0;16,2;18,1;20,0;47,2;48,0;53,2;58,0;60,-1; 3:4,16,12,Times,0,14,0,0,0;3,13,10,Courier,1,12,0,0,0;4,16,12,Times,2,14,0,0,0; :[font = special2; inactive; preserveAspect; keywords = "Variables"] Variables :[font = smalltext; inactive; preserveAspect] Variables[poly ] gives a list of all independent variables in poly . ;[s] 6:0,1;10,2;15,1;16,0;62,2;67,0;69,-1; 3:2,16,12,Times,0,14,0,0,0;2,13,10,Courier,1,12,0,0,0;2,16,12,Times,2,14,0,0,0; :[font = special2; inactive; preserveAspect; keywords = "Numerator"] Numerator :[font = smalltext; inactive; preserveAspect] Numerator[expr ] gives the numerator of expr . ;[s] 6:0,1;10,2;15,1;16,0;40,2;45,0;47,-1; 3:2,16,12,Times,0,14,0,0,0;2,13,10,Courier,1,12,0,0,0;2,16,12,Times,2,14,0,0,0; :[font = special2; inactive; preserveAspect; keywords = "Denominator"] Denominator :[font = smalltext; inactive; preserveAspect] Denominator[expr ] gives the denominator of expr . ;[s] 6:0,1;12,2;17,1;19,0;44,2;49,0;51,-1; 3:2,16,12,Times,0,14,0,0,0;2,13,10,Courier,1,12,0,0,0;2,16,12,Times,2,14,0,0,0; :[font = special2; inactive; preserveAspect; keywords = "Part"] Part :[font = smalltext; inactive; preserveAspect; endGroup] Part[expr , n ] gives the n th term in expr . ;[s] 11:0,1;5,2;10,1;11,0;12,2;14,1;15,0;27,2;29,0;40,2;45,0;47,-1; 3:4,16,12,Times,0,14,0,0,0;3,13,10,Courier,1,12,0,0,0;4,16,12,Times,2,14,0,0,0; :[font = subsubsection; inactive; Cclosed; preserveAspect; startGroup] Picking Out a Coefficient :[font = input; Cclosed; preserveAspect; startGroup] Coefficient[x^2 - 3 x^4 + y - 1 , x^4] :[font = output; output; inactive; preserveAspect; endGroup] -3 ;[o] -3 :[font = input; Cclosed; preserveAspect; startGroup] Coefficient[x^2 - 3 x^4 + y - 1 , x, 4] :[font = output; output; inactive; preserveAspect; endGroup; endGroup] -3 ;[o] -3 :[font = subsubsection; inactive; Cclosed; preserveAspect; startGroup] Picking Out the Term Independent of x ;[s] 3:0,0;36,1;37,0;38,-1; 2:2,14,10,Helvetica,1,12,0,0,0;1,14,10,Helvetica,3,12,0,0,0; :[font = input; Cclosed; preserveAspect; startGroup] Coefficient[x^2 - 3 x^4 + y - 1, x, 0] :[font = output; output; inactive; preserveAspect; endGroup; endGroup] -1 + y ;[o] -1 + y :[font = subsubsection; inactive; Cclosed; preserveAspect; startGroup] Getting a List of Coefficients :[font = input; Cclosed; preserveAspect; startGroup] CoefficientList[ Expand[ (x + y)^3], {x,y}] :[font = output; output; inactive; preserveAspect; endGroup; endGroup] {{0, 0, 0, 1}, {0, 0, 3, 0}, {0, 3, 0, 0}, {1, 0, 0, 0}} ;[o] {{0, 0, 0, 1}, {0, 0, 3, 0}, {0, 3, 0, 0}, {1, 0, 0, 0}} :[font = subsubsection; inactive; Cclosed; preserveAspect; startGroup] The Maximum Exponent of x in a Polynomial ;[s] 3:0,0;24,1;26,0;43,-1; 2:2,14,10,Helvetica,1,12,0,0,0;1,14,10,Helvetica,3,12,0,0,0; :[font = input; Cclosed; preserveAspect; startGroup] Exponent[x^2 + 3 x^4 + y x , x] :[font = output; output; inactive; preserveAspect; endGroup; endGroup] 4 ;[o] 4 :[font = subsubsection; inactive; Cclosed; preserveAspect; startGroup] Picking Out the Numerator :[font = input; Cclosed; preserveAspect; startGroup] Numerator[(y^2 - 1)/(x - 1)] :[font = output; output; inactive; preserveAspect; endGroup; endGroup] -1 + y^2 ;[o] 2 -1 + y :[font = subsubsection; inactive; Cclosed; preserveAspect; startGroup] Picking Out the Denominator :[font = input; Cclosed; preserveAspect; startGroup] Denominator[(y^2 - 1)/(x - 1)] :[font = output; output; inactive; preserveAspect; endGroup] -1 + x ;[o] -1 + x :[font = input; Cclosed; preserveAspect; startGroup] Denominator[x^2 + 1] :[font = output; output; inactive; preserveAspect; endGroup; endGroup] 1 ;[o] 1 :[font = subsubsection; inactive; Cclosed; preserveAspect; startGroup] Picking Out the n th Term ;[s] 3:0,0;16,1;18,0;26,-1; 2:2,14,10,Helvetica,1,12,0,0,0;1,14,10,Helvetica,3,12,0,0,0; :[font = input; Cclosed; preserveAspect; startGroup] Part[ x^2 + 2 x + 7, 2] :[font = output; output; inactive; preserveAspect; endGroup; endGroup] 2*x ;[o] 2 x :[font = subsubsection; inactive; Cclosed; preserveAspect; startGroup] A Note on Manipulating Expressions like Lists :[font = text; inactive; preserveAspect; endGroup; endGroup] Every Mathematica expression can be manipulated structurally much like a list. For example, the function Part used in the previous example also picks out the n th element of a list. This flexibility is one of the things that makes Mathematica so powerful. However, all functions that manipulate the structure of expressions act on the internal form of these expressions. You can see these forms using FullForm[expr ]. You must be careful, because Mathematica often shows algebraic expressions in a form that is different from the way it treats them internally. For more information, see page 196. ;[s] 15:0,0;6,1;17,0;106,2;110,0;159,1;161,0;232,1;243,0;403,2;412,1;417,2;418,0;450,1;462,0;601,-1; 3:7,16,12,Times,0,14,0,0,0;5,16,12,Times,2,14,0,0,0;3,13,10,Courier,1,12,0,0,0; :[font = section; inactive; Cclosed; preserveAspect; startGroup] Algebraic Operations on Polynomials :[font = subsubsection; inactive; Cclosed; preserveAspect; startGroup] Syntax (see page 597) :[font = special2; inactive; preserveAspect; keywords = "PolynomialQuotient"] PolynomialQuotient :[font = smalltext; inactive; preserveAspect] PolynomialQuotient[poly1 , poly2 , x ] gives the result of dividing poly1 by poly2 , treated as polynomials in x , with any remainder dropped. ;[s] 14:0,2;19,1;25,2;27,1;33,2;35,1;37,2;38,0;68,1;74,0;78,1;84,0;112,1;114,0;144,-1; 3:4,16,12,Times,0,14,0,0,0;6,16,12,Times,2,14,0,0,0;4,13,10,Courier,1,12,0,0,0; :[font = special2; inactive; preserveAspect; keywords = "PolynomialRemainder"] PolynomialRemainder :[font = smalltext; inactive; preserveAspect] PolynomialRemainder[poly1 , poly2 , x ] gives the remainder from dividing poly1 by poly2 , treated as polynomials in x . ;[s] 16:0,2;20,1;26,2;27,0;28,1;34,2;35,0;36,1;38,2;39,0;74,1;79,0;84,1;90,0;118,1;120,0;122,-1; 3:6,16,12,Times,0,14,0,0,0;6,16,12,Times,2,14,0,0,0;4,13,10,Courier,1,12,0,0,0; :[font = special2; inactive; preserveAspect; keywords = "PolynomialGCD"] PolynomialGCD :[font = smalltext; inactive; preserveAspect] PolynomialGCD[poly1 , poly2 ] gives the greatest common divisor of poly1 and poly2 . ;[s] 10:0,2;14,1;20,2;21,0;22,1;28,2;29,0;67,1;72,0;78,1;87,-1; 3:3,16,12,Times,0,14,0,0,0;4,16,12,Times,2,14,0,0,0;3,13,10,Courier,1,12,0,0,0; :[font = special2; inactive; preserveAspect; keywords = "PolynomialLCM"] PolynomialLCM :[font = smalltext; inactive; preserveAspect] PolynomialLCM[poly1 , poly2 ] gives the least common multiple of poly1 and poly2 . ;[s] 11:0,3;14,2;20,3;21,0;22,2;28,3;29,1;30,0;65,2;70,0;76,2;85,-1; 4:3,16,12,Times,0,14,0,0,0;1,13,10,Courier,1,12,0,0,65535;4,16,12,Times,2,14,0,0,0;3,13,10,Courier,1,12,0,0,0; :[font = special2; inactive; preserveAspect; keywords = "PolynomialMod"] PolynomialMod :[font = smalltext; inactive; preserveAspect] PolynomialMod[poly ,m ] gives poly reduced modulo m . ;[s] 13:0,3;14,2;18,0;19,3;20,2;21,0;22,3;23,1;24,0;30,2;35,0;51,2;52,0;55,-1; 4:5,16,12,Times,0,14,0,0,0;1,13,10,Courier,1,12,0,0,65535;4,16,12,Times,2,14,0,0,0;3,13,10,Courier,1,12,0,0,0; :[font = special2; inactive; preserveAspect; keywords = "Resultant"] Resultant :[font = smalltext; inactive; preserveAspect] Resultant[poly1 ,poly2 , x ] gives the resultant of poly1 and poly2 with respect to x . ;[s] 16:0,3;10,2;16,3;17,2;23,3;24,0;25,2;27,3;28,1;29,0;52,2;57,0;63,2;68,0;86,2;88,0;90,-1; 4:5,16,12,Times,0,14,0,0,0;1,13,10,Courier,1,12,0,0,65535;6,16,12,Times,2,14,0,0,0;4,13,10,Courier,1,12,0,0,0; :[font = special2; inactive; preserveAspect; keywords = "Decompose"] Decompose :[font = smalltext; inactive; preserveAspect; endGroup] Decompose[poly ,x ] decomposes a polynomial, if possible, into a composition of simpler polynomials. ;[s] 8:0,3;10,2;14,0;15,3;16,2;18,3;19,1;20,0;101,-1; 4:2,16,12,Times,0,14,0,0,0;1,13,10,Courier,1,12,0,0,65535;2,16,12,Times,2,14,0,0,0;3,13,10,Courier,1,12,0,0,0; :[font = subsubsection; inactive; Cclosed; preserveAspect; startGroup] The Quotient of Polynomials :[font = input; Cclosed; preserveAspect; startGroup] PolynomialQuotient[ x^2, x+1, x] :[font = output; output; inactive; preserveAspect; endGroup; endGroup] -1 + x ;[o] -1 + x :[font = subsubsection; inactive; Cclosed; preserveAspect; startGroup] The Remainder in a Polynomial Quotient :[font = input; Cclosed; preserveAspect; startGroup] PolynomialRemainder[ x^2, x+1, x] :[font = output; output; inactive; preserveAspect; endGroup; endGroup] 1 ;[o] 1 :[font = subsubsection; inactive; Cclosed; preserveAspect; startGroup] The Greatest Common Divisor :[font = input; Cclosed; preserveAspect; startGroup] PolynomialGCD[ (1-x)^2 (1+x) (2+x), (1-x) (2+x) (3+x)] :[font = output; output; inactive; preserveAspect; endGroup; endGroup] (-1 + x)*(2 + x) ;[o] (-1 + x) (2 + x) :[font = subsubsection; inactive; Cclosed; preserveAspect; startGroup] The Least Common Multiple :[font = input; Cclosed; preserveAspect; startGroup] PolynomialLCM[ (1-x)^2 (1+x) (2+x), (1-x) (2+x) (3+x)] :[font = output; output; inactive; preserveAspect; endGroup; endGroup] (-1 + x)^2*(1 + x)*(2 + x)*(3 + x) ;[o] 2 (-1 + x) (1 + x) (2 + x) (3 + x) :[font = subsubsection; inactive; Cclosed; preserveAspect; startGroup] Reduction Modulo 2 :[font = input; Cclosed; preserveAspect; startGroup] PolynomialMod[ 2 x^2 - 7 x^3 + 3, 2] :[font = output; output; inactive; preserveAspect; endGroup; endGroup] 1 + x^3 ;[o] 3 1 + x :[font = subsubsection; inactive; Cclosed; preserveAspect; startGroup] The Resultant :[font = input; Cclosed; preserveAspect; startGroup] Resultant[ (x-y)^2 - 2, y^2 - 3, y] :[font = output; output; inactive; preserveAspect; endGroup; endGroup] 1 - 10*x^2 + x^4 ;[o] 2 4 1 - 10 x + x :[font = subsubsection; inactive; Cclosed; preserveAspect; startGroup] Decomposing a Polynomial :[font = input; Cclosed; preserveAspect; startGroup] Decompose [ x^4 + x^2 + 1, x] :[font = output; output; inactive; preserveAspect; endGroup; endGroup; endGroup] {1 + x + x^2, x^2} ;[o] 2 2 {1 + x + x , x } :[font = section; inactive; Cclosed; preserveAspect; startGroup] Expressions Involving Complex Variables :[font = subsubsection; inactive; Cclosed; preserveAspect; startGroup] Syntax (see pages 81 and 604) :[font = special2; inactive; preserveAspect; keywords = "ComplexExpand"] ComplexExpand :[font = smalltext; inactive; preserveAspect] ComplexExpand[expr ] expands expr assuming that all variables are real. ;[s] 7:0,2;14,1;18,0;19,2;20,0;29,1;33,0;74,-1; 3:3,16,12,Times,0,14,0,0,0;2,16,12,Times,2,14,0,0,0;2,13,10,Courier,1,12,0,0,0; :[font = smalltext; inactive; preserveAspect] ComplexExpand[expr , {x1 , x2 , ...}] expands expr assuming that the xi are complex. ;[s] 17:0,2;14,3;18,0;19,2;22,3;24,0;27,3;29,0;31,2;32,4;35,2;37,1;38,0;46,3;50,0;71,3;74,0;88,-1; 5:6,16,12,Times,0,14,0,0,0;1,13,10,Courier,1,12,0,0,65535;4,13,10,Courier,1,12,0,0,0;5,16,12,Times,2,14,0,0,0;1,16,12,Times,3,14,0,0,0; :[font = smalltext; inactive; preserveAspect] ComplexExpand[expr , TargetFunctions -> {Abs ,Arg }] gives the result in polar form. ;[s] 11:0,1;14,2;18,0;19,1;20,0;21,1;60,2;61,1;65,2;66,1;68,0;101,-1; 3:3,16,12,Times,0,14,0,0,0;5,13,10,Courier,1,12,0,0,0;3,16,12,Times,2,14,0,0,0; :[font = smalltext; inactive; preserveAspect] ComplexExpand[expr , TargetFunctions -> {Conjugate, Sign}] gives the result in terms of complex conjugates. ;[s] 12:0,2;14,3;18,0;19,2;36,0;38,2;40,0;59,2;69,0;71,2;77,1;78,0;127,-1; 4:5,16,12,Times,0,14,0,0,0;1,13,10,Courier,1,12,0,0,65535;5,13,10,Courier,1,12,0,0,0;1,16,12,Times,2,14,0,0,0; :[font = input; preserveAspect; endGroup] ComplexExpand[Tan[x + I y]] :[font = subsubsection; inactive; Cclosed; preserveAspect; startGroup] Expanding the Exponential :[font = input; Cclosed; preserveAspect; startGroup] ComplexExpand[Exp[x + I y]] :[font = output; output; inactive; preserveAspect; endGroup; endGroup] E^x*Cos[y] + I*E^x*Sin[y] ;[o] x x E Cos[y] + I E Sin[y] :[font = subsubsection; inactive; Cclosed; preserveAspect; startGroup] Expanding Sine with Real x and y ;[s] 5:0,0;25,1;26,0;32,1;33,0;35,-1; 2:3,14,10,Helvetica,1,12,0,0,0;2,14,10,Helvetica,3,12,0,0,0; :[font = input; Cclosed; preserveAspect; startGroup] ComplexExpand[Sin[x + I y]] :[font = output; output; inactive; preserveAspect; endGroup; endGroup] Cosh[y]*Sin[x] + I*Cos[x]*Sinh[y] ;[o] Cosh[y] Sin[x] + I Cos[x] Sinh[y] :[font = subsubsection; inactive; Cclosed; preserveAspect; startGroup] Expanding Sine with Complex z ;[s] 3:0,0;28,1;29,0;31,-1; 2:2,14,10,Helvetica,1,12,0,0,0;1,14,10,Helvetica,3,12,0,0,0; :[font = input; Cclosed; preserveAspect; startGroup] ComplexExpand[Sin[z], z] :[font = output; output; inactive; preserveAspect; endGroup; endGroup] Cosh[Im[z]]*Sin[Re[z]] + I*Cos[Re[z]]*Sinh[Im[z]] ;[o] Cosh[Im[z]] Sin[Re[z]] + I Cos[Re[z]] Sinh[Im[z]] :[font = subsubsection; inactive; Cclosed; preserveAspect; startGroup] Expanding in Polar Form :[font = input; Cclosed; preserveAspect; startGroup] ComplexExpand[x^2, {x}, TargetFunctions -> {Abs, Arg}] :[font = output; output; inactive; preserveAspect; endGroup; endGroup] Abs[x]^2*Cos[Arg[x]]^2 + 2*I*Abs[x]^2*Cos[Arg[x]]*Sin[Arg[x]] - Abs[x]^2*Sin[Arg[x]]^2 ;[o] 2 2 2 Abs[x] Cos[Arg[x]] + 2 I Abs[x] Cos[Arg[x]] Sin[Arg[x]] - 2 2 Abs[x] Sin[Arg[x]] :[font = subsubsection; inactive; Cclosed; preserveAspect; startGroup] Expanding Using Complex Conjugates :[font = input; Cclosed; preserveAspect; startGroup] ComplexExpand[x^2, {x}, TargetFunctions -> {Conjugate, Sign}] :[font = output; output; inactive; preserveAspect; endGroup; endGroup; endGroup] (x - Conjugate[x])^2/4 + ((x - Conjugate[x])*(x + Conjugate[x]))/2 + (x + Conjugate[x])^2/4 ;[o] 2 (x - Conjugate[x]) (x - Conjugate[x]) (x + Conjugate[x]) ------------------- + ------------------------------------- + 4 2 2 (x + Conjugate[x]) ------------------- 4 :[font = section; inactive; Cclosed; preserveAspect; startGroup] Controlling the Display of Large Expressions :[font = subsubsection; inactive; Cclosed; preserveAspect; startGroup] Syntax (see pages 83 and 346) :[font = special3; inactive; preserveAspect; keywords = "Output`suppressing"] Supressing Output :[font = smalltext; inactive; preserveAspect] command ; executes command but does not print the result. ;[s] 5:0,2;8,1;9,0;23,2;31,0;63,-1; 3:2,16,12,Times,0,14,0,0,0;1,13,10,Courier,1,12,0,0,0;2,16,12,Times,2,14,0,0,0; :[font = special2; inactive; preserveAspect; keywords = "Short"] Short :[font = smalltext; inactive; preserveAspect] Short[expr ] or expr //Short shows a one-line outline of expr . ;[s] 10:0,2;6,3;11,2;12,1;13,0;17,3;22,2;29,0;60,3;65,0;67,-1; 4:3,16,12,Times,0,14,0,0,0;1,13,10,Courier,1,12,0,0,65535;3,13,10,Courier,1,12,0,0,0;3,16,12,Times,2,14,0,0,0; :[font = smalltext; inactive; preserveAspect; endGroup] Short[expr ,n ] shows an outline of expr about n lines long. ;[s] 11:0,1;6,2;11,1;12,2;13,0;14,1;15,0;37,2;42,0;49,2;50,0;64,-1; 3:4,16,12,Times,0,14,0,0,0;3,13,10,Courier,1,12,0,0,0;4,16,12,Times,2,14,0,0,0; :[font = subsubsection; inactive; Cclosed; preserveAspect; startGroup] Supressing Output :[font = text; inactive; preserveAspect] Note that you can still use % to get the output that would have been produced. ;[s] 3:0,0;28,1;29,0;79,-1; 2:2,16,12,Times,0,14,0,0,0;1,13,10,Courier,1,12,0,0,0; :[font = input; preserveAspect] Expand[ (x + 5y + 10) ^ 4]; :[font = input; Cclosed; preserveAspect; startGroup] Short[%] :[font = output; output; inactive; preserveAspect; endGroup; endGroup] Short["<<>>"] ;[o] 2 4 10000 + 4000 x + 600 x + <<11>> + 625 y :[font = subsubsection; inactive; Cclosed; preserveAspect; startGroup] Getting Short Output :[font = input; Cclosed; preserveAspect; startGroup] Expand[ (x + 5y + 10) ^ 4] // Short :[font = output; output; inactive; preserveAspect; endGroup] Short["<<>>"] ;[o] 2 4 10000 + 4000 x + 600 x + <<11>> + 625 y :[font = input; Cclosed; preserveAspect; startGroup] Short[Expand[ (x + 5y + 10) ^ 4], 3] :[font = output; output; inactive; preserveAspect; endGroup; endGroup; endGroup; endGroup] Short["<<>>"] ;[o] 2 3 4 2 10000 + 4000 x + 600 x + 40 x + x + 20000 y + 6000 x y + 600 x y + 3 2 2 3 3 4 20 x y + <<2>> + 150 x y + 5000 y + 500 x y + 625 y :[font = title; inactive; preserveAspect; startGroup] Trigonometry :[font = section; inactive; Cclosed; preserveAspect; startGroup] Index :[font = text; inactive; dontPreserveAspect] This index gives a list of keywords that are associated with various cells in this Notebook. If you Command-Double-Click one of the keywords below, Mathematica will find the cell associated with that keyword, select it, and display it in the center of your window. ;[s] 3:0,0;150,1;161,0;269,-1; 2:2,16,12,Times,0,14,0,0,0;1,16,12,Times,2,14,0,0,0; :[font = smalltext; inactive; preserveAspect; endGroup] AlgebraicRules Apart ArcCos ArcCot ArcCsc ArcSec ArcSin ArcTan Assignments Cancel Coefficient CoefficientList Collect ComplexExpand Cos Cot Csc Decompose Denominator Expand ExpandAll ExpandDenominator ExpandNumerator Exponent Factor FactorSquareFree FactorTerms Numerator Output`suppressing Part PolynomialGCD PolynomialLCM PolynomialMod PolynomialQuotient PolynomialRemainder Replacements Resultant Sec Short Simplify Sin Tan Together Variables :[font = section; inactive; Cclosed; preserveAspect; startGroup] Trigonometric Functions :[font = subsubsection; inactive; Cclosed; preserveAspect; startGroup] Syntax (see pages 49 and 562) :[font = special3; inactive; preserveAspect] Trigonometric Functions :[font = text; inactive; preserveAspect; keywords = "Sin, Cos, Tan, Csc, Sec, Cot"] Sin[x ], Cos[x ], Tan[x ], Csc[x ], Sec[x ], and Cot[x ] give the value of the trigonometric functions at x radians. ;[s] 32:0,1;4,2;5,0;6,1;7,0;9,1;13,2;14,0;15,1;16,0;18,1;22,2;23,0;24,1;25,0;27,1;31,2;32,0;33,1;34,0;36,1;40,2;41,0;42,1;43,0;49,1;53,2;54,0;55,1;56,0;107,2;108,0;119,-1; 3:13,16,12,Times,0,14,0,0,0;12,13,10,Courier,1,12,0,0,0;7,16,12,Times,2,14,0,0,0; :[font = special3; inactive; preserveAspect] Inverse Trigonometric Functions :[font = text; inactive; preserveAspect; endGroup; keywords = "ArcSin, ArcCos, ArcTan, ArcCsc, ArcSec, ArcCot"] ArcSin[x ], ArcCos[x ], ArcTan[x ], ArcCsc[x ], ArcSec[x ], and ArcCot[x ] give the value of the inverse trigonometric functions at x . ;[s] 32:0,1;7,2;8,0;9,1;10,0;12,1;19,2;20,0;21,1;22,0;24,1;31,2;32,0;33,1;34,0;36,1;43,2;44,0;45,1;46,0;48,1;55,2;56,0;57,1;58,0;64,1;71,2;72,0;73,1;74,0;133,2;134,0;137,-1; 3:13,16,12,Times,0,14,0,0,0;12,13,10,Courier,1,12,0,0,0;7,16,12,Times,2,14,0,0,0; :[font = subsubsection; inactive; Cclosed; preserveAspect; startGroup] Trigonometric Function with Exact Result :[font = text; inactive; preserveAspect] Note that the arguments to trigonometric functions are always in radians. :[font = input; Cclosed; preserveAspect; startGroup] Sin[Pi/3] :[font = output; output; inactive; preserveAspect; endGroup] 3^(1/2)/2 ;[o] Sqrt[3] ------- 2 :[font = input; Cclosed; preserveAspect; startGroup] N[%] :[font = output; output; inactive; preserveAspect; endGroup; endGroup] 0.866025403784439 ;[o] 0.866025 :[font = subsubsection; inactive; Cclosed; preserveAspect; startGroup] Trigonometric Function with Approximate Result :[font = text; inactive; preserveAspect] Note the explicit use of the decimal point. :[font = input; Cclosed; preserveAspect; startGroup] Tan[2.] :[font = output; output; inactive; preserveAspect; endGroup; endGroup] -2.185039863261519 ;[o] -2.18504 :[font = subsubsection; inactive; Cclosed; preserveAspect; startGroup] Trigonometric Function Using Degrees :[font = text; inactive; preserveAspect] Multiplying by the constant Degree converts the argument to radians. ;[s] 3:0,0;28,1;34,0;69,-1; 2:2,16,12,Times,0,14,0,0,0;1,13,10,Courier,1,12,0,0,0; :[font = input; Cclosed; preserveAspect; startGroup] Tan[2 Degree] //N :[font = output; output; inactive; preserveAspect; endGroup; endGroup] 0.03492076949174772 ;[o] 0.0349208 :[font = subsubsection; inactive; Cclosed; preserveAspect; startGroup] Inverse Trigonometric Function :[font = input; Cclosed; preserveAspect; startGroup] ArcCsc[1] :[font = output; output; inactive; preserveAspect; endGroup] Pi/2 ;[o] Pi -- 2 :[font = input; Cclosed; preserveAspect; startGroup] ArcTan[.12] :[font = output; output; inactive; preserveAspect; endGroup; endGroup] 0.1194289260183384 ;[o] 0.119429 :[font = subsubsection; inactive; Cclosed; preserveAspect; startGroup] A Note on Inverse Functions :[font = text; inactive; preserveAspect; endGroup; endGroup] An inverse function is the solution to an equation. For example, the inverse or arc sine function gives a solution to the equation y = Sin[x ]. However, there are many such solutions. Thus, in defining an inverse function one must make a choice of a "principal value". For the inverse trigonometric and hyperbolic functions there are standard choices made in mathematics. These same choices are used by Mathematica . For example, the values of ArcSin are always in the range -Pi/2 to Pi/2. For information on a specific inverse function, see its reference guide entry in The Mathematica Book. ;[s] 20:0,0;131,1;132,0;134,2;140,1;141,0;142,2;143,0;404,1;416,0;447,2;453,0;478,2;481,3;483,0;487,2;489,3;491,0;580,1;591,0;599,-1; 4:9,16,12,Times,0,14,0,0,0;4,16,12,Times,2,14,0,0,0;5,13,10,Courier,1,12,0,0,0;2,13,9,Times,0,12,0,0,0; :[font = section; inactive; Cclosed; preserveAspect; startGroup] Transforming Trigonometric Expressions :[font = input; preserveAspect; keywords = "Expand"] Expand ;[s] 2:0,2;6,1;8,-1; 3:0,13,10,Courier,1,12,0,0,65535;1,16,12,Times,0,14,0,0,0;1,13,10,Courier,1,12,0,0,0; :[font = smalltext; inactive; preserveAspect] Expand[expr , Trig->True] writes Sin[x ]^2 in terms of Sin[2x ], etc. ;[s] 14:0,1;7,2;12,1;25,0;34,1;38,2;39,0;40,1;42,0;57,1;61,2;63,0;64,1;65,0;72,-1; 3:5,16,12,Times,0,14,0,0,0;6,13,10,Courier,1,12,0,0,0;3,16,12,Times,2,14,0,0,0; :[font = input; preserveAspect; keywords = "ExpandAll"] ExpandAll ;[s] 2:0,2;9,1;11,-1; 3:0,13,10,Courier,1,12,0,0,65535;1,16,12,Times,0,14,0,0,0;1,13,10,Courier,1,12,0,0,0; :[font = smalltext; inactive; preserveAspect] ExpandAll[expr , Trig->True] expands the numerator and denominators completely and uses trigonometric identities. ;[s] 4:0,1;10,2;15,1;29,0;115,-1; 3:1,16,12,Times,0,14,0,0,0;2,13,10,Courier,1,12,0,0,0;1,16,12,Times,2,14,0,0,0; :[font = input; preserveAspect; keywords = "Factor"] Factor ;[s] 2:0,2;6,1;8,-1; 3:0,13,10,Courier,1,12,0,0,65535;1,16,12,Times,0,14,0,0,0;1,13,10,Courier,1,12,0,0,0; :[font = smalltext; inactive; preserveAspect] Factor[expr , Trig->True] writes Sin[2x ] in terms of Sin[x ]^2, etc. ;[s] 15:0,1;7,2;11,0;12,1;25,0;34,1;38,2;40,0;41,1;42,0;58,1;62,2;63,0;64,1;66,0;74,-1; 3:6,16,12,Times,0,14,0,0,0;6,13,10,Courier,1,12,0,0,0;3,16,12,Times,2,14,0,0,0; :[font = input; preserveAspect; keywords = "Simplify"] Simplify ;[s] 2:0,2;8,1;10,-1; 3:0,13,10,Courier,1,12,0,0,65535;1,16,12,Times,0,14,0,0,0;1,13,10,Courier,1,12,0,0,0; :[font = smalltext; inactive; preserveAspect] Simplify[expr , Trig->True] simplifies and uses trigonometric identities. ;[s] 5:0,1;9,2;13,0;14,1;27,0;75,-1; 3:2,16,12,Times,0,14,0,0,0;2,13,10,Courier,1,12,0,0,0;1,16,12,Times,2,14,0,0,0; :[font = input; preserveAspect; keywords = "Together"] Together ;[s] 2:0,2;8,1;10,-1; 3:0,13,10,Courier,1,12,0,0,65535;1,16,12,Times,0,14,0,0,0;1,13,10,Courier,1,12,0,0,0; :[font = smalltext; inactive; preserveAspect] Together[expr , Trig->True] combines all terms over a common denominator and uses trigonometric identities. ;[s] 6:0,1;9,2;14,1;16,0;17,1;28,0;110,-1; 3:2,16,12,Times,0,14,0,0,0;3,13,10,Courier,1,12,0,0,0;1,16,12,Times,2,14,0,0,0; :[font = input; preserveAspect; keywords = "Apart"] Apart ;[s] 2:0,2;5,1;7,-1; 3:0,13,10,Courier,1,12,0,0,65535;1,16,12,Times,0,14,0,0,0;1,13,10,Courier,1,12,0,0,0; :[font = smalltext; inactive; preserveAspect] Apart[expr , Trig->True] writes expr as a sum of terms with simple denominators and uses trigonometric identities. ;[s] 9:0,1;6,2;10,0;11,1;12,0;14,1;25,0;34,2;39,0;118,-1; 3:4,16,12,Times,0,14,0,0,0;3,13,10,Courier,1,12,0,0,0;2,16,12,Times,2,14,0,0,0; :[font = subsubsection; inactive; Cclosed; preserveAspect; startGroup] Expanding a Trigonometric Expression :[font = input; Cclosed; preserveAspect; startGroup] Expand[Cos[x]^3 Sin[x]^2, Trig -> True] :[font = output; output; inactive; preserveAspect; endGroup; endGroup] Cos[x]/8 - Cos[3*x]/16 - Cos[5*x]/16 ;[o] Cos[x] Cos[3 x] Cos[5 x] ------ - -------- - -------- 8 16 16 :[font = subsubsection; inactive; Cclosed; preserveAspect; startGroup] Factoring a Trigonometric Expression :[font = input; Cclosed; preserveAspect; startGroup] Factor[1/2 - Cos[2x]/2, Trig -> True] :[font = output; output; inactive; preserveAspect; endGroup; endGroup] Sin[x]^2 ;[o] 2 Sin[x] :[font = subsubsection; inactive; Cclosed; preserveAspect; startGroup] Simplifying a Trigonometric Expression :[font = input; Cclosed; preserveAspect; startGroup] Simplify[Sin[x]^2 + Cos[x]^2, Trig -> True] :[font = output; output; inactive; preserveAspect; endGroup] 1 ;[o] 1 :[font = input; Cclosed; preserveAspect; startGroup] Simplify[Tan[x]^2 + 1, Trig -> True] :[font = output; output; inactive; preserveAspect; endGroup; endGroup] Sec[x]^2 ;[o] 2 Sec[x] :[font = subsubsection; inactive; Cclosed; preserveAspect; startGroup] A Note on Using Trig->True ;[s] 2:0,0;16,1;27,-1; 2:1,14,10,Helvetica,1,12,0,0,0;1,13,10,Courier,1,12,0,0,0; :[font = text; inactive; preserveAspect; endGroup] Trigonometric expressions like Sin[2x ] are by default left unchanged by Mathematica' s algebraic manipulation functions. Any trigonometric expression can be viewed as a rational function of exponentials. What the option setting Trig->True effectively does is to use this form in performing algebraic manipulations you specify. With Trig->True, Mathematica first converts all trigonometric functions to exponentials. Then it performs the algebraic operation you specify. Then it takes the exponentials in the result and attempts to combine them into trigonometric functions. ;[s] 13:0,0;31,2;35,1;38,2;39,0;73,1;85,0;230,2;240,0;334,2;344,0;346,1;357,0;577,-1; 3:6,16,12,Times,0,14,0,0,0;3,16,12,Times,2,14,0,0,0;4,13,10,Courier,1,12,0,0,0; :[font = subsubsection; inactive; Cclosed; preserveAspect; startGroup] Using Apart ;[s] 3:0,0;6,1;11,0;12,-1; 2:2,14,10,Helvetica,1,12,0,0,0;1,13,10,Courier,1,12,0,0,0; :[font = input; Cclosed; preserveAspect; startGroup] Apart[ 1/(Cos[2x] Sin[2x]), Trig -> True] :[font = output; output; inactive; preserveAspect; endGroup; endGroup] Cot[x]/2 + Sin[x]/(Cos[x] - Sin[x]) + Sin[x]/(Cos[x] + Sin[x]) - Tan[x]/2 ;[o] Cot[x] Sin[x] Sin[x] Tan[x] ------ + --------------- + --------------- - ------ 2 Cos[x] - Sin[x] Cos[x] + Sin[x] 2 :[font = subsubsection; inactive; Cclosed; preserveAspect; startGroup] Using Together ;[s] 3:0,0;6,1;14,0;15,-1; 2:2,14,10,Helvetica,1,12,0,0,0;1,14,10,Helvetica,0,12,0,0,0; :[font = input; Cclosed; preserveAspect; startGroup] Together[ Cos[2x]/Sin[x]^2 - Sin[2x]/Cos[x], Trig -> True] :[font = output; output; inactive; preserveAspect; endGroup; endGroup; endGroup; endGroup] (Csc[x]^2*(2*Cos[2*x] - 3*Sin[x] + Sin[3*x]))/2 ;[o] 2 Csc[x] (2 Cos[2 x] - 3 Sin[x] + Sin[3 x]) ------------------------------------------ 2 ^*)