This preview shows pages 1–2. Sign up to view the full content.
Homework Problems – Week 2
440:127 – Fall 2011 – S. J. Orfanidis
This homework set is due online at Sakai no later than 5:00 AM on Monday, September 26, 2011. Please
submit the
HTML fle together with any supporting PNG fles
generated by MATLAB’s
publish
command from
your script MFle (do not copypaste from the command window, but you may copypaste from the HTML
Fle into Word). Late submissions will not be accepted. Please upload your Fles to Sakai under Assignments,
not to the Drop Box. Please do the following problems:
1. Problems 3.6–3.9 dealing with discrete mathematics functions.
2. The factorial of an integer
n
is deFned as the product
n
!
=
1
·
2
·
3
···
n
. Stirling’s approximation states
that for large
n
, the factorial behaves as:
n
!
≈
√
2
πn
±
n
e
²
n
where
e
=
exp
(
1
)
=
2
.
71828
. To test it, let us deFne the function
f(n)
as the ratio
=
n
!
√
2
πn
±
n
e
²
n
=
factorial
(n)
√
2
πn
±
n
e
²
n
which should converge to unity for large
n
. DeFne the vector
n
=
[
1
,
2
,
3
,...,
50
]
, that is, in MATLAB,
n
=
1:50. Using MATLAB’s builtin function
factorial
, which admits vector inputs, calculate the corre
sponding vector of
f
values using a completely vectorized calculation (no loops). Then, plot
f
versus
n
and verify that
f
converges to unity.
3. In a joint civil engineering project, two towns
A
and
B
decide to build a bridge across a river separating
them. The vertical distances of the towns to the river are
a,b
, the river width is
w
, and the distance
separating the towns along the river is
d
, as shown below. The total distance (red line) between the two
towns through the bridge is the sum of the segments:
L
=
(AC)
+
(CD)
+
(DB)
. The bridge location is
deFned by the distance
x
from the point
O
, that is,
x
=
(OC)
. The total distance may be thought of as
a function of
x
and is given by:
L(x)
=
p
x
2
+
a
2
+
q
(d
−
x)
2
+
b
2
+
w
This preview has intentionally blurred sections. Sign up to view the full version.
View Full Document
This is the end of the preview. Sign up
to
access the rest of the document.
 Spring '11
 Orfandi

Click to edit the document details