Sie sind auf Seite 1von 5

Technische Universitt Mnchen

Fakultt fr Informatik
Dr. Tobias Lasser
Richard Brosig, Jakob Vogel

WiSe 2011/12
Solution for Exercise Sheet 10
February 2, 2012

Exercises in Basic Mathematical Tools

Assignment 1

Poisson Distribution

X Poi(), Y Poi()
a) Compute the distribution of X +Y = n
n

P(X +Y = n) = P(X = k,Y = n k)


k=0
n

= P(X = k) P(Y = n k)
k=0
n k nk
e e

k!

k=0

(n k)!

k nk
k=0 k!(n k)!

=e+
=e+
=e+
=

1 n
n!
k nk

n! k=0 k!(n k)!


n!
1 n
k nk

n! k=0 k!(n k)!

e+ ( + )n
Poi( + )
n!

The last equation can be obtained with the binomial theorem1


b) Compute the probability of {X = k} on the condition that {X +Y = n}.
(i) Guess which distribution type P[{X = k}|{X +Y = n}] will follow!
The computation of P(X = k|X + Y = n) can be seen as the sum of Bernoulli experiments. We have n Experiments with either X or Y as result. After this experiments the
sum of both is n and we want to get the probability that X = k. So we can assume that
P(X = k|X +Y = n) B(n, p).

(ii) Compute the parameter of the conditional distribution P[{X = k}|{X +Y = n}]!
In the previous exercise we already mentioned that this distribution is Binomially distributed. This is the sum of coin flip experiments. We can see the event X as head and
Y as tail. Since we already have n and k we have to compute the probability p of the
1 http://en.wikipedia.org/wiki/Binomial_theorem

Solution 10/ page 2


event X.
P(X = k, and X +Y = n)
P(X +Y = n)
P(X = k, and Y = n k)
=
P(X +Y = n)
P(X = k) P(Y = n k)
=
P(X +Y = n)

P(X = k|X +Y = n) =

e k
k!

(nk)

e (nk)!

e(+) (+)n
n!

e k e

(nk) n!
k!(n k)! e(+) ( + )n
n!
k nk
=
k!(n k)! ( + )n

k 
nk

n!
=
k!(n k)! +
+



B n,
+
=

Assignment 2 Advection Equation (Exemplary Solution)


In this exercise we have a closer look at the one-dimensional advection equation
u(x,t)
u(x,t)
v
=0
t
x
with x R, t [0, ) and the initial values
u(x, 0) = u0 (x)

u0 C1 (R)

a) Proof that
u(x,t) = u0 (x + vt)
is an analytical solution of equation (1)!
First compute the partial derivations of the solution
ux (x,t) = u00 (x + vt)
ut (x,t) = u00 (x + vt)v
After substitution of these two equations in (1) we get
u(x,t)
u(x,t)
v
t
x
=ut (x,t) vux (x,t)

0=

=u00 (x + vt)v vu00 (x + vt) = 0

So we have proven that this is the exact solution.

(1)

Solution 10/ page 3


b) One numerical class of methods for solving the advection equation are the finite difference
methods. For deriving a numerical computation scheme the partial derivation are approximated with the Taylor Expansion.
u(x,t)
x
u(x,t)
u(x h,t) u(x,t) h
x
u(x,t)
u(x,t + ) u(x,t) +
t
u(x + h,t) u(x,t) + h

Derive a numerical scheme for the computation of the advection equation, by substituting
the temporal partial derivative with the approximation given by the Taylor expansions. For
the spatial derivative use the first two Taylor expansions to get a equation without u(x,t) and
substitute this equation in (1). (This formular is called central differences)
Afterwards, try to get a formula for u(x,t + ).
First the we have derive a equation for the spatial partial derivation, by eliminating u(x,t)
with the use of the two spartial Taylor expansions. Subtracting this two equations we get
u(x,t)
u(x,t)
+h
x
x
u(x,t) u(x + h,t) u(x h,t)

t
2h

u(x + h,t) u(x h,t) h

For the approximation to the temporal derivation we get


u(x,t) u(x,t + ) u(x,t)

This can be substituted and solved


u(x,t)
u(x,t)
v
t
t
u(x,t + ) u(x,t)
u(x + h,t) u(x h,t)
0=
v

2h
u(x,t + ) u(x,t)
u(x + h,t) u(x h,t)
=v

2h
0=

u(x,t + ) = u(x,t) +

v
(u(x + h,t) u(x h,t))
2h

(2)

c) Implement this scheme in Matlab and compute the numerical and analytical solution of the
two advection equations with
(i) v = 0.5
(ii) v = 2
and the boundary conditions
(
0
|x| > p/2
u0 =
cos2 (x) else
u(5,t) = u(5,t) = 0 t [0, 1)

Solution 10/ page 4


(0.5, 0.5)
t
v=2
v = 0.5

= 0.1

h = 0.1

Ddiscrete

Dcont,v=0.5 = (0.75, 0)

Figure 1: domain of dependence of the explicit FD method


in the region of (x,t) [5; 5] [0, 1). For the computation use a regular grid with the step
size = 0.01 in the temporal dimension and h = 0.01 in the spatial.
See Matlab
d) One of the numerical solutions does not give a good approximation of the analytical one.
Figure out the boundary grid points on which the numerical and analytical solutions for the
grid point (x,t) = (0.5, 0.5) depend on.
Having a look at equation (2) with a regular grid = h = 0.01 we see that the point
(x,t) = (0.5, 0.5) depends on the points (0.49, 0.49), (0.50, 0.49), (0.51, 0.49). This points
itself depends on the points (0.48, 0.48), (0.49, 0.48), (0.50, 0.48), (0.51, 0.48), (0.52, 0.48).
Following this recursively we end up with the numerically domain of dependence



h
h
Ddiscrete (0.5, 0.5) = (x,t)|t = 0, x 0.5 0.5, 0.5 + 0.5 = {(x,t)|t = 0, x [0, 1]}

Having a look the analytical solution


u(x,t) u0 (x + vt)
we see that the analytical domain of dependence is

Dcont (0.5, 0.5) = (0.5 + 0.5v, 0).


This leads for v = 0.5 to

Dcont (0.5, 0.5) = (0.75, 0) Ddiscrete (0.5, 0.5)


and for v = 2

Dcont (0.5, 0.5) = (1.5, 0) 6 Ddiscrete (0.5, 0.5).

In the case v = 2 the numerical solution does not depend on the points where the analytical
solution depends on. In this case the method cant be stable (see fig. 1).
There is a relationship between v, h and such that the analytical domain of dependence is
a subset of the numerical one. This is called the CFL-condition (Courant-Friedrichs-Lewy).
Give an explicit equation for this condition!
Looking at the discrete domain of dependence we can see that the size of this is changing
with the ratio of the temporal and spartial spacing h/. For a stable method discretisation
we need to have
h
v

or
v
1
h

Solution 10/ page 5


(0.5, 0.5)
t
v=2
v = 0.5

= 0.1

h = 0.1

Ddiscrete

Dcont,v=0.5 = (0.75, 0)

Figure 2: Domain of Dependence of the implicit finite differences method.


e) Find a numerical scheme which satisfies the CFL Condition for every v!
Using the spatial Taylor expansion for u(x h,t + ) leads to
u(x,t + ) = u(x,t) +

v
(u(x + h,t + ) u(x h,t + ))
2h

In this case the numerical domain of dependence is the whole boundary of the state space,
but we have to solve a linear equation for each time step(see fig 2).
f) PDEs are often used to simulate physical models. Why does a numerical scheme which is
implicit in time not yield a good approximation to a physical solution?
Knowing the fact, that an implicit numerical scheme (5) in the spatial direction seems to
be better than a explicit one (1), someone can think about a method which is also implicit
in time. This methods tends to be instable again, since they are not modeling the physical
background correct. It is a bad idea to have a point like (x,t + ) in the discretization, since
future states should not affect the present state!

Das könnte Ihnen auch gefallen