









Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
Homework solution 2 Material Type: Notes; Professor: Hetmaniuk; Class: LINR ALG & NUM ANLY; Subject: Applied Mathematics; University: University of Washington - Seattle; Term: Autumn 2011;
Typology: Study notes
1 / 17
This page cannot be seen from the preview
Don't miss anything!










homework02ex2m Printed: (^) 10/12/11 (^) 12:29:20 (^) PM Page^1 of (^1) Printed (^) For: (^) hetmaniu
% Code (^) to (^) approximate (^) the (^) value of pi
clear (^) all;
MySum = 0; for (^) n (^) = 1:20, MySum (^) = MySum (^) + l/((2fl1)2(2fl+1)A2); [n, sqrt(MySum16+8)pJ end
save (^) s2Odat (^) MySum (^) -ascii
MyError (^) = abs( sqrt(MySum*16+8)
nn (^) = 0; ss (^) = 00; MyValue =^ sqrt(16ss^ + (^) 8); while (^) (abs(Myvalue (^) - pi) (^) > 10e-08) nn = nn + (^) 1; ss = ss (^) + MyValue = sqrt(16ss (^) + (^) 8); end
save (^) n08dat nn (^) -ascii;
homeworkO2exlm Printed: (^) 10/12/11 (^) 12:29:29 (^) PM Page (^1) of 1 Printed (^) For: (^) hetmanin
%---- (^) The goal (^) is to (^) compute the (^) norm of (^) a vector,
clear (^) all;
x (^) = [1; 2; (^) 3.0; (^) 5.0; 7.Oj;
save (^) NormXl,dat (^) NormXl -ascii
NormX2 (^) = norm(x, (^) 2); save (^) NormX2 (^) .dat (^) NormX2 (^) -ascii
NormX4 (^) = norm(x, (^) 4); save (^) NormX4,dat (^) NormX4 (^) -ascii
x = [1; (^) 3.0; (^) 5.0; (^) 7.0; (^) 9.Oj; y = [1; (^) 2; (^) 4.0; 6.0; (^) 8.0j;
mydot (^) = dot(x,y); save (^) dot (^) xy.dat (^) mydot (^) -ascii
theta (^) = save (^) angle (^) xy.dat (^) theta (^) -ascii
.
-^
rp. r
4
N
%J
f
cr
-^
••
•u
t
.
1
P
-^
‘3-.)
t’’
It
;
[
i
I
.s
Ct
-^
4
...
.^
r-
cr
A^
•c
v
r——--——
I
P
‘
.^
.
4’
n
.
t
5,
1•
r
!•!
r
4
F
o%\
—‘
‘S
a
51
c,J
..te
e
(
P
p
4
cr
çj
r
.^
trw
1
tr
(
‘\O
4%
Ii^
“j’
‘a.
V
(^141)
4%
rz
tr-
A
.
1’ I
Jr
I
j1t
‘Cj
tJ
N 01 1 0
rfl
C.
as
‘
Li^0
‘
t frt frOt
0 II
1 z.t.÷
0
‘3 ‘ $
0* em
4 Vt
÷
‘
—
t
N)
. r
‘I
aV
r
ci
.,
ad1)
••>h
(^44) lb 6
Sc’
$
-------------auiaaaaae.fl
C^
(
,
;
:
t
2
—F
.
\
L^
_—J
a
A
ThN
‘
7
3
S H
C
CN
I^
—
‘C
000
‘S
c-
k
op
t
Uyr
.p
V 1
p ‘p
—
r
0
I
S
r
“
I ‘St 1
‘0N
-o eqt
S
.
%%
-r
4
.
4%•_)
t%
E
er
r
c)
G
Nee_st
%
.
•ia 4
‘
•.O 4 Ocr
a
•N 1•
0
.
•.
E
.
.
:
I
C%w%.m
.
.f-.v.
t
.
C’
.r:i
.
.L
a
10
*aLt
1
S
a.
S
‘I?
%f
‘V
.
Ob
.
1\ ‘c
t Ii 4
t
—
%
‘k
N
N
a
N
—
N)^5 it
N
V.
z
r
p
-r
.
..^
, 3 z
Cc
I
1
÷
-^
.
-_Th
r-&
rfll
.^
E
Pr.. C-----?
r
-^
4
•F
I’ V
x I’
•‘t;i
L
C (Mt^
csir).^ s-^ c^ a’
kc 4-^ 5c
Cct•z 1 a
Wa (^31)
Ic 4r:LE 4 t2J
Ui-cit
.=:,.
rw, L4)# (^) I
(i*r.c49. At^ Ca’^ a>^
t (^) “a 44. C1tiZ_cm%s
Ui (^) L
LeJ (^) U
(we3v).. *r
r-z