aboutsummaryrefslogtreecommitdiff
path: root/src/hyper/pages/PFR.ht
blob: b50ae3d4a9c91eec4d700672bef43f57db16b61a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
% Copyright The Numerical Algorithms Group Limited 1992-94. All rights reserved.
% !! DO NOT MODIFY THIS FILE BY HAND !! Created by ht.awk.
\newcommand{\PartialFractionXmpTitle}{PartialFraction}
\newcommand{\PartialFractionXmpNumber}{9.61}
%
% =====================================================================
\begin{page}{PartialFractionXmpPage}{9.61 PartialFraction}
% =====================================================================
\beginscroll
%%
%% pfr.htex
%%

A {\it partial fraction} is a decomposition of a quotient into
%-% \HDindex{partial fraction}{PartialFractionXmpPage}{9.61}{PartialFraction}
a sum
%-% \HDindex{fraction!partial}{PartialFractionXmpPage}{9.61}{PartialFraction}
of quotients where the denominators of the summands are powers of
primes.\footnote{Most people first encounter partial fractions when they
are learning integral calculus.
For a technical discussion of partial fractions, see, for example, Lang's {\it
Algebra.}} For example, the rational number \spad{1/6} is decomposed into
\spad{1/2 -1/3}.
You can compute partial fractions of quotients of objects from domains
belonging to the category \spadtype{EuclideanDomain}.
For example, \spadtype{Integer}, \spadtype{Complex Integer}, and
\spadtype{UnivariatePolynomial(x, Fraction Integer)} all belong to
\spadtype{EuclideanDomain}.
In the examples following, we demonstrate how to decompose quotients of
each of these kinds of object into partial fractions.
Issue the system command
\spadcmd{)show PartialFraction}
to display the full list of operations defined by \spadtype{PartialFraction}.

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 \spadfun{factor}.
In these examples, it is not necessary to factor the
denominators explicitly.
%
\xtc{
The main operation for computing partial fractions is called
\spadfunFrom{partialFraction}{PartialFraction} and we use this to
compute a decomposition of \spad{1 / 10!}.
The first argument to \spadfunFrom{partialFraction}{PartialFraction} is
the numerator of the quotient and the second argument is the factored
denominator.
}{
\spadpaste{partialFraction(1,factorial 10) \bound{prev1}}
}
\xtc{
Since the denominators are powers of primes, it may be possible
to expand the numerators further with respect to those primes. Use the
operation \spadfunFrom{padicFraction}{PartialFraction} to do this.
}{
\spadpaste{f := padicFraction(\%) \free{prev1}\bound{f}}
}
%
%
\xtc{
The operation \spadfunFrom{compactFraction}{PartialFraction} returns an
expanded fraction into the usual form.
The compacted version is used internally for computational efficiency.
}{
\spadpaste{compactFraction(f) \free{f}}
}
%
\xtc{
You can add, subtract, multiply
and divide partial fractions.  In addition, you can extract the parts
of the decomposition.
\spadfunFrom{numberOfFractionalTerms}{PartialFraction} computes
the number of terms in the fractional part.
This does not include the whole part of the fraction,
which you get by calling \spadfunFrom{wholePart}{PartialFraction}.
In this example, the whole part is just \spad{0}.
}{
\spadpaste{numberOfFractionalTerms(f) \free{f}}
}
\xtc{
The operation
\spadfunFrom{nthFractionalTerm}{PartialFraction} returns the individual terms in the
decomposition.
Notice that the object returned is a partial fraction itself.
\spadfunFrom{firstNumer}{PartialFraction} and
\spadfunFrom{firstDenom}{PartialFraction} extract the numerator and
denominator of the first term of the fraction.
}{
\spadpaste{nthFractionalTerm(f,3) \free{f}}
}
%

%
\xtc{
Given two gaussian integers (see \downlink{`Complex'}{ComplexXmpPage}\ignore{Complex}), you can
decompose their quotient into a partial fraction.
}{
\spadpaste{partialFraction(1,- 13 + 14 * \%i) \bound{prev2}}
}
%
\xtc{
To convert back to a quotient, simply use a conversion.
}{
\spadpaste{\% :: Fraction Complex Integer \free{prev2}}
}

To conclude this section, we compute the decomposition of
\texht{\narrowDisplay{1 \over {{(x + 1)}{(x + 2)}^2{(x + 3)}^3{(x + 4)}^4}}}{
\begin{verbatim}
                   1
     -------------------------------
                   2       3       4
     (x + 1)(x + 2) (x + 3) (x + 4)
\end{verbatim}
}
The polynomials in this object have type
\spadtype{UnivariatePolynomial(x, Fraction Integer)}.
%
\xtc{
We use the \spadfunFrom{primeFactor}{Factored} operation (see
\downlink{`Factored'}{FactoredXmpPage}\ignore{Factored}) to create the denominator in factored form directly.
}{
\spadpaste{u : FR UP(x, FRAC INT) := reduce(*,[primeFactor(x+i,i) for i in 1..4]) \bound{u}}
}
%
%
\xtc{
These are the compact and expanded partial fractions for the quotient.
}{
\spadpaste{partialFraction(1,u) \free{u}\bound{prev3}}
}
\xtc{
}{
\spadpaste{padicFraction \% \free{prev3}}
}

All see \downlink{`FullPartialFractionExpansion'}{FullPartialFractionExpansionXmpPage}\ignore{FullPartialFractionExpansion} for examples of
factor-free conversion of quotients to full partial fractions.
\endscroll
\autobuttons
\end{page}
%