Docsity

Computational Physics an Introduction-Computational Physics-Lecture Slides, Slides of Computational Physics

Partial preview of the text

Download Computational Physics an Introduction-Computational Physics-Lecture Slides and more Slides Computational Physics in PDF only on Docsity!

Dr. Hanif Durad

2

Lecture Outline  Computational Physics  Scientific computing  Approximations  Computer Arithmetic

Dr. Hanif Durad

3

Computational Physics (1/3)

^ Computational physics (CP) is a subfield ofcomputational science. ^ CP is a multidisciplinary subject that combinesaspects of physics, applied mathematics, andcomputer science ^ With the aim of solving realistic physicsproblems

Dr. Hanif Durad

Computational Physics (3/3)

[Landau,P-2]

Physics Problems &(Computational Methods)

^ Deterministic Approach^ ^

Solve the governing equations by analytical ornumerical methods ^ Probabilistic Approach^ ^ Model^ Model the various processes as they actually happenwithout solving the equations

Solution

Visualization

My Part

Scientific Computing

^ What is scientific computing?^ ^

Design and analysis of algorithms for solvingmathematical problems in science and engineeringnumerically ^ Traditionally called numerical analysis ^ Distinguishing features:^ ^

continuous quantities  effects of approximations

Dr. Hanif Durad

8

Why scientific computing?  Simulation of physical phenomena  Virtual prototyping of products

Dr. Hanif Durad

9

1.1.1 General Strategy

^ Replace difficult problem by easier one havingsame or closely related solution^ ^

Infinite

→^ finite (space, integral sum) ^ Differential

→^ algebraic

^ Nonlinear

→^ linear ^ Complicated

simple

^ Solution obtained may only

approximate

that of

original problem

Dr. Hanif Durad

11

[P-3]

1.2.1 Sources of Approximation

^ Before computation:^ ^

modeling  empirical measurements ^ During computation:^ ^

previous computations  truncation or discretization  rounding ^ Accuracy of final result reflects all these ^ Uncertainty in input may be amplified by problem ^ Perturbations during computation may be amplified by algo.

1.2.2 Absolute Error and RelativeError

^ Absolute error

= approx value

−^ true value

^ Relative error

=(absolute error /true value)

^ Equivalently,^ ^

Approx value = (true value)(1 + rel. error) ^ True value

usually unknown, so

estimate

or^ bound

error rather than compute it exactly  Relative error

often taken relative to approximate

value, rather than (unknown) true value

Dr. Hanif Durad

14

Data Error and ComputationalError (1/3)

^ Typical problem: compute value of functionfor given argument= true value of input,

= desired result= approximate (inexact) input= approximate function computedTotal error =

= computational error + propagated data error ^ Algorithm has no effect on propagated data error

Dr. Hanif Durad

15

f:^

x ( ) f xxf

( )^

( )^

(

)^

) )

(^

(

(^

)^

f^ x^

f^ x

x

f^

f^

f x^

x

x^ f

^ ^

^

^

^

^

Data Error and ComputationalError (3/3)  propagated data error

, which does not depend on

the algorithm, might already be present in theinput data;  computational error

, which does depend on the

algorithm, might be introduced by thecomputational process into the output data.

Dr. Hanif Durad

17

[Adopted from Robert D. Skeel notes CS515,file 1.pdf

→P-13/41 ]

Truncation Error and RoundingError

^ Truncation error : difference between true result (for actual input)and result produced by given algorithm

using exact arithmetic

^ Due to approximations such as truncating infinite series or terminatingiterative sequence before convergence  Rounding error : difference between result produced by givenalgorithm using exact arithmetic and result produced by samealgorithm using limited precision arithmetic ^ Due to inexact representation of real numbers and arithmetic operationsupon them  Computational error is sum of truncation error and rounding error,but one of these usually dominates

Dr. Hanif Durad

18

Example: Finite Difference

Approximation

Forward and Backward Error