ECM6Lecture3Vietnam_2014
description
Transcript of ECM6Lecture3Vietnam_2014
-
Slide 1 of 12
ECM6 Computational Methods :
Lecture 3Introduction to Algorithms
Brian G. HigginsDepartment of Chemical Engineering & Materials Science
University of California, Davis
April 2014, Hanoi, Vietnam
-
Slide 2 of 12Topics for Lecture 3
In this lecture we give a brief over view of the following topics
1. Concept of an algorithm2. Example involving summations3. Algorithm for approximating an integral (trapezoidal rule) using Table4. Algorithm for approximating integral using For loop
2 ECM6Lecture3Vietnam_2014.nb
-
Slide 3 of 12Introduction to Algorithms
An algorithm is a step-by-step procedure that produces a solution in a finite number of steps. The basic components of an algorithm are
(i) List of the input parameters that must be supplied(ii) List of operations that must be performed and in what order(iii) Output of the algorithm.
When the output is a numerical result we call the procedure a numerical method. Numerical methods by their nature do not produce exact solutions. There is always some error associated with the method. Thus one goal of a numerical method is to assess how close the "solution" is to the exact solution. Matters are complicated because the exact solution is often not known. If it were there would be no reason to use a numerical method.
Here are some simple example of an algorithm
Example
Evaluate the mean and standard deviation of a given set of data (measurements). Suppose the data is in the form of a sequencedata = 8x1, x2, x3, , xn