välkomna till numpk09 - csc.kth.se · användarhandledning för matlab på nada, matlabterminologi...
TRANSCRIPT
091027 DN1212 NUMPK09 1
Välkomna till NUMPK09:DN1212 Numeriska metoder ochgrundläggande programmering
för K2 och Bio3, 9 hp
Kurshemsidahttp://www.csc.kth.se/DN1212/numpk09/
091027 DN1212 NUMPK09 2
Beatrice Frock, [email protected](kursansvarig, numeriska metoder, Bio)Jesper Oppelstrup, [email protected](MATLAB, Bio)Eva Hansén, KRodrigo Vilela de Abreu, K
Kursbunt, 120SEK, säljs på CSC stud exp:Osquars B. 2, plan 2 - kontant snabbare än kort!Kursprogram, HederskodexEdsberg, Eriksson, Lindberg: Exempelsamling i numeriska metoderLaborationsuppgifterAnvändarhandledning för Matlab på Nada, MatlabterminologiExtentor
Kurslitteratur,säljs på kårbokhandeln1. P.Pohl: Grundkurs i Numeriska metoder (GNM) 2. S.J. Chapman: Matlab Programming for Engineers (PEng)
091027 DN1212 NUMPK09 3
Laborationer 6 obligatoriska,rapporteras i Ladok, syns i Mina sidor som
LAB1 (1 + 2), LAB2 (3), LAB3 (4 + 5), LAB4 (6, = projektet).
Grupper om 2. Redovisas för handledare i datorsal.
Terminalövningar i datorsal : handledare tillgängliga för konsultationer och redovisningar. Lab-arbete: ca. 160 tim = 5-7 tim eget arbete per vecka förutom schemalagd tid.
091027 DN1212 NUMPK09 4
BonusLaborationer som redovisas i tid ger bonus, max. 4 tp.
Tentamen – samma för alla DN1212-kurserInga hjälpmedel, 3 timmar.Två delar. Godkänd del 1 ger betyget E.Del 2 rättas endast om del 1 är godkänd: D-A.Del 1: flervalsuppgifterDel 2: problemuppgifter, Matlab-program, algoritmbeskrivning.
Ordinarie tenta: ons 17/3, kl 14–17 i D–, E–, V– och Q–salar
KursutvärderingsenkätI slutet av kursen. Synpunkter mottages tacksamt när som helst direkt till lärare, eller via e-mail.
091027 DN1212 NUMPK09 5
VECKA 44• 27/10 F1 Introduktion. MATLAB. Kap 1-2 i PEng• 27/10 Ö1 Programmering, t.ex 2.1, 2.6, 2.10,
2.16 (2.14) i PEng• 30/10 F2 Styrstrukturer, programmeringsteknik.
Kap 3–4 i PEng• 30/10,2/11 Ö2 Programmering, t.ex. 3.3, 3.7, 4.7a,
4.8a, 4.9a, 4.19 i PEngVECKA 45• 3/11 F3 Funktioner, kap 5 i PEng• 3/11 Ö3, Programmering, t.ex. 5.2, 5.9, 5.22
(5.17), 5.28 (5.24) i PEng• 4/11 TÖ1 Checka in i res. Arbete med och
redovisning av Lab 1
091027 DN1212 NUMPK09 6
It is hard to understand an ocean because it is too big.It is hard to understand a molecule because it is too small.It is hard to understand nuclear physics because it is too fast.It is hard to understand the greenhouse effect because it is too slow.
[Super] Computers break these barriers to understanding. They, ineffect, shrink oceans, zoom in on molecules, slow down physics, andfast-forward climates. Clearly a scientist who can see natural phenomenaat the right size and the right speed learns more than one who is facedwith a blur.
Vem, när?
Al Gore, 1990, “Scientific Computing” (A Convenient Truth!)
091027 DN1212 NUMPK09 7
“The purpose of computing is insight, not numbers.” (R.W.Hamming)
The Unreasonable Effectiveness ofMathematics (1980)
“There are three kinds of lies: Lies,damn’ lies, and colorful computerpictures” (P.Colella)
091027 DN1212 NUMPK09 8
Helt dominerande program för ingenjörsberäkningar, numerisk analys, visualisering,
1974 “Matrix Laboratory” C.MolerNu: MathWorks > 2200 pers.
20 årsdag 2004:MATLAB Varför MATLAB?
”Life is too short forwriting do-loops”C.Moler, 1974
091027 DN1212 NUMPK09 9
Svante Littmarck, Dr HC, KTH
• Huvudkontor Boston:150• Utveckling:Stockholm: 30
Germund Dahlquist1925-2005, KTH
Sverige
091027 DN1212 NUMPK09 10
MATLAB 1 rad:x = A\b;
Intel x86 assembler 500 rader.file "msolve.f".section .rodata.str1.1,"aMS",@progbits,1
.LC0:.string "Memory allocation failed".text
.globl msolve_.type msolve_, @function
msolve_:pushl %ebpmovl %esp, %ebppushl %edipushl %esipushl %ebxsubl $108, %espmovl 8(%ebp), %ebxmovl 12(%ebp), %eaxmovl 16(%ebp), %edxmovl 20(%ebp), %ecxmovl (%ebx), %esimovl %eax, -76(%ebp)movl %edx, -80(%ebp)movl %ecx, -84(%ebp)movl %esi, %eaxnotl %eaxsarl $31, %eaxandl %eax, %esimovl %esi, -20(%ebp)movl -20(%ebp), %eaxnotl %esimovl %esi, -56(%ebp)movl $0, -44(%ebp)sall $2, %eaxje .L4subl $12, %esppushl %eaxcall mallocaddl $16, %esptestl %eax, %eaxmovl %eax, -44(%ebp)je .L39
.L4:movl (%ebx), %edxmovl $0, -40(%ebp)movl %edx, %eax
… notl %ea
F77 50 rader subroutine msolve(n,A,b,x) implicit none integer n real*8 A(n,n),b(n),x(n) … do i=1,nc Search for pivot element col = i row = i do j=i,n do k=i,n if(abs(A(p(k),q(j))) .gt. abs(A(p(row),q(col)))) then row = k col = j endif enddo enddoc Swap diagonal element with found pivot k = p(i) …end
091027 DN1212 NUMPK09 11
MATLAB:(s = 3;)…s = s + 2;
PowerPC Assembler…LD r14,[s]ADDI r14,r14,2ST [s] r14…
Minnesplats för s(”symbolisk adress”)Fysisk adress: 102679
… 0 0 … …
Nr. 102679r14
… r13
r15…3
5
Minne
CPU-register