Lecture6 Linear Algebra
Lecture6 Linear Algebra
Instructor:
Danial Faghihi
The Institute for Computational Engineering and Science ACES 4.122, [email protected]
x Zero
order
(n=0):
e ' 1 Percent
total
error:
"t = | 1.648721 1 | = 39.3 1.648721
x=0.5 First
order
(n=1):
Use
the
Zero
order
M-le
of
Figure
4.2
of
the
book,
IterMeth.m
to
conrm
the
results.
>> [approxval, ea, iter] = IterMeth(.5,0.05,100)! approxval =! 1.6487! ea =! 0.0158! iter =! 6! ! >> trueval=exp(.5)! trueval =! 1.6487! >> et=abs((trueval- approxval)/trueval)*100! et =! 0.0014 !
x2 x3 xn e =1+x+ + + ... + 2 3! n!
diagonal matrix: a square matrix where all elements off the main diagonal are equal to zero
identity matrix: a diagonal matrix where all elements on the main diagonal are equal to 1
Property of [ I ]
AddiEon and SubtracEon: cij = aij bij MulEplicaEon of matrix [A] by a scalar g
the original matrix. For example, suppose we have a 3*3 matrix of coecients. We might wish to augment this matrix [A] with a 3*3 idenEty matrix to yield a 3*6 dimensional matrix:
Performing
a
set
of
idenEcal
operaEons
on
the
rows
of
two
matrices.
6 A=4 7 3
6 7 4 25 6 7
i h i 5 8 1 x= 8 6 9 ; y= h i z= 4 8 2
transpose
of
[A]:
[B]
6 B=4 5 4
9 8 17 5 8 2
6 B=4 5 4
3 6 9 8 17 5 8 2
[C1]-1
=?
-0.0890 -0.0193 0.0937 -0.1334! -0.0199! 0.1079!
[C1]T
=?
>> C1! ans =! 7 94 26 44 90 71 -26! 86! -7!
[C1]-T
=?
>> inv(C1')! >> inv(C1)! ans =!
0.2073 -0.0890 -0.1334 0.0473 -0.0193 -0.0199 -0.1884! 0.0937! 0.1079!
D=
"
1 4 5 8
3 1
[A][D]
=?
>> A*D! Error using
[AI]
=
[A]-1
=?
>> -0.2154 0.6154! -0.4769!
[AI]-1
=?
inv(AI)! ans =! 1.0000 5.0000 7.0000 4.0000 -3.0000 6.0000 6.0000! 2.0000! 7.0000!
* !
>> AI = inv(A)! AI =!
0.2462 0.0154 -0.8462 0.3846 0.8308 -0.3231
[D][A]
=?
>> D*A! ans =! 20 58 39 63 35! 53!
[A]
[AI]
=?
>> A*AI! ans =!
1.0000 0.0000 0.0000 -0.0000 1.0000 -0.0000 -0.0000! -0.0000! 1.0000!
can be expressed as
6 4a21 a31
a11
matrix of coefficients
[A]{x} = {b}
vector of unknowns
vector of constants
Solving the system of equation: determining (solving) the vector {x} for given [A] and {b} in the following relation
[A]{x} = {b}
[ A]
[ A]
1
[A]{x} = [A]
{b}
[ A] = [ I ]
{ x } = [ A]
{b }
[I ]{x} = {x}
Solving the system of equation: determining (solving) the vector {x} for given [A] and {b} in the following relation
{ x } = [ A]
matrix inversion: >> x = inv(A)*b!
{b }
MATLAB provides two direct ways to solve systems of linear algebraic equations.