Numerical Methods in Scientific Computation
|
|
- Tracy Paul
- 6 years ago
- Views:
Transcription
1 Numerical Methods in Scientific Computation Programming and Software Introduction to error analysis 1
2 Packages vs. Programming Packages MATLAB Excel Mathematica Maple Packages do the work for you Most offer an interactive environment 2
3 MATLAB Software product from The MathWorks, Inc. Originally focused on matrix manipulations Interactive tool to do numerical functions, and visualization Commands can be saved into user scripts call and m-file Graphics and graphical user interfaces (GUI) are built into program 3
4 MATLAB Base product is extended with a variety of toolboxes Optimization Statistics Curve fitting Image processing 4
5 MATLAB Example: Find roots of >> p = [ ] >> r = roots (p) >> r = x 3 6x 2 72x 27 5
6 MATLAB Advantages: Large library of functions to evaluate a wide variety of numerical problems Interactive tool allows immediate evaluation of results Disadvantages Expensive Not as fast as C/C++/FORTRAN code 6
7 Programming language concepts Interpreted Languages MATLAB Usually integrated with an interactive GUI Allows quick evaluation of algorithms Ideal for debugging and one-time analysis and in cases where high speed is not critical 7
8 Programming language concepts Compiled Languages FORTRAN, C, C++ Source code is created with an editor as a plain text file Programs then needs to be compiled (converted from source code to machine instructions with relative addresses and undefined external routines still needed). The compiled routines (called object modules) need then to be linked with system libraries. Faster execution than interpreted languages 8
9 Programming concepts Data representation Constants, variables, type declarations Data organization and structures Arrays, lists, trees, etc. 9
10 Programming concepts Mathematical formulas Assignment, priority rules Input/Output Stdin / Stdout, files, GUI 10
11 Programming concepts Structured programming Set of rules that prescribe good programming style Single entry point and exit point to all control structures Flexible enough to allow creativity and personal expression Easy to debut, test and update 11
12 Structured programming Control structures Sequence Selection Repetition Computer code is clearer and easier to follow 12
13 Algorithm expression Flowcharts Visual representation Useful in planning Pseudocode Simple representation of an algorithm Basic program constructs without being language-specific Easy to modify and share with others 13
14 Flowcharts 14
15 Control structures Sequence Implement one instruction at a time 15
16 Control structures Selection Branching IF/THEN/ELSE CASE/ELSE 16
17 Control structures 17
18 Control structures 18
19 Control structures Repetition DOEXIT loops (break loop) Similar to C while loop DOFOR loop (count-controlled) 19
20 Control structures pretest posttest midtest 20
21 Control structures 21
22 Modular programming Break complicated tasks into manageable parts Independent and self-contained Well-defined modules with a single entry point and single exit point Always a good idea to return a value for status or error code 22
23 Modular programming Makes logic easier to understand and digest Allows black-box development of modules Requires well-defined interfaces with no side effects Isolates errors Allows for reuse of modules and development of libraries 23
24 Software engineering approach Specification: A clear statement of the problem, the requirements, and any special parameters of operation Algorithm/Design: A flow chart or pseudo code representation of how exactly how will the problem be solved. 24
25 Software engineering approach Implementation: Breaking the algorithm into manageable pieces that can be coded into the language of choice, and putting all the pieces together to solve the problem. Verification: Checking that the implementation solves the original specification. In numerical problems, this is difficult because most of the time you don t know what the correct answer is. 25
26 Example case How do you solve the sum of integers problem? S = n i= 0 i a) Simplest sum = N Coded specifically for specific values of N. 26
27 Possible solutions b) Intermediate solution Does not require much thought, takes advantage of looping ability of most languages: C/C++: MATLAB 27
28 Possible solutions c) Analytical solution Requires some thought about the sequence remember back to one of your math classes. sum = n* ( n + 1) 2 28
29 Verification of algorithm What can fail in the above algorithms. (To know all the possible failure modes requires knowledge of how computers work). Some examples of failures are: For (b): This algorithm is fairly robust. But, when N is large execution will be slow compared to (c) 29
30 Algorithm (c) This is most common algorithm for this type of problem, and it has many potential failure modes. For example: (c.1) What if N is less than zero? Still returns an answer but not what would be expected. (What happens in (b) if N is negative?). 30
31 Algorithm (c) (c.2) In which order will the multiplication and division be done. For all values of N, either N or N+1 will be even and therefore N*(N+1) will always be even but what if the division is done first? Algorithm will work half of the time. If division is done first and N+1 is odd, the algorithm will return a result but it will not be correct. This is a bug. For verification, it means the algorithm works sometimes but not always. 31
32 Algorithm (c) (c.3) What if N is very large? What is the maximum value N*(N+1) can have? There are maximum values that integers can be represented in a computer and we may overflow. What happens then? Can we code this to handle large values of N? 32
33 Verification By breaking the program into small modules, each of which can be checked, the sum of the parts is likely to be correct but not always.. Problems can be that the program only works some of the time or it may not work on all platforms. The critical issue to realize all possible cases that might occur. 33
34 Introduction to error analysis Error is the difference between the exact solution and a numerical method solution In most cases, you don t know what the exact solution is, so how do you calculate the error Error analysis is the process of predicting what the error will be even if you don t know what the exact solution Errors can also be introduced by the fact that the numerical algorithm has been implemented on a computer 34
35 Significant digits Can a number be used with confidence? How accurate is the number? How many digits of the number do we trust? 35
36 Significant digits Can the speed be estimated to one decimal place? 36
37 Significant digits The significant digits of a number are those that can be used with confidence The digits that are known with certainty plus one estimated digit zeros are not always significant digits , , x10 4, 4.530x10 4, x10 4 Exact numbers vs. measured numbers Exact numbers have an infinite number of significant digits π is an exact number but usually subject to round-off 37
38 Significant digits 38
39 Accuracy and precision Accuracy is how close a computed or measured value is to the true value Precision is how close individual computed or measured values agree with each other Reproducibility Inaccuracy/Bias vs. Imprecision/Uncertainty Inaccuracy: systematic deviation from the truth imprecision: magnitude of the scatter 39
40 Accuracy and precision 40
41 Accuracy and precision The level of accuracy and precision required depend on the problem Error to represent both the inaccuracy and imprecision of predictions 41
42 Error definitions Two general types of errors Truncation errors due to approximations of exact mathematical functions Round-off errors due to limited significant digit representation of exact numbers E t = true value approximation 42
43 Error definitions E t does not capture the order of magnitude of error 1V error probably doesn t matter if you re measuring line voltage, but it does matter if you re measuring the voltage supply to a VLSI chip Therefore, its better to normalize the error relative to the value 43
44 Error definitions Example: Line voltage Chip supply voltage 44
45 Error definitions What if we don t know the true value? Use an approximation of the true value a How do we calculate the approximate error? Use an iterative approach Approximate error = current approximation previous approximation Assumes that the iteration will converge 45
46 Error Definitions For most problems, we are interested in keeping the error less than specified error tolerance How many iterations do you do, before you re satisfied that the result is correct to at least n significant digits? 46
47 Example Infinite series expansion of e x As we add terms to the expansion, the expression becomes more exact Using this series expansion, can we calculate e 0.5 to three significant digits? 47
48 Example Calculate the error tolerance First approximation Second approximation Error approximation 48
49 Example Third approximation Error approximation 49
50 Example 50
51 Next class HW1, due 9/8 Chapra & Canale 6 th Edition 1.8 (typo: dy/dx -> dy/dt), 1.12, 2.5 (choose order n=6), 2.14 Next class Continue on error analysis 51
Scientific Computing. Error Analysis
ECE257 Numerical Methods and Scientific Computing Error Analysis Today s s class: Introduction to error analysis Approximations Round-Off Errors Introduction Error is the difference between the exact solution
More informationLecture Objectives. Structured Programming & an Introduction to Error. Review the basic good habits of programming
Structured Programming & an Introduction to Error Lecture Objectives Review the basic good habits of programming To understand basic concepts of error and error estimation as it applies to Numerical Methods
More informationLECTURE 0: Introduction and Background
1 LECTURE 0: Introduction and Background September 10, 2012 1 Computational science The role of computational science has become increasingly significant during the last few decades. It has become the
More informationMatlab Advanced Programming. Matt Wyant University of Washington
Matlab Advanced Programming Matt Wyant University of Washington Matlab as a programming Language Strengths (as compared to C/C++/Fortran) Fast to write -no type declarations needed Memory allocation/deallocation
More informationIntroduction to Computer Programming with MATLAB Calculation and Programming Errors. Selis Önel, PhD
Introduction to Computer Programming with MATLAB Calculation and Programming Errors Selis Önel, PhD Today you will learn Numbers, Significant figures Error analysis Absolute error Relative error Chopping
More informationIntroduction to Computational Mathematics
Introduction to Computational Mathematics Introduction Computational Mathematics: Concerned with the design, analysis, and implementation of algorithms for the numerical solution of problems that have
More informationChapter 1. Numeric Artifacts. 1.1 Introduction
Chapter 1 Numeric Artifacts 1.1 Introduction Virtually all solutions to problems in electromagnetics require the use of a computer. Even when an analytic or closed form solution is available which is nominally
More informationBasics of Computation. PHY 604:Computational Methods in Physics and Astrophysics II
Basics of Computation Basics of Computation Computers store information and allow us to operate on it. That's basically it. Computers have finite memory, so it is not possible to store the infinite range
More informationNumerical computing. How computers store real numbers and the problems that result
Numerical computing How computers store real numbers and the problems that result The scientific method Theory: Mathematical equations provide a description or model Experiment Inference from data Test
More informationhttps://asd-pa.perfplusk12.com/admin/admin_curric_maps_display.aspx?m=5507&c=618&mo=18917&t=191&sy=2012&bl...
Page 1 of 13 Units: - All - Teacher: ProgIIIJavaI, CORE Course: ProgIIIJavaI Year: 2012-13 Intro to Java How is data stored by a computer system? What does a compiler do? What are the advantages of using
More informationIntroduction. C provides two styles of flow control:
Introduction C provides two styles of flow control: Branching Looping Branching is deciding what actions to take and looping is deciding how many times to take a certain action. Branching constructs: if
More informationTruncation Errors. Applied Numerical Methods with MATLAB for Engineers and Scientists, 2nd ed., Steven C. Chapra, McGraw Hill, 2008, Ch. 4.
Chapter 4: Roundoff and Truncation Errors Applied Numerical Methods with MATLAB for Engineers and Scientists, 2nd ed., Steven C. Chapra, McGraw Hill, 2008, Ch. 4. 1 Outline Errors Accuracy and Precision
More informationProgramming Languages and Program Development Life Cycle Fall Introduction to Information and Communication Technologies CSD 102
Programming Languages and Program Development Life Cycle Fall 2016 Introduction to Information and Communication Technologies CSD 102 Outline The most common approaches to program design and development
More informationCSc 10200! Introduction to Computing. Lecture 1 Edgardo Molina Fall 2013 City College of New York
CSc 10200! Introduction to Computing Lecture 1 Edgardo Molina Fall 2013 City College of New York 1 Introduction to Computing Lectures: Tuesday and Thursday s (2-2:50 pm) Location: NAC 1/202 Recitation:
More informationMATLAB is a multi-paradigm numerical computing environment fourth-generation programming language. A proprietary programming language developed by
1 MATLAB is a multi-paradigm numerical computing environment fourth-generation programming language. A proprietary programming language developed by MathWorks In 2004, MATLAB had around one million users
More informationMethod & Tools for Program Analysis & Design
Method & Tools for Program Analysis & Design TMB208 Pemrograman Teknik Kredit: 3 (2-3) 1 Programming Logic and Design, Introductory, Fourth Edition 2 1 Programming Methods Based on structures of programming
More informationRepetition Structures Chapter 9
Sum of the terms Repetition Structures Chapter 9 1 Value of the Alternating Harmonic Series 0.9 0.8 0.7 0.6 0.5 10 0 10 1 10 2 10 3 Number of terms Objectives After studying this chapter you should be
More informationOur Strategy for Learning Fortran 90
Our Strategy for Learning Fortran 90 We want to consider some computational problems which build in complexity. evaluating an integral solving nonlinear equations vector/matrix operations fitting data
More informationC++ Programming Language Lecture 2 Problem Analysis and Solution Representation
C++ Programming Language Lecture 2 Problem Analysis and Solution Representation By Ghada Al-Mashaqbeh The Hashemite University Computer Engineering Department Program Development Cycle Program development
More informationApproximations and Errors
The Islamic University of Gaza Faculty of Engineering Civil Engineering Department Numerical Analysis ECIV 3306 Chapter 3 Approximations and Errors Associate Prof. Mazen Abualtayef Civil Engineering Department,
More informationWe deliver Global Engineering Solutions. Efficiently. This page contains no technical data Subject to the EAR or the ITAR
Numerical Computation, Statistical analysis and Visualization Using MATLAB and Tools Authors: Jamuna Konda, Jyothi Bonthu, Harpitha Joginipally Infotech Enterprises Ltd, Hyderabad, India August 8, 2013
More informationOutline. Program development cycle. Algorithms development and representation. Examples.
Outline Program development cycle. Algorithms development and representation. Examples. 1 Program Development Cycle Program development cycle steps: Problem definition. Problem analysis (understanding).
More informationComputing Seminar Introduction Oct
Computing Seminar Introduction Oct 6 2010 Outline today Programming/computing basics terminology, high level concepts (variables, control flow, input/output) Before next week... Make sure you can login
More informationSelec%on and Decision Structures in Java: If Statements and Switch Statements CSC 121 Fall 2016 Howard Rosenthal
Selec%on and Decision Structures in Java: If Statements and Switch Statements CSC 121 Fall 2016 Howard Rosenthal Lesson Goals Understand Control Structures Understand how to control the flow of a program
More informationCoding and Unit Testing! The Coding Phase! Coding vs. Code! Coding! Overall Coding Language Trends!
Requirements Spec. Design Coding and Unit Testing Characteristics of System to be built must match required characteristics (high level) Architecture consistent views Software Engineering Computer Science
More informationAn interesting related problem is Buffon s Needle which was first proposed in the mid-1700 s.
Using Monte Carlo to Estimate π using Buffon s Needle Problem An interesting related problem is Buffon s Needle which was first proposed in the mid-1700 s. Here s the problem (in a simplified form). Suppose
More informationChapter 7. Iteration. 7.1 Multiple assignment
Chapter 7 Iteration 7.1 Multiple assignment You can make more than one assignment to the same variable; effect is to replace the old value with the new. int bob = 5; System.out.print(bob); bob = 7; System.out.println(bob);
More information2 Computation with Floating-Point Numbers
2 Computation with Floating-Point Numbers 2.1 Floating-Point Representation The notion of real numbers in mathematics is convenient for hand computations and formula manipulations. However, real numbers
More informationHow to approach a computational problem
How to approach a computational problem A lot of people find computer programming difficult, especially when they first get started with it. Sometimes the problems are problems specifically related to
More informationGetting Started with MATLAB
Getting Started with MATLAB Math 315, Fall 2003 Matlab is an interactive system for numerical computations. It is widely used in universities and industry, and has many advantages over languages such as
More informationIntroduction Objectives: 1) differentiate between high-level, low-level, and machine language; 2) explain why it is necessary to translate a program
Introduction Objectives: 1) differentiate between high-level, low-level, and machine language; 2) explain why it is necessary to translate a program written in a high-level programming language into machine
More informationIntroduction to Scientific Computing with Matlab
Introduction to Scientific Computing with Matlab Matlab is an interactive system for numerical computations. It is widely used in universities and industry, and has many advantages over languages such
More informationFlow Control: Branches and loops
Flow Control: Branches and loops In this context flow control refers to controlling the flow of the execution of your program that is, which instructions will get carried out and in what order. In the
More informationTest Automation Beyond Regression Testing
Test Automation Beyond Regression Testing Doug Hoffman, BA, MBA, MSEE, ASQ-CSQE Software Quality Methods, LLC. (SQM) www.softwarequalitymethods.com doug.hoffman@acm.org STPCon Spring 2008 Why Automate
More informationTesting! Prof. Leon Osterweil! CS 520/620! Spring 2013!
Testing Prof. Leon Osterweil CS 520/620 Spring 2013 Relations and Analysis A software product consists of A collection of (types of) artifacts Related to each other by myriad Relations The relations are
More information(Refer Slide Time: 02:59)
Numerical Methods and Programming P. B. Sunil Kumar Department of Physics Indian Institute of Technology, Madras Lecture - 7 Error propagation and stability Last class we discussed about the representation
More informationCSC 121 Spring 2017 Howard Rosenthal
CSC 121 Spring 2017 Howard Rosenthal Agenda To be able to define computer program, algorithm, and highlevel programming language. To be able to list the basic stages involved in writing a computer program.
More informationChapter 2. Designing a Program. Input, Processing, and Output Fall 2016, CSUS. Chapter 2.1
Chapter 2 Input, Processing, and Output Fall 2016, CSUS Designing a Program Chapter 2.1 1 Algorithms They are the logic on how to do something how to compute the value of Pi how to delete a file how to
More informationProgramming for Engineers Iteration
Programming for Engineers Iteration ICEN 200 Spring 2018 Prof. Dola Saha 1 Data type conversions Grade average example,-./0 class average = 23450-67 893/0298 Grade and number of students can be integers
More informationInteractive MATLAB use. Often, many steps are needed. Automated data processing is common in Earth science! only good if problem is simple
Chapter 2 Interactive MATLAB use only good if problem is simple Often, many steps are needed We also want to be able to automate repeated tasks Automated data processing is common in Earth science! Automated
More informationScientific Programming in C VI. Common errors
Scientific Programming in C VI. Common errors Susi Lehtola 6 November 2012 Beginner errors If you re a beginning C programmer, you might often make off-by one errors when you use arrays: #i n c l u de
More informationSKILL AREA 304: Review Programming Language Concept. Computer Programming (YPG)
SKILL AREA 304: Review Programming Language Concept Computer Programming (YPG) 304.1 Demonstrate an Understanding of Basic of Programming Language 304.1.1 Explain the purpose of computer program 304.1.2
More informationPIETRO, GIORGIO & MAX ROUNDING ESTIMATING, FACTOR TREES & STANDARD FORM
PIETRO, GIORGIO & MAX ROUNDING ESTIMATING, FACTOR TREES & STANDARD FORM ROUNDING WHY DO WE ROUND? We round numbers so that it is easier for us to work with. We also round so that we don t have to write
More informationIntroduction to Programming in C Department of Computer Science and Engineering. Lecture No. #17. Loops: Break Statement
Introduction to Programming in C Department of Computer Science and Engineering Lecture No. #17 Loops: Break Statement (Refer Slide Time: 00:07) In this session we will see one more feature that is present
More informationSTEPHEN WOLFRAM MATHEMATICADO. Fourth Edition WOLFRAM MEDIA CAMBRIDGE UNIVERSITY PRESS
STEPHEN WOLFRAM MATHEMATICADO OO Fourth Edition WOLFRAM MEDIA CAMBRIDGE UNIVERSITY PRESS Table of Contents XXI a section new for Version 3 a section new for Version 4 a section substantially modified for
More informationSelec%on and Decision Structures in Java: If Statements and Switch Statements CSC 121 Spring 2016 Howard Rosenthal
Selec%on and Decision Structures in Java: If Statements and Switch Statements CSC 121 Spring 2016 Howard Rosenthal Lesson Goals Understand Control Structures Understand how to control the flow of a program
More informationLecture Transcript While and Do While Statements in C++
Lecture Transcript While and Do While Statements in C++ Hello and welcome back. In this lecture we are going to look at the while and do...while iteration statements in C++. Here is a quick recap of some
More informationBits, Words, and Integers
Computer Science 52 Bits, Words, and Integers Spring Semester, 2017 In this document, we look at how bits are organized into meaningful data. In particular, we will see the details of how integers are
More informationFloating-point representation
Lecture 3-4: Floating-point representation and arithmetic Floating-point representation The notion of real numbers in mathematics is convenient for hand computations and formula manipulations. However,
More information3.5 Floating Point: Overview
3.5 Floating Point: Overview Floating point (FP) numbers Scientific notation Decimal scientific notation Binary scientific notation IEEE 754 FP Standard Floating point representation inside a computer
More informationChapter 1. Math review. 1.1 Some sets
Chapter 1 Math review This book assumes that you understood precalculus when you took it. So you used to know how to do things like factoring polynomials, solving high school geometry problems, using trigonometric
More informationA Multiple-Precision Division Algorithm
Digital Commons@ Loyola Marymount University and Loyola Law School Mathematics Faculty Works Mathematics 1-1-1996 A Multiple-Precision Division Algorithm David M. Smith Loyola Marymount University, dsmith@lmu.edu
More informationReading Assignment. Lazy Evaluation
Reading Assignment Lazy Evaluation MULTILISP: a language for concurrent symbolic computation, by Robert H. Halstead (linked from class web page Lazy evaluation is sometimes called call by need. We do an
More informationExpressions and Casting. Data Manipulation. Simple Program 11/5/2013
Expressions and Casting C# Programming Rob Miles Data Manipulation We know that programs use data storage (variables) to hold values and statements to process the data The statements are obeyed in sequence
More information2.0 MATLAB Fundamentals
2.0 MATLAB Fundamentals 2.1 INTRODUCTION MATLAB is a computer program for computing scientific and engineering problems that can be expressed in mathematical form. The name MATLAB stands for MATrix LABoratory,
More information2 Computation with Floating-Point Numbers
2 Computation with Floating-Point Numbers 2.1 Floating-Point Representation The notion of real numbers in mathematics is convenient for hand computations and formula manipulations. However, real numbers
More informationUp next. Midterm. Today s lecture. To follow
Up next Midterm Next Friday in class Exams page on web site has info + practice problems Excited for you to rock the exams like you have been the assignments! Today s lecture Back to numbers, bits, data
More information2.1.1 Fixed-Point (or Integer) Arithmetic
x = approximation to true value x error = x x, relative error = x x. x 2.1.1 Fixed-Point (or Integer) Arithmetic A base 2 (base 10) fixed-point number has a fixed number of binary (decimal) places. 1.
More informationMark Important Points in Margin. Significant Figures. Determine which digits in a number are significant.
Knowledge/Understanding: How and why measurements are rounded. Date: How rounding and significant figures relate to precision and uncertainty. When significant figures do not apply. Skills: Determine which
More informationComputational Methods of Scientific Programming. Lecturers Thomas A Herring Chris Hill
12.010 Computational Methods of Scientific Programming Lecturers Thomas A Herring Chris Hill Review of Lecture 2 Examined computer hardware Computer basics and the main features of programs Program design:
More informationExpressions and Casting
Expressions and Casting C# Programming Rob Miles Data Manipulation We know that programs use data storage (variables) to hold values and statements to process the data The statements are obeyed in sequence
More informationCS102 Unit 2. Sets and Mathematical Formalism Programming Languages and Simple Program Execution
1 CS102 Unit 2 Sets and Mathematical Formalism Programming Languages and Simple Program Execution 2 Review Show how "Hi!\n" would be stored in the memory below Use decimal to represent each byte Remember
More informationChapter 6 Programming the LC-3
Chapter 6 Programming the LC-3 Based on slides McGraw-Hill Additional material 4/5 Lewis/Martin Aside: Booting the Computer How does it all begin? We have LC-3 hardware and a program, but what next? Initial
More informationFortran 90 Two Commonly Used Statements
Fortran 90 Two Commonly Used Statements 1. DO Loops (Compiled primarily from Hahn [1994]) Lab 6B BSYSE 512 Research and Teaching Methods The DO loop (or its equivalent) is one of the most powerful statements
More informationPhysics 331 Introduction to Numerical Techniques in Physics
Physics 331 Introduction to Numerical Techniques in Physics Instructor: Joaquín Drut Lecture 2 Any logistics questions? Today: Number representation Sources of error Note: typo in HW! Two parts c. Call
More informationComputing and compilers
Computing and compilers Comp Sci 1570 to Outline 1 2 3 4 5 Evaluate the difference between hardware and software Find out about the various types of software Get a high level understanding of how program
More informationMAT128A: Numerical Analysis Lecture Two: Finite Precision Arithmetic
MAT128A: Numerical Analysis Lecture Two: Finite Precision Arithmetic September 28, 2018 Lecture 1 September 28, 2018 1 / 25 Floating point arithmetic Computers use finite strings of binary digits to represent
More informationIntegers are whole numbers; they include negative whole numbers and zero. For example -7, 0, 18 are integers, 1.5 is not.
What is an INTEGER/NONINTEGER? Integers are whole numbers; they include negative whole numbers and zero. For example -7, 0, 18 are integers, 1.5 is not. What is a REAL/IMAGINARY number? A real number is
More informationFloating Point. What can be represented in N bits? 0 to 2N-1. 9,349,398,989,787,762,244,859,087, x 1067
MIPS Floating Point Operations Cptr280 Dr Curtis Nelson Floating Point What can be represented in N bits? Unsigned 2 s Complement 0 to 2N-1-2N-1 to 2N-1-1 But, what about- Very large numbers? 9,349,398,989,787,762,244,859,087,678
More informationControl Flow. COMS W1007 Introduction to Computer Science. Christopher Conway 3 June 2003
Control Flow COMS W1007 Introduction to Computer Science Christopher Conway 3 June 2003 Overflow from Last Time: Why Types? Assembly code is typeless. You can take any 32 bits in memory, say this is an
More informationStructure Array 1 / 50
Structure Array A structure array is a data type that groups related data using data containers called fields. Each field can contain any type of data. Access data in a structure using dot notation of
More informationLecture 03 Approximations, Errors and Their Analysis
AM702 Applied Computational Methods c ecture 03 Approximations, rrors and heir Analysis Approximations and rrors c Approximation is unavoidable in mathematical modeling the real world phenomena Approximation
More informationControl Statements. Objectives. ELEC 206 Prof. Siripong Potisuk
Control Statements ELEC 206 Prof. Siripong Potisuk 1 Objectives Learn how to change the flow of execution of a MATLAB program through some kind of a decision-making process within that program The program
More informationIteration. # a and b are now equal # a and b are no longer equal Multiple assignment
Iteration 6.1. Multiple assignment As you may have discovered, it is legal to make more than one assignment to the same variable. A new assignment makes an existing variable refer to a new value (and stop
More informationAlgorithms. Abdelghani Bellaachia, CSCI 1121 Page: 1
Algorithms 1. Objectives... 2 2. Design You Solution... 2 3. Structure of an algorithm:... 3 4. Pseudocode:... 4 5. Example... 5 6. Selection or Conditional Execution... 8 7. Looping or Iteration... 9
More informationFlow Chart & Algorithms
Flow Chart Algorithms Planning Your Code Page 1 Page 4 See Appendix A, for Licensing Attribution information by-nc-sa-3.0 https://creativecommons.org/licenses/by-nc-sa/3.0/ https://creativecommons.org/faq/#what-does-some-rights-reserved-mean
More informationMAT 003 Brian Killough s Instructor Notes Saint Leo University
MAT 003 Brian Killough s Instructor Notes Saint Leo University Success in online courses requires self-motivation and discipline. It is anticipated that students will read the textbook and complete sample
More informationNational Numeracy and Mathematics Progression Framework BEGIN
National Numeracy and Mathematics Progression Framework BEGIN Main menu Please choose an organiser below to find out more: National Numeracy Progression Framework ESTIMATION AND ROUNDING NUMBER AND NUMBER
More informationTesting. UW CSE 160 Winter 2016
Testing UW CSE 160 Winter 2016 1 Testing Programming to analyze data is powerful It s useless (or worse!) if the results are not correct Correctness is far more important than speed 2 Famous examples Ariane
More informationCS 542G: Preliminaries, Floating-Point, Errors
CS 542G: Preliminaries, Floating-Point, Errors Robert Bridson September 8, 2008 1 Preliminaries The course web-page is at: http://www.cs.ubc.ca/ rbridson/courses/542g. Details on the instructor, lectures,
More informationMATH2070: LAB 3: Roots of Equations
MATH2070: LAB 3: Roots of Equations 1 Introduction Introduction Exercise 1 A Sample Problem Exercise 2 The Bisection Idea Exercise 3 Programming Bisection Exercise 4 Variable Function Names Exercise 5
More informationIslamic University of Gaza Computer Engineering Dept. C++ Programming. For Industrial And Electrical Engineering By Instructor: Ruba A.
Islamic University of Gaza Computer Engineering Dept. C++ Programming For Industrial And Electrical Engineering By Instructor: Ruba A. Salamh Chapter Four: Loops 2 Chapter Goals To implement while, for
More informationn! = 1 * 2 * 3 * 4 * * (n-1) * n
The Beauty and Joy of Computing 1 Lab Exercise 9: Problem self-similarity and recursion Objectives By completing this lab exercise, you should learn to Recognize simple self-similar problems which are
More information10.1. Unit 10. Signed Representation Systems Binary Arithmetic
0. Unit 0 Signed Representation Systems Binary Arithmetic 0.2 BINARY REPRESENTATION SYSTEMS REVIEW 0.3 Interpreting Binary Strings Given a string of s and 0 s, you need to know the representation system
More informationPROBLEM SOLVING AND PYTHON PROGRAMMING
ALGORITHM UNIT-1 It is defined as a sequence of instructions that describe a method for solving a problem. In other words it is a step by step procedure for solving a problem. Properties of Algorithms
More informationVariable A variable is a value that can change during the execution of a program.
Declare and use variables and constants Variable A variable is a value that can change during the execution of a program. Constant A constant is a value that is set when the program initializes and does
More informationCS321 Introduction To Numerical Methods
CS3 Introduction To Numerical Methods Fuhua (Frank) Cheng Department of Computer Science University of Kentucky Lexington KY 456-46 - - Table of Contents Errors and Number Representations 3 Error Types
More informationA Multiple -Precision Division Algorithm. By David M. Smith
A Multiple -Precision Division Algorithm By David M. Smith Abstract. The classical algorithm for multiple -precision division normalizes digits during each step and sometimes makes correction steps when
More informationDivide: Paper & Pencil
Divide: Paper & Pencil 1001 Quotient Divisor 1000 1001010 Dividend -1000 10 101 1010 1000 10 Remainder See how big a number can be subtracted, creating quotient bit on each step Binary => 1 * divisor or
More informationdepicts pictorially schematic representation of an algorithm document algorithms. used in designing or documenting
Definition A flowchart depicts pictorially the sequence in which instructions are carried out in an algorithm. A flowchart is a schematic representation of an algorithm or a stepwise process, showing the
More informationProgramming Fundamentals - A Modular Structured Approach using C++ By: Kenneth Leroy Busbee
1 0 1 0 Foundation Topics 1 0 Chapter 1 - Introduction to Programming 1 1 Systems Development Life Cycle N/A N/A N/A N/A N/A N/A 1-8 12-13 1 2 Bloodshed Dev-C++ 5 Compiler/IDE N/A N/A N/A N/A N/A N/A N/A
More informationPseudo Code and Flow Charts. Chapter 1 Lesson 2
Pseudo Code and Flow Charts Chapter 1 Lesson 2 Pseudocode Using Pseudocode Statements and Flowchart Symbols English-like representation of the logical steps it takes to solve a problem Flowchart Pictorial
More informationTable of Contents. Introduction.*.. 7. Part /: Getting Started With MATLAB 5. Chapter 1: Introducing MATLAB and Its Many Uses 7
MATLAB Table of Contents Introduction.*.. 7 About This Book 1 Foolish Assumptions 2 Icons Used in This Book 3 Beyond the Book 3 Where to Go from Here 4 Part /: Getting Started With MATLAB 5 Chapter 1:
More information4.1 QUANTIZATION NOISE
DIGITAL SIGNAL PROCESSING UNIT IV FINITE WORD LENGTH EFFECTS Contents : 4.1 Quantization Noise 4.2 Fixed Point and Floating Point Number Representation 4.3 Truncation and Rounding 4.4 Quantization Noise
More information1.1 - Functions, Domain, and Range
1.1 - Functions, Domain, and Range Lesson Outline Section 1: Difference between relations and functions Section 2: Use the vertical line test to check if it is a relation or a function Section 3: Domain
More informationSECTION 5: STRUCTURED PROGRAMMING IN MATLAB. ENGR 112 Introduction to Engineering Computing
SECTION 5: STRUCTURED PROGRAMMING IN MATLAB ENGR 112 Introduction to Engineering Computing 2 Conditional Statements if statements if else statements Logical and relational operators switch case statements
More informationSolving Equations with Inverse Operations
Solving Equations with Inverse Operations Math 97 Supplement LEARNING OBJECTIVES 1. Solve equations by using inverse operations, including squares, square roots, cubes, and cube roots. The Definition of
More informationMeasurements: Significant Figures
Measurements: Significant Figures Significant figures: all digits in a number representing data or results that are known with certainty plus one uncertain digit. Ruler A: The last digit in a number associated
More informationCS 1313 Spring 2000 Lecture Outline
1. What is a Computer? 2. Components of a Computer System Overview of Computing, Part 1 (a) Hardware Components i. Central Processing Unit ii. Main Memory iii. The Bus iv. Loading Data from Main Memory
More informationRoundoff Errors and Computer Arithmetic
Jim Lambers Math 105A Summer Session I 2003-04 Lecture 2 Notes These notes correspond to Section 1.2 in the text. Roundoff Errors and Computer Arithmetic In computing the solution to any mathematical problem,
More information