You are on page 1of 14

LYCEUM OF THE PHILIPPINES UNIVERSITY LAGUNA

Km. 54, National Highway, Makiling, Calamba City, Laguna


COLLEGE OF ENGINEERING
ELECTRONICS ENGINEERING PROGRAM
ECEL46E ECE Computer Appli!tio"#
MATLA$ L!%or!tor& Ati'it& ()
Polynomials, Linear Algebraic Equations, and
Partial Fraction Expansion
Alzona,Sahara Marielle
ECE4-2
Ro"el V* Vi + ! l, P E CE
instrutor
!
I* O%-eti'e#.
!. "o #esribe $olynomials in MA"LA%
&. "o im$lement $olynomials a##ition, subtration, salar multi$liation, multi$liation, an#
#i'ision with MA"LA%
(. "o sol'e linear algebrai e)uations with MA"LA%
4. "o im$lement $artial * +ration e,$ansion with MA"LA%
II* Primer.
A* Pol&"omi!l#
MA"LA% is a$able working with $olynomials whih are use# in many a#'ane#
ourses an# a$$liations in engineering. "o #esribe a $olynomial in MA"LA% with a row
'etor whose elements are the $olynomial-s oe++iients, onsi#er. f /x0 = 4x
(
1x
&
+ 2x 5
33 % to represent the polynomial 4x
3
-8x
2
+7x-5
33 lear
33 + 4 54, 61, 2, 657
+ 4
4 61 2 65
Pol&"omi!l Al/e%r!
)* A++itio" !"+ Su%tr!tio"
"o a## an#8or subtrat two $olynomials, a##8 subtrat the arrays that #esribe their
oe++iients. 9+ the $olynomials are o+ #i++erent #egrees, a## zeros to the oe++iient array o+
the lower #egree $olynomial.
Consi#er.
f /x0 = 10x
3
6x
2
+ 2x + 10 an# g/x0 = 5x
&
4x + ( ,
33 % Polynomial addition and sutra!tion
33 lear
33 + 4 5!:, 6;, &, !:7<
33 g 4 5:, 5, 64, (7<
33 h 4 + = g %addition
h 4
!: 6! 6& !(
33 k 4 + * g %sutra!tion
k 4
!: 6!! ; 2
"hus the result +or a##ition is
" /x0 = !:x
(
!!x
&
+ ;x + 2
h/x0 = !:x
(
x
&
&x
+!(
an# +or subtration is
0* S!l!r Multipli!tio" o1 Pol&"omi!l#
"o multi$ly a $olynomial by a salar, sim$ly multi$ly the oe++iient array by that salar.
Consi#er
f /x0 = 10x
3
6x
2
+ 2x + 10 an# g/x0 = 5x
&
4x + ( .
&
33 % #!alar multipli!ation of Polynomial
33 lear
33 + 4 5!:, 6;, &, !:7<
33 +! 4 5>+ %to multiply f$x% y a s!alar 5
+! 4
5: 6(: !: 5:
33 g 4 5:, 5, 64, (7<
33 g! 4 ;>g %to multiply g$x% y a s!alar &
g! 4
: (: 6&4 !1
"hus the result o+ salar multi$liation is
f !/x0 = 5:x
(
(:x
&
+ !:x + 5: an# g!/x0 = (:x
&
&4x
+!1 .
2* Multipli!tio" !"+ 3i'i#io" o1 Pol&"omi!l#
"he omman# o"'4!,%5 $stands for '!on(ol(e)% om$utes the $ro#ut o+ the two
$olynomials #esribe# by the oe++iient arrays ?!6 an# ?%6* "he two $olynomials nee# not
be the same #egree. "he result is the oe++iient array o+ the $ro#ut $olynomial.
"o $er+orm syntheti #i'ision o+ $olynomials, use the omman# 78uotie"t9 rem!i"+er:
; +eo"'4"um, +e"5 whih om$utes the results o+ #i'i#ing a numerator $olynomial, whose
oe++iient array is ?"um@, by a #enominator $olynomial re$resente# by the oe++iient array
?+e"@. "he )uotient $olynomial is gi'en by the oe++iient array ?8uotie"t@, ?rem!i"+er@ is
the remain#er $olynomial.
Consi#er
f /x0 = &:x
(
2x
&
+ 5x +!: an# g/x0 = 4x
&
+!&x ( .
33 %*ultipli!ation of t+o Polynomials
33 lear
33 + 4 5&:, 62, 5, !:7<
33 g 4 54, !&, 6(7<
33 $ro#ut 4 on'/+,g0
$ro#ut 4
1: &!& 6!&4 !&! !:5 6(:
"hus the result is produ!t = 1:x
5
+ &!&x
4
!&4x
(
+!&!x
&
+!:5x (: .
33 %,i(ision of t+o Polynomials
33 lear
33 + 4 5&:, 62, 5, !:7<
33 g 4 54, !&, 6(7<
33 5)uotient, remain#er7 4 #eon'/+,g0
)uotient 4
5.:::: 6!;.25::
remain#er 4
: : &&!.:::: 64:.&5::
"hus the result is -uotient = 5x !;.25 an# with remainder = &&!x 4:.&5 .
(
4* Pol&"omi!l Root#
"he omman# root#4!5 om$utes an array ontaining the roots o+ a $olynomial s$ei+ie#
by the oe++iient array ?!@. "he result is a olumn array that ontains the $olynomial-s roots.
Consi#er
f /t0 = t
(
2t
&
+ 4:t (4
33 %Polynomial .oots or 33 %Polynomial .oots
33 lear 33 lear
33 + 45!, 62, 4:, 6(47< 33 roots/5!, 62, 4:, 6(470
33 roots/+0 ans 4
ans 4 (.:::: = 5.::::i
(.:::: = 5.::::i (.:::: 6 5.::::i
(.:::: 6 5.::::i !.::::
!.::::
"he roots are t 4 !, ( = 5A, an# ( * 5A
<* Pol&"omi!l# Coe11iie"t 1rom Root#
"he pol&4r5 +untion om$utes oe++iients o+ the $olynomial whose roots are
s$ei+ie# by the array ?r6* "he result is a row array that ontains the $olynomial-s oe++iients.
Bi'en the roots !, ( = 5i, an# ( * 5i, +in# the $olynomial oe++iients.
33 %/o find polynomial !oeffi!ients from the gi(en roots
33 lear
33 r 4 5!, (=5i, (65i7<
33 $oly/r0
ans 4
! 62 4: 6(4
"hus the $olynomial is
x
(
2x
&
+ 4:x (4 .
6* "he pol&'!l4!,=5 +untion e'aluates a $olynomial at s$ei+ie# 'alues o+ its in#e$en#ent
'ariable ?=6, whih an be a matri, or a 'etor. "he $olynomial-s oe++iient array is ?!6
Consi#er f /x0 = Cx
(
5x
&
+ (x + 2 . "o e'aluate at the $oints x 0 12 22 42 &2 82 312 type
33 %E(aluates a polynomial at spe!ified (alues of x
33 lear
33 a 4 5C 65 ( 27<
33 , 4 5:.&.!:7<
33 + 4 $oly'al/a,,0
+ 4
2 ;5 5!5 !21C 4(!C 15(2
4
$* Solutio" to Li"e!r Al/e%r!i E8u!tio"#
Linear algebrai e)uations an be sol'e# with MA"LA%. MA"LA% $ro'i#es the le+t
#i'ision metho# +or sol'ing the e)uation set A= ; %* "o use the le+t #i'ision metho# to sol'e +or
?=6, ty$e = ; A>%* 9+ the number o+ e)uations e)uals the number o+ terms an# i+ #eterminant o+
A
?, then the e)uation set has a uni)ue solution.
Consi#er.
(x + & y C4 = ;5
Cx 5 y + &4 = !;
;x + 2 y + (4 = 5
"o sol'e the 'alue o+ ,, y, an# z in MA"LA%<
33 %#olution to linear algerai! e-uations
33 lear
33 A 4 5( & 6C< 6C 65 &< ; 2 (7
A 4
( & 6C
6C 65 &
; 2 (
33 #et/A0 %to test if a uni-ue solution exists
ans 4
&11
33 b 4 56;5< !;< 57<
33 , 4 ADb
, 4
&.::::
64.::::
2.::::
z 4 2.
"his answer gi'es the 'etor =, whih orres$on#s to the solution , 4 &, y 4 *4, an#
C* P!rti!l Fr!tio" E=p!"#io" @itA MATLA$
Consi#er.
5/s0
=
6/s0
7um
,en
s
n
+ s
n!
+ ...... +

=
: ! n
s
n
+ a s
n!
+ ...... +
a
! n
Num 4 5b
:
, b
!
, EE. b
n
7 * oe++iient o+ the numerator
Fen 4 5!, a
!
, a
&
, EEa
n
7 * oe++iient o+ the #enominator
"he omman# 7r,p,B: ; re#i+ue4Num,3e"5 +in#s tAe re#i+ue 4r5, pole# 4p5, !"+
+iret term# 4B5 o+ a $artial * +ration e,$ansion.
5/s0
=
6/s0
r/!0
+
s p/!0
r/&0
s p/&0
+ ........ +
r/n0
s p/n0
+ " /s0
5
G,am$le.
Consi#er.
"he MA"LA% $rogram.
5/s0
6/s0
&s
(
+ 5s
&
+ (s + ;
=
s
(
+ ;s
&
+!!s + ;
33 %partial - fra!tion expansion of polynomials$7um 8 ,en%
33 Num 4 5& 5 ( ;7< %!oeffi!ient of the numerator
33 Fen 4 5! ; !! ;7< %!oeffi!ient of the denominator
33 5r,$,k7 4 resi#ue/Num,Fen0
r 4
6;.::::
64.::::
(.::::
$ 4
6(.::::
6&.::::
6!.::::
k 4
&
Hartial * +ration e,$ansion o+ %/s08A/s0.
5/s0
=
6/s0
;
+
s + (
4
+
s + &
(
+ &
s + !
III* L!%or!tor& E=eri#e#
A. Holynomials
9oo" for t+o pairs of polynomial expressions and perform the follo+ing operations
of polynomials:
3: 6dd2 sutra!t2 multiply2 and di(ide ea!h pair of polynomials
2: *ultiply the four polynomials y 42 52 &2 and 72 in that order
3: ;ind their roots
4: <se the results of part 3 to find the polynomial !oeffi!ients from the gi(en roots
5: E(aluate the four polynomials at the point x 032 32 52 72 =2 and 33
%. Solution to Linear Algebrai G)uations with MA"LA%
9oo" for 2 sets of linear algerai! e-uations $4 e-uations 8 4 un"no+ns% then find
their solution:
C. Hartial * Iration G,$ansion with MA"LA%
9oo" for 4 polynomial e-uations $num>den% and determine their partial fra!tion
expansion:
;
Program and Outputs
clear
>> a=[2,-10,3,2,-10,5];
>> b=[1,1,2,-6,3,-5];
>> c=[6,-1,5,-5];
>> d=[1,5,-!,3];
Addition of a &b
>> a"b
ans =
3 -# 5 -! -$ 0
Ans= x x x x x 2 4 5 C (
& ( 4 5
+
Addition of c&d
>> c"d
ans =
$ -13 1 -2
Ans= & !( 2
& (
+ x x x
Subtraction of a&b
>> a-b
ans =
1 -11 1 -13 10
Ans = !: !( 1 !!
& ( 4 5
+ + + x x x x x
Subtraction of c&d
>> c-d
ans =
5 -23 # -
Ans= 1 C &( 5
& (
+ x x x
Product of a&b
>> product = con%&a,b'
product =
2 - -3 -2$ 6! -5# 32 61 -$0 65 -25
Product=
&5 ;5 2: ;! (&
5C ;4 &2 ( 1 &
& ( 4
5 ; 2 1 C !:
+ +
+ +
x x x x
x x x x x x
Product of c&d
>> product = con%&c,d'
product =
6 12 -10# 110 -## 35 -15
Product=
!5 (5 5C CC
!!: !:C !& ;
5 &
( 4 5 ;
+
+ +
x x x
x x x x
Division of a&b
>> [(uot)ent, rema)nder] = decon%&a,b'
(uot)ent =
2
rema)nder =
0 -12 -1 1! -16 15
*ema)nder= !5 !; !4 !&
& ( 4
+ + x x x x
Division of c&d
>> [(uot)ent, rema)nder] = decon%&c,d'
(uot)ent =
6
rema)nder =
0 -! 2# -23
*ema)nder= &( &C 41
&
+ x x
Polynomial a! multiply by "
>> !+a
ans =
-!0 12 -!0 20
,ns = &: 4: 1 !& 4: 1
& ( 4 5
+ + + x x x x x
Polynomial b! multiplied by #
>> 5+b
ans =
5 5 10 -30 15 -25
,ns = &5 !5 (: !: 5 5
& ( 4 5
+ + + x x x x x
Polynomial $ multiplied by %
>> 6+c
ans =
36 -10 30 -30
,ns = (: (: !:1 (;
& (
+ x x x
Polynomial d! multiplied by &
>> $+d
ans =
$ 35 -2 21
Ans = &! &1 (5 2
& (
+ + x x x
'oots of polynomial !a!
>> roots&a'
ans =
!-6$$2
-1-0!11
0-!16 " 0-#13)
0-!16 - 0-#13)
0-5303
'oots of polynomial b!
>> roots&b'
ans =
-1-2#3! " 1-1)
-1-2#3! - 1-1)
1-3132
0-136 " 0-636)
0-136 - 0-636)
'oots of polynomial c!
>> roots&c'
ans =
2-0#
0-0#55 " 0-5362)
0-0#55 - 0-5362)
'oots of polynomial d!
>> roots&d'
ans =
-5-$16
0-3#0 " 0-6051)
0-3#0 - 0-6051)
Polynomial coefficient of t(e given roots of a!
>> rootsa=[!-6$$2,-1-0!11,0-!16 " 0-#13),0-!16 - 0-#13),0-5303];
>> pol.&rootsa'
ans =
2-0000 -10-0000 3-0000 2-000! -10-0001 5-0000
,ns= 5 !: & ( !: &
& ( 4 5
+ + + x x x x x
Polynomial coefficient of t(e given roots of b!
>> rootsb=[-1-2#3! " 1-1),-1-2#3! - 1-1),1-3132,0-136 " 0-636),0-136 -
0-636)];
>> pol.&rootsb'
ans =
1-0000 1-0000 2-0000 -6-0006 3-0005 -5-000$
,ns = 5 ( ; &
& ( 4 5
+ + x x x x x
Polynomial coefficient of t(e given roots of c!
>> rootsc=[2-0#,0-0#55 " 0-5362),0-0#55 - 0-5362)];
>> pol.&rootsc'
ans =
6-0000 -1$-#### 5-0001 -5-0002
,ns = 5 5 !1 ;
& (
+ x x x
Polynomial coefficient of t(e given roots of d!
>> rootsd=[-5-$16,0-3#0 " 0-6051),0-3#0 - 0-6051)];
>> pol.&rootsd'
ans =
1-0000 5-0000 -!-0000 2-####
,ns = ( 4 5
& (
+ + x x x
)alues of polynomial a! at specified values of its independent
variable *x+
>> /=[103011];
>> pol.%al&a,/'
ans =
- -323 10666 103105
)alues of polynomial b! at specified values of its independent
variable *x+
>> pol.%al&b,/'
ans =
-! 131# 1#616 111!25
)alues of polynomial c! at specified values of its independent
variable *x+
>> pol.%al&c,/'
ans =
-12 111 1206 !2!5
)alues of polynomial a! at specified values of its independent
variable *d+
>> pol.%al&d,/'
ans =
5 131 563 1!63
, sets of linear algebraic equations and t(eir solution-
>> 1=[1 -3 -2 2;1 -2 1 3;2 5 -3 6;3 -2 2 3]
1 =
1 -3 -2 2
1 -2 1 3
2 5 -3 6
3 -2 2 3
>> 2=[! 1 2 3;3 -6 5 !;# $ -$ ;3 ! 3 2]
2 =
! 1 2 3
3 -6 5 !
# $ -$
3 ! 3 2
>> /=[-!;-12;-15;-1!];
>> .=[6;1;!;5];
>> sol1=13/
sol1 =
-0-2020
0-1133
-1-5#61
-3-3251
w=-3.3251 x=-.2020 y=.1133 z=-1.5961
>> sol2=23.
sol2 =
!-1$32
-0-2$3$
0-312
-3-616
w=4.1732 x=-0.2737 y=0.3128 z=-3.6816

You might also like