Computational modeling

Size: px
Start display at page:

Download "Computational modeling"

Transcription

1 Computational modeling Lecture 3 : Random variables Theory: 1 Random variables Programming: 1 Implicit none statement 2 Modules 3 Outputs 4 Functions 5 Conditional statement Instructor : Cedric Weber Course : 4CCP1000

2 P. Higgs wins the Nobel prize LHC collider * Peter Higgs shares the Nobel prize for Physics with professor Francois Englert * KCL BSc '50, MSc '52, PhD '54 2

3 Schedule Class/Week Chapter Topic Milestones 1 Monte Carlo UNIX system / Fortran 2 Monte Carlo Fibonacci sequence 3 Monte Carlo Random variables 4 Monte Carlo Central Limit Theorem 5 Monte Carlo Monte Carlo integration Milestone 1 6 Differential equations The Pendulum 7 Differential equations A Quantum Particle in a box 8 Differential equations The Tacoma bridge Milestone 2 9 Linear Algebra System of equations 10 Linear Algebra Matrix operations Milestone 3 3

4 What did you learn last time? 1. Compilation and execution of a program " " "ý " " 2. do loop " " " " ý " 3. Reading a number from the keyboard " " ý " 4. Understanding the limitations of a computer" " "ý " 5. Sequences / Finding a fix point with pen & paper ý " 4

5 Where are we going? 100% * Lecture 1: * Introduction 90% 80% 70% * Lecture 2: * Fibonacci sequence / do loop * Lecture 3: * Today: another type of sequence the random number generator 60% 50% 40% 30% 20% 10% 0% week 1 week 2 week 3 Milestone 1 : Monte Carlo integration week 4 week 5 week 6 week 7 week 8 week 9 week 10 5

6 Part 1 : Theory Random variables 6

7 Jacob Bernoulli ( ): Game Theory q The Bernoulli family, originally form Holland, established in Switzerland, were probably the most predominant math family of Europe" q Jacob discovered the Euler constant" q Famous for his work on Game theories The Art of Conjecture" q His nephew, Daniel Bernoulli ( ) became famous for his work in hydrodynamics" q Simple idea: lets define the outcome of an experiment X i, and the result of the experiment is either X i =0 or X i =1. When I repeat the experiment, I sometimes get X i =0, and sometimes I obtain X i =1" q Let s think of X i as a coin, which is flipped (head/tail). " q Experiment: flip the coin 1000 times" q how many tail, how many head?" q Definition of a Probability: " q P(head) = N(head) / total P(tail) = N(tail) / total " q Reference: The Life and Times of the Central Limit Theorem, William J. Adams" 7 = 500 = 500

8 q I give you a number R q R is any rational number between 0 and 1 q R is random R Flipping a coin q How could you use R to describe the coin flipping experiment? q Write down the relation between R and the coin configurations (head/tail) q Example, I obtain : q R=0.121 Corresponds to : [FILL IN] q R=0.551 Corresponds to : [FILL IN] 8

9 How can we obtain a random R? * We ll get to that in a moment First a short recap on the modulo * X mod Y : remainder of the division X/Y * Examples : * 1 mod 5 = 1 (remains 1 from the division 1/5) * 3 mod 5 = 3 * 5 mod 5 = 0 * 6 mod 5 = [FILL IN] * 10 mod 5 = [FILL IN] * Question: which one of the following statement is true? q X mod Y < Y q X mod Y = Y q X mod Y > Y 9

10 How can we obtain a random R? * How can we implement a random process in a computer when the only thing a computer can do is carry out pre- defined calculations? * Answer: we generate a long sequence of numbers, each of this number can be seen as one realization of the experiment (coin flipping) * Example - throwing a dice : we would generate a long sequence of numbers between 1 and 6, each number corresponds to one experiment * Condition : the numbers in the sequence have to be independent. Counter example : the sequence is not random. * Random number generator: they generate numbers which seem independent. More precisely, if we generate a sequence of random numbers, we don t want some pattern to repeat and start over with the same sub- sequence of numbers (cycle length, e.g ) 10

11 Random generator * In a computer, we generate a sequence (mod stands for the modulo of): x i =(ax i 1 + c) modm * a and c are chosen parameters * We will generate a sequence of numbers: 41,3,213,60,300 * We have the property : x i < m * How can we obtain a random number R in the interval [0,1] from the obtained xi? * Answer : Ri = [FILL IN] 11

12 One bad choice of parameters * a=12 * c=0 * m=143 * x 0 =1 x i =(ax i 1 + c) modm * Let s try it : x 1 = 12x 0 mod 143 = 12 x 2 = 12x 1 mod 143 = 144mod 143 = 1 x 3 = 12x 2 mod 143 = 12 * Random sequence obtained : 1, 12, 1, 12, 1, 12, 1, 12 12

13 Part 2 : Programming Implicit none statement Outputs and plots Modules Function Conditional statement 13

14 1. Implicit none statement 2. Outputs and plotting tool 3. Modules 4. Function 5. Conditional statement 14

15 Spot the mistake 1. Program something 2. Integer(4) :: var1 3. do i = 0, 100 Ø There is one problem in this code, can you find it? 4. var1 = var1 + i 5. write(*,*) var1 =, var1 6. end do 7. end program 15

16 Implicit none statement 1. Program something 2. Implicit none 3. Integer(4) :: var1 4. do i = 0, var1 = var1 + i 6. write(*,*) var1 =, var1 7. end do Ø Implicit none statement comes right after the block definition (program, function, subroutine, ) Ø It prevents to use undeclared variables 8. end program 16

17 1. Implicit none statement 2. Outputs and plotting tool 3. Modules 4. Function 5. Conditional statement " 17

18 IO operations : Inputs 1. Program something 2. Implicit none 3. Integer(4) :: var1 4. write(*,*) enter the variable to the keyboard and hit enter: 5. read(*,*) a 6. write(*,*) you entered :,a * To read a variable from the keyboard, use the command: * read(*,*) variable_name * Why did we add the write(*,*) statement at line 4? 7. end program 18

19 IO operations : File output 1. Program something 2. Implicit none 3. Real(8) :: a, b 4. Integer(4) :: i 5. do i=1, a=(3.1428/360.0) * dble(i) write(100,*) a, cos(a) 9. end do 10. end program * Replacing the first * of the write statement by a number, redirects the output into a file named fort.xxx * To write a list of variables to a file, use the command: * write(100,*) a, b * This appends a line to the end of the file named fort.100 with the values of a and b 19

20 IO operations : File output 1. Program something 2. Implicit none 3. Real(8) :: a, b 4. Integer(4) :: i 5. do i=1, a=(3.1428/360.0) * dble(i) write(100,*) a, cos(a) 9. end do 10. end program * Replacing the first * of the write statement by a number, redirects the output into a file named fort.xxx * To write a list of variables to a file, axis" use the command: * write(100,*) a, b Horizontal Vertical axis" * This appends a line to the end of the file named fort.100 with the values of a and b 20

21 Plotting tool : xmgrace command u In the terminal, type : xmgrace fort

22 Plotting tool : xmgrace command u In the terminal, type : xmgrace fort

23 1. Implicit none statement 2. Outputs and plotting tool 3. Modules 4. Function 5. Conditional statement " 23

24 Modules * A module contains all your functions, it is your library * It forms an independent block, and needs to be above your program * To access an element from the module in your program, after the line program test, you need to specify use mylibrary, to tell the code that you want to make the functions contained in the module mylibrary available in your 1. Module mylibrary 2. Contains 3. Function1 4. Function2 5. Function3 6. End module 7. program test 8. use mylibrary 9. implicit none 10. Real(8) ::. 11. [..] 12. end program program section 24

25 Optional: split the module from your program file Content of file prog.f90 : Content of file library.f90 : 1. program test 2. Use mylibrary 3. Implicit none 4. Real(8) ::. 5. [..] 6. end program 1. Module mylibrary 2. Contains 3. Functions.. 4. End module Compilation : The order matters! gfortran [space] o [space] prog_name.out [space] library.f90 [space] prog.f90

26 1. Implicit none statement 2. Outputs and plotting tool 3. Modules 4. Function 5. Conditional statement " 26

27 Functions 4.1" 2.1" Function block 1. Function some_name ( input_variable_name ) 2. Implicit none 3. real(8) :: input_variable_name 4. real(8) :: some_name 5. some_name = input_variable_name End function 1. A function is defined by a block function end function 2. It is a black- box which receives an input value (2.1) and returns an output values (4.1) 3. The computer stores the input value to the variable input_variable_name 4. The computer stores the output value to the variable some_name. This is the name that you want to give to your function (volume_of_a_sphere) 5. Within the block of the function, you can do any calculation (define more variables if needed). The value given to input_variable_name 27 is obtained when the function is executed in your program.

28 Example : volume of a sphere BLOCK 1 BLOCK 2 1. Function volume_of_a_sphere ( radius ) 2. real(8) :: radius 3. real(8) :: volume_of_a_sphere 4. volume_of_a_sphere = 3.14*radius**3*4.0/ End function 6. program test 7. Real(8) :: vol 8. vol = volume_of_a_sphere ( 2.0 ) 9. write(*,*) volume is :, vol 10. end program * Blocks do not communicate, variables in Block 1 only exist in this block, same for variables in Block 2 * Same variable names can be used in the block 1&2, they are still different * The computer replaces in your program the function by its numerical evaluation obtained with the given argument 28

29 Example : volume of a sphere BLOCK 1 BLOCK Function volume_of_a_sphere ( radius ) 2. real(8) :: radius 3. real(8) :: volume_of_a_sphere 4. volume_of_a_sphere = 3.14*radius**3*4.0/ End function 6. program test 7. Real(8) :: vol 8. vol = volume_of_a_sphere ( 2.0 ) 9. write(*,*) volume is :, vol 10. end program * Function is followed by a name of your choice, it is how you want to name this new function * The chosen name of the function also has to appear in the argument list, the value returned by the function will be the value of this variable * Radius is a chosen variable name. The value of this variable is attributed when the function is called from the program section. In this example, radius takes the value 2.0 * you can use in your program this function in the same way you would use the Fortran functions (sqrt, exp, sin, ).

30 Spot the mistakes. 1. Function volume_of_a_sphere ( radius ) 2. real(8) :: radius 3. volume_of_a_sphere = 3.14 * (radius**3) * 4.0/ End function 5. program test 6. real(8) :: vol 7. vol = volume_of_a_sphere ( 2.0 ) 8. write(*,*) volume is :, vol 9. write(*,*) radius is :, radius 10. end program Mistake 1 : line? Mistake 2 : line? 30

31 1. Implicit none statement 2. Outputs and plotting tool 3. Modules 4. Function 5. Conditional statement " 31

32 BLOCK 1 BLOCK 2 1. Program something 2. Implicit none 3. Real(8) :: a 4. a=0.2 Conditional statement 5. If ( a < 1.0 ) then 6. write(*,*) a smaller than 1 7. else 8. write(*,*) a larger than 1 9. end if 10. end program * The if statement executes: * the block 1 if the condition a<1.0 is satisfied * The block 2 if the condition a<1.0 is NOT satisfied * Possible logical tests are: * a < 1.0 a > 1.0 * a <= 1.0 a >= 1.0 * a==1.0 a!=

33 Practice Problems u Exercice 1 : Random number generator u Exercice 2 : Flipping a coin 33

Computational modeling

Computational modeling Computational modeling Lecture 5 : Monte Carlo Integration Physics: Integration The Monte Carlo method Programming: Subroutine Differences Subroutine/Function The Fortran random number subroutine Monte

More information

Introduction to Computational Modeling

Introduction to Computational Modeling Introduction to Computational Modeling Lecture 1 : Introduction to UNIX and Fortran Instructor : Cedric Weber Course : 4CCP1000 General informations Ø Lecture: Thursday, 9-10am Ø Practice: K3.16 (25C),

More information

Computational modeling

Computational modeling Computational modeling Lecture 8 : Monte Carlo Instructor : Cedric Weber Course : 4CCP1000 Integrals, how to calculate areas? 2 Integrals, calculate areas There are different ways to calculate areas Integration

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

Topic 3: Fractions. Topic 1 Integers. Topic 2 Decimals. Topic 3 Fractions. Topic 4 Ratios. Topic 5 Percentages. Topic 6 Algebra

Topic 3: Fractions. Topic 1 Integers. Topic 2 Decimals. Topic 3 Fractions. Topic 4 Ratios. Topic 5 Percentages. Topic 6 Algebra Topic : Fractions Topic Integers Topic Decimals Topic Fractions Topic Ratios Topic Percentages Duration / weeks Content Outline PART (/ week) Introduction Converting Fractions to Decimals Converting Decimals

More information

3+2 3*2 3/2 3^2 3**2 In matlab, use ^ or ** for exponentiation. In fortran, use only ** not ^ VARIABLES LECTURE 1: ARITHMETIC AND FUNCTIONS

3+2 3*2 3/2 3^2 3**2 In matlab, use ^ or ** for exponentiation. In fortran, use only ** not ^ VARIABLES LECTURE 1: ARITHMETIC AND FUNCTIONS LECTURE 1: ARITHMETIC AND FUNCTIONS MATH 190 WEBSITE: www.math.hawaii.edu/ gautier/190.html PREREQUISITE: You must have taken or be taking Calculus I concurrently. If not taken here, specify the college

More information

Computational Methods of Scientific Programming. Lecturers Thomas A Herring Chris Hill

Computational 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 last lecture Start examining the FORTRAN language Development of the language Philosophy of language:

More information

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

Rational Numbers and the Coordinate Plane

Rational Numbers and the Coordinate Plane Rational Numbers and the Coordinate Plane LAUNCH (8 MIN) Before How can you use the numbers placed on the grid to figure out the scale that is used? Can you tell what the signs of the x- and y-coordinates

More information

COMP Preliminaries Jan. 6, 2015

COMP Preliminaries Jan. 6, 2015 Lecture 1 Computer graphics, broadly defined, is a set of methods for using computers to create and manipulate images. There are many applications of computer graphics including entertainment (games, cinema,

More information

3x - 5 = 22 4x - 12 = 2x - 9

3x - 5 = 22 4x - 12 = 2x - 9 3. Algebra Solving Equations ax + b = cx + d Algebra is like one big number guessing game. I m thinking of a number. If you multiply it by 2 and add 5, you get 21. 2x + 5 = 21 For a long time in Algebra

More information

FOR Loops. Last Modified: 01 June / 1

FOR Loops. Last Modified: 01 June / 1 FOR Loops http://people.sc.fsu.edu/ jburkardt/isc/week04 lecture 08.pdf... ISC3313: Introduction to Scientific Computing with C++ Summer Semester 2011... John Burkardt Department of Scientific Computing

More information

Section Graphs and Lines

Section Graphs and Lines Section 1.1 - Graphs and Lines The first chapter of this text is a review of College Algebra skills that you will need as you move through the course. This is a review, so you should have some familiarity

More information

Introduction to Fortran Programming. -External subprograms-

Introduction to Fortran Programming. -External subprograms- Introduction to Fortran Programming -External subprograms- Subprograms Subprograms are used to split a program into separate smaller units. Internal subprograms are dependent parts of a program. Fortran

More information

Introduction to Fortran Programming. -Internal subprograms (1)-

Introduction to Fortran Programming. -Internal subprograms (1)- Introduction to Fortran Programming -Internal subprograms (1)- Subprograms Subprograms are used to split the program into separate smaller units. Internal subprogram is not an independent part of a program.

More information

CS 97SI: INTRODUCTION TO PROGRAMMING CONTESTS. Jaehyun Park

CS 97SI: INTRODUCTION TO PROGRAMMING CONTESTS. Jaehyun Park CS 97SI: INTRODUCTION TO PROGRAMMING CONTESTS Jaehyun Park Today s Lecture Algebra Number Theory Combinatorics (non-computational) Geometry Emphasis on how to compute Sum of Powers n k=1 k 2 = 1 6 n(n

More information

Math background. 2D Geometric Transformations. Implicit representations. Explicit representations. Read: CS 4620 Lecture 6

Math background. 2D Geometric Transformations. Implicit representations. Explicit representations. Read: CS 4620 Lecture 6 Math background 2D Geometric Transformations CS 4620 Lecture 6 Read: Chapter 2: Miscellaneous Math Chapter 5: Linear Algebra Notation for sets, functions, mappings Linear transformations Matrices Matrix-vector

More information

Sets. Sets. Examples. 5 2 {2, 3, 5} 2, 3 2 {2, 3, 5} 1 /2 {2, 3, 5}

Sets. Sets. Examples. 5 2 {2, 3, 5} 2, 3 2 {2, 3, 5} 1 /2 {2, 3, 5} Sets We won t spend much time on the material from this and the next two chapters, Functions and Inverse Functions. That s because these three chapters are mostly a review of some of the math that s a

More information

2.1 Transforming Linear Functions

2.1 Transforming Linear Functions 2.1 Transforming Linear Functions Before we begin looking at transforming linear functions, let s take a moment to review how to graph linear equations using slope intercept form. This will help us because

More information

2. Numbers In, Numbers Out

2. Numbers In, Numbers Out COMP1917: Computing 1 2. Numbers In, Numbers Out Reading: Moffat, Chapter 2. COMP1917 15s2 2. Numbers In, Numbers Out 1 The Art of Programming Think about the problem Write down a proposed solution Break

More information

PY502, Computational Physics Instructor: Prof. Anders Sandvik

PY502, Computational Physics Instructor: Prof. Anders Sandvik PY502, Computational Physics Instructor: Prof. Anders Sandvik Office: SCI 450A, phone: 353-3843, e-mail: sandvik@bu.edu Lectures: Tuesday/Thursday 11-12:15 in PRB 146 Tutorials/discussions, some Fridays

More information

Practice problems from old exams for math 233

Practice problems from old exams for math 233 Practice problems from old exams for math 233 William H. Meeks III October 26, 2012 Disclaimer: Your instructor covers far more materials that we can possibly fit into a four/five questions exams. These

More information

Select the Points You ll Use. Tech Assignment: Find a Quadratic Function for College Costs

Select the Points You ll Use. Tech Assignment: Find a Quadratic Function for College Costs In this technology assignment, you will find a quadratic function that passes through three of the points on each of the scatter plots you created in an earlier technology assignment. You will need the

More information

CS1110 Lab 6 (Mar 17-18, 2015)

CS1110 Lab 6 (Mar 17-18, 2015) CS1110 Lab 6 (Mar 17-18, 2015) First Name: Last Name: NetID: The lab assignments are very important and you must have a CS 1110 course consultant tell CMS that you did the work. (Correctness does not matter.)

More information

Math Day 2 Programming: How to make computers do math for you

Math Day 2 Programming: How to make computers do math for you Math Day 2 Programming: How to make computers do math for you Matt Coles February 10, 2015 1 Intro to Python (15min) Python is an example of a programming language. There are many programming languages.

More information

Math Lab 6: Powerful Fun with Power Series Representations of Functions Due noon Thu. Jan. 11 in class *note new due time, location for winter quarter

Math Lab 6: Powerful Fun with Power Series Representations of Functions Due noon Thu. Jan. 11 in class *note new due time, location for winter quarter Matter & Motion Winter 2017 18 Name: Math Lab 6: Powerful Fun with Power Series Representations of Functions Due noon Thu. Jan. 11 in class *note new due time, location for winter quarter Goals: 1. Practice

More information

f( x ), or a solution to the equation f( x) 0. You are already familiar with ways of solving

f( x ), or a solution to the equation f( x) 0. You are already familiar with ways of solving The Bisection Method and Newton s Method. If f( x ) a function, then a number r for which f( r) 0 is called a zero or a root of the function f( x ), or a solution to the equation f( x) 0. You are already

More information

Remaining Enhanced Labs

Remaining Enhanced Labs Here are some announcements regarding the end of the semester, and the specifications for the last Enhanced Labs. Don t forget that you need to take the Common Final Examination on Saturday, May 5, from

More information

EE 301 Signals & Systems I MATLAB Tutorial with Questions

EE 301 Signals & Systems I MATLAB Tutorial with Questions EE 301 Signals & Systems I MATLAB Tutorial with Questions Under the content of the course EE-301, this semester, some MATLAB questions will be assigned in addition to the usual theoretical questions. This

More information

Discrete Math: Selected Homework Problems

Discrete Math: Selected Homework Problems Discrete Math: Selected Homework Problems 2006 2.1 Prove: if d is a common divisor of a and b and d is also a linear combination of a and b then d is a greatest common divisor of a and b. (5 3.1 Prove:

More information

UNIT 9A Randomness in Computation: Random Number Generators

UNIT 9A Randomness in Computation: Random Number Generators UNIT 9A Randomness in Computation: Random Number Generators 1 Last Unit Computer organization: what s under the hood 3 This Unit Random number generation Using pseudorandom numbers 4 Overview The concept

More information

3. Conditionals & Loops

3. Conditionals & Loops Context: basic building blocks for programming any program you might want to write objects functions and modules graphics, sound, and image I/O arrays conditionals and loops conditionals loops Math primitive

More information

DEPARTMENT - Mathematics. Coding: N Number. A Algebra. G&M Geometry and Measure. S Statistics. P - Probability. R&P Ratio and Proportion

DEPARTMENT - Mathematics. Coding: N Number. A Algebra. G&M Geometry and Measure. S Statistics. P - Probability. R&P Ratio and Proportion DEPARTMENT - Mathematics Coding: N Number A Algebra G&M Geometry and Measure S Statistics P - Probability R&P Ratio and Proportion YEAR 7 YEAR 8 N1 Integers A 1 Simplifying G&M1 2D Shapes N2 Decimals S1

More information

(I m not printing out these notes! Take your own.)

(I m not printing out these notes! Take your own.) PT1420 Week 2: Software Program Design I (I m not printing out these notes! Take your own.) Today we'll be discussing designing programs: Algorithms and errors Flowcharts and pseudocode Sequence structures

More information

Instant Insanity Instructor s Guide Make-it and Take-it Kit for AMTNYS 2006

Instant Insanity Instructor s Guide Make-it and Take-it Kit for AMTNYS 2006 Instant Insanity Instructor s Guide Make-it and Take-it Kit for AMTNYS 2006 THE KIT: This kit contains materials for two Instant Insanity games, a student activity sheet with answer key and this instructor

More information

Procedures: Algorithms and Abstraction

Procedures: Algorithms and Abstraction Procedures: Algorithms and Abstraction 5 5.1 Objectives After completing this module, a student should be able to: Read and understand simple NetLogo models. Make changes to NetLogo procedures and predict

More information

Lecture 3 - Template and Vectors

Lecture 3 - Template and Vectors Lecture - Template and Vectors Homework Format and Template: We ll each develop a simple template to use to start any new homework. The idea of a template is to layout the basic structure of what goes

More information

MTH 122 Calculus II Essex County College Division of Mathematics and Physics 1 Lecture Notes #11 Sakai Web Project Material

MTH 122 Calculus II Essex County College Division of Mathematics and Physics 1 Lecture Notes #11 Sakai Web Project Material MTH Calculus II Essex County College Division of Mathematics and Physics Lecture Notes # Sakai Web Project Material Introduction - - 0 - Figure : Graph of y sin ( x y ) = x cos (x + y) with red tangent

More information

Math 170, Section 002 Spring 2012 Practice Final Exam with Solutions

Math 170, Section 002 Spring 2012 Practice Final Exam with Solutions Math 170, Section 002 Spring 2012 Practice Final Exam with Solutions Contents 1 Problems 2 2 Solution key 11 3 Solutions 12 1 1 Problems Question 1: Consider all natural numbers that can be written only

More information

CSCI 1100L: Topics in Computing Lab Lab 11: Programming with Scratch

CSCI 1100L: Topics in Computing Lab Lab 11: Programming with Scratch CSCI 1100L: Topics in Computing Lab Lab 11: Programming with Scratch Purpose: We will take a look at programming this week using a language called Scratch. Scratch is a programming language that was developed

More information

Rectangular Coordinates in Space

Rectangular Coordinates in Space Rectangular Coordinates in Space Philippe B. Laval KSU Today Philippe B. Laval (KSU) Rectangular Coordinates in Space Today 1 / 11 Introduction We quickly review one and two-dimensional spaces and then

More information

Ch. 7.4, 7.6, 7.7: Complex Numbers, Polar Coordinates, ParametricFall equations / 17

Ch. 7.4, 7.6, 7.7: Complex Numbers, Polar Coordinates, ParametricFall equations / 17 Ch. 7.4, 7.6, 7.7: Complex Numbers, Polar Coordinates, Parametric equations Johns Hopkins University Fall 2014 Ch. 7.4, 7.6, 7.7: Complex Numbers, Polar Coordinates, ParametricFall equations 2014 1 / 17

More information

5/27/12. Objectives. Plane Curves and Parametric Equations. Sketch the graph of a curve given by a set of parametric equations.

5/27/12. Objectives. Plane Curves and Parametric Equations. Sketch the graph of a curve given by a set of parametric equations. Objectives Sketch the graph of a curve given by a set of parametric equations. Eliminate the parameter in a set of parametric equations. Find a set of parametric equations to represent a curve. Understand

More information

Best Student Exam (Open and Closed) Solutions Texas A&M High School Math Contest 8 November 2014

Best Student Exam (Open and Closed) Solutions Texas A&M High School Math Contest 8 November 2014 Best Student Exam (Open and Closed) Solutions Texas A&M High School Math Contest 8 November 2014 1. The numbers 1, 2, 3, etc. are written down one after the other up to 1000, without any commas, in one

More information

Conditionals !

Conditionals ! Conditionals 02-201! Computing GCD GCD Problem: Compute the greatest common divisor of two integers. Input: Two integers a and b. Output: The greatest common divisor of a and b. Exercise: Design an algorithm

More information

Choose the file menu, and select Open. Input to be typed at the Maple prompt. Output from Maple. An important tip.

Choose the file menu, and select Open. Input to be typed at the Maple prompt. Output from Maple. An important tip. MAPLE Maple is a powerful and widely used mathematical software system designed by the Computer Science Department of the University of Waterloo. It can be used for a variety of tasks, such as solving

More information

Buds Public School, Dubai

Buds Public School, Dubai Buds Public School, Dubai Subject: Maths Grade: 11 AB Topic: Statistics, Probability, Trigonometry, 3D, Conic Section, Straight lines and Limits and Derivatives Statistics and Probability: 1. Find the

More information

CS61A Summer 2010 George Wang, Jonathan Kotker, Seshadri Mahalingam, Eric Tzeng, Steven Tang

CS61A Summer 2010 George Wang, Jonathan Kotker, Seshadri Mahalingam, Eric Tzeng, Steven Tang CS61A Notes Week 6B: Streams Streaming Along A stream is an element and a promise to evaluate the rest of the stream. You ve already seen multiple examples of this and its syntax in lecture and in the

More information

Creating and Incorporating Dynamic Applets for Differential Equations the Easy Way

Creating and Incorporating Dynamic Applets for Differential Equations the Easy Way Creating and Incorporating Dynamic Applets for Differential Equations the Easy Way Robert Decker University of Hartford June Decker Three Rivers Community College rdecker@hartford.edu uhaweb.hartford.edu/rdecker

More information

2. Numbers In, Numbers Out

2. Numbers In, Numbers Out REGZ9280: Global Education Short Course - Engineering 2. Numbers In, Numbers Out Reading: Moffat, Chapter 2. REGZ9280 14s2 2. Numbers In, Numbers Out 1 The Art of Programming Think about the problem Write

More information

C Functions. 5.2 Program Modules in C

C Functions. 5.2 Program Modules in C 1 5 C Functions 5.2 Program Modules in C 2 Functions Modules in C Programs combine user-defined functions with library functions - C standard library has a wide variety of functions Function calls Invoking

More information

Monte Carlo Integration and Random Numbers

Monte Carlo Integration and Random Numbers Monte Carlo Integration and Random Numbers Higher dimensional integration u Simpson rule with M evaluations in u one dimension the error is order M -4! u d dimensions the error is order M -4/d u In general

More information

MS6021 Scientific Computing. MatLab and Python for Mathematical Modelling. Aimed at the absolute beginner.

MS6021 Scientific Computing. MatLab and Python for Mathematical Modelling. Aimed at the absolute beginner. MS6021 Scientific Computing MatLab and Python for Mathematical Modelling. Aimed at the absolute beginner. Natalia Kopteva Email: natalia.kopteva@ul.ie Web: http://www.staff.ul.ie/natalia/ Room: B2037 Office

More information

Lecture 8 Mathematics

Lecture 8 Mathematics CS 491 CAP Intro to Competitive Algorithmic Programming Lecture 8 Mathematics Uttam Thakore University of Illinois at Urbana-Champaign October 14, 2015 Outline Number theory Combinatorics & probability

More information

a a= a a =a a 1 =1 Division turned out to be equivalent to multiplication: a b= a b =a 1 b

a a= a a =a a 1 =1 Division turned out to be equivalent to multiplication: a b= a b =a 1 b MATH 245 Extra Effort ( points) My assistant read through my first draft, got half a page in, and skipped to the end. So I will save you the flipping. Here is the assignment. Do just one of them. All the

More information

Lecture 2: SML Basics

Lecture 2: SML Basics 15-150 Lecture 2: SML Basics Lecture by Dan Licata January 19, 2012 I d like to start off by talking about someone named Alfred North Whitehead. With someone named Bertrand Russell, Whitehead wrote Principia

More information

UNIVERSITETET I OSLO

UNIVERSITETET I OSLO (Continued on page 2.) UNIVERSITETET I OSLO Det matematisk-naturvitenskapelige fakultet Examination in: INF1100 Introduction to programming with scientific applications Day of examination: Friday, December

More information

Bootstrapping Method for 14 June 2016 R. Russell Rhinehart. Bootstrapping

Bootstrapping Method for  14 June 2016 R. Russell Rhinehart. Bootstrapping Bootstrapping Method for www.r3eda.com 14 June 2016 R. Russell Rhinehart Bootstrapping This is extracted from the book, Nonlinear Regression Modeling for Engineering Applications: Modeling, Model Validation,

More information

Programming. Dr Ben Dudson University of York

Programming. Dr Ben Dudson University of York Programming Dr Ben Dudson University of York Outline Last lecture covered the basics of programming and IDL This lecture will cover More advanced IDL and plotting Fortran and C++ Programming techniques

More information

Introduction to Modular Arithmetic

Introduction to Modular Arithmetic Randolph High School Math League 2014-2015 Page 1 1 Introduction Introduction to Modular Arithmetic Modular arithmetic is a topic residing under Number Theory, which roughly speaking is the study of integers

More information

CSC 1351: Quiz 6: Sort and Search

CSC 1351: Quiz 6: Sort and Search CSC 1351: Quiz 6: Sort and Search Name: 0.1 You want to implement combat within a role playing game on a computer. Specifically, the game rules for damage inflicted by a hit are: In order to figure out

More information

Getting Started With Fortran 90

Getting Started With Fortran 90 Getting Started With Fortran 90 Tabish Qureshi First Edition, August 2011 Center for Theoretical Physics Jamia Millia Islamia New Delhi - 110025. CONTENTS Tabish Qureshi Contents 1 Programming Languages

More information

Activity Guide - Public Key Cryptography

Activity Guide - Public Key Cryptography Unit 2 Lesson 19 Name(s) Period Date Activity Guide - Public Key Cryptography Introduction This activity is similar to the cups and beans encryption we did in a previous lesson. However, instead of using

More information

y= sin( x) y= cos( x)

y= sin( x) y= cos( x) . The graphs of sin(x) and cos(x). Now I am going to define the two basic trig functions: sin(x) and cos(x). Study the diagram at the right. The circle has radius. The arm OP starts at the positive horizontal

More information

hp calculators HP 9g Probability Random Numbers Random Numbers Simulation Practice Using Random Numbers for Simulations

hp calculators HP 9g Probability Random Numbers Random Numbers Simulation Practice Using Random Numbers for Simulations Random Numbers Simulation Practice Using Random Numbers for Simulations Random numbers Strictly speaking, random numbers are those numbers the digits of which are chosen with replacement so that it is

More information

During the timed portion for Part A, you may work only on the problems in Part A.

During the timed portion for Part A, you may work only on the problems in Part A. SECTION II Time: hour and 30 minutes Percent of total grade: 50 Part A: 45 minutes, 3 problems (A graphing calculator is required for some problems or parts of problems.) During the timed portion for Part

More information

CS 130. Scan Conversion. Raster Graphics

CS 130. Scan Conversion. Raster Graphics CS 130 Scan Conversion Raster Graphics 2 1 Image Formation Computer graphics forms images, generally two dimensional, using processes analogous to physical imaging systems like: - Cameras - Human visual

More information

CpSc 1111 Lab 6 Conditional Statements, Loops, the Math Library, and Random Numbers What s the Point?

CpSc 1111 Lab 6 Conditional Statements, Loops, the Math Library, and Random Numbers What s the Point? CpSc 1111 Lab 6 Conditional Statements, Loops, the Math Library, and Random Numbers What s the Point? Overview For this lab, you will use: one or more of the conditional statements explained below scanf()

More information

Excel for Gen Chem General Chemistry Laboratory September 15, 2014

Excel for Gen Chem General Chemistry Laboratory September 15, 2014 Excel for Gen Chem General Chemistry Laboratory September 15, 2014 Excel is a ubiquitous data analysis software. Mastery of Excel can help you succeed in a first job and in your further studies with expertise

More information

Outline of Fortran 90 Topics

Outline of Fortran 90 Topics Outline of Fortran 90 Topics Overview of Computing Computer Organization Languages Problem Solving Data Fortran 90 Character Set Variables Basic Data Types Expressions Numeric Non-numeric Control Structures

More information

COMP 250: Java Programming I. Carlos G. Oliver, Jérôme Waldispühl January 17-18, 2018 Slides adapted from M. Blanchette

COMP 250: Java Programming I. Carlos G. Oliver, Jérôme Waldispühl January 17-18, 2018 Slides adapted from M. Blanchette COMP 250: Java Programming I Carlos G. Oliver, Jérôme Waldispühl January 17-18, 2018 Slides adapted from M. Blanchette Variables and types [Downey Ch 2] Variable: temporary storage location in memory.

More information

Fundamentals. Fundamentals. Fundamentals. We build up instructions from three types of materials

Fundamentals. Fundamentals. Fundamentals. We build up instructions from three types of materials Fundamentals We build up instructions from three types of materials Constants Expressions Fundamentals Constants are just that, they are values that don t change as our macros are executing Fundamentals

More information

Honors Advanced Algebra Unit 4: Rational & Radical Relationships January 12, 2017 Task 18: Graphing Rational Functions

Honors Advanced Algebra Unit 4: Rational & Radical Relationships January 12, 2017 Task 18: Graphing Rational Functions Honors Advanced Algebra Name Unit 4: Rational & Radical Relationships January 1, 017 Task 18: Graphing Rational Functions MGSE9 1.F.IF.7 Graph functions expressed symbolically and show key features of

More information

Monte Carlo Integration

Monte Carlo Integration Lab 18 Monte Carlo Integration Lab Objective: Implement Monte Carlo integration to estimate integrals. Use Monte Carlo Integration to calculate the integral of the joint normal distribution. Some multivariable

More information

3. Conditionals & Loops

3. Conditionals & Loops COMPUTER SCIENCE S E D G E W I C K / W A Y N E 3. Conditionals & Loops Section 1.3 http://introcs.cs.princeton.edu Context: basic building blocks for programming any program you might want to write objects

More information

Applied Calculus. Lab 1: An Introduction to R

Applied Calculus. Lab 1: An Introduction to R 1 Math 131/135/194, Fall 2004 Applied Calculus Profs. Kaplan & Flath Macalester College Lab 1: An Introduction to R Goal of this lab To begin to see how to use R. What is R? R is a computer package for

More information

CS 206 Introduction to Computer Science II

CS 206 Introduction to Computer Science II CS 206 Introduction to Computer Science II 03 / 25 / 2013 Instructor: Michael Eckmann Today s Topics Comments/Questions? More on Recursion Including Dynamic Programming technique Divide and Conquer techniques

More information

Let be a function. We say, is a plane curve given by the. Let a curve be given by function where is differentiable with continuous.

Let be a function. We say, is a plane curve given by the. Let a curve be given by function where is differentiable with continuous. Module 8 : Applications of Integration - II Lecture 22 : Arc Length of a Plane Curve [Section 221] Objectives In this section you will learn the following : How to find the length of a plane curve 221

More information

3. Conditionals and loops

3. Conditionals and loops COMPUTER SCIENCE S E D G E W I C K / W A Y N E 3. Conditionals and loops Section 1.3 http://introcs.cs.princeton.edu COMPUTER SCIENCE S E D G E W I C K / W A Y N E 3. Conditionals & Loops Conditionals:

More information

Professor Stephen Sekula

Professor Stephen Sekula Monte Carlo Techniques Professor Stephen Sekula Guest Lecture PHYS 4321/7305 What are Monte Carlo Techniques? Computational algorithms that rely on repeated random sampling in order to obtain numerical

More information

Mathematics. Jaehyun Park. CS 97SI Stanford University. June 29, 2015

Mathematics. Jaehyun Park. CS 97SI Stanford University. June 29, 2015 Mathematics Jaehyun Park CS 97SI Stanford University June 29, 2015 Outline Algebra Number Theory Combinatorics Geometry Algebra 2 Sum of Powers n k=1 k 3 k 2 = 1 n(n + 1)(2n + 1) 6 = ( k ) 2 = ( 1 2 n(n

More information

Introduction to Fortran Programming. - Module -

Introduction to Fortran Programming. - Module - Introduction to Fortran Programming - Module - Subprograms Subprograms are used to split program into separate smaller units. Internal subprograms are dependent parts of program. Fortran 90 has two types

More information

x 2 + 3, r 4(x) = x2 1

x 2 + 3, r 4(x) = x2 1 Math 121 (Lesieutre); 4.2: Rational functions; September 1, 2017 1. What is a rational function? It s a function of the form p(x), where p(x) and q(x) are both polynomials. In other words, q(x) something

More information

MATHEMATICS FOR ENGINEERING TUTORIAL 5 COORDINATE SYSTEMS

MATHEMATICS FOR ENGINEERING TUTORIAL 5 COORDINATE SYSTEMS MATHEMATICS FOR ENGINEERING TUTORIAL 5 COORDINATE SYSTEMS This tutorial is essential pre-requisite material for anyone studying mechanical engineering. This tutorial uses the principle of learning by example.

More information

Discrete Mathematics and Probability Theory Fall 2013 Midterm #2

Discrete Mathematics and Probability Theory Fall 2013 Midterm #2 CS 70 Discrete Mathematics and Probability Theory Fall 013 Midterm # 1. (30 points) Short Answer. No justification necessary. Please write only the answer in the space provided after each question. Please

More information

The x coordinate tells you how far left or right from center the point is. The y coordinate tells you how far up or down from center the point is.

The x coordinate tells you how far left or right from center the point is. The y coordinate tells you how far up or down from center the point is. We will review the Cartesian plane and some familiar formulas. College algebra Graphs 1: The Rectangular Coordinate System, Graphs of Equations, Distance and Midpoint Formulas, Equations of Circles Section

More information

What You ll See in This Chapter. Word Cloud. René Descartes. Introduction. Ian Parberry University of North Texas. Fletcher Dunn

What You ll See in This Chapter. Word Cloud. René Descartes. Introduction. Ian Parberry University of North Texas. Fletcher Dunn What You ll See in This Chapter Chapter 1: Cartesian Coordinate Systems Fletcher Dunn Valve Software Ian Parberry University of North Texas This chapter describes the basic concepts of 3D math. It is divided

More information

Woodcote Primary School Learning Ladder Maths Milestone 1 Autumn

Woodcote Primary School Learning Ladder Maths Milestone 1 Autumn Maths Milestone 1 tumn count to ten twenty, forwards backwards, beginning with 0 or 1, or from any given count, read write to 10 20 in numerals words show s using objects pictures the words; equals to,

More information

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

Numerical Modelling in Fortran: day 7. Paul Tackley, 2017 Numerical Modelling in Fortran: day 7 Paul Tackley, 2017 Today s Goals 1. Makefiles 2. Intrinsic functions 3. Optimisation: Making your code run as fast as possible 4. Combine advection-diffusion and Poisson

More information

Outline. Announcements. Homework 2. Boolean expressions 10/12/2007. Announcements Homework 2 questions. Boolean expression

Outline. Announcements. Homework 2. Boolean expressions 10/12/2007. Announcements Homework 2 questions. Boolean expression Outline ECS 10 10/8 Announcements Homework 2 questions Boolean expressions If/else statements State variables and avoiding sys.exit( ) Example: Coin flipping (if time permits) Announcements Professor Amenta

More information

MATLAB INTRODUCTION. Matlab can be used interactively as a super hand calculator, or, more powerfully, run using scripts (i.e., programs).

MATLAB INTRODUCTION. Matlab can be used interactively as a super hand calculator, or, more powerfully, run using scripts (i.e., programs). L A B 6 M A T L A B MATLAB INTRODUCTION Matlab is a commercial product that is used widely by students and faculty and researchers at UTEP. It provides a "high-level" programming environment for computing

More information

MATH 22 MORE ABOUT FUNCTIONS. Lecture M: 10/14/2003. Form follows function. Louis Henri Sullivan

MATH 22 MORE ABOUT FUNCTIONS. Lecture M: 10/14/2003. Form follows function. Louis Henri Sullivan MATH 22 Lecture M: 10/14/2003 MORE ABOUT FUNCTIONS Form follows function. Louis Henri Sullivan This frightful word, function, was born under other skies than those I have loved. Le Corbusier D ora innanzi

More information

Math-2. Lesson 3-1. Equations of Lines

Math-2. Lesson 3-1. Equations of Lines Math-2 Lesson 3-1 Equations of Lines How can an equation make a line? y = x + 1 x -4-3 -2-1 0 1 2 3 Fill in the rest of the table rule x + 1 f(x) -4 + 1-3 -3 + 1-2 -2 + 1-1 -1 + 1 0 0 + 1 1 1 + 1 2 2 +

More information

3D Rotation: more than just a hobby

3D Rotation: more than just a hobby 3D Rotation: more than just a hobby Eric Yang s special talent is the mental rotation of threedimensional objects. Mental rotation is Yang s hobby. I can see textures and imperfections and the play of

More information

Modular Arithmetic. Marizza Bailey. December 14, 2015

Modular Arithmetic. Marizza Bailey. December 14, 2015 Modular Arithmetic Marizza Bailey December 14, 2015 Introduction to Modular Arithmetic If someone asks you what day it is 145 days from now, what would you answer? Would you count 145 days, or find a quicker

More information

Week 1: Introduction to R, part 1

Week 1: Introduction to R, part 1 Week 1: Introduction to R, part 1 Goals Learning how to start with R and RStudio Use the command line Use functions in R Learning the Tools What is R? What is RStudio? Getting started R is a computer program

More information

Lecture 3: Recursion; Structural Induction

Lecture 3: Recursion; Structural Induction 15-150 Lecture 3: Recursion; Structural Induction Lecture by Dan Licata January 24, 2012 Today, we are going to talk about one of the most important ideas in functional programming, structural recursion

More information

The Rational Zero Theorem

The Rational Zero Theorem The Rational Zero Theorem Our goal in this section is to learn how we can ind the rational zeros o the polynomials. For example: x = x 4 + x x x + ( ) We could randomly try some actors and use synthetic

More information

PRIMES Circle: High School Math Enrichment at MIT

PRIMES Circle: High School Math Enrichment at MIT PRIMES Circle: High School Math Enrichment at MIT Department of Mathematics, MIT ivogt@mit.edu June 25th, 2015 PRIMES Umbrella organization: research and outreach Four programs: MIT PRIMES: research on

More information

Name: Dr. Fritz Wilhelm Lab 1, Presentation of lab reports Page # 1 of 7 5/17/2012 Physics 120 Section: ####

Name: Dr. Fritz Wilhelm Lab 1, Presentation of lab reports Page # 1 of 7 5/17/2012 Physics 120 Section: #### Name: Dr. Fritz Wilhelm Lab 1, Presentation of lab reports Page # 1 of 7 Lab partners: Lab#1 Presentation of lab reports The first thing we do is to create page headers. In Word 2007 do the following:

More information