The dierence between these sorts is best shown by an

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: l contains only one unknown, x, then the terms might contain x3 , x1 = x, and x0 = 1 as in the case of the polynomial x3 − 2x + 1. If more than one unknown exists, then a term may also contain a product of the unknowns, as in the polynomial x3 + 3x2 y + y 2 . Coefficients can be integers (as in the previous examples), rational numbers, irrational numbers, floating-point numbers, complex numbers, or other variables. > x^2 - 1; x2 − 1 > x + y + z; x+y+z > 1/2*x^2 - sqrt(3)*x - 1/3; 1 12 √ x − 3x − 2 3 > (1 - I)*x + 3 + 4*I; (1 − I ) x + 3 + 4 I 60 • Chapter 3: Finding Solutions > a*x^4 + b*x^3 + c*x^2 + d*x + f; a x4 + b x3 + c x2 + d x + f Maple possesses commands for many kinds of manipulations and mathematical calculations with polynomials. The following sections investigate some of them. Sorting and Collecting The sort command arranges a polynomial into descending order of powers of the unknowns. Rather than making another copy of the polynomial with the terms in order, sort modifies the way Maple stores the original polynomial in memory. In other words, if you display your polynomial after sorting it, it retains the new order. > sort_poly := x + x^2 - x^3 + 1 - x^4; sort _poly := x + x2 − x3 + 1 − x4 > sort(sort_poly); −x4 − x3 + x2 + x + 1 > sort_poly; −x4 − x3 + x2 + x + 1 Maple sorts multivariate polynomials in two ways. The default method sorts them by total degree of the terms. Thus, x2 y 2 will come before both x3 and y 3 . • The other option sorts by pure lexicographic order (plex), first by the powers of the first variable in the variable list (second argument) and then by the powers of the second variable in the variable list. The difference between these sorts is best shown by an example. > mul_var_poly := y^3 + x^2*y^2 + x^3; mul _var _poly := y 3 + x2 y 2 + x3 3.4 Polynomials > sort(mul_var_poly, [x,y]); • 61 x2 y 2 + x3 + y 3 > sort(mul_var_poly, [x,y], ’plex’); x3 + x2 y 2 + y 3 The collect command groups coefficients of like powers in a polynomial. For example, if the terms ax and bx are in a polynomial, Maple collects them as (a + b)x. > big_poly:=x*y + z*x*y + y*x^2 - z*y*x^2 + x + z*x; big _poly := x y + z x y + y x2 − z y x2 + x + z x > collect(big_poly, x); (y − z y ) x2 + (y + z y + 1 + z ) x > collect(big_poly, z); (x y − y x2 + x) z + x y + y x2 + x Mathematical Operations You can perform many mathematical operations on polynomials. Among the most fundamental is division, that is, to divide one polynomial into another and determine the quotient and remainder. Maple provides the commands rem and quo to find the remainder and quotient of a polynomial division. > r := rem(x^3+x+1, x^2+x+1, x); r := 2 + x > q := quo(x^3+x+1, x^2+x+1, x); q := x − 1 62 • Chapter 3: Finding Solutions > collect( (x^2+x+1) * q + r, x ); x3 + x + 1 Sometimes it is sufficient to know whether one polynomial divides into another polynomial exactly. The divide command tests for exact polynomial division. > divide(x^3 - y^3, x - y); true > rem(x^3 - y^3, x - y, x); 0 You evaluate polynomials at values as you would with any expression, by using eval. > poly := x^2 + 3*x - 4; poly := x2 + 3 x − 4 > eval(poly, x=2); 6 > mul_var_poly := y^2*x - 2*y + x^2*y + 1; mul _var _poly := y 2 x − 2 y + y x2 + 1 > eval(mul_var_poly, {y=1,x=-1}); −1 Coefficients and Degrees The commands degree and coeff determine the degree of...
View Full Document

Ask a homework question - tutors are online