TMA4329 Intro til vitensk. beregn. V2017

Like dokumenter
Mathematics 114Q Integration Practice Problems SOLUTIONS. = 1 8 (x2 +5x) 8 + C. [u = x 2 +5x] = 1 11 (3 x)11 + C. [u =3 x] = 2 (7x + 9)3/2

Neural Network. Sensors Sorter

MA2501 Numerical methods

Universitetet i Bergen Det matematisk-naturvitenskapelige fakultet Eksamen i emnet Mat131 - Differensiallikningar I Onsdag 25. mai 2016, kl.

Eksamensoppgave i TMA4320 Introduksjon til vitenskapelige beregninger

UNIVERSITETET I OSLO

Eksamensoppgave i TMA4320 Introduksjon til vitenskapelige beregninger

Trigonometric Substitution

Unit Relational Algebra 1 1. Relational Algebra 1. Unit 3.3

Slope-Intercept Formula

Graphs similar to strongly regular graphs

IN2010: Algoritmer og Datastrukturer Series 2

SVM and Complementary Slackness

Moving Objects. We need to move our objects in 3D space.

Han Ola of Han Per: A Norwegian-American Comic Strip/En Norsk-amerikansk tegneserie (Skrifter. Serie B, LXIX)

Elementære eliminasjonsmatriser

Databases 1. Extended Relational Algebra

TMA4240 Statistikk 2014

TFY4170 Fysikk 2 Justin Wells

UNIVERSITETET I OSLO ØKONOMISK INSTITUTT

UNIVERSITETET I OSLO

Endelig ikke-røyker for Kvinner! (Norwegian Edition)

Du må håndtere disse hendelsene ved å implementere funksjonene init(), changeh(), changev() og escape(), som beskrevet nedenfor.

Start MATLAB. Start NUnet Applications Statistical and Computational packages MATLAB Release 13 MATLAB 6.5

Norsk (English below): Guide til anbefalt måte å printe gjennom plotter (Akropolis)

5 E Lesson: Solving Monohybrid Punnett Squares with Coding

Trådløsnett med. Wireless network. MacOSX 10.5 Leopard. with MacOSX 10.5 Leopard

Dynamic Programming Longest Common Subsequence. Class 27

UNIVERSITETET I OSLO ØKONOMISK INSTITUTT

FYSMEK1110 Eksamensverksted 23. Mai :15-18:00 Oppgave 1 (maks. 45 minutt)

Level Set methods. Sandra Allaart-Bruin. Level Set methods p.1/24

UNIVERSITETET I OSLO ØKONOMISK INSTITUTT

Lineære likningssystemer

Little Mountain Housing

Hvor mye teoretisk kunnskap har du tilegnet deg på dette emnet? (1 = ingen, 5 = mye)

UNIVERSITETET I OSLO

Newtons fargeskive. Regnbuens farger blir til hvitt. Sett skiva i rask rotasjon ved hjelp av sveiva.

Gradient. Masahiro Yamamoto. last update on February 29, 2012 (1) (2) (3) (4) (5)

UNIVERSITY OF OSLO DEPARTMENT OF ECONOMICS

Hvordan føre reiseregninger i Unit4 Business World Forfatter:

Start Here USB *CC * *CC * USB USB

GEF2200 Atmosfærefysikk 2017

Eksamensoppgave i TMA4135 Matematikk 4D

Ringvorlesung Biophysik 2016

IN 211 Programmeringsspråk. Dokumentasjon. Hvorfor skrive dokumentasjon? For hvem? «Lesbar programmering» Ark 1 av 11

Hvordan 3 konsulenter tester et konserndatavarehus

KROPPEN LEDER STRØM. Sett en finger på hvert av kontaktpunktene på modellen. Da får du et lydsignal.

UNIVERSITETET I OSLO ØKONOMISK INSTITUTT

Information search for the research protocol in IIC/IID

Den som gjør godt, er av Gud (Multilingual Edition)

Stationary Phase Monte Carlo Methods

Emneevaluering GEOV272 V17

Physical origin of the Gouy phase shift by Simin Feng, Herbert G. Winful Opt. Lett. 26, (2001)

SERVICE BULLETINE

Bestille trykk av doktoravhandling Ordering printing of PhD Thesis

INF2820 Datalingvistikk V2011. Jan Tore Lønning & Stephan Oepen

2018 ANNUAL SPONSORSHIP OPPORTUNITIES

0:7 0:2 0:1 0:3 0:5 0:2 0:1 0:4 0:5 P = 0:56 0:28 0:16 0:38 0:39 0:23

TMA4240 Statistikk Høst 2013

Maple Basics. K. Cooper

UNIVERSITETET I OSLO ØKONOMISK INSTITUTT

UNIVERSITETET I OSLO ØKONOMISK INSTITUTT

GEO231 Teorier om migrasjon og utvikling

C13 Kokstad. Svar på spørsmål til kvalifikasjonsfasen. Answers to question in the pre-qualification phase For English: See page 4 and forward

HONSEL process monitoring

UNIVERSITETET I OSLO ØKONOMISK INSTITUTT

CSR Harvesting Final Meeting September, 2015 Brest, France. Anne Che-Bohnenstengel & Matthias Pramme, BSH

Numerical Simulation of Shock Waves and Nonlinear PDE

Exercise 1: Phase Splitter DC Operation

Second Order ODE's (2P) Young Won Lim 7/1/14

Solutions #12 ( M. y 3 + cos(x) ) dx + ( sin(y) + z 2) dy + xdz = 3π 4. The surface M is parametrized by σ : [0, 1] [0, 2π] R 3 with.

TMA4122/TMA4130 Matematikk 4M/4N Høsten 2010

Stjerner og galakser Nybegynner Python PDF

BYFE/EMFE 1000, 2012/2013. Numerikkoppgaver uke 33

Generalization of age-structured models in theory and practice

Øving 5 - Fouriertransform - LF

PATIENCE TÅLMODIGHET. Is the ability to wait for something. Det trenger vi når vi må vente på noe

3/1/2011. I dag. Recursive descent parser. Problem for RD-parser: Top Down Space. Jan Tore Lønning & Stephan Oepen

Matematikk Øvingsoppgaver i numerikk leksjon 1. Løsningsforslag

Elektronisk innlevering/electronic solution for submission:

JDBC. Java Data Base Connec.vity

TEKSTER PH.D.-VEILEDERE FREMDRIFTSRAPPORTERING DISTRIBUSJONS-E-POST TIL ALLE AKTUELLE VEILEDERE:

Dagens tema: Eksempel Klisjéer (mønstre) Tommelfingerregler

UNIVERSITETET I OSLO ØKONOMISK INSTITUTT

Løsning til deleksamen 2 i SEKY3322 Kybernetikk 3

Speed Racer Theme. Theme Music: Cartoon: Charles Schultz / Jef Mallett Peanuts / Frazz. September 9, 2011 Physics 131 Prof. E. F.

Bildebehandling med Python og EzGraphics

Mannen min heter Ingar. Han er også lege. Han er privatpraktiserende lege og har et kontor på Grünerløkka sammen med en kollega.

EKSAMENSOPPGAVE I BI2034 Samfunnsøkologi EXAMINATION IN: BI Community ecology

Splitting the differential Riccati equation

klassisk angoragenser classic angora sweater

BIBSYS Brukermøte 2011 Live Rasmussen og Andreas Christensen. Alt på et brett? -om pensum på ipad og lesebrett

REMOVE CONTENTS FROM BOX. VERIFY ALL PARTS ARE PRESENT READ INSTRUCTIONS CAREFULLY BEFORE STARTING INSTALLATION

Utvikling av skills for å møte fremtidens behov. Janicke Rasmussen, PhD Dean Master Tel

MØTEPROTOKOLL. Internasjonalt Utvalg. Dato: kl. 9:00 Sted: Skype Arkivsak: 15/01544

Eksamensoppgave i PSY3100 Forskningsmetode - Kvantitativ

TDT4102 Prosedyre og Objektorientert programmering Vår 2014

Last ned The baby guest book : for barn som tåler å høre sannheten. Last ned

STØTTEMATERIALE TIL FORELESNINGENE OM SKATT

TEKSTER PH.D.-KANDIDATER FREMDRIFTSRAPPORTERING

Transkript:

Norges teknisk naturvitenskapelige universitet Institutt for Matematiske Fag TMA439 Intro til vitensk. beregn. V17 ving 4 [S]T. Sauer, Numerical Analysis, Second International Edition, Pearson, 14 Teorioppgaver 1 Prøv å kjøre LU faktorisering manuelt på så mange små matriser som dere kan - f.eks. oppgavene..1..5. Solution,.. (a) A 4 3 I will perform LU in place and denote the elements of L using green color, finalized elements of U using blue color. First we go through column(1) and eliminate non-zero subdiagonal elements: Subtract 1 row(1) from row(): A 1 3 Subtract 1/ row(1) from row(3): A 1 1/ 1 3 We know move on to column(). Subtract 1/ row() from row(3) [only black elements need to be modified] A 1 1/ 1/ or 1 L 1 1, U. 1/ 1/ 1 We can check the factorization numerically: 16. februar 17 Side 1 av 6

>>> A np.array([[4,,],[4,4,],[,,3]],dtype f8 ) >>> L np.array([[1,,],[1,1,],[1/.,1/.,1]],dtype f8 ) >>> U np.array([[4,,],[,,],[,,]],dtype f8 ) >>> np.matmul(l,u)-a array([[.,.,.], [.,.,.], [.,.,.]]) En annen type av oppgaver er å arbeide med vurdering av kompleksiteten i LU - f.eks. oppgavene..6..9. Solution,..9: antakelsen her at å løse k 1 systemer etter å have beregnet LUfaktoriseringen koster samme tid som å beregne LU faktorisering, og målet er å finne n. Da kan vi skrive 3 n3 kn, (se seksjon..3 i boken) eller n 3k 3. 3 Oppgave.3.1. Svaret kan sjekkes vha numpy.linalg.norm(a,numpy.inf) 4 Oppgave.3.. Svaret kan sjekkes vha numpy.linalg.cond(a,numpy.inf) Solution,.3. (b) A ( ) 1.1 3 6 A max{1 +.1, 3 + 6 } 9. ( ) ( ) A 1 1 6.1 1 6.1 det(a) 3 1 1 6 ( 3) (.1) 3 1 ( ) 67 1 33 1 3 A 1 max{ + 67, 1 + 33 1 3 } 67. 1.3 Therefore κ (A) 9 67 43. Note that because the rows of A are almost linearly dependent, even though A itself is small, the norm of A 1 is quite sizeable resulting in a relatively large condition number. ( 6 ).1 3 1 5 Oppgave.3.5,.3.6 Solution,.3.6 (a) Backward error is: Ax b [ 1 + 6 3, ( 1) + 4.1 6 6.1] [ 1, 1.95] 1.95 16. februar 17 Side av 6

and therefore the relative backward error is Ax b b 1.95 6.1.3446. In order to compute the forward error we need to know the solution to our system, which is x a [1, 1]. the relative forward error is: x x a x a [ 11, 5] [1, 1] 11 1 11. (e): We compute the inverse of A first: A 1 1 1 4.1 ( ) 4.1 1 ( 41 ) 1 Therefore κ (A) A A 1 6.1 61 361.1. 6 Prøv å kjøre LU faktorisering med pivotering manuelt på så mange små matriser som dere kan - f.eks. oppgavene.4.1.4.4. Solution,.4. (c) 1 3 1 A P 1 1 3 1 I will perform LU in place and denote the elements of L using green color, finalized elements of U using blue color. First we go through column(1). The largest element is in row (). We exchange rows 1 and in A and P : 1 A 1 3 P 1 1 3 1 Subtract 1/ row(1) from row(): Subtract 1/ row(1) from row(3): 1 A 1/ 4 P 1 1 3 1 1 A 1/ 4 P 1 1/ 1 16. februar 17 Side 3 av 6

We move on to column (). Since >, we exchange rows () and (3): 4 1 A 1/ P 1 1/ 4 1 Because element in position (3,) is, there is nothing left to eliminate, and the final answer is: 4 1 A 1/ P 1 1/ 4 1 We verify our computations: >>> import numpy as np >>> import scipy.linalg as la >>> Anp.array([[1,,-3],[,4,],[-1,,3]],dtype f8 ) >>> [P,L,U]la.lu(A) >>> print(p.t) [[. 1..] [.. 1.] [ 1...]] >>> print(l) [[ 1... ] [-.5 1.. ] [.5. 1. ]] >>> print(u) [[. 4..] [.. 4.] [.. -4.]] 7 Oppgave.4.9,.4.1 Solution,.4.9 (a): 1 1 A 1 1 1 1 1 1 1 1 1 1 1 1 1 A 1 1 1 1 1 1 1 1 1 1 1 1 A 1 1 1 1 1 1 1 1 1 16. februar 17 Side 4 av 6

1 1 A 1 1 1 1 1 1 1 1 1 1 A 1 1 1 1 1 4 1 1 1 1 1 A 1 1 1 1 1 4 1 1 1 4 1 1 A 1 1 1 1 1 4 1 1 1 8 No row exchanges are necessary, so P I, the identity matrix. (b): We can see that all subdiagonal elements of L are 1, all diagonal elements of U are 1 (except the last one), and elements of the last column are U in i 1, i 1,..., n. Solution,.4.1 (a): Since P is just a permultation matrix, all elements of P A satisfy the inequality (P A) ij 1, i, j 1,..., n. Because of partial pivoting, each element of L satisfies L i,j 1, see a comment on p. 95 in the book. (This is clear from the algorithm, as we select the largest entry in the column (absolute value) to divide the rest of the column with.) We now look more carefully at LU-algorithm. First we possibly exchange the rows. Then, when we traverse column j, j 1,..., n 1, each element A ik, i > j, k j is updated once as A ik : A ik L ij A jk. Note that after each update we have A ik A ik + L ij A jk. Thus after eliminating the subdiagonal elements in column 1 the largest element is at most A ik 1 + 1 1. After eliminating the subdiagonal elements in column it is A ik + 1 4 etc. Finally, after eliminating the subdiagonal element in column n 1 the largest element is at most n 1. (b): The question is formulated very vaguely. One can for example scale the matrix A by dividing it with its largest element, say Aîĵ. Then the elements of the new matrix A 1 A will be bounded by 1 in absolute magnitude. We then get îĵ P A 1 îĵ A LU with U ij n 1. We can rescale the equations back to obtain the LU factorization of the original matrix: P A L(Aîĵ U). 16. februar 17 Side 5 av 6

Thus the elements in the upper triangular matrix will be bounded by Aîĵ n 1. (Note that we must include the factor Aîĵ into U and not L, since L must have 1 on the main diagonal by convention.) Computeroppgaver 8 Implementer en funksjon solve som tar en matris A og en vektor b som input og produserer en vektor x som løser systemet Ax b vha LU-faktorisering. Du kan bruke A LU fakrotisering kode lu.py fra wiki-siden; da trenger du bare å implementere back-substitusjoner. Ly b og Ux y. 9 Implementer P A LU faktorisering i Python. Du kan begynne med A LU fakrotisering kode lu.py fra wiki-siden. Tips: man kan finne posisjonen av den største element som ligger under diagonalen i kolon j som ihat j+np.argmax(np.fabs(a[j:,j])) To radene i matrisen kan bytes vha a[[ihat,j]]a[[j,ihat]] Implementasjonen kan testes mot scipy.linalg.lu. Husk at scipy beregner factoriseringen A P LU og ikke P A LU; men P P 1 P T. 1 Modificer oppgaven 8 slik at den bruker P A LU faktorisering istedenfor A LU. 11 Oppgave.3.3,.3.4; brug funksjonen fra oppgaven 1 for å løse systemet. 16. februar 17 Side 6 av 6