Allocating Storage for 1-Dimensional Arrays

Size: px
Start display at page:

Download "Allocating Storage for 1-Dimensional Arrays"

Transcription

1 Allocating Storage for 1-Dimensional Arrays Recall that if we know beforehand what size we want an array to be, then we allocate storage in the declaration statement, e.g., real, dimension (100 ) :: temperatures However, sometimes we have to perform some calculations or have some values read in before we know an array s size Fortran 90 allows us to allocate storage during run time. In Fortran 77 if we didn t know the size of the array we had to estimate the size (and usually make it a little larger for safety). We still must declare the array as real, integer, etc. and we must tell the compiler that we are going to allocate its size during execution. Also we must declare the shape of the array. The declaration statement now becomes

2 real, dimension (:), allocatable :: temperatures The specifier allocatable tells the compiler we will be setting aside memory for this array during execution. The specifier dimension (:) tells the compiler that this is going to be a one-dimensional array, i.e., it gives the shape of the array. Later we will be looking at two-dimensional and higher arrays. Being able to allocate and release memory during execution is an extremely valuable tool because it allows us to save on storage. How do we allocate the memory during execution? through the use of the allocate statement How do we release memory during execution? through the use of the deallocate statement

3 The allocate/deallocate statements When we declare an array as allocatable, then we are telling the compiler that we will be allocating space during execution. Suppose that we have done some calculations and have determined that the entries of our array temperatures should range from 1 to n where n is the result of the calculations. Then to allocate the array we use allocate ( temperatures (n) ) or equivalently allocate ( temperatures (1:n) ) If we want to allocate more than one array we can put them in separate statements or we can put them in one allocate statement by making a list such as allocate (a(1:n), b(1:n) ) Each of these arrays must be initially declared as allocatable and we must

4 use the dimension specifier dimension (:) an error message.. Otherwise you will receive Where do we put the allocate statement? Basically, anyplace in the executable statements before we need to access the array. Since storage is an issue when we do large scale computations, it is good programming practice to release the storage of an array when we no longer need it. If we don t do this, the storage will be used until the execution of the program is terminated. To do this, we use the deallocate statement. For example, deallocate ( temperatures, a, b ) deallocates the 3 arrays listed. Note that we do not have to indicate their size when we deallocate them.

5 Our Fibonacci example revisited Here we are going to rewrite our example where now we are going to allocate storage for the sequence of numbers during execution. program fibonacci implicit none integer, dimension (:), allocatable :: fib sequence integer :: k,n terms print *, " enter number of terms in Fibonacci sequence" read *, n terms allocate ( fib sequence(1:n terms) )

6 fib sequence(1) = 0 if ( n terms > 1 ) then fib sequence(2) = 1 do k = 3, n terms fib sequence(k) = fib sequence(k-1) + fib sequence(k-2) end do else print *, "number of terms in sequence set to 1" end if deallocate ( fib sequence)

7 end program fibonacci

8 Operations on Vectors Addition and subtraction of vectors. This is done by adding/subtracting the corresponding components, i.e., for a, b R n c = a + b = (a 1 + b 1, a 2 + b 2,, a n + b n ) In fortran we can write c = a + b where the arrays have been dimensioned by real, dimension(n) :: a, b, c However, I prefer the following so that we are explicit that these are arrays and which entries we are modifying. c(1:n) = a(1:n) + b(1:n)

9 If a,b,c are vectors of length n and we just want to add the first m components with m < n then we can write c(1:m) = a(1:m) + b(1:m) Multiplication by a scalar To multiply the vector a by a scalar k, we simply multiply each component by k, i.e., In fortran we write c = k*a or more explicitly c(1:n) = k*a(1:n) c = k a = (ka 1, ka 2,, ka n ) Here k needs to be declared as a real number since the array a was declared as real (we don t use mixed arithmetic).

10 The dot product of two vectors Recall that the dot or scalar product of two vectors is a scalar which can be found by summing the product of their components, i.e., n c = a b = a i b i = a 1 b 1 + a 2 b a n b n i=1 This dot product is also useful when we want to determine the Euclidean length of a vector, i.e., a measure of its size a a We will be especially interested in this length if a represents a vector whose components represent components of the error we are making. Fortran has an intrinsic subprogram for computing the dot product of two one-dimensional arrays of the same length. c = dot product (a, b ) If arrays a and b are not of the same length, then you will get an error message. If arrays a and b are not one-dimensional arrays you will get an error.

11 Other Intrinsic Array-Processing Subprograms Fortran 90 has several other intrinsic functions for processing one-dimensional arrays. maxval (a ) This returns the maximum (not in absolute value) value in the given array. For example a= (/ 1.0, 3.0, -2.0,-5.0, 3.0 /) value = maxval (a ) returns the value 3.0 maxloc (a ) This returns a one-dimensional array containing one element whose value is the position of the first occurrence of the maximum value in a. This is an integer. For example

12 integer, dimension(1) :: location = maxloc (a ) location returns the integer location 2 since this is the first occurrence of the max value 3.0 minval(a), minloc (a) are defined analogously. product (a) i.e., returns the product (a scalar) of the elements of the array, a 1 a 2 a n size (a) returns the number of elements in the array. This can be useful because it can give us the option of not passing the size of a one-dimensional array to a subprogram. sum (a) returns the sum (a scalar) of the entries of the array, i.e., a 1 + a a n

13 Example - Finding the mean of a list Suppose we have a 1-dimensional array of real numbers which represents scores throughout the semester. For example, integer, parameter :: n = 9 real, dimension(n) :: scores scores=(\ 75, 92, 81, 68, 85, 89, 82, 77, 75 \) We can average the scores with the sum intrinsic function. average = sum(scores)/(float(n) 100)

14 Other Operations on Vectors For vectors in R 3 we can take the cross product which results in another vector c = a b = (a 2 b 3 a 3 b 2, a 3 b 1 a 1 b 3, a 1 b 2 a 2 b 1 ) Fortran does not have an intrinsic routine for the cross product. We can find the angle, θ, between two vectors from the formula so in fortran we could write cos θ = a b a b theta = acos( dot product(a, b)/ & ( sqrt(dot product(a, a)) sqrt(dot product(b, b)) ) ) where recall that acos is the arccosine; e.g., arccosine(1) = 0 that is, the angle whose cosine is one is zero degrees.

15 There are a myriad of vector identities that can also be determined. We have seen that we can find the Euclidean length of a vector by taking the square root of the dot product of the vector with itself. There are other ways to quantify the length of a vector.

16 Classwork Write a program test vectors.f90 to set n as an integer parameter, say n = 4 and dimension real arrays a, b by n. Set the values of array a to be (1., 2., 3., 5.) by using the syntax a = (/ /) Print out all of a using the format 4f12.4 Print out only the first 2 components of a in an unformatted write. Set the one-dimensional array b to zero. Then reset the second element to -2 and the fourth entry to one and print out. Declare a new 1-dimensional array c as allocatable. Then read in the value 4 for the dimension of the array and then allocate it. Add code to set c = 2 a 1 2 b and print out c.

17 Add code to modify the vector a so that its first three components are multiplied by 2. Print out a to verify that the change has been properly made. Redefine c as c = a b and print out c. Add code to compute the length of c = c c and print the length.

18 Review of Vectors We first stated that vectors or one-dimensional arrays will be a useful data structure. All entries of the array must be of the same type; e.g., integer, real, etc. Syntax for setting aside memory for our one-dimensional array: Compile time example real, dimension(n) :: where n has been defined. Run time example real, allocatable, dimension(:) :: a allocate ( a (n) ) deallocate ( a ) We accessed a particular element in our array by, for example a

19 print *, a(5) or a section of an array print *, a(10:20) We can set the values of an array in several ways. We can read them from a file, hard wire them (as a(1)=1.2 ) or assign all entries using format a = (/ 1.0, 2.0, -3.0 /) Next we became familiar with some simple operations with vectors. c(1:n) = a(1:n) + b(1:n) c(1:n) = k * a(1:n) We also looked at some intrinsic subprograms in fortran whose arguments are one-dimensional arrays. These include dot product( a(1:n), b(1:n) maxval(a) size(a)

20 Vector Norms An important part of scientific computing is validation that your program is working properly. One way to do this is to compare your computational errors to expected theoretical errors or rates of convergence. In the last section for nonlinear equations we looked at the rate of convergence of a method and could compare this with the theoretical rates. In many cases we will have an error vector instead of a single scalar error (which we had in our nonlinear problems). From this vector we would like to obtain a single non-negative number. There are many ways to do this and which measure of the error you use can depend on what error you are trying to control. A vector norm will be a quantification of a vector in some sense.

21 How will we denote a norm? Commonly we use the notation a A subscript is usually added to indicate which norm, e.g., a 2. What properties do we want a norm to possess? Since the norm will be some measure of the length of a vector, the norm should always be 0 and only = 0 if the vector is the zero vector. The norm of a scalar times a vector, i.e., k a, must satisfy k a = k a So if we take a vector and multiply it by -3 then its length should change by 3. The triangle inequality a + b a + b This inequality derives its name from vectors in Euclidean space where in R 2 if a and b are the sides of a triangle, the length of the hypotenuse is less than the sum of the lengths of the two sides.

22 Three Common Vector Norms 1. Probably the most commonly used norm is the standard Euclidean length (sometimes called the l 2 norm ) a 2 = n a 2 i = ( a a a 2 n) 1/2 i=1 When the vector represents an error and we don t normalize this by the norm of the solution, then we must normalize by its length, i.e., a 2 = 1 n a 2 i n Why do we do this? Suppose we have a vector which represents components of our error and all of its components are exactly 0.1; whether the vector has i=1

23 length 10 or 100 we would like this measure of the error, i.e., e 2 to be the same. This will be the case if we normalize as above. For example, for a vector of length 10 ( ) 1/2 = (.1) 1/2 = ( 1 ) 1/2 10 ( ) = 0.1 and for a vector of length 100 ( 1 ) 1/2 ( ) 1/2 = (.1) 1/2 = ( ) = 0.1 However, if we always measure the error in a relative sense by normalizing by the norm of the solution, then this is not necessary. 2. Another commonly used measure is the max norm or the infinity norm a = max i=1,...,n a i

24 3. A third commonly used measure is the one norm a 1 = n a i = i=1 ( ) a 1 + a a n

25 Example Consider the vector v = Then the Euclidean norm, called the l 2 norm and denoted by 2 is given by v 2 = ( 5) 2 = = 30 = The infinity or max norm, denoted is given by v = max i=1,2,3 v i = max{2, 1, 5 } = 5 The one-norm, denoted 1 is given by v 1 = = 8.

26 Passing Arrays to a Subprogram Now we want to write functions to calculate the various norms of a vector. Suppose we want to write a routine to calculate the infinity norm of a vector. Recall that we can not use the intrinsic function maxval because this returns the maximum value but not in absolute value. Consequently, we have to write our own subprogram to do this. If we pass an array to a subprogram then the array must be defined in the calling unit and in the subprogram. When the subprogram is referenced, the first element of the actual array in the calling program is associated with the first element of the corresponding array in the subprogram. Successive array elements are then associated. Of course like variables, the name in the calling program doesn t have to match the array name in the subprogram.

27 To write a routine to calculate the maximum norm, we need to pass the vector whose norm we are going to compute. What about the length of the vector? We could always write function max norm ( x, n) result (norm) integer :: n real, dimension(n) :: x where our declaration statement for the vector x is the usual compile-time declaration. It doesn t matter whether the vector was an allocatable array or not in the calling program. However, Fortran allows us an alternative to passing the size of a one-dimensional array argument to a subprogram. We can simply use an assumed-shape array. For our problem this would be function max norm ( x ) result(norm) integer :: n real, dimension(:), intent(in) :: x

28 Warning: This works for one-dimensional arrays; for higher dimensional arrays we must specify the actual size (more precisely, we can only use an assumed shape for the last dimension) So the safest thing is to send the dimension of the array into the subprogram. Warning: If you need the length of a vector for a do loop then you can not use the size function to get this if you have dimensioned the array in your subprogram with the assumed shape (:). Also when you use intrinsics like dot product with two vectors defined through the assumed shape you must write the command as dot product ( a(1:n), b(1:n) ) instead of dot product (a, b) since the subprogram does not have the explicit value of n. The same is true using commands like maxval, etc. So the safest thing is to send the dimension of the array into the subprogram.

29 Classwork Now return to your code from last time test vectors.f90. First we want to write a function which returns the Euclidean length of a vector. Pass both the vector and its length as arguments to the function. Add this to the program test vector.f90 and test it with the vector c. Add print statements in the main program to output c 2. We want to write a function which computes the max or infinity norm of a vector. Pass both the vector and its length as arguments to the function. Add this to the program test vector.f90 and test it with the vector c.add print statements in the main program to output c. Remove the two functions from the code and put them in a module called norms. Modify your program test vectors.f90 to have access to this module and then compute c 2 and c.

30 Multi-dimensional Arrays In mathematics, we call 2-dimensional arrays as matrices. For example 1 4 A = is 3 by 2 matrix because it has 3 rows and 2 columns. To denote an element of the matrix we write A ij, e.g., A 2,1 = 2 An array in fortran can hold the entries of a matrix or it can just be used to store data. For example, suppose a firm has 10 employees each of whom work part time during the 5-day work week. We could represent their hours worked by a 10 5 array where each row of the array is for a different employee and each column is the number of hours worked; the first column Monday, second

31 column Tuesday, etc How do we dimension a higher dimensional array? Analogous to what we did for a 1-dimensional array. For example, for a 10 5 real array named hours real, dimension(10, 5) :: hours which has 10 5 = 50 storage locations. We can also allocate the storage in real time. real, allocatable, dimension(:, :) :: hours We can also set up integer arrays allocate(hours(10, 5)) integer, dimension(5, 5) :: a sets up an integer array a which has 25 integer storage locations.

32 We can also set up character or logical arrays. character(len = 10), dimension(5, 5) :: employees We can also set up storage arrays that have more than two dimensions, e.g., real, dimension(5, 3, 2) :: value sets up a real 3-dimensional array with = 30 storage locations. Fortran allows the use of up to 7-dimensional arrays but these are rarely used. You can access part of a matrix, just like you accessed part of a vector. For example, if we want to print out the 10th row of a 2-dimensional array we use and if we want the second column print, a(10, :) print, a(:, 2)

33 Example: Creating the Hilbert Matrix The Hilbert matrix is a notoriously bad matrix with very undesirable properties. However, its entries are easy to define and the matrix does appear in applications. If H is the Hilbert matrix then its (i, j) is defined by 1 H ij = i + j 1 For example, a 4 4 Hilbert matrix is Now suppose we want to write a program to create an n n Hilbert matrix. We query the user to input n which means that the array must be allocated during

34 run time. Our code might look like this. Here I have omitted the program, implicit none, and common statements for brevity. real, allocatable, dimension(:,: ) :: h integer :: i,j integer :: n print *, "enter the size of the desired Hilbert matrix" read *, n write(*,110) n,n allocate ( h(1:n, 1:n) ) do i = 1, n do j = 1,n h (i,j) = one / float(i+j-1)

35 end do end do print *, do i = 1, n write(*,120) h(i,:)! print a row at a time end do 110 format ("We are creating a ", I3, " by", I3, " Hilbert matrix" 120 format ( 10 (f8.5,2x) )

36 and if we set n = 6 we get We are creating a 6 by 6 Hilbert matrix

37 Mean Time to Failure - an example of handling arrays This example is taken from your suggested text Fortran 90 for Scientists and Engineers. One important statistic used in measuring the reliability of a component of a circuit is the mean time to failure which can be used to predict the circuit s lifetime. This is especially important in situations where repair is difficult such as for a space satellite. If only one circuit is tested, then we read in each failure time, add it to the previous failure time until all the times have been summed. We then average the failure times and get the result. We wouldn t have to use a 1-dimensional array with this approach. If we choose to use a 1-dimensional array then we simply read in all the failure times at once and store them in a vector and then we calculate the mean.

38 However, now assume that we have tested a number of circuits in a satellite. For each circuit we have tested it several times and recorded the time it failed. Now we want to find the mean time of failure for each circuit and then print out the circuit number with the smallest mean time to failure. Assume that 5 circuits were tested 10 times each and the following failures times is in the file failures.txt. The 10 failures times for circuit #1 are on the first line of the file, 10 failure times for circuit # 2 are on the second line of the file, etc. We first want to read these values into a 2-dimensional array of size We will use an unformatted read and use a do loop. We will output the failure times to check to make sure they are read in correctly. integer, parameter :: n_circuit = 5 integer, parameter :: n_test = 10 real, dimension (n_circuit, n_test) :: times real, dimension (n_circuit) :: mean real :: sum_failure, mean_small integer :: i, circuit_no

39 open ( unit=15, file="failures.txt")! Read in the failure times do i=1, n_circuit read (15,*) times(i,:) write(*,120) times(i,:) end do

40 Now the next thing to do is to calculate the average of the failure times for each circuit. Clearly we need a loop over the number of circuits. To calculate the sum of all the failure times for each circuit we could add another do loop but, if you remember, fortran has an intrinsic function sum which sums the entires in a vector. But we want to sum a row of a matrix but we can access it like a vector. For example, sum (a(1,:) sums the entries in the first row of an array a.! Calculate the mean for each circuit and store in mean do i = 1, n_circuit sum_failure = sum (times(i,:) ) mean (i ) = sum_failure / float(n_test) write(*,125) i, mean(i) end do mean time to failure for circuit number 1 is

41 mean time to failure for circuit number 2 is mean time to failure for circuit number 3 is mean time to failure for circuit number 4 is mean time to failure for circuit number 5 is Lastly we want the computer to find the circuit which has the shortest mean time to failure. From our output, this is clearly circuit # 2 but we want the computer to determine this for us because in practice we might have thousands of circuits. How do we do this? We could just set a variable mean small to a large number (since we are looking for the smallest) and loop over the calculated means and check to see if it is smaller than the current value of mean small. If it is, replace mean small by mean(i). Also we want to keep track of the circuit number.

42 ! Find the circuit with the shortest mean failure time mean_small = do i = 1, n_circuit if (mean(i) < mean_small ) then circuit_no = i mean_small = mean(i) end if end do write(*,130) circuit_no, mean_small Circuit number 2 has shortest mean time to failure of

43 Classwork 1. The file populations.txt contains the populations of 6 cities in the U.S. Each line of the file gives the census in 2010 and in Write a code to read in these populations using an unformatted read and store in a 2-dimensional real array. 2. The name of the cities are listed below the populations in the same file. Dimension a character array and then add code to read in the names of the cities. There is one on each line. Use an unformatted read. We need the names of the cities for printing. For example, if n cities has been defined as the number of cities we have character(len = 12), dimension(n cities) :: city names 3. Add code to calculate the percent increase in population each city has. Store this percent in an array and print out the information using the name of the city.

44 4. Add code to find the city with the largest increase in population over the four year period. Output your result using the name of the city. 5. Add code to find the city with the smallest increase in population over the four year period. Output your result using the name of the city.

Our Strategy for Learning Fortran 90

Our 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 information

An interesting related problem is Buffon s Needle which was first proposed in the mid-1700 s.

An 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 information

Review More Arrays Modules Final Review

Review More Arrays Modules Final Review OUTLINE 1 REVIEW 2 MORE ARRAYS Using Arrays Why do we need dynamic arrays? Using Dynamic Arrays 3 MODULES Global Variables Interface Blocks Modular Programming 4 FINAL REVIEW THE STORY SO FAR... Create

More information

Matrices. A Matrix (This one has 2 Rows and 3 Columns) To add two matrices: add the numbers in the matching positions:

Matrices. A Matrix (This one has 2 Rows and 3 Columns) To add two matrices: add the numbers in the matching positions: Matrices A Matrix is an array of numbers: We talk about one matrix, or several matrices. There are many things we can do with them... Adding A Matrix (This one has 2 Rows and 3 Columns) To add two matrices:

More information

FORTRAN 90: Functions, Modules, and Subroutines. Meteorology 227 Fall 2017

FORTRAN 90: Functions, Modules, and Subroutines. Meteorology 227 Fall 2017 FORTRAN 90: Functions, Modules, and Subroutines Meteorology 227 Fall 2017 Purpose First step in modular program design Cannot always anticipate all of the steps that will be needed to solve a problem Easier

More information

Numerical Modelling in Fortran: day 2. Paul Tackley, 2017

Numerical Modelling in Fortran: day 2. Paul Tackley, 2017 Numerical Modelling in Fortran: day 2 Paul Tackley, 2017 Goals for today Review main points in online materials you read for homework http://www.cs.mtu.edu/%7eshene/courses/cs201/notes/intro.html More

More information

CSC-140 Assignment 5

CSC-140 Assignment 5 CSC-140 Assignment 5 Please do not Google a solution to these problems, cause that won t teach you anything about programming - the only way to get good at it, and understand it, is to do it! 1 Introduction

More information

Unit-5 Dynamic Programming 2016

Unit-5 Dynamic Programming 2016 5 Dynamic programming Overview, Applications - shortest path in graph, matrix multiplication, travelling salesman problem, Fibonacci Series. 20% 12 Origin: Richard Bellman, 1957 Programming referred to

More information

Introduction to Modern Fortran

Introduction to Modern Fortran Introduction to Modern Fortran p. 1/?? Introduction to Modern Fortran Advanced Use Of Procedures Nick Maclaren nmm1@cam.ac.uk March 2014 Introduction to Modern Fortran p. 2/?? Summary We have omitted some

More information

Chapter 4. Fortran Arrays

Chapter 4. Fortran Arrays Chapter 4. Fortran Arrays Fortran arrays are any object with the dimension attribute. In Fortran 90/95, and in HPF, arrays may be very different from arrays in older versions of Fortran. Arrays can have

More information

Practical Exercise 1 Question 1: The Hello World Program Write a Fortran 95 program to write out Hello World on the screen.

Practical Exercise 1 Question 1: The Hello World Program Write a Fortran 95 program to write out Hello World on the screen. Practical Exercise Question : The Hello World Program Write a Fortran 95 program to write out Hello World on the screen. Question : Some Division One Results A particular number can be expressed as the

More information

MATLAB COURSE FALL 2004 SESSION 1 GETTING STARTED. Christian Daude 1

MATLAB COURSE FALL 2004 SESSION 1 GETTING STARTED. Christian Daude 1 MATLAB COURSE FALL 2004 SESSION 1 GETTING STARTED Christian Daude 1 Introduction MATLAB is a software package designed to handle a broad range of mathematical needs one may encounter when doing scientific

More information

Does Not Meet State Standard Meets State Standard

Does Not Meet State Standard Meets State Standard Exceeds the Standard Solves real-world and mathematical problems using addition, subtraction, and multiplication; understands that the size of a fractional part is relative to the size of the whole. Exceeds

More information

1 Definition of Reduction

1 Definition of Reduction 1 Definition of Reduction Problem A is reducible, or more technically Turing reducible, to problem B, denoted A B if there a main program M to solve problem A that lacks only a procedure to solve problem

More information

Goals for This Lecture:

Goals for This Lecture: Goals for This Lecture: Learn about multi-dimensional (rank > 1) arrays Learn about multi-dimensional array storage Learn about the RESHAPE function Learn about allocatable arrays & the ALLOCATE and DEALLOCATE

More information

6.001 Notes: Section 4.1

6.001 Notes: Section 4.1 6.001 Notes: Section 4.1 Slide 4.1.1 In this lecture, we are going to take a careful look at the kinds of procedures we can build. We will first go back to look very carefully at the substitution model,

More information

UNIVERSITY OF CALIFORNIA, SANTA CRUZ BOARD OF STUDIES IN COMPUTER ENGINEERING

UNIVERSITY OF CALIFORNIA, SANTA CRUZ BOARD OF STUDIES IN COMPUTER ENGINEERING UNIVERSITY OF CALIFORNIA, SANTA CRUZ BOARD OF STUDIES IN COMPUTER ENGINEERING CMPE13/L: INTRODUCTION TO PROGRAMMING IN C SPRING 2012 Lab 3 Matrix Math Introduction Reading In this lab you will write a

More information

SCHOOL OF ENGINEERING & BUILT ENVIRONMENT. Mathematics. Numbers & Number Systems

SCHOOL OF ENGINEERING & BUILT ENVIRONMENT. Mathematics. Numbers & Number Systems SCHOOL OF ENGINEERING & BUILT ENVIRONMENT Mathematics Numbers & Number Systems Introduction Numbers and Their Properties Multiples and Factors The Division Algorithm Prime and Composite Numbers Prime Factors

More information

Fortran 90 Two Commonly Used Statements

Fortran 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 information

190 Lecture 14 Arrays, allocation

190 Lecture 14 Arrays, allocation 190 Lecture 14 Arrays, allocation Reading assignment: chapters. 8, 9, 10, 11, VECTORS AND ARRAYS real::v(4) means v = v 1, v 2, v 3, v 4 real::v(1:4)same thing v = v 1, v 2, v 3, v 4 real::v(0:3)means

More information

PROGRAMMING IN C AND C++:

PROGRAMMING IN C AND C++: PROGRAMMING IN C AND C++: Week 1 1. Introductions 2. Using Dos commands, make a directory: C:\users\YearOfJoining\Sectionx\USERNAME\CS101 3. Getting started with Visual C++. 4. Write a program to print

More information

AM205: lecture 2. 1 These have been shifted to MD 323 for the rest of the semester.

AM205: lecture 2. 1 These have been shifted to MD 323 for the rest of the semester. AM205: lecture 2 Luna and Gary will hold a Python tutorial on Wednesday in 60 Oxford Street, Room 330 Assignment 1 will be posted this week Chris will hold office hours on Thursday (1:30pm 3:30pm, Pierce

More information

Bits, Bytes, and Precision

Bits, Bytes, and Precision Bits, Bytes, and Precision Bit: Smallest amount of information in a computer. Binary: A bit holds either a 0 or 1. Series of bits make up a number. Byte: 8 bits. Single precision variable: 4 bytes (32

More information

7. Procedures and Structured Programming

7. Procedures and Structured Programming 7. Procedures and Structured Programming ONE BIG PROGRAM external procedure: separated small and reusable program units to conduct individual subtasks smaller main program Each program unit can be debugged

More information

Subroutines, Functions and Modules

Subroutines, Functions and Modules Subroutines, Functions and Modules Subdividing the Problem Most problems are thousands of lines of code. Few people can grasp all of the details. Good design principle: Exhibit the overall structure in

More information

ARRAYS COMPUTER PROGRAMMING. By Zerihun Alemayehu

ARRAYS COMPUTER PROGRAMMING. By Zerihun Alemayehu ARRAYS COMPUTER PROGRAMMING By Zerihun Alemayehu AAiT.CED Rm. E119B BASIC RULES AND NOTATION An array is a group of variables or constants, all of the same type, that are referred to by a single name.

More information

Performance Level Descriptors. Mathematics

Performance Level Descriptors. Mathematics Performance Level Descriptors Grade 3 Well Students rarely, Understand that our number system is based on combinations of 1s, 10s, and 100s (place value, compare, order, decompose, and combine using addition)

More information

Introduction to Homogeneous coordinates

Introduction to Homogeneous coordinates Last class we considered smooth translations and rotations of the camera coordinate system and the resulting motions of points in the image projection plane. These two transformations were expressed mathematically

More information

Chapter 1. Math review. 1.1 Some sets

Chapter 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 information

LECTURE 0: Introduction and Background

LECTURE 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 information

Lecture 3: Linear Classification

Lecture 3: Linear Classification Lecture 3: Linear Classification Roger Grosse 1 Introduction Last week, we saw an example of a learning task called regression. There, the goal was to predict a scalar-valued target from a set of features.

More information

Using Arithmetic of Real Numbers to Explore Limits and Continuity

Using Arithmetic of Real Numbers to Explore Limits and Continuity Using Arithmetic of Real Numbers to Explore Limits and Continuity by Maria Terrell Cornell University Problem Let a =.898989... and b =.000000... (a) Find a + b. (b) Use your ideas about how to add a and

More information

Basics of Computational Geometry

Basics of Computational Geometry Basics of Computational Geometry Nadeem Mohsin October 12, 2013 1 Contents This handout covers the basic concepts of computational geometry. Rather than exhaustively covering all the algorithms, it deals

More information

Table of Laplace Transforms

Table of Laplace Transforms Table of Laplace Transforms 1 1 2 3 4, p > -1 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 Heaviside Function 27 28. Dirac Delta Function 29 30. 31 32. 1 33 34. 35 36. 37 Laplace Transforms

More information

1 Introduction to MATLAB

1 Introduction to MATLAB 1 Introduction to MATLAB 1.1 General Information Quick Overview This chapter is not intended to be a comprehensive manual of MATLAB R. Our sole aim is to provide sufficient information to give you a good

More information

MATLAB is a multi-paradigm numerical computing environment fourth-generation programming language. A proprietary programming language developed by

MATLAB 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 information

Declaration and Initialization

Declaration and Initialization 6. Arrays Declaration and Initialization a1 = sqrt(a1) a2 = sqrt(a2) a100 = sqrt(a100) real :: a(100) do i = 1, 100 a(i) = sqrt(a(i)) Declaring arrays real, dimension(100) :: a real :: a(100) real :: a(1:100)!

More information

Grade 7 Mathematics Performance Level Descriptors

Grade 7 Mathematics Performance Level Descriptors Limited A student performing at the Limited Level demonstrates a minimal command of Ohio s Learning Standards for Grade 7 Mathematics. A student at this level has an emerging ability to work with expressions

More information

AN INTRODUCTION TO FORTRAN 90 LECTURE 2. Consider the following system of linear equations: a x + a x + a x = b

AN INTRODUCTION TO FORTRAN 90 LECTURE 2. Consider the following system of linear equations: a x + a x + a x = b AN INTRODUCTION TO FORTRAN 90 LECTURE 2 1. Fortran 90. Arrays, functions and subroutines. 2. Scientific plotting. Gnuplot 1 Each coefficient and variable is a scalar. Lengthy and cumbersome! Program Scalar

More information

6B Quiz Review Learning Targets ,

6B Quiz Review Learning Targets , 6B Quiz Review Learning Targets 5.10 6.3, 6.5-6.6 Key Facts Double transformations when more than one transformation is applied to a graph o You can still use our transformation rules to identify which

More information

CMP Book: Investigation Number Objective: PASS: 1.1 Describe data distributions and display in line and bar graphs

CMP Book: Investigation Number Objective: PASS: 1.1 Describe data distributions and display in line and bar graphs Data About Us (6th Grade) (Statistics) 1.1 Describe data distributions and display in line and bar graphs. 6.5.1 1.2, 1.3, 1.4 Analyze data using range, mode, and median. 6.5.3 Display data in tables,

More information

Math 340 Fall 2014, Victor Matveev. Binary system, round-off errors, loss of significance, and double precision accuracy.

Math 340 Fall 2014, Victor Matveev. Binary system, round-off errors, loss of significance, and double precision accuracy. Math 340 Fall 2014, Victor Matveev Binary system, round-off errors, loss of significance, and double precision accuracy. 1. Bits and the binary number system A bit is one digit in a binary representation

More information

Data Structures and Algorithms Key to Homework 1

Data Structures and Algorithms Key to Homework 1 Data Structures and Algorithms Key to Homework 1 January 31, 2005 15 Define an ADT for a set of integers (remember that a set may not contain duplicates) Your ADT should consist of the functions that can

More information

1. Use the Trapezium Rule with five ordinates to find an approximate value for the integral

1. Use the Trapezium Rule with five ordinates to find an approximate value for the integral 1. Use the Trapezium Rule with five ordinates to find an approximate value for the integral Show your working and give your answer correct to three decimal places. 2 2.5 3 3.5 4 When When When When When

More information

Intermediate Mathematics League of Eastern Massachusetts

Intermediate Mathematics League of Eastern Massachusetts Meet # January 010 Intermediate Mathematics League of Eastern Massachusetts Meet # January 010 Category 1 - Mystery Meet #, January 010 1. Of all the number pairs whose sum equals their product, what is

More information

Old Questions Name: a. if b. open c. output d. write e. do f. exit

Old Questions Name: a. if b. open c. output d. write e. do f. exit Old Questions Name: Part I. Multiple choice. One point each. 1. Which of the following is not a Fortran keyword? a. if b. open c. output d. write e. do f. exit 2. How many times will the code inside the

More information

WHOLE NUMBER AND DECIMAL OPERATIONS

WHOLE NUMBER AND DECIMAL OPERATIONS WHOLE NUMBER AND DECIMAL OPERATIONS Whole Number Place Value : 5,854,902 = Ten thousands thousands millions Hundred thousands Ten thousands Adding & Subtracting Decimals : Line up the decimals vertically.

More information

Prentice Hall Mathematics: Course Correlated to: Ohio Academic Content Standards for Mathematics (Grade 7)

Prentice Hall Mathematics: Course Correlated to: Ohio Academic Content Standards for Mathematics (Grade 7) Ohio Academic Content Standards for Mathematics (Grade 7) NUMBER, NUMBER SENSE AND OPERATIONS STANDARD 1. Demonstrate an understanding of place value using powers of 10 and write large numbers in scientific

More information

Name: Teacher: Form: LEARNER JOURNAL. Set: Mathematics. Module 2 END OF YEAR TARGET: GCSE TARGET:

Name: Teacher: Form: LEARNER JOURNAL. Set: Mathematics. Module 2 END OF YEAR TARGET: GCSE TARGET: Name: Teacher: Form: Set: LEARNER JOURNAL Mathematics Module 2 END OF YEAR TARGET: GCSE TARGET: MODULE 2 use a number line to represent negative numbers use inequalities with negative numbers compare and

More information

SHAPE Returns the number of elements in each direction in an integer vector.

SHAPE Returns the number of elements in each direction in an integer vector. Chapter 5: Arrays An advantage fortran has over other programming languages is the ease with which it handles arrays. Because arrays are so easy to handle, fortran is an ideal choice when writing code

More information

2. Basic Elements of Fortran

2. Basic Elements of Fortran 2. Basic Elements of Fortran Structure of a Fortran Program 31 characters must be in the 1st line if present declaration section program my_first_program! Declare variables integer :: i, j, k! i, j, k

More information

Unit 2: Accentuate the Negative Name:

Unit 2: Accentuate the Negative Name: Unit 2: Accentuate the Negative Name: 1.1 Using Positive & Negative Numbers Number Sentence A mathematical statement that gives the relationship between two expressions that are composed of numbers and

More information

Introduction to Internet of Things Prof. Sudip Misra Department of Computer Science & Engineering Indian Institute of Technology, Kharagpur

Introduction to Internet of Things Prof. Sudip Misra Department of Computer Science & Engineering Indian Institute of Technology, Kharagpur Introduction to Internet of Things Prof. Sudip Misra Department of Computer Science & Engineering Indian Institute of Technology, Kharagpur Lecture - 23 Introduction to Arduino- II Hi. Now, we will continue

More information

Arrays. 1. Derived Data Types Outline

Arrays. 1. Derived Data Types Outline Derived Data Types Outline 1. Derived Data Types Outline 2. Arrays 3. A Company and Its Employees 4. Multiple Employees 5. A New Data Type 6. Breaking Down a Derived Type Definition 7. Declaring an Instance

More information

1 Introduction to MATLAB

1 Introduction to MATLAB 1 Introduction to MATLAB 1.1 Quick Overview This chapter is not intended to be a comprehensive manual of MATLAB R. Our sole aim is to provide sufficient information to give you a good start. If you are

More information

Catalan Numbers. Table 1: Balanced Parentheses

Catalan Numbers. Table 1: Balanced Parentheses Catalan Numbers Tom Davis tomrdavis@earthlink.net http://www.geometer.org/mathcircles November, 00 We begin with a set of problems that will be shown to be completely equivalent. The solution to each problem

More information

,!7IA3C1-cjfcei!:t;K;k;K;k ISBN Graphing Calculator Reference Card. Addison-Wesley s. Basics. Created in conjuction with

,!7IA3C1-cjfcei!:t;K;k;K;k ISBN Graphing Calculator Reference Card. Addison-Wesley s. Basics. Created in conjuction with Addison-Wesley s Graphing Calculator Reference Card Created in conjuction with Basics Converting Fractions to Decimals The calculator will automatically convert a fraction to a decimal. Type in a fraction,

More information

Module 28.3: nag mv rotation Rotations. Contents

Module 28.3: nag mv rotation Rotations. Contents Multivariate Analysis Module Contents Module 28.3: nag mv rotation Rotations nag mv rotation contains a procedure to compute rotations for sets of data values. Contents Introduction..............................................................

More information

AMSC/CMSC 460 Final Exam, Fall 2007

AMSC/CMSC 460 Final Exam, Fall 2007 AMSC/CMSC 460 Final Exam, Fall 2007 Show all work. You may leave arithmetic expressions in any form that a calculator could evaluate. By putting your name on this paper, you agree to abide by the university

More information

Subprograms. FORTRAN 77 Chapter 5. Subprograms. Subprograms. Subprograms. Function Subprograms 1/5/2014. Satish Chandra.

Subprograms. FORTRAN 77 Chapter 5. Subprograms. Subprograms. Subprograms. Function Subprograms 1/5/2014. Satish Chandra. FORTRAN 77 Chapter 5 Satish Chandra satish0402@gmail.com When a programs is more than a few hundred lines long, it gets hard to follow. Fortran codes that solve real research problems often have tens of

More information

Fundamentals of the J Programming Language

Fundamentals of the J Programming Language 2 Fundamentals of the J Programming Language In this chapter, we present the basic concepts of J. We introduce some of J s built-in functions and show how they can be applied to data objects. The pricinpals

More information

Prentice Hall Mathematics: Course Correlated to: Colorado Model Content Standards and Grade Level Expectations (Grade 8)

Prentice Hall Mathematics: Course Correlated to: Colorado Model Content Standards and Grade Level Expectations (Grade 8) Colorado Model Content Standards and Grade Level Expectations (Grade 8) Standard 1: Students develop number sense and use numbers and number relationships in problemsolving situations and communicate the

More information

Montana City School GRADE 5

Montana City School GRADE 5 Montana City School GRADE 5 Montana Standard 1: Students engage in the mathematical processes of problem solving and reasoning, estimation, communication, connections and applications, and using appropriate

More information

An array is a collection of data that holds fixed number of values of same type. It is also known as a set. An array is a data type.

An array is a collection of data that holds fixed number of values of same type. It is also known as a set. An array is a data type. Data Structures Introduction An array is a collection of data that holds fixed number of values of same type. It is also known as a set. An array is a data type. Representation of a large number of homogeneous

More information

The Further Mathematics Support Programme

The Further Mathematics Support Programme The Further Mathematics Support Programme Algorithms An algorithm is a precise set of instructions which is used to accomplish a specific process. We come across algorithms in every-day life, for example:

More information

Therefore, after becoming familiar with the Matrix Method, you will be able to solve a system of two linear equations in four different ways.

Therefore, after becoming familiar with the Matrix Method, you will be able to solve a system of two linear equations in four different ways. Grade 9 IGCSE A1: Chapter 9 Matrices and Transformations Materials Needed: Straightedge, Graph Paper Exercise 1: Matrix Operations Matrices are used in Linear Algebra to solve systems of linear equations.

More information

C++ Programming: From Problem Analysis to Program Design, Third Edition

C++ Programming: From Problem Analysis to Program Design, Third Edition C++ Programming: From Problem Analysis to Program Design, Third Edition Chapter 2: Basic Elements of C++ Objectives (continued) Become familiar with the use of increment and decrement operators Examine

More information

18.02 Multivariable Calculus Fall 2007

18.02 Multivariable Calculus Fall 2007 MIT OpenCourseWare http://ocw.mit.edu 18.02 Multivariable Calculus Fall 2007 For information about citing these materials or our Terms of Use, visit: http://ocw.mit.edu/terms. 18.02 Problem Set 4 Due Thursday

More information

2.3 Algorithms Using Map-Reduce

2.3 Algorithms Using Map-Reduce 28 CHAPTER 2. MAP-REDUCE AND THE NEW SOFTWARE STACK one becomes available. The Master must also inform each Reduce task that the location of its input from that Map task has changed. Dealing with a failure

More information

Lines and Planes in 3D

Lines and Planes in 3D Lines and Planes in 3D Philippe B. Laval KSU January 28, 2013 Philippe B. Laval (KSU) Lines and Planes in 3D January 28, 2013 1 / 20 Introduction Recall that given a point P = (a, b, c), one can draw a

More information

Integer Operations. Summer Packet 7 th into 8 th grade 1. Name = = = = = 6.

Integer Operations. Summer Packet 7 th into 8 th grade 1. Name = = = = = 6. Summer Packet 7 th into 8 th grade 1 Integer Operations Name Adding Integers If the signs are the same, add the numbers and keep the sign. 7 + 9 = 16-2 + -6 = -8 If the signs are different, find the difference

More information

Course Number 432/433 Title Algebra II (A & B) H Grade # of Days 120

Course Number 432/433 Title Algebra II (A & B) H Grade # of Days 120 Whitman-Hanson Regional High School provides all students with a high- quality education in order to develop reflective, concerned citizens and contributing members of the global community. Course Number

More information

2.1.1 Fixed-Point (or Integer) Arithmetic

2.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 information

Equations and Functions, Variables and Expressions

Equations and Functions, Variables and Expressions Equations and Functions, Variables and Expressions Equations and functions are ubiquitous components of mathematical language. Success in mathematics beyond basic arithmetic depends on having a solid working

More information

Watkins Mill High School. Algebra 2. Math Challenge

Watkins Mill High School. Algebra 2. Math Challenge Watkins Mill High School Algebra 2 Math Challenge "This packet will help you prepare for Algebra 2 next fall. It will be collected the first week of school. It will count as a grade in the first marking

More information

Excel Lesson 3 USING FORMULAS & FUNCTIONS

Excel Lesson 3 USING FORMULAS & FUNCTIONS Excel Lesson 3 USING FORMULAS & FUNCTIONS 1 OBJECTIVES Enter formulas in a worksheet Understand cell references Copy formulas Use functions Review and edit formulas 2 INTRODUCTION The value of a spreadsheet

More information

Arrays. Defining arrays, declaration and initialization of arrays. Designed by Parul Khurana, LIECA.

Arrays. Defining arrays, declaration and initialization of arrays. Designed by Parul Khurana, LIECA. Arrays Defining arrays, declaration and initialization of arrays Introduction Many applications require the processing of multiple data items that have common characteristics (e.g., a set of numerical

More information

1. (a) O(log n) algorithm for finding the logical AND of n bits with n processors

1. (a) O(log n) algorithm for finding the logical AND of n bits with n processors 1. (a) O(log n) algorithm for finding the logical AND of n bits with n processors on an EREW PRAM: See solution for the next problem. Omit the step where each processor sequentially computes the AND of

More information

2 3. Syllabus Time Event 9:00{10:00 morning lecture 10:00{10:30 morning break 10:30{12:30 morning practical session 12:30{1:30 lunch break 1:30{2:00 a

2 3. Syllabus Time Event 9:00{10:00 morning lecture 10:00{10:30 morning break 10:30{12:30 morning practical session 12:30{1:30 lunch break 1:30{2:00 a 1 Syllabus for the Advanced 3 Day Fortran 90 Course AC Marshall cuniversity of Liverpool, 1997 Abstract The course is scheduled for 3 days. The timetable allows for two sessions a day each with a one hour

More information

Algebra 2 Semester 2 Final Exam Study Outline Semester 2 Final Exam Study Tips and Information

Algebra 2 Semester 2 Final Exam Study Outline Semester 2 Final Exam Study Tips and Information Algebra 2 Semester 2 Final Exam Study Outline 2013 Semester 2 Final Exam Study Tips and Information The final exam is CUMULATIVE and will include all concepts taught from Chapter 1 through Chapter 13.

More information

It can be confusing when you type something like the expressions below and get an error message. a range variable definition a vector of sine values

It can be confusing when you type something like the expressions below and get an error message. a range variable definition a vector of sine values 7_april_ranges_.mcd Understanding Ranges, Sequences, and Vectors Introduction New Mathcad users are sometimes confused by the difference between range variables and vectors. This is particularly true considering

More information

PROBLEM SOLVING WITH FORTRAN 90

PROBLEM SOLVING WITH FORTRAN 90 David R. Brooks PROBLEM SOLVING WITH FORTRAN 90 FOR SCIENTISTS AND ENGINEERS Springer Contents Preface v 1.1 Overview for Instructors v 1.1.1 The Case for Fortran 90 vi 1.1.2 Structure of the Text vii

More information

C A S I O f x L B UNIVERSITY OF SOUTHERN QUEENSLAND. The Learning Centre Learning and Teaching Support Unit

C A S I O f x L B UNIVERSITY OF SOUTHERN QUEENSLAND. The Learning Centre Learning and Teaching Support Unit C A S I O f x - 8 2 L B UNIVERSITY OF SOUTHERN QUEENSLAND The Learning Centre Learning and Teaching Support Unit MASTERING THE CALCULATOR USING THE CASIO fx-82lb Learning and Teaching Support Unit (LTSU)

More information

(Refer Slide Time: 02:59)

(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 information

SECTION 1: INTRODUCTION. ENGR 112 Introduction to Engineering Computing

SECTION 1: INTRODUCTION. ENGR 112 Introduction to Engineering Computing SECTION 1: INTRODUCTION ENGR 112 Introduction to Engineering Computing 2 Course Overview What is Programming? 3 Programming The implementation of algorithms in a particular computer programming language

More information

Introduction to MATLAB 7 for Engineers

Introduction to MATLAB 7 for Engineers PowerPoint to accompany Introduction to MATLAB 7 for Engineers William J. Palm III Chapter 2 Numeric, Cell, and Structure Arrays Copyright 2005. The McGraw-Hill Companies, Inc. Permission required for

More information

Introduction to MATLAB for Engineers, Third Edition

Introduction to MATLAB for Engineers, Third Edition PowerPoint to accompany Introduction to MATLAB for Engineers, Third Edition William J. Palm III Chapter 2 Numeric, Cell, and Structure Arrays Copyright 2010. The McGraw-Hill Companies, Inc. This work is

More information

Lecture 2 Arrays, Searching and Sorting (Arrays, multi-dimensional Arrays)

Lecture 2 Arrays, Searching and Sorting (Arrays, multi-dimensional Arrays) Lecture 2 Arrays, Searching and Sorting (Arrays, multi-dimensional Arrays) In this lecture, you will: Learn about arrays Explore how to declare and manipulate data into arrays Understand the meaning of

More information

Subject: Computer Science

Subject: Computer Science Subject: Computer Science Topic: Data Types, Variables & Operators 1 Write a program to print HELLO WORLD on screen. 2 Write a program to display output using a single cout statement. 3 Write a program

More information

Algorithms and Data Structures

Algorithms and Data Structures Algorithms and Data Structures Spring 2019 Alexis Maciel Department of Computer Science Clarkson University Copyright c 2019 Alexis Maciel ii Contents 1 Analysis of Algorithms 1 1.1 Introduction.................................

More information

PRE-ALGEBRA PREP. Textbook: The University of Chicago School Mathematics Project. Transition Mathematics, Second Edition, Prentice-Hall, Inc., 2002.

PRE-ALGEBRA PREP. Textbook: The University of Chicago School Mathematics Project. Transition Mathematics, Second Edition, Prentice-Hall, Inc., 2002. PRE-ALGEBRA PREP Textbook: The University of Chicago School Mathematics Project. Transition Mathematics, Second Edition, Prentice-Hall, Inc., 2002. Course Description: The students entering prep year have

More information

Appendix D. Fortran quick reference

Appendix D. Fortran quick reference Appendix D Fortran quick reference D.1 Fortran syntax... 315 D.2 Coarrays... 318 D.3 Fortran intrisic functions... D.4 History... 322 323 D.5 Further information... 324 Fortran 1 is the oldest high-level

More information

3.2 Recursions One-term recursion, searching for a first occurrence, two-term recursion. 2 sin.

3.2 Recursions One-term recursion, searching for a first occurrence, two-term recursion. 2 sin. Chapter 3 Sequences 3.1 Summation Nested loops, while-loops with compound termination criteria 3.2 Recursions One-term recursion, searching for a first occurrence, two-term recursion. In Chapter 2 we played

More information

INTRODUCTION TO FORTRAN PART II

INTRODUCTION TO FORTRAN PART II INTRODUCTION TO FORTRAN PART II Prasenjit Ghosh An example: The Fibonacci Sequence The Fibonacci sequence consists of an infinite set of integer nos. which satisfy the following recurrence relation x n

More information

STATISTICS MEAN Know the TOTAL # of points MEDIAN MIDDLE ($) Arrange the scores in order MODE most frequent. RANGE DIFFERENCE in high and low scores

STATISTICS MEAN Know the TOTAL # of points MEDIAN MIDDLE ($) Arrange the scores in order MODE most frequent. RANGE DIFFERENCE in high and low scores HSPE Mathematics Hints for SUCCESS The BASICS Be positive, be reassuring. Tell the students that if they have done what you have asked in preparation, then they are prepared for the test. They will pass

More information

Why Use Graphs? Test Grade. Time Sleeping (Hrs) Time Sleeping (Hrs) Test Grade

Why Use Graphs? Test Grade. Time Sleeping (Hrs) Time Sleeping (Hrs) Test Grade Analyzing Graphs Why Use Graphs? It has once been said that a picture is worth a thousand words. This is very true in science. In science we deal with numbers, some times a great many numbers. These numbers,

More information

Level 4 means that I can

Level 4 means that I can Level 4 means that I can Describe number patterns Find multiples Find factors Work out the square numbers Use word formulae Use co-ordinates in the first quadrant Multiply and divide whole numbers by 10

More information

Mathematics Scope & Sequence Grade 8 Revised: June 2015

Mathematics Scope & Sequence Grade 8 Revised: June 2015 Mathematics Scope & Sequence 2015-16 Grade 8 Revised: June 2015 Readiness Standard(s) First Six Weeks (29 ) 8.2D Order a set of real numbers arising from mathematical and real-world contexts Convert between

More information

Numerical Methods Lecture 1

Numerical Methods Lecture 1 Numerical Methods Lecture 1 Basics of MATLAB by Pavel Ludvík The recommended textbook: Numerical Methods Lecture 1 by Pavel Ludvík 2 / 30 The recommended textbook: Title: Numerical methods with worked

More information

Mathematical preliminaries and error analysis

Mathematical preliminaries and error analysis Mathematical preliminaries and error analysis Tsung-Ming Huang Department of Mathematics National Taiwan Normal University, Taiwan August 28, 2011 Outline 1 Round-off errors and computer arithmetic IEEE

More information