Math 105/206 - Practice problems for Quiz 4 Problem 1

advertisement
Math 105/206 - Practice problems for Quiz 4
Problem 1
Compute Simpson’s approximation for the integral
Z π/2
sin(2x) dx
0
with n = 4 subintervals, and estimate the absolute error. How big do you need to take n to have an error of at
1
most 1000
?
Solution
The endpoints of the intervals of the subdivision are x0 = 0, x1 = π/8, x2 = π/4, x3 = 3π/8, x4 = π/2, and
∆x = π/8.
Applying Simpson’s rule’s formula we get
∆x
S(4) = (f (x0 ) + 4f (x1 ) + 2f (x2 ) + 4f (x3 ) + f (x4 ))
3
and
f (x0 ) = f (0) = sin(0) = 0
√
f (x1 ) = f (π/8) = sin(π/4) =
2
2
f (x2 ) = f (π/4) = sin(π/2) = 1
f (x3 ) = f (3π/8) = sin(3π/4) =
√
2
2
f (x4 ) = f (π/2) = sin(π) = 0
so
√
√
√ π
π(2 2 + 1)
=
≈ 1.0022
S(4) = 2 2 + 2 + 2 2
24
12
To estimate the error we use
K(b − a)
(∆x )4
180
with b − a = π/2, ∆x = π/8, and K is the maximum of |f (4) (x)| over [0, π/2].
Now f 0 (x) = 2 cos(2x), f 00 (x) = −4 sin(2x), f (3) (x) = −8 cos(2x), and f (4) (x) = 16 sin(2x). Since −1 ≤
sin(2x) ≤ 1 we have −16 ≤ 16 sin(2x) ≤ 16 in [0, π/2]. Moreover 16 sin(2(π/4)) = 16, so K = 16.
In conclusion
K(b − a)
16π 5
ES ≤
(∆x )4 =
≈ 0.0033
180
180 · 2 · 84
and in fact the exact value of the integral is 1, so the absolute error for S(4) is about 1.0022 − 1 = 0.0022, which
is less than our estimate 0.0033.
1
To have an error of at most 1000
, using ∆x = π/2n, we set
ES ≤
ES ≤
K(b − a)
16π 5
1
(∆x )4 =
≤
180
180 · 2 · 24 · n4
1000
and solving for n
r
n≥
so we can take n ≥ 6.
4
1000 · 16π 5
≈ 5.399
180 · 2 · 24
Problem 2
Find the general solution of the following separable first-order differential equations.
dy
dx
= y(x2 + 1) where y > 0
√
• x2 dw
= w(3x + 1).
dx
•
Solution
The first one by separating the variables can be rewritten as
dy
= (x2 + 1)dx
y
so integrating both sides yields
x3
+ x + C.
3
Since y > 0 we can get rid of the absolute value, and exponentiating we get
ln |y| =
x3
y(x) = e 3 +x+C
which is the general solution.
Separating the variables of the second one we find
(3x + 1)
dw
√ =
dx
x2
w
and let’s integrate both members
√
2 w=
Z
3
dx +
x
Z
1
1
dx = 3 ln |x| − + C
2
x
x
so
w(x) =
3 ln |x|
1
C
−
+
2
2x
2
2
.
Note that w is not
√ defined for x = 0, and it actually is a solution only if 3 ln |x| −
to be equal to 2 w, which is certainly ≥ 0).
Problem 3
Find the solution to the following first-order initial value problem.



dz
z2


= 2
dx
x +1



 z(0) = 16
Solution
Separating the variables we find
dz
dx
= 2
2
z
x +1
and integrating
1
− = arctan(x) + C
z
so
z(x) = −
1
.
arctan(x) + C
1
x
+ C ≥ 0 (because this has
To determine C we have to impose the initial condition, that gives
z(0) = −
1
1
1
=− =
arctan(0) + C
C
6
so C = −6, and the solution to the initial value problem is
z(x) = −
1
1
=
.
arctan(x) − 6
6 − arctan(x)
Problem 4
You have a colony of bacteria that, if left undisturbed, grows proportionally to the population, with a factor
0.008 (and they never die......). Let’s say we use years as unit of time, and you harvest a quantity h of the
bacteria every year, and say the initial population is P0 .
• if P0 = 2000, what’s the value of h that gives you a constant population?
• if h = 200, what’s the value of P0 that gives you a constant population?
• if P0 = 100 and h = 50, find an expression for the population at a generic time t.
Solution
The differential equation that models the population P (t) is
dP
= 0.008P − h
dt
with initial value y(0) = y0 .
To answer the first two questions, it is sufficient to note that to have a constant population means that the
function P (t) will be constant, so its derivative has to be zero. So
0=
dP
= 0.008P − h
dt
and this gives h = 0.008P . So if P0 = 2000, we get h = 0.008 · 2000 = 16, and if h = 200 we get P0 =
25000.
For the last point, we have to solve
dP
= 0.008P − 50
dt
with initial condition P (0) = 100.
Separating the variables gives
dP
= dt
0.008P − 50
and integrating we find
1
ln |0.008P − 50| = t + C
0.008
and exponentiating
|0.008P − 50| = e0.008t+0.008C
200
0.008
Now the absolute value could give you a minus sign in front of the function. We get two kinds of solutions
0.008P − 50 = e0.008t+0.008C
so
e0.008t+0.008C + 50
P (t) =
0.008
and
0.008P − 50 = −e0.008t+0.008C
=
so
−e0.008t+0.008C + 50
0.008
50
= 6250, but this does not satisfy our
(there’s also a constant solution where 0.008P − 50 = 0, so P (t) = 0.008
initial condition P (0) = 100).
Imposing the initial condition will tell us which of the two solutions above is correct. Using the first formula
we get
e0.008C + 50
P (0) =
= 100
0.008
so
e0.008C = 0.8 − 50 = −49.2
P (t) =
but this has no solutions for C, because ez is positive for every real number z.
Using the second formula instead, we find
P (0) =
−e0.008C + 50
= 100
0.008
so
e0.008C = 50 − 0.8 = 49.2
and now this has precisely one solution for C. There’s no need to compute it, because C appears in P (t) only
through e0.008C , since e0.008t+0.008C = e0.008t · e0.008C . Plugging this in the formula for P (the second one) we get
P (t) =
−49.2e0.008t + 50
.
0.008
Note that as t grows, P (t) will reach the value 0 (and in very short time, like t ≈ 2). You are harvesting 50
bacteria from an initial population of 100, and they are growing very slowly......
Problem 5
Are the following functions CDFs for a continuous random variable?
1. F (x) = π1 (arctan(x) + π2 )
2. F (x) = 1 + e−x
3. F (x) =
1
1+log(x2 +1)

if x < 1
 0
2x − 2 if 1 ≤ x < 32
4. F (x) =

1
if x ≥ 32

if x < 1
 0
x − 1 if 1 ≤ x < 32
5. F (x) =

1
if x ≥ 23
Solution
A function F (x) is a CDF for a continuous random variable if
• it is continuous
• it is non-decreasing (that is F 0 (x) ≥ 0 for all x)
• limx→−∞ F (x) = 0 and limx→+∞ F (x) = 1, and
• we have 0 ≤ F (x) ≤ 1 for all x (this last condition is actually automatic if all the other ones are satisfied).
Number 1 is a CDF: limx→−∞ arctan(x) = − π2 and limx→+∞ arctan(x) = π2 , so the limits check out. Moreover
< arctan(x) < π2 for all x, and arctan(x) is continuous and non-decreasing.
Number 2 is not a CDF because it is not non-decreasing: its derivative is −e−x which is always negative.
1
Number 3 is not a CDF because limx→+∞ 1+log(x
2 +1) = 0.
Number 4 is a CDF: the limits check out because of how the function is defined, it is continuous since
2 · 1 − 2 = 0 and 2 · 32 − 2 = 3 − 2 = 1, it is non-decreasing (its derivative where it is not constant is 2 so it’s
positive), and it’s always between 0 and 1.
Number 5 is not a CDF: everything is ok except for continuity: the function is not continuous at x = 23 ,
since 32 − 1 = 21 6= 1.
− π2
Download