• Keine Ergebnisse gefunden

Sheet 9 Submission on Thursday, 12.7.18.

N/A
N/A
Protected

Academic year: 2021

Aktie "Sheet 9 Submission on Thursday, 12.7.18. "

Copied!
2
0
0

Wird geladen.... (Jetzt Volltext ansehen)

Volltext

(1)

Scientific Computing II

Summer term 2018 Priv.-Doz. Dr. Christian Rieger

Christopher Kacwin

Sheet 9 Submission on Thursday, 12.7.18.

Programmieraufgabe 1. (moving least squares) Let Ω = [0, 1] 2 and f : Ω −→ R be given by

f(x) =

( 1 1/2 ≤ kxk 2 ≤ 1 , 0 else .

We want to approximate f with a smooth function using the moving least squares algorithm.

a) Write a routine that generates N uniformly distributed random samples {x i } N i=1 ⊂ Ω and stores them in a vector x ∈ ( R 2 ) N .

To allow fast access to the random samples based on their location, we use a binning procedure:

b) Write a routine that takes x ∈ ( R 2 ) N and M ∈ N as input and produces a set of M 2 vectors y ij ∈ ( R 2 ) n

ij

, i, j = 1, . . . , M satisfying (thinking of x, y ij as sets)

– P M

i,j=1 n ij = N – S M

i,j=1 y ij = x

– y ij ⊂ Ω ij = [ i−1 M , M i ] × [ j−1 M , M j ] for i, j = 1, . . . , M As a weight function, we use

θ(d) =

( (1 − dM ) 4 (4dM + 1) d ≤ 1/M ,

0 else .

Therefore the minimization of

N

X

i=1

θ(kz − x i )k)|f (x i ) − p(x i )| 2

over a given polynomial space can be performed on the 3x3 Bin-patch surrounding z.

c) Write a routine that takes z ∈ Ω, M ∈ N, {y ij } M i,j=1 and p ∈ N and returns the MLS-approximation of f (z) with order p (we take monomial basis functions P qr (z) = z q 1 z 2 r , q + r ≤ p). This includes the following steps:

– Find i, j such that z ∈ Ω ij , and assemble the points Z = S

k,l∈{−1,0,1} y i+k,j+l = {z a } m a=1

– assemble the Vandermonde matrix V ∈ R m×(p+1)(p+2)/2 , V a,qr = P qr (z a ) for a = 1, . . . , m, q + r ≤ p

1

(2)

– assemble the weight matrix W ∈ R m×m , W ab = δ ab θ(kz − z a k) for a, b = 1, . . . , m

– Solve the linear system

V > W F = V > W V b

with F ∈ R m , F a = f (z a ) for a = 1, . . . , m. Do this with an iterati- ve solver (e.g. CG-method or Jacobi method) and with the starting point b 0 = (1/2, 0, . . . , 0) >

– return the MLS approximation f (z) ≈ P

q+r≤p b qr P qr (z)

d) Test your implementation for N ∈ {10, 100, 1000, 10000}, M = bN 1/3 c, p = 3 and plot your solution using an equidistant rectangular sampling grid of size 201 × 201.

(20 points) The programming exercise should be handed in either before/after the exercise class on 12.7.18 (bring your own laptop!) or in the HRZ-CIP-Pool, after making an appoint- ment at ’angelina.steffens@uni-bonn.de’. All group members need to attend the pre- sentation of your solution. Closing date for the programming exercise is the 12.7.2018.

You can choose the programming language yourself.

2

Referenzen

ÄHNLICHE DOKUMENTE

The analogue of h-refinement from finite elements for B-Splines (and B-Spline curves and surfaces and volumes) is knot insertion. a) Write a function using the described algorithm

Furthermore assume the corresponding value function as continuous in Ω.. assume the extrema to be a

Wissenschaftliches Rechnen II/Scientific Computing II.. Sommersemester

Give an alternative proof of Lemma 46 based on the representer

(Worst-case integration error in kernel spaces). Consider the same setting as

In the file src/main/Main.java the application will try to connect to a database and then it will attempt to create a MovieExplorer object with the obtained Connection..

Also, you are re- quired to comment sections of your program code (using Java comments) so that it is easy to un- derstand by others (in particular by your tutor).. If your code