+ All Categories
Home > Documents > Computational Physics PS 587. We are still waiting for the Ph D class to join in… Till then,...

Computational Physics PS 587. We are still waiting for the Ph D class to join in… Till then,...

Date post: 02-Jan-2016
Category:
Upload: maurice-norris
View: 213 times
Download: 0 times
Share this document with a friend
24
Computational Physics PS 587
Transcript
Page 1: Computational Physics PS 587. We are still waiting for the Ph D class to join in… Till then, refresh some concepts in programming (later). Discuss some.

Computational Physics

PS 587

Page 2: Computational Physics PS 587. We are still waiting for the Ph D class to join in… Till then, refresh some concepts in programming (later). Discuss some.

We are still waiting for the Ph D class to join in…

• Till then, refresh some concepts in programming (later).

• Discuss some general techniques which may be useful in any case

• Accuracy, and why it is important.

Page 3: Computational Physics PS 587. We are still waiting for the Ph D class to join in… Till then, refresh some concepts in programming (later). Discuss some.

Decimal System

• Foundation of our computer revolution.• Imagine computing in the Roman system CCXXXII times XLVIII, i.e. 232 48.

• Zero was invented by Indian mathematicians, who were inspired by the Babylonian and the Chinese number systems, particularly as used in abacuses.

2 104 103 2 40 3000 3042

10Base 9} 8, 7, 6, 5, 4, 3, 2, 1, 0, {Digits3 +×+×=++=

==

Page 4: Computational Physics PS 587. We are still waiting for the Ph D class to join in… Till then, refresh some concepts in programming (later). Discuss some.

The Discovery of Decimal Fractions

• Persians and Arabs invented the representation of decimal fractions that we use today.

• They discovered the rules for basic arithmetic operations that we now learn in school.

213 105107 2104103 042.75 3 −− ×+×++×+×=

Page 5: Computational Physics PS 587. We are still waiting for the Ph D class to join in… Till then, refresh some concepts in programming (later). Discuss some.

The Long Journey

Diophantus3rdc. AD

Brahmagupta, 598 ADSridhara, 850 AD

Adelard 1080 AD

House of Wisdom9thc. AD

Khwarizmi780 AD

Kashani1380 AD

Page 6: Computational Physics PS 587. We are still waiting for the Ph D class to join in… Till then, refresh some concepts in programming (later). Discuss some.

Khwarizmi (780 – 850)

• Settled in the House of Wisdom (Baghdad).

• Wrote three books:– Hindu Arithmetic– Al-jabr va Al-Moghabela– Astronomical Tables

• The established words:“Algorithm” from “Al-Khwarizmiand “Algebra” from “Al-jabr”testify to his fundamentalcontribution to human thought.

Page 7: Computational Physics PS 587. We are still waiting for the Ph D class to join in… Till then, refresh some concepts in programming (later). Discuss some.

The Long Journey

Diophantus3rdc. AD

Brahmagupta, 598 ADSridhara, 850 AD

Adelard 1080 AD

House of Wisdom9thc. AD

Khwarizmi780 AD

Kashani1380 AD

Page 8: Computational Physics PS 587. We are still waiting for the Ph D class to join in… Till then, refresh some concepts in programming (later). Discuss some.

Adelard of Bath (1080 – 1160)

• First English Scientist.

• Translated from Arabic to Latin Khwarizmi’s astronomical tables with their use of zero.

• After a long rivalry between Algorists and abacists, the decimal system replaced the abacus.

Page 9: Computational Physics PS 587. We are still waiting for the Ph D class to join in… Till then, refresh some concepts in programming (later). Discuss some.

The Long Journey

Diophantus3rdc. AD

Brahmagupta, 598 ADSridhara, 850 AD

Adelard 1080 AD

House of Wisdom9thc. AD

Khwarizmi780 AD

Kashani1380 AD

Page 10: Computational Physics PS 587. We are still waiting for the Ph D class to join in… Till then, refresh some concepts in programming (later). Discuss some.

Kashani (1380 – 1429)• Developed arithmetic algorithms for fractions, that we use today.

• Computed up to 16 decimals.

o1sin368 306 80523 28 =×=n• He used

2 793 589 653 592 141.3=π• Computed π up to 16 decimal places:

• Took the unit circle.• The circumferences of the inscribed and circumscribed polygons with n sides give lower and upper bounds for 2π.

• Took the unit circle.• The circumferences of the inscribed and circumscribed polygons with n sides give lower and upper bounds for 2π.

• Took the unit circle.

Page 11: Computational Physics PS 587. We are still waiting for the Ph D class to join in… Till then, refresh some concepts in programming (later). Discuss some.

• Kashani invented the first mechanical special purpose computers:–to find when the planets are closest,

–to calculate longitudes of planets,

–to predict lunar eclipses.

Kashani (1380 – 1429)

Page 12: Computational Physics PS 587. We are still waiting for the Ph D class to join in… Till then, refresh some concepts in programming (later). Discuss some.

Kashani’s Planetarium

Page 13: Computational Physics PS 587. We are still waiting for the Ph D class to join in… Till then, refresh some concepts in programming (later). Discuss some.

Mechanical Computers in Europe

Leibniz(1646 –1716)

Pascal(1632 – 1662)

Napier(1550-1617)

Oughtred(1575 – 1660)

Babbage(1792 – 1871)

Page 14: Computational Physics PS 587. We are still waiting for the Ph D class to join in… Till then, refresh some concepts in programming (later). Discuss some.

Modern Computers: Floating Point Numbers

• Any other number like π is rounded or approximated to a close floating point number.

5110 817310. ×±

• Represents only a finite collection of numbers.

Sign

± 5 1

Exponent

8 1 7 3

Mantissa

Page 15: Computational Physics PS 587. We are still waiting for the Ph D class to join in… Till then, refresh some concepts in programming (later). Discuss some.

Computers lie.

One has to be alert.

Page 16: Computational Physics PS 587. We are still waiting for the Ph D class to join in… Till then, refresh some concepts in programming (later). Discuss some.

10

10

10

===

20101010

10102010

10102010

2020

2020

2020

+−−

−−+

−−+

Floating Point Arithmetic is not sound

• Especially when adding BIG numbers:

• But using IEEE’s standard precision, we get three different results,

Page 17: Computational Physics PS 587. We are still waiting for the Ph D class to join in… Till then, refresh some concepts in programming (later). Discuss some.

What is 0 on the computer?

• 0 is the smallest number such that 0+1=1.

• Compute the 0 on your calculator. This is related to the number of bits used to represent a real number. Typically this will be something like 10-8.

Page 18: Computational Physics PS 587. We are still waiting for the Ph D class to join in… Till then, refresh some concepts in programming (later). Discuss some.

20101010

10102010

10102010

2020

2020

2020

+−−

−−+

−−+

Floating Point Arithmetic is not sound

• A simple calculation shows:

20

10

0

=−=

=

• But using IEEE’s standard precision, we get three different results, all wrong.

Page 19: Computational Physics PS 587. We are still waiting for the Ph D class to join in… Till then, refresh some concepts in programming (later). Discuss some.

Failure of Floating Point Computation

0 102558961 5.41869520

1 159018721 64919121

21

21

=−=−

xxxx

• Double precision floating-point arithmetic gives: 5.41869520~ 102558961~

21 == xx

• The correct solution is:

83739041 205117922 21 == xx

Page 20: Computational Physics PS 587. We are still waiting for the Ph D class to join in… Till then, refresh some concepts in programming (later). Discuss some.

• Depending on the floating point format, the sequence tends to 1 or 2 or 3 or 4.

• In reality, it oscillates about 1.51 and 2.37.

Failure of Floating Point Computation

2470304

2435203

3185100050721.1

23

234

1

0

−+−−+−

=

=

+nnn

nnnn aaa

aaaa

a

Page 21: Computational Physics PS 587. We are still waiting for the Ph D class to join in… Till then, refresh some concepts in programming (later). Discuss some.

Failure of Floating Point Computation

• In any floating point format, the sequence converges to 100.

• In reality, it converges to 6.

nnnn aaaaaa

1110

30001130111

11

61

2

11

−+ +−===

Floating Point Exact Arithmetic

5.6334313 =a 5.6334313 =a

Page 22: Computational Physics PS 587. We are still waiting for the Ph D class to join in… Till then, refresh some concepts in programming (later). Discuss some.

Failure of Floating Point Computation

• In any floating point format, the sequence converges to 100.

• In reality, it converges to 6.

nnnn aaaaaa

1110

30001130111

11

61

2

11

−+ +−===

Floating Point Exact Arithmetic

6.56399413 =a 5.91452513 =a68.46342415 =a 5.93905015 =a

Page 23: Computational Physics PS 587. We are still waiting for the Ph D class to join in… Till then, refresh some concepts in programming (later). Discuss some.

Failure of Floating Point Computation

• In any floating point format, the sequence converges to 100.

• In reality, it converges to 6.

nnnn aaaaaa

1110

30001130111

11

61

2

11

−+ +−===

Floating Point Exact Arithmetic99.99996420 =a 5.97457920 =a100.00000040 =a 5.99932040 =a

5.99999980 =a100.00000080 =a

Page 24: Computational Physics PS 587. We are still waiting for the Ph D class to join in… Till then, refresh some concepts in programming (later). Discuss some.

3.14159265358979323846264338327950288419716939937510582974944592307816406286208998628034825342117067982148086513282306647093844609550582231725359408128481117450284102701938521105559644622948954930381964428810975665933446128475648233786783165271201909145648566923460348610454326648213393607260249141273724587006606315588174881520920962829254091715364367892590360011330530548820466521384146951941511609...


Recommended