CSCE 206 1 Review—Fortran. CSCE 206 2 Review—I/O Patterns: Read until a sentinel value is found Read n, then read n things Read until EOF encountered.

Slides:



Advertisements
Similar presentations
Introduction to C Programming
Advertisements

Roundoff and truncation errors
Computational Modeling for Engineering MECN 6040
Copyright © 2014, 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Starting Out with C++ Early Objects Eighth Edition by Tony Gaddis,
Data Modeling and Parameter Estimation Nov 9, 2005 PSCI 702.
Chapter 9: Searching, Sorting, and Algorithm Analysis
MATH 685/ CSI 700/ OR 682 Lecture Notes
Solving Linear Systems (Numerical Recipes, Chap 2)
CSCE Finding Roots of Equations This is a fundamental computational problem Several methods exist. We will look at the bisection method and at Newton’s.
Lecture #18 EEE 574 Dr. Dan Tylavsky Nonlinear Problem Solvers.
Second Term 05/061 Roots of Equations Bracketing Methods.
Motion Analysis (contd.) Slides are from RPI Registration Class.
Chapter 1 Introduction The solutions of engineering problems can be obtained using analytical methods or numerical methods. Analytical differentiation.
Roots of Equations Bracketing Methods.
Revision.
Revision – A simple program How to start a program? How to end a program? How to declare variables? What are the mathematical operators? How to start a.
Systems of Non-Linear Equations
Arrays Data Structures - structured data are data organized to show the relationship among the individual elements. It usually requires a collecting mechanism.
ECIV 301 Programming & Graphics Numerical Methods for Engineers REVIEW II.
CSCE Monte Carlo Methods When you can’t do the math, simulate the process with random numbers Numerical integration to get areas/volumes Particle.
Dr. Marco A. Arocha Aug,  “Roots” problems occur when some function f can be written in terms of one or more dependent variables x, where the.
CISE-301: Numerical Methods Topic 1: Introduction to Numerical Methods and Taylor Series Lectures 1-4: KFUPM.
Monte Carlo Methods in Partial Differential Equations.
Numerical Analysis 1 EE, NCKU Tien-Hao Chang (Darby Chang)
MATH 685/ CSI 700/ OR 682 Lecture Notes Lecture 8. Nonlinear equations.
Pointers (Continuation) 1. Data Pointer A pointer is a programming language data type whose value refers directly to ("points to") another value stored.
Solving Non-Linear Equations (Root Finding)
Mathematics for Computer Graphics (Appendix A) Won-Ki Jeong.
Erin Catto Blizzard Entertainment Numerical Integration.
Scott Marino MSMIS Kean University MSAS5104 Programming with Data Structures and Algorithms Week 10 Scott Marino.
Chapter 17 Boundary Value Problems. Standard Form of Two-Point Boundary Value Problem In total, there are n 1 +n 2 =N boundary conditions.
CISE-301: Numerical Methods Topic 1: Introduction to Numerical Methods and Taylor Series Lectures 1-4: KFUPM CISE301_Topic1.
CISE301_Topic11 CISE-301: Numerical Methods Topic 1: Introduction to Numerical Methods and Taylor Series Lectures 1-4:
Today  Table/List operations  Parallel Arrays  Efficiency and Big ‘O’  Searching.
 Data is always stored in a logical way so that it can be accessed efficiently. Ex:A telephone directory  The way data is stored is called the structure.
Analysis of Algorithms
MA/CS 375 Fall MA/CS 375 Fall 2002 Lecture 31.
Integration of 3-body encounter. Figure taken from
Curve-Fitting Regression
CSC 211 Data Structures Lecture 13
Chapter 3 Roots of Equations. Objectives Understanding what roots problems are and where they occur in engineering and science Knowing how to determine.
Data Structure Introduction.
Introduction to: Programming CS105 Lecture: Yang Mu.
Numerical Methods for Engineering MECN 3500
Numerical Methods.
MECN 3500 Inter - Bayamon Lecture 9 Numerical Methods for Engineering MECN 3500 Professor: Dr. Omar E. Meza Castillo
Linear Systems – Iterative methods
Newton’s Method, Root Finding with MATLAB and Excel
Lecture 5 - Single Variable Problems CVEN 302 June 12, 2002.
One Dimensional Search
1 Searching and Sorting Searching algorithms with simple arrays Sorting algorithms with simple arrays –Selection Sort –Insertion Sort –Bubble Sort –Quick.
Lecture 6 - Single Variable Problems & Systems of Equations CVEN 302 June 14, 2002.
Data Structures and Algorithms Searching Algorithms M. B. Fayek CUFE 2006.
1. Searching The basic characteristics of any searching algorithm is that searching should be efficient, it should have less number of computations involved.
Searching Topics Sequential Search Binary Search.
INTRO TO OPTIMIZATION MATH-415 Numerical Analysis 1.
Spring 2006CISC101 - Prof. McLeod1 Announcements Assn 4 is posted. Note that due date is the 12 th (Monday) at 7pm. (Last assignment!) Final Exam on June.
Onlinedeeneislam.blogspot.com1 Design and Analysis of Algorithms Slide # 1 Download From
Arrays Department of Computer Science. C provides a derived data type known as ARRAYS that is used when large amounts of data has to be processed. “ an.
Chapter 7. Classification and Prediction
NUMERICAL DIFFERENTIATION Forward Difference Formula
MATH 2140 Numerical Methods
Numerical Analysis Lecture 45.
Today’s class Multiple Variable Linear Regression
POLYNOMIAL INTERPOLATION
MATH-321 In One Slide MATH-321 & MATLAB Command.
1 Newton’s Method.
Chapter 2 A Survey of Simple Methods and Tools
CISE-301: Numerical Methods Topic 1: Introduction to Numerical Methods and Taylor Series Lectures 1-4: KFUPM CISE301_Topic1.
Presentation transcript:

CSCE Review—Fortran

CSCE Review—I/O Patterns: Read until a sentinel value is found Read n, then read n things Read until EOF encountered Techniques: Unformatted reads (preferred) Formatted reads (deprecated) Unformatted writes (deprecated) Formatted writes (preferred)

CSCE Conditional Execution IF (…) THEN … ELSE … END IF Keep it simple Follow rules of boolean logic Use Logical variables if necessary

CSCE Loops DO n = begin,end,step END DO ………………………………………………….. DO IF(we’re done) THEN EXIT END IF … END DO

CSCE Loops X = initial value DO n = begin,end,step update X END DO Works for finding min, max, Works for sum of values, product of values

CSCE Loops DO IF(we’re done) THEN EXIT END IF … END DO Works for searching, indeterminate termination conditions

CSCE Data Types and Variables Intrinsic logical, character, integer, real, complex Structures Static or dynamic allocation Call by reference, call by value INTENT keyword

CSCE Subprograms and Scope of Variables Functions and subroutines Internal and external Variables are available to internal subprograms unless otherwise redefined Variables are not available to external subprograms

CSCE Algorithms

CSCE Pointers to Data Sorting with an index array Linked lists, queues, stacks Old fashioned way used arrays bad—more cumbersome? good—all the data can be read More modern way uses dynamic allocation bad—can’t necessarily find the data good—perhaps simpler

CSCE Divide and Conquer Bisection is divide and conquer Split the problem in half Determine which half is relevant Inherently fast

CSCE Algorithm Analysis f(n) = O(g(x)) means f(x) < C g(x) for some fixed constant C and “all large x” If f(x) is a polynomial, then it’s big O of the leading term Hierarchy log n n n log n n^2 …

CSCE Numerical Algorithms

CSCE Root Finding Bisection method more or less guaranteed to work but slow to converge Newton’s method generally fast in convergence but less predictable

CSCE Approximation of Functions Forward (backward) difference approximations: Approximate derivatives with slopes from data points forward (backward) from an initial base point Central difference approximations: Approx with average forward and backward Both methods approx a function with a polynomial by approximating the derivatives using data points and then approximating the function with a Taylor series Lagrange interpolation: Create the exact polynomial passing through the data points.

CSCE Approximation of Functions When the data is felt to be accurate, difference methods are appropriate. When the data is known to be inaccurate, a least squares approximation is used. Usually: Minimize the sums of the errors in the vertical (y) direction if we were to approx the function with a straight line If we have nonlinear data, do a transformation, then approximate with a straight line.

CSCE Means, Variances, etc. Mean can be computed “online” Variance can be computed online, but is usually expressed as a computation that requires first computing the mean

CSCE Random Numbers Monte Carlo computations Numerical integration Simulation of statistical events (traffic flow, particle interactions, etc.)

CSCE Differential Equations Start from an initial condition (time zero, for example) Estimate rate of change numerically Proceed in the direction of that change for one time step Recalculate rates of changes repeat

CSCE Sorting Bubble sort/insertion sort, O(n^2) time, but there are faster ways Sort data? Sort keys? Create an index array but don’t move the data itself?

CSCE Matrix Operations Matrix multiplication Loops

CSCE Gaussian Elimination The most basic of all direct linear system solvers Also not very stable or successful, and not very efficient Best done as vector-matrix multiplication either explicitly or implicitly

CSCE Gauss-Seidel Iteration The most basic of all iterative linear system solvers Reasonably stable and successful, and reasonably efficient Can be done either sequentially (G-S) or in parallel (Jacobi iteration)

CSCE The End