==================================================================== Partial Fraction ==================================================================== A partial fraction is a decomposition of a quotient into a sum of quotients where the denominators of the summands are powers of primes. Most people first encounter partial fractions when they are learning integral calculus. For a technical discussion of partial fractions, see, for example, Lang's Algebra. For example, the rational number 1/6 is decomposed into 1/2-1/3. You can compute partial fractions of quotients of objects from domains belonging to the category EuclideanDomain. For example, Integer, Complex Integer, and UnivariatePolynomial(x, Fraction Integer) all belong to EuclideanDomain. In the examples following, we demonstrate how to decompose quotients of each of these kinds of object into partial fractions. It is necessary that we know how to factor the denominator when we want to compute a partial fraction. Although the interpreter can often do this automatically, it may be necessary for you to include a call to factor. In these examples, it is not necessary to factor the denominators explicitly. The main operation for computing partial fractions is called partialFraction and we use this to compute a decomposition of 1/10!. The first argument to partialFraction is the numerator of the quotient and the second argument is the factored denominator. :: partialFraction(1,factorial 10) 159 23 12 1 --- - -- - -- + - 8 4 2 7 2 3 5 Type: PartialFraction Integer Since the denominators are powers of primes, it may be possible to expand the numerators further with respect to those primes. Use the operation padicFraction to do this. :: f := padicFraction(%) 1 1 1 1 1 1 2 1 2 2 2 1 - + -- + -- + -- + -- + -- - -- - -- - -- - - - -- + - 2 4 5 6 7 8 2 3 4 5 2 7 2 2 2 2 2 3 3 3 5 Type: PartialFraction Integer The operation compactFraction returns an expanded fraction into the usual form. The compacted version is used internally for computational efficiency. :: compactFraction(f) 159 23 12 1 --- - -- - -- + - 8 4 2 7 2 3 5 Type: PartialFraction Integer You can add, subtract, multiply and divide partial fractions. In addition, you can extract the parts of the decomposition. numberOfFractionalTerms computes the number of terms in the fractional part. This does not include the whole part of the fraction, which you get by calling wholePart. In this example, the whole part is just 0. :: numberOfFractionalTerms(f) 12 Type: PositiveInteger The operation nthFractionalTerm returns the individual terms in the decomposition. Notice that the object returned is a partial fraction itself. firstNumer and firstDenom extract the numerator and denominator of the first term of the fraction. :: nthFractionalTerm(f,3) 1 -- 5 2 Type: PartialFraction Integer Given two gaussian integers, you can decompose their quotient into a partial fraction. :: partialFraction(1,- 13 + 14 * %i) 1 4 - ------- + ------- 1 + 2%i 3 + 8%i Type: PartialFraction Complex Integer To convert back to a quotient, simply use a conversion. :: % :: Fraction Complex Integer %i - --------- 14 + 13%i Type: Fraction Complex Integer To conclude this section, we compute the decomposition of :: 1 ------------------------------- 2 3 4 (x + 1)(x + 2) (x + 3) (x + 4) The polynomials in this object have type UnivariatePolynomial(x, Fraction Integer). We use the primeFactor operation to create the denominator in factored form directly. :: u : FR UP(x, FRAC INT) := reduce(*,[primeFactor(x+i,i) for i in 1..4]) 2 3 4 (x + 1)(x + 2) (x + 3) (x + 4) Type: Factored UnivariatePolynomial(x,Fraction Integer) These are the compact and expanded partial fractions for the quotient. :: partialFraction(1,u) 1 1 7 17 2 139 607 3 10115 2 391 44179 --- - x + -- - -- x - 12x - --- --- x + ----- x + --- x + ----- 648 4 16 8 8 324 432 4 324 ----- + -------- + ------------------- + --------------------------------- x + 1 2 3 4 (x + 2) (x + 3) (x + 4) Type: PartialFraction UnivariatePolynomial(x,Fraction Integer) padicFraction % 1 1 1 17 3 1 607 403 --- - -- -- - - --- --- 648 4 16 8 4 2 324 432 ----- + ----- - -------- - ----- + -------- - -------- + ----- + -------- x + 1 x + 2 2 x + 3 2 3 x + 4 2 (x + 2) (x + 3) (x + 3) (x + 4) + 13 1 -- -- 36 12 -------- + -------- 3 4 (x + 4) (x + 4) Type: PartialFraction UnivariatePolynomial(x,Fraction Integer) See Also: * )help Factored * )help Complex * )help FullPartialFractionExpansionXmpPage * )show PartialFraction