Numerisches Praktikum (UKNum)
Transcript of Numerisches Praktikum (UKNum)
![Page 1: Numerisches Praktikum (UKNum)](https://reader034.fdocuments.net/reader034/viewer/2022051715/588c6db91a28aba5218b8119/html5/thumbnails/1.jpg)
Numerisches Praktikum(UKNum)
Hubert KlahrChristoph MordasiniMax-Planck-Institut für Astronomie
unterstützt von
http://www.mpia-hd.mpg.de/~mordasini/UKNUM.html
![Page 2: Numerisches Praktikum (UKNum)](https://reader034.fdocuments.net/reader034/viewer/2022051715/588c6db91a28aba5218b8119/html5/thumbnails/2.jpg)
Numerisches Praktikumgeplanter Ablauf
• Lecture 1: Introduction, number representation in a computer• Lecture 2: Interpolation, Extrapolation, Splines•Lecture 3: Finding roots, iterative Newton-Raphson method• Lecture 4: Solving ordinary differential equations• Lecture 5: Numerical integration• Lecture 6: Sort algorithms• Lecture 7: Systems of linear equations• Lecture 8: Statistical methods, data modeling• Lecture 9: Random numbers, Monte Carlo methods• Lecture 10: Summary and concluding remarks
![Page 3: Numerisches Praktikum (UKNum)](https://reader034.fdocuments.net/reader034/viewer/2022051715/588c6db91a28aba5218b8119/html5/thumbnails/3.jpg)
Numerisches Praktikumgeplanter Tagesablauf
Lösungen und Programme bitte an
senden
![Page 4: Numerisches Praktikum (UKNum)](https://reader034.fdocuments.net/reader034/viewer/2022051715/588c6db91a28aba5218b8119/html5/thumbnails/4.jpg)
You can work on the exercises during the tutorial time in presence of lecturers. In the afternoonyou can continue and complete the assigned exercise work. Please write down the results, documentthe important bits of the code in proper form (tables, lists, etc). Do not print out theentire code. The results can be handed in until the following morning 9:15 a.m. by e-mail to
![Page 5: Numerisches Praktikum (UKNum)](https://reader034.fdocuments.net/reader034/viewer/2022051715/588c6db91a28aba5218b8119/html5/thumbnails/5.jpg)
Criteron for Certificate60 % of maximum number of points, and presentation of results at least once.
Contact:Hubert Klahr: [email protected] (Tel. 528-255)Christoph Mordasini: [email protected] (Tel. 528-449)
![Page 6: Numerisches Praktikum (UKNum)](https://reader034.fdocuments.net/reader034/viewer/2022051715/588c6db91a28aba5218b8119/html5/thumbnails/6.jpg)
UKNum
Geschichte
John von Neumann (1903-1957)Geb. Budapest, Dozent Berlin, seit 1930 Univ. PrincetonForderungen an den Aufbau einer elektrischen Rechenanlage (1946)
![Page 7: Numerisches Praktikum (UKNum)](https://reader034.fdocuments.net/reader034/viewer/2022051715/588c6db91a28aba5218b8119/html5/thumbnails/7.jpg)
UKNum
Geschichte
Konrad Zuse (1910-1995) Berlin
Z1 in der elterlichen Wohnung 1936
Erfinder des frei programmierbaren Rechners
![Page 8: Numerisches Praktikum (UKNum)](https://reader034.fdocuments.net/reader034/viewer/2022051715/588c6db91a28aba5218b8119/html5/thumbnails/8.jpg)
UKNum
Geschichte
Zuse Z4: 1944 Berlin, 1950 Zürich 1954 Frankreich 1959 Deutsches Museum München
Rechenanlage 0.03 MHzSpeicher 256 byte
0.03 Mflopshttp://www.rtd-net.de/Zuse.html
![Page 9: Numerisches Praktikum (UKNum)](https://reader034.fdocuments.net/reader034/viewer/2022051715/588c6db91a28aba5218b8119/html5/thumbnails/9.jpg)
UKNum
Geschichte
Grundprinzipien des elektronischen. Rechners
Verwirklicht von Zuse, Theorie von Neumann
Freie ProgrammierbarkeitBinäres ZahlenformatSpeicherGleitkommaarithmetik
![Page 10: Numerisches Praktikum (UKNum)](https://reader034.fdocuments.net/reader034/viewer/2022051715/588c6db91a28aba5218b8119/html5/thumbnails/10.jpg)
UKNum
Geschichte
Seymour Cray (1925-1996)!``The father of supercomputing´´
CRAY1: Vektorregister (1976) 160 Mflop, 80 MHz, 8 MByte RAMCRAY2: (1984)1Gflop, 120MHz, 2GByte RAM
![Page 11: Numerisches Praktikum (UKNum)](https://reader034.fdocuments.net/reader034/viewer/2022051715/588c6db91a28aba5218b8119/html5/thumbnails/11.jpg)
UKNum
Geschichte
Wem nutzt es?
Auto, Luft- und RaumfahrtMeteorologie, Klimaforschung, WetterTheoretische ElementarteilchenphysikAstrophysik
Hitachi SR8000 LRZ München6 Tflops, TByte Speicher HLRS Stuttgart
NIC Jülich
![Page 12: Numerisches Praktikum (UKNum)](https://reader034.fdocuments.net/reader034/viewer/2022051715/588c6db91a28aba5218b8119/html5/thumbnails/12.jpg)
UKNum
SuperrechnerJUGENEIBM Blue GeneAm FZ Jülich
Eröffnet mit J. Rüttgers Juni 2008
Computer
![Page 13: Numerisches Praktikum (UKNum)](https://reader034.fdocuments.net/reader034/viewer/2022051715/588c6db91a28aba5218b8119/html5/thumbnails/13.jpg)
UKNum
2007…GeForce 8800 GTX, 128 Stream Proc., 768 MBGeForce 8800 GTS, 128 Stream Proc., 512 MBGeForce 8800 GT, 112 Stream Proc., 512 MB
2008…GeForce 9800 GTX, 128 Stream Proc., 512 MBGeForce 9800 GX2, 256 Stream Proc., 1 GBGeForce 9800 GT, 64 Stream Proc., 512 MB
Grafikkarten (GPU) als Superprozessoren http://www.nvidia.com
Computer
![Page 14: Numerisches Praktikum (UKNum)](https://reader034.fdocuments.net/reader034/viewer/2022051715/588c6db91a28aba5218b8119/html5/thumbnails/14.jpg)
http://numericalmethods.eng.usf.edu 14
Introduction to Scientific Computing
Major: All Engineering Majors
Authors: Autar Kaw, Luke Snyder
http://numericalmethods.eng.usf.eduNumerical Methods for STEM undergraduates
![Page 15: Numerisches Praktikum (UKNum)](https://reader034.fdocuments.net/reader034/viewer/2022051715/588c6db91a28aba5218b8119/html5/thumbnails/15.jpg)
http://numericalmethods.eng.usf.edu15
How do we solve an engineering problem?
Problem Description
Mathematical
Model
Solution of Mathematical Model
Using the
Solution
![Page 16: Numerisches Praktikum (UKNum)](https://reader034.fdocuments.net/reader034/viewer/2022051715/588c6db91a28aba5218b8119/html5/thumbnails/16.jpg)
http://numericalmethods.eng.usf.edu16
Mathematical Procedures" Nonlinear Equations" Differentiation" Simultaneous Linear Equations" Curve Fitting
• Interpolation• Regression
" Integration" Ordinary Differential Equations" Other Advanced Mathematical Procedures:
• Partial Differential Equations• Optimization• Fast Fourier Transform
![Page 17: Numerisches Praktikum (UKNum)](https://reader034.fdocuments.net/reader034/viewer/2022051715/588c6db91a28aba5218b8119/html5/thumbnails/17.jpg)
http://numericalmethods.eng.usf.edu17
Nonlinear EquationsFloating Ball Problem
Root of equation,
![Page 18: Numerisches Praktikum (UKNum)](https://reader034.fdocuments.net/reader034/viewer/2022051715/588c6db91a28aba5218b8119/html5/thumbnails/18.jpg)
http://numericalmethods.eng.usf.edu18
DifferentiationVelocity vs. time rocket problem
What is the acceleration at t=10 seconds?
![Page 19: Numerisches Praktikum (UKNum)](https://reader034.fdocuments.net/reader034/viewer/2022051715/588c6db91a28aba5218b8119/html5/thumbnails/19.jpg)
http://numericalmethods.eng.usf.edu19
Simultaneous Linear EquationsFind the velocity profile from
Time,t Velocity,v
s m/s
5 106.8
8 177.2
12 279.2
Three simultaneous linear equations:
![Page 20: Numerisches Praktikum (UKNum)](https://reader034.fdocuments.net/reader034/viewer/2022051715/588c6db91a28aba5218b8119/html5/thumbnails/20.jpg)
http://numericalmethods.eng.usf.edu20
Interpolation
Time,t Velocity,v
s m/s
5 106.8
8 177.2
12 279.2
What is the velocity of the rocket at t=10 seconds?
![Page 21: Numerisches Praktikum (UKNum)](https://reader034.fdocuments.net/reader034/viewer/2022051715/588c6db91a28aba5218b8119/html5/thumbnails/21.jpg)
http://numericalmethods.eng.usf.edu21
IntegrationFinding the contraction in a metal construction part.
![Page 22: Numerisches Praktikum (UKNum)](https://reader034.fdocuments.net/reader034/viewer/2022051715/588c6db91a28aba5218b8119/html5/thumbnails/22.jpg)
Ex: magnetohydrodynmical equations
Ideal MHD + self-gravity + ideal gas + heating & cooling
![Page 23: Numerisches Praktikum (UKNum)](https://reader034.fdocuments.net/reader034/viewer/2022051715/588c6db91a28aba5218b8119/html5/thumbnails/23.jpg)
Ex: magnetohydrodynmical equations
![Page 24: Numerisches Praktikum (UKNum)](https://reader034.fdocuments.net/reader034/viewer/2022051715/588c6db91a28aba5218b8119/html5/thumbnails/24.jpg)
with random component: Bx = 3µG + δb = 3µG
Ex: magnetohydrodynmical equations
![Page 25: Numerisches Praktikum (UKNum)](https://reader034.fdocuments.net/reader034/viewer/2022051715/588c6db91a28aba5218b8119/html5/thumbnails/25.jpg)
12/13/2009 Hubert Klahr - Planet Formation - MPIA Heidelberg
25
Garching, Feb 1st, 2011
The nature and role of Turbulence in Planet Formation: Magnetorotational and Baroclinic Instability.Hubert Klahr, Max-Planck-Institut für Astronomie, HeidelbergWlad Lyra (AMNH), Peter Bodenheimer (Santa Cruz), Anders Johansen (Lund), Natalia Raettig, Helen Morrison, Mario Flock, Natalia Dzyurkevich, Karsten Dittrich, Til Birnstiel, Kees Dullemond, Chris Ormel (MPIA), Neal Turner (JPL), Jeffrey S. Oishi (Berkley), Mordecai-Mark Mac Low (AMNH), Andrew Youdin (CITA), Doug Lin (Santa Cruz)
Johansen and Klahr: High resolution simulations of planetesimal formation 7
t=35.0
0 100 200 300 400 5000
100
200
300
400
500t=35.7
0 100 200 300 400 5000
100
200
300
400
500
t=36.1
0 100 200 300 400 5000
100
200
300
400
500t=36.2
0 100 200 300 400 5000
100
200
300
400
500
t=36.3
0 100 200 300 400 5000
100
200
300
400
500t=36.5
0 100 200 300 400 5000
100
200
300
400
500
Fig. 6. The particle column density as a function of time after self-gravity is turned on after t = 35.0Torb. The insert shows an enlargement of theregion around the point of highest column density.
![Page 26: Numerisches Praktikum (UKNum)](https://reader034.fdocuments.net/reader034/viewer/2022051715/588c6db91a28aba5218b8119/html5/thumbnails/26.jpg)
12/13/2009 Hubert Klahr - Planet Formation - MPIA Heidelberg
“Birth places of Planets:”Gas and dust disks around young stars
![Page 27: Numerisches Praktikum (UKNum)](https://reader034.fdocuments.net/reader034/viewer/2022051715/588c6db91a28aba5218b8119/html5/thumbnails/27.jpg)
12/13/2009 Hubert Klahr - Planet Formation - MPIA Heidelberg
t = 107
t = 0
... a miracle occurs...
![Page 28: Numerisches Praktikum (UKNum)](https://reader034.fdocuments.net/reader034/viewer/2022051715/588c6db91a28aba5218b8119/html5/thumbnails/28.jpg)
12/13/2009 Hubert Klahr - Planet Formation - MPIA Heidelberg
28
t = 103-104 yrs t = 105 yrs
t = 105-106 yrst = 105-106 yrs t = 106-107 yrs
a. Turbulent disk b. Hit and stick c. Gravotubulent fragmentation
d. Gravitational focusing e. Gas accretion f. Migration and scattering
The planetary construction plant.
![Page 29: Numerisches Praktikum (UKNum)](https://reader034.fdocuments.net/reader034/viewer/2022051715/588c6db91a28aba5218b8119/html5/thumbnails/29.jpg)
12/13/2009 Hubert Klahr - Planet Formation - MPIA Heidelberg
29
Synthetic Populations...
...to explore the importance of metallicity, stellar mass, etc...
...and to test the individual modeling steps of planet formation by comp. To observations.
![Page 30: Numerisches Praktikum (UKNum)](https://reader034.fdocuments.net/reader034/viewer/2022051715/588c6db91a28aba5218b8119/html5/thumbnails/30.jpg)
12/13/2009 Hubert Klahr - Planet Formation - MPIA Heidelberg
10 cm sized boulders:
V ertic a l
h o r i z o n t a lJohansen, Henning & Klahr 2006
![Page 31: Numerisches Praktikum (UKNum)](https://reader034.fdocuments.net/reader034/viewer/2022051715/588c6db91a28aba5218b8119/html5/thumbnails/31.jpg)
12/13/2009 Hubert Klahr - Planet Formation - MPIA Heidelberg
31
Magneto Rotational Instability (MRI) drives turbulence in accretion disks
Simulation by Mario Flock using the Pluto code.
![Page 32: Numerisches Praktikum (UKNum)](https://reader034.fdocuments.net/reader034/viewer/2022051715/588c6db91a28aba5218b8119/html5/thumbnails/32.jpg)
12/13/2009 Hubert Klahr - Planet Formation - MPIA Heidelberg
384x192x768
32
Global 360 stratified!At 20 grid cells per H!1.8 Million CPU hours
Pluto Code: HLLDUpwind CT, piecewise linear reconstruction,
Runge Kutta 2nd order
![Page 33: Numerisches Praktikum (UKNum)](https://reader034.fdocuments.net/reader034/viewer/2022051715/588c6db91a28aba5218b8119/html5/thumbnails/33.jpg)
12/13/2009 Hubert Klahr - Planet Formation - MPIA Heidelberg
33
Disk:
Box:
…because it is a reliable source for turbulence.
![Page 34: Numerisches Praktikum (UKNum)](https://reader034.fdocuments.net/reader034/viewer/2022051715/588c6db91a28aba5218b8119/html5/thumbnails/34.jpg)
12/13/2009 Hubert Klahr - Planet Formation - MPIA Heidelberg
34
Development of MHD Turbulence
From initial perturbation to saturation of the turbulence
Colors: gas densityyellow = highblue " = low
Standard magneto rotational instability simulation ala Balbus and Hawley
![Page 35: Numerisches Praktikum (UKNum)](https://reader034.fdocuments.net/reader034/viewer/2022051715/588c6db91a28aba5218b8119/html5/thumbnails/35.jpg)
12/13/2009 Hubert Klahr - Planet Formation - MPIA Heidelberg
35
2,000,000 boulders of 1m
Johansen, Klahr and Henning, 2006
![Page 36: Numerisches Praktikum (UKNum)](https://reader034.fdocuments.net/reader034/viewer/2022051715/588c6db91a28aba5218b8119/html5/thumbnails/36.jpg)
12/13/2009 Hubert Klahr - Planet Formation - MPIA Heidelberg
gas
dust
MRI plus self-gravity for the dust, including particle feed back on the gas: collaboration with Mac Low & Oichi AMNH
Poisson equation solved via FFT in parallel mode: up to 2563 cells
Pia 256 + 8 Opteron processor clusterNext: Theo 1008 Cores
![Page 37: Numerisches Praktikum (UKNum)](https://reader034.fdocuments.net/reader034/viewer/2022051715/588c6db91a28aba5218b8119/html5/thumbnails/37.jpg)
12/13/2009 Hubert Klahr - Planet Formation - MPIA Heidelberg
Streaming instability for radial drift:
vertical
r a d i a l
This is what laminar radial drift actually looks like!
![Page 38: Numerisches Praktikum (UKNum)](https://reader034.fdocuments.net/reader034/viewer/2022051715/588c6db91a28aba5218b8119/html5/thumbnails/38.jpg)
12/13/2009 Hubert Klahr - Planet Formation - MPIA Heidelberg
Johansen, Oichi, MacLow, Klahr, Henning & Youdin, 2007, nature
http://www.mpia.de/homes/johansen/research_en.php
![Page 39: Numerisches Praktikum (UKNum)](https://reader034.fdocuments.net/reader034/viewer/2022051715/588c6db91a28aba5218b8119/html5/thumbnails/39.jpg)
From 2563 to 5123 and 10243 simulations. Question: Does the mass of the Planetesimals converege? Higher resolution allows for higher density concentration
and thus the formation of a wider mass scale.
Changes in Pencil to allow for runs on 4096 cores
![Page 40: Numerisches Praktikum (UKNum)](https://reader034.fdocuments.net/reader034/viewer/2022051715/588c6db91a28aba5218b8119/html5/thumbnails/40.jpg)
At 5123 and the usual set up: As before mass of planetesimals depends on the available mass.
new: Intermediate Formation of Binaries;Also: confirmation of prograde rotation!
Johansen and Klahr: High resolution simulations of planetesimal formation 7
t=35.0
0 100 200 300 400 5000
100
200
300
400
500t=35.7
0 100 200 300 400 5000
100
200
300
400
500
t=36.1
0 100 200 300 400 5000
100
200
300
400
500t=36.2
0 100 200 300 400 5000
100
200
300
400
500
t=36.3
0 100 200 300 400 5000
100
200
300
400
500t=36.5
0 100 200 300 400 5000
100
200
300
400
500
Fig. 6. The particle column density as a function of time after self-gravity is turned on after t = 35.0Torb. The insert shows an enlargement of theregion around the point of highest column density.
![Page 41: Numerisches Praktikum (UKNum)](https://reader034.fdocuments.net/reader034/viewer/2022051715/588c6db91a28aba5218b8119/html5/thumbnails/41.jpg)
41
![Page 42: Numerisches Praktikum (UKNum)](https://reader034.fdocuments.net/reader034/viewer/2022051715/588c6db91a28aba5218b8119/html5/thumbnails/42.jpg)
12/13/2009 Hubert Klahr - Planet Formation - MPIA Heidelberg
42
Vorticityaz
imut
hal
radial
![Page 43: Numerisches Praktikum (UKNum)](https://reader034.fdocuments.net/reader034/viewer/2022051715/588c6db91a28aba5218b8119/html5/thumbnails/43.jpg)
02/05/10 http://numericalmethods.eng.usf.edu 1
Binary Representation
Major: All Engineering Majors
Authors: Autar Kaw, Matthew Emmons
http://numericalmethods.eng.usf.eduNumerical Methods for STEM undergraduates
![Page 44: Numerisches Praktikum (UKNum)](https://reader034.fdocuments.net/reader034/viewer/2022051715/588c6db91a28aba5218b8119/html5/thumbnails/44.jpg)
http://numericalmethods.eng.usf.edu2
How a Decimal Number is Represented
![Page 45: Numerisches Praktikum (UKNum)](https://reader034.fdocuments.net/reader034/viewer/2022051715/588c6db91a28aba5218b8119/html5/thumbnails/45.jpg)
http://numericalmethods.eng.usf.edu3
Base 2
![Page 46: Numerisches Praktikum (UKNum)](https://reader034.fdocuments.net/reader034/viewer/2022051715/588c6db91a28aba5218b8119/html5/thumbnails/46.jpg)
http://numericalmethods.eng.usf.edu4
Convert Base 10 Integer to binary representation
Table 1 Converting a base-10 integer to binary representation.
Quotient Remainder
11/2 5
5/2 2
2/2 1
1/2 0
Hence
![Page 47: Numerisches Praktikum (UKNum)](https://reader034.fdocuments.net/reader034/viewer/2022051715/588c6db91a28aba5218b8119/html5/thumbnails/47.jpg)
http://numericalmethods.eng.usf.edu5
Start
I n p u t (N)10
i = 0
Divide N by 2 to get quotient Q & remainder R
ai = R
Is Q = 0?
n = i(N)10 = (an. . .a0)2
STOP
Integer N to be converted to binary
format
i=i+1,N=Q
No
Yes
![Page 48: Numerisches Praktikum (UKNum)](https://reader034.fdocuments.net/reader034/viewer/2022051715/588c6db91a28aba5218b8119/html5/thumbnails/48.jpg)
http://numericalmethods.eng.usf.edu6
Fractional Decimal Number to Binary
Number Number afterdecimal
Number beforedecimal
0.375 0.3750.75 0.751.5 0.51.0 0.0
Table 2. Converting a base-10 fraction to binary representation.
Hence
![Page 49: Numerisches Praktikum (UKNum)](https://reader034.fdocuments.net/reader034/viewer/2022051715/588c6db91a28aba5218b8119/html5/thumbnails/49.jpg)
http://numericalmethods.eng.usf.edu7
Start
Input (F)10
Multiply F by 2 to get number before decimal, S and after decimal, T
ai = R
Is T =0?
n = i(F)10 = (a-1. . .a-n)2
STOP
F r a c t i o n F t o b e converted to binary format
No
Yes
![Page 50: Numerisches Praktikum (UKNum)](https://reader034.fdocuments.net/reader034/viewer/2022051715/588c6db91a28aba5218b8119/html5/thumbnails/50.jpg)
http://numericalmethods.eng.usf.edu8
Decimal Number to Binary
and
we have
Since
![Page 51: Numerisches Praktikum (UKNum)](https://reader034.fdocuments.net/reader034/viewer/2022051715/588c6db91a28aba5218b8119/html5/thumbnails/51.jpg)
http://numericalmethods.eng.usf.edu9
All Fractional Decimal Numbers Cannot be Represented Exactly
NumberNumber
afterdecimal
Number beforeDecimal
0.6 0.61.2 0.20.4 0.40.8 0.81.6 0.6
Table 3. Converting a base-10 fraction to approximate binary representation.
![Page 52: Numerisches Praktikum (UKNum)](https://reader034.fdocuments.net/reader034/viewer/2022051715/588c6db91a28aba5218b8119/html5/thumbnails/52.jpg)
http://numericalmethods.eng.usf.edu10
Another Way to Look at Conversion
Convert to base 2
![Page 53: Numerisches Praktikum (UKNum)](https://reader034.fdocuments.net/reader034/viewer/2022051715/588c6db91a28aba5218b8119/html5/thumbnails/53.jpg)
http://numericalmethods.eng.usf.edu11
![Page 54: Numerisches Praktikum (UKNum)](https://reader034.fdocuments.net/reader034/viewer/2022051715/588c6db91a28aba5218b8119/html5/thumbnails/54.jpg)
02/05/10 http://numericalmethods.eng.usf.edu 1
Floating Point Representation
Major: All Engineering Majors
Authors: Autar Kaw, Matthew Emmons
http://numericalmethods.eng.usf.eduNumerical Methods for STEM undergraduates
![Page 55: Numerisches Praktikum (UKNum)](https://reader034.fdocuments.net/reader034/viewer/2022051715/588c6db91a28aba5218b8119/html5/thumbnails/55.jpg)
http://numericalmethods.eng.usf.edu2
Floating Decimal Point – Scientific Form
![Page 56: Numerisches Praktikum (UKNum)](https://reader034.fdocuments.net/reader034/viewer/2022051715/588c6db91a28aba5218b8119/html5/thumbnails/56.jpg)
http://numericalmethods.eng.usf.edu3
Example
The form is
or
Example: For
![Page 57: Numerisches Praktikum (UKNum)](https://reader034.fdocuments.net/reader034/viewer/2022051715/588c6db91a28aba5218b8119/html5/thumbnails/57.jpg)
http://numericalmethods.eng.usf.edu4
Floating Point Format for Binary Numbers
1 is not stored as it is always given to be 1.
![Page 58: Numerisches Praktikum (UKNum)](https://reader034.fdocuments.net/reader034/viewer/2022051715/588c6db91a28aba5218b8119/html5/thumbnails/58.jpg)
http://numericalmethods.eng.usf.edu5
Example9 bit-hypothetical word
#the first bit is used for the sign of the number, #the second bit for the sign of the exponent, #the next four bits for the mantissa, and#the next three bits for the exponent
We have the representation as
0 0 1 0 1 1 1 0 1
Sign of the number
mantissaSign of the exponent
exponent
![Page 59: Numerisches Praktikum (UKNum)](https://reader034.fdocuments.net/reader034/viewer/2022051715/588c6db91a28aba5218b8119/html5/thumbnails/59.jpg)
http://numericalmethods.eng.usf.edu6
Machine Epsilon
Defined as the measure of accuracy and found by difference between 1 and the next number that can be represented
![Page 60: Numerisches Praktikum (UKNum)](https://reader034.fdocuments.net/reader034/viewer/2022051715/588c6db91a28aba5218b8119/html5/thumbnails/60.jpg)
http://numericalmethods.eng.usf.edu7
ExampleTen bit word
#Sign of number#Sign of exponent#Next four bits for exponent#Next four bits for mantissa0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 1Nextnumber
![Page 61: Numerisches Praktikum (UKNum)](https://reader034.fdocuments.net/reader034/viewer/2022051715/588c6db91a28aba5218b8119/html5/thumbnails/61.jpg)
http://numericalmethods.eng.usf.edu8
Relative Error and Machine Epsilon
The absolute relative true error in representing a number will be less then the machine epsilon
Example
10 bit word (sign, sign of exponent, 4 for exponent, 4 for mantissa)
0 1 0 1 1 0 1 1 0 0
Sign of the number
mantissaSign of the exponent
exponent
![Page 62: Numerisches Praktikum (UKNum)](https://reader034.fdocuments.net/reader034/viewer/2022051715/588c6db91a28aba5218b8119/html5/thumbnails/62.jpg)
http://numericalmethods.eng.usf.edu9
IEEE-754 Format
32 bits for single precision
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
Sign BiasedExponent
Mantissa
![Page 63: Numerisches Praktikum (UKNum)](https://reader034.fdocuments.net/reader034/viewer/2022051715/588c6db91a28aba5218b8119/html5/thumbnails/63.jpg)
http://numericalmethods.eng.usf.edu10
Exponent for 32 Bit IEEE-7548 bits would represent
Bias is 127; so subtract 127 from representation
Actually
0 0 0 0 0 0 0 1
1 1 1 1 1 1 1 0
0 0 0 0 0 0 0 0
1 1 1 1 1 1 1 1
is -126
is 127
for number zero
for infinity, NaN, etc.
![Page 64: Numerisches Praktikum (UKNum)](https://reader034.fdocuments.net/reader034/viewer/2022051715/588c6db91a28aba5218b8119/html5/thumbnails/64.jpg)
http://numericalmethods.eng.usf.edu11
IEEE-754 FormatThe largest number by magnitude
The smallest number by magnitude
Machine epsilon
![Page 65: Numerisches Praktikum (UKNum)](https://reader034.fdocuments.net/reader034/viewer/2022051715/588c6db91a28aba5218b8119/html5/thumbnails/65.jpg)
http://numericalmethods.eng.usf.edu 65
Sources of Error
Major: All Engineering MajorsAuthors: Autar Kaw, Luke Snyder
http://numericalmethods.eng.usf.eduNumerical Methods for STEM undergraduates
![Page 66: Numerisches Praktikum (UKNum)](https://reader034.fdocuments.net/reader034/viewer/2022051715/588c6db91a28aba5218b8119/html5/thumbnails/66.jpg)
http://numericalmethods.eng.usf.edu66
Two sources of numerical error
1) Round off error2) Truncation error
![Page 67: Numerisches Praktikum (UKNum)](https://reader034.fdocuments.net/reader034/viewer/2022051715/588c6db91a28aba5218b8119/html5/thumbnails/67.jpg)
http://numericalmethods.eng.usf.edu67
Round off Error" Caused by representing a number
approximately
![Page 68: Numerisches Praktikum (UKNum)](https://reader034.fdocuments.net/reader034/viewer/2022051715/588c6db91a28aba5218b8119/html5/thumbnails/68.jpg)
http://numericalmethods.eng.usf.edu68
Problems created by round off error
" 28 Americans were killed on February 25, 1991 by an Iraqi Scud missile in Dhahran, Saudi Arabia.
" The patriot defense system failed to track and intercept the Scud. Why?
![Page 69: Numerisches Praktikum (UKNum)](https://reader034.fdocuments.net/reader034/viewer/2022051715/588c6db91a28aba5218b8119/html5/thumbnails/69.jpg)
http://numericalmethods.eng.usf.edu69
Problem with Patriot missile" Clock cycle of 1/10 seconds
was represented in 24-bit fixed point register created an error of 9.5 x 10-8 seconds.
" The battery was on for 100 consecutive hours, thus causing an inaccuracy of
![Page 70: Numerisches Praktikum (UKNum)](https://reader034.fdocuments.net/reader034/viewer/2022051715/588c6db91a28aba5218b8119/html5/thumbnails/70.jpg)
http://numericalmethods.eng.usf.edu70
Problem (cont.)" The shift calculated in the ranging
system of the missile was 687 meters." The target was considered to be out of
range at a distance greater than 137 meters.
![Page 71: Numerisches Praktikum (UKNum)](https://reader034.fdocuments.net/reader034/viewer/2022051715/588c6db91a28aba5218b8119/html5/thumbnails/71.jpg)
http://numericalmethods.eng.usf.edu71
Truncation error" Error caused by truncating or
approximating a mathematical procedure.
![Page 72: Numerisches Praktikum (UKNum)](https://reader034.fdocuments.net/reader034/viewer/2022051715/588c6db91a28aba5218b8119/html5/thumbnails/72.jpg)
http://numericalmethods.eng.usf.edu72
Example of Truncation ErrorTaking only a few terms of a Maclaurin series toapproximate
If only 3 terms are used,
![Page 73: Numerisches Praktikum (UKNum)](https://reader034.fdocuments.net/reader034/viewer/2022051715/588c6db91a28aba5218b8119/html5/thumbnails/73.jpg)
http://numericalmethods.eng.usf.edu73
Another Example of Truncation Error
Using a finite to approximate
P
Q
secant line
tangent line
Figure 1. Approximate derivative using finite Δx
![Page 74: Numerisches Praktikum (UKNum)](https://reader034.fdocuments.net/reader034/viewer/2022051715/588c6db91a28aba5218b8119/html5/thumbnails/74.jpg)
http://numericalmethods.eng.usf.edu74
Another Example of Truncation Error
Using finite rectangles to approximate an integral.
![Page 75: Numerisches Praktikum (UKNum)](https://reader034.fdocuments.net/reader034/viewer/2022051715/588c6db91a28aba5218b8119/html5/thumbnails/75.jpg)
http://numericalmethods.eng.usf.edu75
Example 1 —Maclaurin seriesCalculate the value of with an absoluterelative approximate error of less than 1%.
n
1 1 __ ___
2 2.2 1.2 54.545
3 2.92 0.72 24.658
4 3.208 0.288 8.9776
5 3.2944 0.0864 2.6226
6 3.3151 0.020736 0.62550
6 terms are required. How many are required to get at least 1 significant digit correct in your answer?
![Page 76: Numerisches Praktikum (UKNum)](https://reader034.fdocuments.net/reader034/viewer/2022051715/588c6db91a28aba5218b8119/html5/thumbnails/76.jpg)
http://numericalmethods.eng.usf.edu76
Example 2 —Differentiation Find for usingand
The actual value is
Truncation error is then,
Can you find the truncation error with
![Page 77: Numerisches Praktikum (UKNum)](https://reader034.fdocuments.net/reader034/viewer/2022051715/588c6db91a28aba5218b8119/html5/thumbnails/77.jpg)
http://numericalmethods.eng.usf.edu77
Example 3 — Integration Use two rectangles of equal width to approximate the area under the curve for
over the interval
![Page 78: Numerisches Praktikum (UKNum)](https://reader034.fdocuments.net/reader034/viewer/2022051715/588c6db91a28aba5218b8119/html5/thumbnails/78.jpg)
http://numericalmethods.eng.usf.edu78
Integration example (cont.)Choosing a width of 3, we have
Actual value is given by
Truncation error is then
Can you find the truncation error with 4 rectangles?
![Page 79: Numerisches Praktikum (UKNum)](https://reader034.fdocuments.net/reader034/viewer/2022051715/588c6db91a28aba5218b8119/html5/thumbnails/79.jpg)
http://numericalmethods.eng.usf.edu 79
Measuring Errors
Major: All Engineering Majors
Authors: Autar Kaw, Luke Snyder
http://numericalmethods.eng.usf.eduNumerical Methods for STEM undergraduates
![Page 80: Numerisches Praktikum (UKNum)](https://reader034.fdocuments.net/reader034/viewer/2022051715/588c6db91a28aba5218b8119/html5/thumbnails/80.jpg)
http://numericalmethods.eng.usf.edu80
Why measure errors?1) To determine the accuracy of
numerical results.2) To develop stopping criteria for
iterative algorithms.
![Page 81: Numerisches Praktikum (UKNum)](https://reader034.fdocuments.net/reader034/viewer/2022051715/588c6db91a28aba5218b8119/html5/thumbnails/81.jpg)
http://numericalmethods.eng.usf.edu81
True Error" Defined as the difference between the true
value in a calculation and the approximate value found using a numerical method etc.
True Error = True Value – Approximate Value
![Page 82: Numerisches Praktikum (UKNum)](https://reader034.fdocuments.net/reader034/viewer/2022051715/588c6db91a28aba5218b8119/html5/thumbnails/82.jpg)
http://numericalmethods.eng.usf.edu82
Example—True Error The derivative, of a function can be approximated by the equation,
If and a) Find the approximate value ofb) True value of c) True error for part (a)
![Page 83: Numerisches Praktikum (UKNum)](https://reader034.fdocuments.net/reader034/viewer/2022051715/588c6db91a28aba5218b8119/html5/thumbnails/83.jpg)
http://numericalmethods.eng.usf.edu83
Example (cont.)Solution:a) For and
![Page 84: Numerisches Praktikum (UKNum)](https://reader034.fdocuments.net/reader034/viewer/2022051715/588c6db91a28aba5218b8119/html5/thumbnails/84.jpg)
http://numericalmethods.eng.usf.edu84
Example (cont.)Solution:
b) The exact value of can be found by usingour knowledge of differential calculus.
So the true value of is
True error is calculated asTrue Value – Approximate Value
![Page 85: Numerisches Praktikum (UKNum)](https://reader034.fdocuments.net/reader034/viewer/2022051715/588c6db91a28aba5218b8119/html5/thumbnails/85.jpg)
http://numericalmethods.eng.usf.edu85
Relative True Error" Defined as the ratio between the true
error, and the true value.
Relative True Error ( ) = True Error
True Value
![Page 86: Numerisches Praktikum (UKNum)](https://reader034.fdocuments.net/reader034/viewer/2022051715/588c6db91a28aba5218b8119/html5/thumbnails/86.jpg)
http://numericalmethods.eng.usf.edu86
Example—Relative True ErrorFollowing from the previous example for true error, find the relative true error for atwith
From the previous example,
Relative True Error is defined as
as a percentage,
![Page 87: Numerisches Praktikum (UKNum)](https://reader034.fdocuments.net/reader034/viewer/2022051715/588c6db91a28aba5218b8119/html5/thumbnails/87.jpg)
http://numericalmethods.eng.usf.edu87
Approximate Error" What can be done if true values are not
known or are very difficult to obtain?" Approximate error is defined as the
difference between the present approximation and the previous approximation.
Approximate Error ( ) = Present Approximation – Previous Approximation
![Page 88: Numerisches Praktikum (UKNum)](https://reader034.fdocuments.net/reader034/viewer/2022051715/588c6db91a28aba5218b8119/html5/thumbnails/88.jpg)
http://numericalmethods.eng.usf.edu88
Example—Approximate ErrorFor at find the following,
a) usingb) usingc) approximate error for the value of for part b)
Solution:a) For and
![Page 89: Numerisches Praktikum (UKNum)](https://reader034.fdocuments.net/reader034/viewer/2022051715/588c6db91a28aba5218b8119/html5/thumbnails/89.jpg)
http://numericalmethods.eng.usf.edu89
Example (cont.)Solution: (cont.)
b) For and
![Page 90: Numerisches Praktikum (UKNum)](https://reader034.fdocuments.net/reader034/viewer/2022051715/588c6db91a28aba5218b8119/html5/thumbnails/90.jpg)
http://numericalmethods.eng.usf.edu90
Example (cont.)Solution: (cont.)
c) So the approximate error, isPresent Approximation – Previous Approximation
![Page 91: Numerisches Praktikum (UKNum)](https://reader034.fdocuments.net/reader034/viewer/2022051715/588c6db91a28aba5218b8119/html5/thumbnails/91.jpg)
http://numericalmethods.eng.usf.edu91
Relative Approximate Error" Defined as the ratio between the
approximate error and the present approximation.
Relative Approximate Error ( Approximate Error
Present Approximation) =
![Page 92: Numerisches Praktikum (UKNum)](https://reader034.fdocuments.net/reader034/viewer/2022051715/588c6db91a28aba5218b8119/html5/thumbnails/92.jpg)
http://numericalmethods.eng.usf.edu92
Example—Relative Approximate Error
For at , find the relative approximateerror using values from andSolution:From Example 3, the approximate value of using and using
Present Approximation – Previous Approximation
![Page 93: Numerisches Praktikum (UKNum)](https://reader034.fdocuments.net/reader034/viewer/2022051715/588c6db91a28aba5218b8119/html5/thumbnails/93.jpg)
http://numericalmethods.eng.usf.edu93
Example (cont.)Solution: (cont.)
Approximate Error
Present Approximation
as a percentage,
Absolute relative approximate errors may also need to be calculated,
![Page 94: Numerisches Praktikum (UKNum)](https://reader034.fdocuments.net/reader034/viewer/2022051715/588c6db91a28aba5218b8119/html5/thumbnails/94.jpg)
http://numericalmethods.eng.usf.edu94
How is Absolute Relative Error used as a stopping criterion?
If where is a pre-specified tolerance, thenno further iterations are necessary and the process is stopped.
If at least m significant digits are required to be correct in the final answer, then
![Page 95: Numerisches Praktikum (UKNum)](https://reader034.fdocuments.net/reader034/viewer/2022051715/588c6db91a28aba5218b8119/html5/thumbnails/95.jpg)
http://numericalmethods.eng.usf.edu95
Table of ValuesFor at with varying step size,
0.3 10.263 N/A 0
0.15 9.8800 0.038765% 3
0.10 9.7558 0.012731% 3
0.01 9.5378 0.024953% 3
0.001 9.5164 0.002248% 4
![Page 96: Numerisches Praktikum (UKNum)](https://reader034.fdocuments.net/reader034/viewer/2022051715/588c6db91a28aba5218b8119/html5/thumbnails/96.jpg)
02/05/10 http://numericalmethods.eng.usf.edu 1
Propagation of Errors
Major: All Engineering Majors
Authors: Autar Kaw, Matthew Emmons
http://numericalmethods.eng.usf.eduNumerical Methods for STEM undergraduates
![Page 97: Numerisches Praktikum (UKNum)](https://reader034.fdocuments.net/reader034/viewer/2022051715/588c6db91a28aba5218b8119/html5/thumbnails/97.jpg)
http://numericalmethods.eng.usf.edu2
Propagation of Errors
In numerical methods, the calculations are not made with exact numbers. How do these inaccuracies propagate through the calculations?
![Page 98: Numerisches Praktikum (UKNum)](https://reader034.fdocuments.net/reader034/viewer/2022051715/588c6db91a28aba5218b8119/html5/thumbnails/98.jpg)
http://numericalmethods.eng.usf.edu3
Example 1:Find the bounds for the propagation in adding two numbers. For example if one is calculating X +Y where X = 1.5 ± 0.05 Y = 3.4 ± 0.04SolutionMaximum possible value of X = 1.55 and Y = 3.44
Maximum possible value of X + Y = 1.55 + 3.44 = 4.99
Minimum possible value of X = 1.45 and Y = 3.36.
Minimum possible value of X + Y = 1.45 + 3.36 = 4.81
Hence 4.81 ≤ X + Y ≤4.99.
![Page 99: Numerisches Praktikum (UKNum)](https://reader034.fdocuments.net/reader034/viewer/2022051715/588c6db91a28aba5218b8119/html5/thumbnails/99.jpg)
http://numericalmethods.eng.usf.edu4
Propagation of Errors In Formulas
If is a function of several variables then the maximum possible value of the error in is
![Page 100: Numerisches Praktikum (UKNum)](https://reader034.fdocuments.net/reader034/viewer/2022051715/588c6db91a28aba5218b8119/html5/thumbnails/100.jpg)
http://numericalmethods.eng.usf.edu5
Example 2:The strain in an axial member of a square cross-section is given by
Given
Find the maximum possible error in the measured strain.
![Page 101: Numerisches Praktikum (UKNum)](https://reader034.fdocuments.net/reader034/viewer/2022051715/588c6db91a28aba5218b8119/html5/thumbnails/101.jpg)
http://numericalmethods.eng.usf.edu6
Example 2:Solution
![Page 102: Numerisches Praktikum (UKNum)](https://reader034.fdocuments.net/reader034/viewer/2022051715/588c6db91a28aba5218b8119/html5/thumbnails/102.jpg)
http://numericalmethods.eng.usf.edu7
Example 2:
Thus
Hence
![Page 103: Numerisches Praktikum (UKNum)](https://reader034.fdocuments.net/reader034/viewer/2022051715/588c6db91a28aba5218b8119/html5/thumbnails/103.jpg)
Example 3:Subtraction of numbers that are nearly equal can create unwanted inaccuracies. Using the formula for error propagation, show that this is true.
SolutionLet
Then
So the relative change is
http://numericalmethods.eng.usf.edu8
![Page 104: Numerisches Praktikum (UKNum)](https://reader034.fdocuments.net/reader034/viewer/2022051715/588c6db91a28aba5218b8119/html5/thumbnails/104.jpg)
Example 3:For example if
= 0.6667 = 66.67%
http://numericalmethods.eng.usf.edu9
![Page 105: Numerisches Praktikum (UKNum)](https://reader034.fdocuments.net/reader034/viewer/2022051715/588c6db91a28aba5218b8119/html5/thumbnails/105.jpg)
http://numericalmethods.eng.usf.edu 105
Taylor Series Revisited
Major: All Engineering Majors
Authors: Autar Kaw, Luke Snyder
http://numericalmethods.eng.usf.eduNumerical Methods for STEM undergraduates
![Page 106: Numerisches Praktikum (UKNum)](https://reader034.fdocuments.net/reader034/viewer/2022051715/588c6db91a28aba5218b8119/html5/thumbnails/106.jpg)
http://numericalmethods.eng.usf.edu106
What is a Taylor series?Some examples of Taylor series which you must have seen
![Page 107: Numerisches Praktikum (UKNum)](https://reader034.fdocuments.net/reader034/viewer/2022051715/588c6db91a28aba5218b8119/html5/thumbnails/107.jpg)
http://numericalmethods.eng.usf.edu107
General Taylor SeriesThe general form of the Taylor series is given by
provided that all derivatives of f(x) are continuous and exist in the interval [x,x+h]
What does this mean in plain English?
As Archimedes would have said, “Give me the value of the function at a single point, and the value of all (first, second, and so on) its derivatives at that single point, and I can give you the value of the function at any other point” (fine print excluded)
![Page 108: Numerisches Praktikum (UKNum)](https://reader034.fdocuments.net/reader034/viewer/2022051715/588c6db91a28aba5218b8119/html5/thumbnails/108.jpg)
http://numericalmethods.eng.usf.edu108
Example—Taylor SeriesFind the value of given that
and all other higher order derivativesof at are zero.
Solution:
![Page 109: Numerisches Praktikum (UKNum)](https://reader034.fdocuments.net/reader034/viewer/2022051715/588c6db91a28aba5218b8119/html5/thumbnails/109.jpg)
http://numericalmethods.eng.usf.edu109
Example (cont.)Solution: (cont.)Since the higher order derivatives are zero,
Note that to find exactly, we only need the valueof the function and all its derivatives at some other point, in this case
![Page 110: Numerisches Praktikum (UKNum)](https://reader034.fdocuments.net/reader034/viewer/2022051715/588c6db91a28aba5218b8119/html5/thumbnails/110.jpg)
http://numericalmethods.eng.usf.edu110
Derivation for Maclaurin Series for ex
Derive the Maclaurin series
The Maclaurin series is simply the Taylor series about the point x=0
![Page 111: Numerisches Praktikum (UKNum)](https://reader034.fdocuments.net/reader034/viewer/2022051715/588c6db91a28aba5218b8119/html5/thumbnails/111.jpg)
http://numericalmethods.eng.usf.edu111
Derivation (cont.)Since and
the Maclaurin series is then
So,
![Page 112: Numerisches Praktikum (UKNum)](https://reader034.fdocuments.net/reader034/viewer/2022051715/588c6db91a28aba5218b8119/html5/thumbnails/112.jpg)
http://numericalmethods.eng.usf.edu112
Error in Taylor Series
where the remainder is given by
where
that is, c is some point in the domain [x,x+h]
The Taylor polynomial of order n of a function f(x) with (n+1) continuous derivatives in the domain [x,x+h] is given by
![Page 113: Numerisches Praktikum (UKNum)](https://reader034.fdocuments.net/reader034/viewer/2022051715/588c6db91a28aba5218b8119/html5/thumbnails/113.jpg)
http://numericalmethods.eng.usf.edu113
Example—error in Taylor seriesThe Taylor series for at point is given by
It can be seen that as the number of terms usedincreases, the error bound decreases and hence abetter estimate of the function can be found.
How many terms would it require to get an approximation of e1 within a magnitude of true error of less than 10-6.
![Page 114: Numerisches Praktikum (UKNum)](https://reader034.fdocuments.net/reader034/viewer/2022051715/588c6db91a28aba5218b8119/html5/thumbnails/114.jpg)
http://numericalmethods.eng.usf.edu114
Example—(cont.)Solution:Using terms of Taylor series gives error bound of
Since
![Page 115: Numerisches Praktikum (UKNum)](https://reader034.fdocuments.net/reader034/viewer/2022051715/588c6db91a28aba5218b8119/html5/thumbnails/115.jpg)
http://numericalmethods.eng.usf.edu115
Example—(cont.)Solution: (cont.)
So if we want to find out how many terms it wouldrequire to get an approximation of within amagnitude of true error of less than ,
So 9 terms or more are needed to get a true errorless than
![Page 116: Numerisches Praktikum (UKNum)](https://reader034.fdocuments.net/reader034/viewer/2022051715/588c6db91a28aba5218b8119/html5/thumbnails/116.jpg)
http://numericalmethods.eng.usf.edu116
![Page 117: Numerisches Praktikum (UKNum)](https://reader034.fdocuments.net/reader034/viewer/2022051715/588c6db91a28aba5218b8119/html5/thumbnails/117.jpg)
http://numericalmethods.eng.usf.edu
" Questions? 117