COMP 204. Object Oriented Programming (OOP) - Inheritance. Mathieu Blanchette

Size: px
Start display at page:

Download "COMP 204. Object Oriented Programming (OOP) - Inheritance. Mathieu Blanchette"

Transcription

1 COMP 204 Object Oriented Programming (OOP) - Inheritance Mathieu Blanchette 1 / 14

2 Inheritance Motivation: We often need to create classes that are closely related but not identical to an existing class. Example: We already have created a Bus class with attributes: station, capacity, passengers, terminus methods: init, move, unload, load, str To represent a bus where passengers have to pay to board, we may want to add new attributes like the price of the ticket and the total amount of money present on the bus. To represent an express bus that only stops at certain stops, we may want to add attributes about the stops the bus will make, and modify the load/unload methods accordingly. Note: We want to continue to use all the other attributes and methods defined on the Bus class. 2 / 14

3 Inheritance How can we do this? A bad approach: Duplication Create a PayBus class. Copy-paste the Bus class code into it. Add a new attribute cost of ticket and cash onboard. Bad because: We now have two copies of the Bus code. If we want to make a change to the Bus class (e.g. bug fix, or improvement), we have to remember to make the same change to the PayBus class. Makes program large, difficult to understand. Good approach: Inheritance Create a PayBus class that inherits the attributes and methods of the Patient class. 3 / 14

4 The Bus class 1 c l a s s Bus : 2 d e f i n i t ( s e l f ) : 3 s e l f. s t a t i o n = 0 # t h e p o s i t i o n o f t h e bus 4 s e l f. c a p a c i t y = 5 # t h e c a p a c i t y o f t h e bus 5 s e l f. p a s s e n g e r s = [ ] # t h e c o n t e n t o f t h e bus 6 s e l f. t e r m i n u s = 5 # The l a s t s t a t i o n 7 8 d e f move ( s e l f ) : 9 # code not shown d e f u n l o a d ( s e l f ) : 12 # code not shown d e f l o a d ( s e l f, w a i t i n g l i n e ) : 15 # code not shown d e f s t r ( s e l f ) : 18 # code not shown 4 / 14

5 Creating a subclass To create a new class PayBus that is a subclass of the Bus class: 1 c l a s s PayBus ( Bus ) : 2 d e f i n i t ( s e l f, p r i c e =2) : 3 Bus. i n i t ( s e l f ) 4 s e l f. c o s t o f t i c k e t = p r i c e # c o s t o f a t i c k e t 5 s e l f. cash = 0 # t h e t o t a l cash onboard Notes: The PayBus class is a subclass of Bus because of line 1: class PayBus(Bus): PayBus inherits the attributes and methods of the Bus class. Those get initialized by the line: Bus. init (self) which calls the init method of the parent class. Note: Since we are calling the method directly on the class rather than on an object, self needs to be explicitly passed as an argument. PayBus extends the Bus class by adding two new attributes: cost of ticket and cash 5 / 14

6 PayBus class The PayBus class has 6 attributes (station, capacity, passengers, terminus, cost of ticket, cash) and 5 methods ( init, move, unload, load, str ). They can be used like with any other class: 1 stm bus = PayBus ( 2 ) 2 stm bus. l o a d ( [ 3, 4, 5, 2, 6, 2, 3 ] ) 3 stm bus. s t a t i o n = 3 4 stm bus. cash = p r i n t ( stm bus ) 6 # P r i n t s : Bus a t s t a t i o n 3 c o n t a i n s p a s s e n g e r s [ 3, 4, 5, 2, 6 ]. OK, so our PayBus class has this extra attribute cash, but the Bus methods don t know about it... 6 / 14

7 Overriding the load method Goal: Make new passengers pay price of ticket when they board, add to cash Approach: Create a new load() method in the PayBus class. It will override the load() method of the parent class. 1 c l a s s PayBus ( Bus ) : 2 d e f i n i t ( s e l f, p r i c e =2) : 3 Bus. i n i t ( s e l f ) 4 s e l f. c o s t o f t i c k e t = p r i c e # c o s t o f a t i c k e t 5 s e l f. cash = 0 # t h e t o t a l cash onboard 6 7 d e f l o a d ( s e l f, w a i t i n g l i n e ) : 8 n u m b e r b o a r d i n g = Bus. l o a d ( s e l f, w a i t i n g l i n e ) 9 s e l f. cash += n u m b e r b o a r d i n g s e l f. c o s t o f t i c k e t 10 r e t u r n n u m b e r b o a r d i n g Notes: The load() method first calls the load method of the parent class. This deals with adding new passengers. It then updates the amount of cash on the bus. 1 stm bus = PayBus ( 2 ) 2 stm bus. l o a d ( [ 3, 4, 5, 2, 6, 2, 3 ] ) 3 p r i n t ( Cash =, stm bus. cash ) # P r i n t s Cash = 10 7 / 14

8 Overriding the str method We should also revise the str method to make it print information about the amount of cash on board. 1 c l a s s PayBus ( Bus ) : 2 d e f i n i t ( s e l f, p r i c e =2) : 3 Bus. i n i t ( s e l f ) 4 s e l f. c o s t o f t i c k e t = p r i c e # c o s t o f a t i c k e t 5 s e l f. cash = 0 # t h e t o t a l cash onboard 6 7 d e f l o a d ( s e l f, w a i t i n g l i n e ) : 8 n u m b e r b o a r d i n g = Bus. l o a d ( s e l f, w a i t i n g l i n e ) 9 s e l f. cash += n u m b e r b o a r d i n g s e l f. c o s t o f t i c k e t 10 r e t u r n n u m b e r b o a r d i n g d e f s t r ( s e l f ) : 13 r e t u r n Bus. s t r ( s e l f )+\ 14. Amount o f cash : + s t r ( s e l f. cash ) 8 / 14

9 ExpressBus class A class like Bus can have many different subclasses. We will create an ExpressBus subclass. An express bus differs from a normal bus in that it only stops at certain predetermined stop. 1 c l a s s E x p r e s s B u s ( Bus ) : 2 d e f i n i t ( s e l f, my stops ) : 3 Bus. i n i t ( s e l f ) 4 s e l f. s t o p s = my stops # l i s t o f s t a t i o n s 5 # where t h e bus w i l l s t o p Note: We could also have decided that the ExpressBus class is a subclass of the PayBus class, if we needed the functionality of payments. 9 / 14

10 ExpressBus class We now need to override the load and unload methods to only allow boarding/unloading if we are at a station where the bus stops. 1 c l a s s E x p r e s s B u s ( Bus ) : 2 d e f i n i t ( s e l f, my stops ) : 3 Bus. i n i t ( s e l f ) 4 s e l f. s t o p s = my stops # l i s t o f s t a t i o n s 5 # where t h e bus w i l l s t o p 6 7 d e f u n l o a d ( s e l f ) : 8 i f s e l f. s t a t i o n i n s e l f. s t o p s : 9 r e t u r n Bus. u n l o a d ( s e l f ) # a l l o w u n l o a d i n g 10 e l s e : 11 r e t u r n [ ] # no u n l o a d i n g d e f l o a d ( s e l f, w a i t i n g l i n e ) : 14 i f s e l f. s t a t i o n i n s e l f. s t o p s : # a l l o w l o a d i n g 15 r e t u r n Bus. l o a d ( s e l f, w a i t i n g l i n e ) 16 e l s e : # no l o a d i n g 17 r e t u r n 0 10 / 14

11 ExpressBus class See the difference between the Bus and ExpressBus classes: 1 exp = E x p r e s s B u s ( [ 0, 2, 4 ] ) # bus w i l l s t o p o n l y a t 0, 2, 4 2 s l o w = Bus ( ) 3 exp. l o a d ( [ 5, 3, 1 ] ) 4 s l o w. l o a d ( [ 5, 3, 1 ] ) 5 p r i n t ( exp ) # Bus a t s t a t i o n 0 c o n t a i n s p a s s e n g e r s [ 5, 3, 1 ] 6 p r i n t ( s l o w ) # Bus a t s t a t i o n 0 c o n t a i n s p a s s e n g e r s [ 5, 3, 1 ] 7 8 exp. move ( ) 9 s l o w. move ( ) 10 exp. l o a d ( [ 4, 3 ] ) # Nobody g e t s l o a d e d onto e x p r e s s bus 11 s l o w. l o a d ( [ 4, 3 ] ) # But p a s s e n g e r s can board t h e s l o w bus 12 p r i n t ( exp ) # Bus a t s t a t i o n 1 c o n t a i n s p a s s e n g e r s [ 5, 3, 1 ] 13 p r i n t ( s l o w ) # Bus a t s t a t i o n 1 c o n t a i n s p a s s e n g e r s [ 5, 3, 1, 4, 3 ] 11 / 14

12 ExpressBus class Subclasses can also define their own methods. Example: Load safe() method only allows boarding for people whose destination is among the stops the express buss will make. 1 d e f l o a d s a f e ( s e l f, w a i t i n g l i n e ) : 2 # o n l y a l l o w s b o a r d i n g f o r p a s s e n g e r s 3 # whose d e s t i n a t i o n i s one o f t h e s t o p s 4 # o f t h e e x p r e s s bus 5 s h o u l d b o a r d = [ p f o r p i n w a i t i n g l i n e \ 6 i f p i n s e l f. s t o p s ] 7 n u m b e r b o a r d i n g = min ( l e n ( s h o u l d b o a r d ),\ 8 s e l f. c a p a c i t y l e n ( s e l f. p a s s e n g e r s ) ) 9 p e o p l e b o a r d i n g = s h o u l d b o a r d [ 0 : n u m b e r b o a r d i n g ] 1 exp = E x p r e s s B u s ( [ 0, 2, 4 ] ) 2 exp. l o a d s a f e ( [ 4, 2, 3, 1, 3, 2 ] ) 3 p r i n t ( exp ) # Bus a t s t a t i o n 0 c o n t a i n s p a s s e n g e r s [ 4, 2, 2 ] 4 5 s l o w = Bus ( ) 6 s l o w. l o a d s a f e ( [ 4, 2, 3, 1, 3, 2 ] ) 7 # A t t r i b u t e E r r o r : Bus o b j e c t has no a t t r i b u t e l o a d s a f e 12 / 14

13 Extending BioPython classes We can write new classes that extend any existing class, including those defined in BioPython. Example: Define the MySeq class that extends the Seq class to add a list of confidence values (between 0 and 1) associated to each character in the sequence an average confidence() method that computes the average confidence values for the sequence a gc content() method that computes the fraction of bases that are either G or C 13 / 14

14 Extending BioPython classes 1 from Bio. Seq i m p o r t Seq 2 3 c l a s s MySeq ( Seq ) : 4 d e f i n i t ( s e l f, seq, c o n f ) : 5 Seq. i n i t ( s e l f, seq ) 6 s e l f. c o n f i d e n c e = c o n f # c o n f i d e n c e v a l u e s 7 8 # Seq doesn t compute GC c o n t e n t so 9 # we l l add t h a t f u n c t i o n a l i t y 10 d e f g c c o n t e n t ( s e l f ) : 11 r e t u r n l e n ( [ b f o r b i n s e l f i f b i n GC ] ) / l e n ( s e l f ) d e f a v g c o n f i d e n c e ( s e l f ) : 14 r e t u r n sum ( s e l f. c o n f i d e n c e ) / l e n ( s e l f. c o n f i d e n c e ) seq1 = Seq ( ACGTATG ) 17 seq2 = MySeq ( AAACG, [ 0. 9, 0. 8, 0. 5, 1, 0. 8 ] ) 18 p r i n t ( GC c o n t e n t =, seq2. g c c o n t e n t ( ) ) 19 p r i n t ( Average c o n f i d e n c e v a l u e =, seq2. a v g c o n f i d e n c e ( ) ) 14 / 14

COMP 204. Object Oriented Programming (OOP) Mathieu Blanchette

COMP 204. Object Oriented Programming (OOP) Mathieu Blanchette COMP 204 Object Oriented Programming (OOP) Mathieu Blanchette 1 / 14 Object-Oriented Programming OOP is a way to write and structure programs to make them easier to design, understand, debug, and maintain.

More information

Instance Methods and Inheritance (1/2)

Instance Methods and Inheritance (1/2) Instance Methods and Inheritance (1/2) 1 class Professor { 2 p u b l i c void say_hello ( ) { 3 System. out. p r i n t l n ( " Hello! " ) ; 4 } 5 } 6 class CSIEProfessor extends Professor { 7 p u b l i

More information

This will mark the bills as Paid in QuickBooks and will show us with one balance number in the faux RJO Exchange Account how much we owe RJO.

This will mark the bills as Paid in QuickBooks and will show us with one balance number in the faux RJO Exchange Account how much we owe RJO. PAYING & ENTERING RJO BILLS QuickBooks will not allow you to pay two separate vendors (like Stuller & Rembrandt Charm Co) on one check and have the payee be "RJO". So we have to use a 2 prong approach.

More information

Math 11 - Systems of Equations and Inequalities

Math 11 - Systems of Equations and Inequalities Name: Period: /30 ID: A Math 11 - Systems of Equations and Inequalities Multiple Choice Identify the choice that best completes the statement or answers the question. 1. (1 point) What system of equations

More information

Chapter 5: Writing Linear Equations Study Guide (REG)

Chapter 5: Writing Linear Equations Study Guide (REG) Chapter 5: Writing Linear Equations Study Guide (REG) 5.1: Write equations of lines given slope and y intercept or two points Write the equation of the line with the given information: Ex: Slope: 0, y

More information

Please bring the task to your first physics lesson and hand it to the teacher.

Please bring the task to your first physics lesson and hand it to the teacher. Pre-enrolment task for 2014 entry Physics Why do I need to complete a pre-enrolment task? This bridging pack serves a number of purposes. It gives you practice in some of the important skills you will

More information

Road to GIS, PSE s past, present and future

Road to GIS, PSE s past, present and future Road to GIS, PSE s past, present and future PSE Gas Mapping History 1840 Early 1900 s Gas piping was captured in Field Books which were than converted onto Mylar maps using Pen and Ink. 1955 Washington

More information

Travel and Transportation

Travel and Transportation A) Locations: B) Time 1) in the front 4) by the window 7) earliest 2) in the middle 5) on the isle 8) first 3) in the back 6) by the door 9) next 10) last 11) latest B) Actions: 1) Get on 2) Get off 3)

More information

MATHEMATICS PAPER 1. Question-Answer Book. QUEEN S COLLEGE Half-yearly Examination, Secondary 1 Date: Time: 8:30 am 9:45 am

MATHEMATICS PAPER 1. Question-Answer Book. QUEEN S COLLEGE Half-yearly Examination, Secondary 1 Date: Time: 8:30 am 9:45 am QUEEN S COLLEGE Half-yearly Examination, 2008-2009 MATHEMATICS PAPER Class Class Number Question-Answer Book Secondary Date: 2 2009 Time: 8:0 am 9:5 am Teacher s Use Only Question No. Max. marks Marks

More information

Event Guide. new york/new jersey. Friday, July 20, Connect @WaterLanternFestival

Event Guide. new york/new jersey. Friday, July 20, Connect  @WaterLanternFestival new york/new jersey Event Guide Friday, July 20, 2018 Connect with us @WaterLanternFestival @OWWaterLantern @WaterLanternFestival #WaterLanternFestival Event Info Welcome to the Water Lantern Festival

More information

Problem Set #2 Due: 1:00pm on Monday, Oct 15th

Problem Set #2 Due: 1:00pm on Monday, Oct 15th Chris Piech PSet #2 CS109 October 5, 2018 Problem Set #2 Due: 1:00pm on Monday, Oct 15th For each problem, briefly explain/justify how you obtained your answer in order to obtain full credit. Your explanations

More information

Frequently Asked Questions

Frequently Asked Questions Frequently Asked Questions Can I still get paid via direct deposit? Can I use e- wallet to pay for USANA auto ship orders? Can I use e- wallet to pay for USANA products? Can I use e- wallet to pay for

More information

Statistics Revision Questions Nov 2016 [175 marks]

Statistics Revision Questions Nov 2016 [175 marks] Statistics Revision Questions Nov 2016 [175 marks] The distribution of rainfall in a town over 80 days is displayed on the following box-and-whisker diagram. 1a. Write down the median rainfall. 1b. Write

More information

Logistic Regression. Some slides from Craig Burkett. STA303/STA1002: Methods of Data Analysis II, Summer 2016 Michael Guerzhoy

Logistic Regression. Some slides from Craig Burkett. STA303/STA1002: Methods of Data Analysis II, Summer 2016 Michael Guerzhoy Logistic Regression Some slides from Craig Burkett STA303/STA1002: Methods of Data Analysis II, Summer 2016 Michael Guerzhoy Titanic Survival Case Study The RMS Titanic A British passenger liner Collided

More information

M5-2 Exact Trig Values

M5-2 Exact Trig Values M5- Exact Trig Values exact values of the trig functions of multiples of and 5 degrees Pre-requisites: M5- (Unit Circle) Estimated Time: hours Summary Learn Solve Revise Answers Summary The es, coes and

More information

Honors Math 2 Unit 5 Exponential Functions. *Quiz* Common Logs Solving for Exponents Review and Practice

Honors Math 2 Unit 5 Exponential Functions. *Quiz* Common Logs Solving for Exponents Review and Practice Honors Math 2 Unit 5 Exponential Functions Notes and Activities Name: Date: Pd: Unit Objectives: Objectives: N-RN.2 Rewrite expressions involving radicals and rational exponents using the properties of

More information

To Infinity and Beyond

To Infinity and Beyond University of Waterloo How do we count things? Suppose we have two bags filled with candy. In one bag we have blue candy and in the other bag we have red candy. How can we determine which bag has more

More information

Announcements. Midterm Review Session. Extended TA session on Friday 9am to 12 noon.

Announcements. Midterm Review Session. Extended TA session on Friday 9am to 12 noon. Announcements Extended TA session on Friday 9am to 12 noon. Midterm Review Session The midterm prep set indicates the difficulty level of the midterm and the type of questions that can be asked. Please

More information

T 1. The value function v(x) is the expected net gain when using the optimal stopping time starting at state x:

T 1. The value function v(x) is the expected net gain when using the optimal stopping time starting at state x: 108 OPTIMAL STOPPING TIME 4.4. Cost functions. The cost function g(x) gives the price you must pay to continue from state x. If T is your stopping time then X T is your stopping state and f(x T ) is your

More information

QueueTraffic and queuing theory

QueueTraffic and queuing theory QueueTraffic and queuing theory + Queues in everyday life You have certainly been in a queue somewhere. Where? How were they different? At ticket vending machines, cash desks, at the doctors, at printers,

More information

Representations of Motion in One Dimension: Speeding up and slowing down with constant acceleration

Representations of Motion in One Dimension: Speeding up and slowing down with constant acceleration Representations of Motion in One Dimension: Speeding up and slowing down with constant acceleration Name: Group Members: Date: TA s Name: Apparatus: Aluminum track and supports, PASCO Smart Cart, two cart

More information

1. If X has density. cx 3 e x ), 0 x < 0, otherwise. Find the value of c that makes f a probability density. f(x) =

1. If X has density. cx 3 e x ), 0 x < 0, otherwise. Find the value of c that makes f a probability density. f(x) = 1. If X has density f(x) = { cx 3 e x ), 0 x < 0, otherwise. Find the value of c that makes f a probability density. 2. Let X have density f(x) = { xe x, 0 < x < 0, otherwise. (a) Find P (X > 2). (b) Find

More information

Using Recursion in Models and Decision Making: Recursion in Cyclical Models IV.D Student Activity Sheet 7: Modeling the Singapore Flyer

Using Recursion in Models and Decision Making: Recursion in Cyclical Models IV.D Student Activity Sheet 7: Modeling the Singapore Flyer Student: Class: Date: On February 11, 2008, Singapore opened a new observation wheel called the Singapore Flyer. At the time of its opening, this giant Ferris wheel was the tallest in the world. The Singapore

More information

Koza s Algorithm. Choose a set of possible functions and terminals for the program.

Koza s Algorithm. Choose a set of possible functions and terminals for the program. Step 1 Koza s Algorithm Choose a set of possible functions and terminals for the program. You don t know ahead of time which functions and terminals will be needed. User needs to make intelligent choices

More information

You may not use your books/notes on this exam. You may use calculator.

You may not use your books/notes on this exam. You may use calculator. MATH 450 Fall 2018 Review problems 12/03/18 Time Limit: 60 Minutes Name (Print: This exam contains 6 pages (including this cover page and 5 problems. Check to see if any pages are missing. Enter all requested

More information

Inequalities. CK12 Editor. Say Thanks to the Authors Click (No sign in required)

Inequalities. CK12 Editor. Say Thanks to the Authors Click  (No sign in required) Inequalities CK12 Editor Say Thanks to the Authors Click http://www.ck12.org/saythanks (No sign in required) To access a customizable version of this book, as well as other interactive content, visit www.ck12.org

More information

Patterns & Graphs FPMath 70 Unit 3 Worksheet

Patterns & Graphs FPMath 70 Unit 3 Worksheet 1. The image below shows a pattern of sections from a fence made from boards. a. Sketch the net two sections of the fence: b. Complete the following chart: Fence # (variable) # of boards 1 4 2 7 3 4 5

More information

Math 378 Spring 2011 Assignment 4 Solutions

Math 378 Spring 2011 Assignment 4 Solutions Math 3 Spring 2011 Assignment 4 Solutions Brualdi 6.2. The properties are P 1 : is divisible by 4. P 2 : is divisible by 6. P 3 : is divisible by. P 4 : is divisible by 10. Preparing to use inclusion-exclusion,

More information

Chapter 9: Hypothesis Testing Sections

Chapter 9: Hypothesis Testing Sections 1 / 22 : Hypothesis Testing Sections Skip: 9.2 Testing Simple Hypotheses Skip: 9.3 Uniformly Most Powerful Tests Skip: 9.4 Two-Sided Alternatives 9.5 The t Test 9.6 Comparing the Means of Two Normal Distributions

More information

Tutorial 2: Modelling Transmission

Tutorial 2: Modelling Transmission Tutorial 2: Modelling Transmission In our previous example the load and generation were at the same bus. In this tutorial we will see how to model the transmission of power from one bus to another. The

More information

EDA045F: Program Analysis LECTURE 10: TYPES 1. Christoph Reichenbach

EDA045F: Program Analysis LECTURE 10: TYPES 1. Christoph Reichenbach EDA045F: Program Analysis LECTURE 10: TYPES 1 Christoph Reichenbach In the last lecture... Performance Counters Challenges in Dynamic Performance Analysis Taint Analysis Binary Instrumentation 2 / 44 Types

More information

Lesson 6-1: Relations and Functions

Lesson 6-1: Relations and Functions I ll bet you think numbers are pretty boring, don t you? I ll bet you think numbers have no life. For instance, numbers don t have relationships do they? And if you had no relationships, life would be

More information

FINANCE & GRAPHS Questions

FINANCE & GRAPHS Questions FINANCE & GRAPHS Questions Question 1 (Adapted from Feb / Mar 2012 P2, Question 2.1) The principal of the local school asked Lihle to take over the running of the school tuck shop. He wanted to show Lihle

More information

Choosing a Safe Vehicle Challenge: Analysis: Measuring Speed Challenge: Analysis: Reflection:

Choosing a Safe Vehicle Challenge: Analysis: Measuring Speed Challenge: Analysis: Reflection: Activity 73: Choosing a Safe Vehicle Challenge: Which vehicle do you think is safer? 1. Compare the features you listed in the data evidence section to the features listed on the worksheet. a. How are

More information

Strategies for dealing with Missing Data

Strategies for dealing with Missing Data Institut für Soziologie Eberhard Karls Universität Tübingen http://www.maartenbuis.nl What do we want from an analysis strategy? Simple example We have a theory that working for cash is mainly men s work

More information

Slowmation Lesson #1 (Design)

Slowmation Lesson #1 (Design) Slowmation Lesson #1 (Design) By Christine Thompson (University of Wollongong) Year: 5/6 Theme: Rockets and Storyboarding Intended Outcome and indicator: IC S3.2: Creates and evaluates information products

More information

Linear Programming Duality

Linear Programming Duality Summer 2011 Optimization I Lecture 8 1 Duality recap Linear Programming Duality We motivated the dual of a linear program by thinking about the best possible lower bound on the optimal value we can achieve

More information

Object Oriented Programming for Python

Object Oriented Programming for Python Object Oriented Programming for Python Bas Roelenga Rijksuniversiteit Groningen Kapteyn Institute February 20, 2017 Bas Roelenga (RUG) February 20, 2017 1 / 21 Why use Object Oriented Programming? Code

More information

Inferring Passenger Boarding and Alighting Preference for the Marguerite Shuttle Bus System

Inferring Passenger Boarding and Alighting Preference for the Marguerite Shuttle Bus System Inferring Passenger Boarding and Alighting Preference for the Marguerite Shuttle Bus System Adrian Albert Abstract We analyze passenger count data from the Marguerite Shuttle system operating on the Stanford

More information

Math 141:512. Practice Exam 1 (extra credit) Due: February 6, 2019

Math 141:512. Practice Exam 1 (extra credit) Due: February 6, 2019 Math 141:512 Due: February 6, 2019 Practice Exam 1 (extra credit) This is an open book, extra credit practice exam which covers the material that Exam 1 will cover (Sections 1.3, 1.4, 2.1, 2.2, 2.3, 2.4,

More information

ADMINISTRATIVE PROCEDURES

ADMINISTRATIVE PROCEDURES PROCEDURES NO: A-AD-109-14 ADMINISTRATIVE PROCEDURES SUBJECT: A. Communications For the purpose of communicating the policies, regulations, administrative procedures, and parental expectations of Transportation

More information

The prediction of passenger flow under transport disturbance using accumulated passenger data

The prediction of passenger flow under transport disturbance using accumulated passenger data Computers in Railways XIV 623 The prediction of passenger flow under transport disturbance using accumulated passenger data T. Kunimatsu & C. Hirai Signalling and Transport Information Technology Division,

More information

Decision Making under Interval (and More General) Uncertainty: Monetary vs. Utility Approaches

Decision Making under Interval (and More General) Uncertainty: Monetary vs. Utility Approaches Decision Making under Interval (and More General) Uncertainty: Monetary vs. Utility Approaches Vladik Kreinovich Department of Computer Science University of Texas at El Paso, El Paso, TX 79968, USA vladik@utep.edu

More information

Topic 2 Part 1 [195 marks]

Topic 2 Part 1 [195 marks] Topic 2 Part 1 [195 marks] The distribution of rainfall in a town over 80 days is displayed on the following box-and-whisker diagram. 1a. Write down the median rainfall. 1b. Write down the minimum rainfall.

More information

Mental multiplication strategies doubling strategy

Mental multiplication strategies doubling strategy Mental multiplication strategies doubling strategy Doubling is a useful strategy to use when multiplying. To multiply a number by four, double it twice. To multiply a number by eight, double it three times.

More information

OFFSHORE. Advanced Weather Technology

OFFSHORE. Advanced Weather Technology Contents 3 Advanced Weather Technology 5 Working Safely, While Limiting Downtime 6 Understanding the Weather Forecast Begins at the Tender Stage 7 Reducing Time and Costs on Projects is a Priority Across

More information

Equations and inequalities

Equations and inequalities 7 Stretch lesson: Equations and inequalities Stretch objectives Before you start this chapter, mark how confident you feel about each of the statements below: I can solve linear equations involving fractions.

More information

Actions SLT Staff Students, Parents/Carers Ensure all. with caution in all. gritted.

Actions SLT Staff Students, Parents/Carers Ensure all. with caution in all. gritted. CODE 1 BASED ON WETAHER FORECAST TEMPERATURES BELOW -3 / LIGHT SNOW OR FREEZING RAIN FORECAST PAVOL TO CALL PAUL AT 07.00 AND BRIEF ON STATUS OF SITE. NO ACTION IF SITE ACCESSIBLE AND SAFE. Code 1 conditions

More information

Thank you for your interest in the Support Resistance Strength Analyzer!

Thank you for your interest in the Support Resistance Strength Analyzer! This user manual refer to FXCM s Trading Station version of the indicator Support Resistance Strength Analyzer Thank you for your interest in the Support Resistance Strength Analyzer! This unique indicator

More information

CHAPTER 2 LOAD FLOW ANALYSIS FOR RADIAL DISTRIBUTION SYSTEM

CHAPTER 2 LOAD FLOW ANALYSIS FOR RADIAL DISTRIBUTION SYSTEM 16 CHAPTER 2 LOAD FLOW ANALYSIS FOR RADIAL DISTRIBUTION SYSTEM 2.1 INTRODUCTION Load flow analysis of power system network is used to determine the steady state solution for a given set of bus loading

More information

Introduction to Algebra: The First Week

Introduction to Algebra: The First Week Introduction to Algebra: The First Week Background: According to the thermostat on the wall, the temperature in the classroom right now is 72 degrees Fahrenheit. I want to write to my friend in Europe,

More information

Foundations of Math. Chapter 3 Packet. Table of Contents

Foundations of Math. Chapter 3 Packet. Table of Contents Foundations of Math Chapter 3 Packet Name: Table of Contents Notes #43 Solving Systems by Graphing Pg. 1-4 Notes #44 Solving Systems by Substitution Pg. 5-6 Notes #45 Solving by Graphing & Substitution

More information

UNDERSTANDING FUNCTIONS

UNDERSTANDING FUNCTIONS Learning Centre UNDERSTANDING FUNCTIONS Function As a Machine A math function can be understood as a machine that takes an input and produces an output. Think about your CD Player as a machine that takes

More information

Math489/889 Stochastic Processes and Advanced Mathematical Finance Solutions for Homework 7

Math489/889 Stochastic Processes and Advanced Mathematical Finance Solutions for Homework 7 Math489/889 Stochastic Processes and Advanced Mathematical Finance Solutions for Homework 7 Steve Dunbar Due Mon, November 2, 2009. Time to review all of the information we have about coin-tossing fortunes

More information

Review of Rail Network Performance in the Snow of December 2010

Review of Rail Network Performance in the Snow of December 2010 Review of Rail Network Performance in the Snow of December 2010 1 Introduction On the afternoon of Tuesday 30 th November 2010 heavy snow began to fall in London and Kent. From the early evening of this

More information

The World Bank China Wuhan Second Urban Transport (P112838)

The World Bank China Wuhan Second Urban Transport (P112838) EAST ASIA AND PACIFIC China Transport Global Practice IBRD/IDA Specific Investment Loan FY 2010 Seq No: 7 ARCHIVED on 28-Jun-2015 ISR18605 Implementing Agencies: Wuhan Urban Construction Utilization of

More information

Vocabulary: Samples and Populations

Vocabulary: Samples and Populations Vocabulary: Samples and Populations Concept Different types of data Categorical data results when the question asked in a survey or sample can be answered with a nonnumerical answer. For example if we

More information

CMPT 710/407 - Complexity Theory Lecture 4: Complexity Classes, Completeness, Linear Speedup, and Hierarchy Theorems

CMPT 710/407 - Complexity Theory Lecture 4: Complexity Classes, Completeness, Linear Speedup, and Hierarchy Theorems CMPT 710/407 - Complexity Theory Lecture 4: Complexity Classes, Completeness, Linear Speedup, and Hierarchy Theorems Valentine Kabanets September 13, 2007 1 Complexity Classes Unless explicitly stated,

More information

Predicting AGI: What can we say when we know so little?

Predicting AGI: What can we say when we know so little? Predicting AGI: What can we say when we know so little? Fallenstein, Benja Mennen, Alex December 2, 2013 (Working Paper) 1 Time to taxi Our situation now looks fairly similar to our situation 20 years

More information

2.1 Simplifying Algebraic Expressions

2.1 Simplifying Algebraic Expressions .1 Simplifying Algebraic Expressions A term is a number or the product of a number and variables raised to powers. The numerical coefficient of a term is the numerical factor. The numerical coefficient

More information

Digital Microelectronic Circuits ( )

Digital Microelectronic Circuits ( ) Digital Microelectronic ircuits (361-1-3021 ) Presented by: Dr. Alex Fish Lecture 5: Parasitic apacitance and Driving a Load 1 Motivation Thus far, we have learned how to model our essential building block,

More information

How fast does Aquarius go around the Earth? Gary: It takes 96 minutes to make one orbit. David: I think it s 7 kilometers per second (Gary agrees.

How fast does Aquarius go around the Earth? Gary: It takes 96 minutes to make one orbit. David: I think it s 7 kilometers per second (Gary agrees. How fast does Aquarius go around the Earth? Gary: It takes 96 minutes to make one orbit. Carla: Do you have any idea fast that is in miles per hour? David: I think it s 7 kilometers per second (Gary agrees.)

More information

Writing and Graphing Inequalities

Writing and Graphing Inequalities .1 Writing and Graphing Inequalities solutions of an inequality? How can you use a number line to represent 1 ACTIVITY: Understanding Inequality Statements Work with a partner. Read the statement. Circle

More information

Name Class Date. Simplifying Algebraic Expressions Going Deeper. Combining Expressions

Name Class Date. Simplifying Algebraic Expressions Going Deeper. Combining Expressions Name Class Date 1-5 1 Simplifying Algebraic Expressions Going Deeper Essential question: How do you add, subtract, factor, and multiply algebraic expressions? CC.7.EE.1 EXPLORE Combining Expressions video

More information

Problem A. Crystal Ball Factory

Problem A. Crystal Ball Factory Problem A Crystal Ball Factory The Astrologically Clairvoyant Manufacturers (ACM), a pioneer in future-predicting technology, just landed a contract to manufacture crystal balls for weather forecasters

More information

Math 381 Discrete Mathematical Modeling

Math 381 Discrete Mathematical Modeling Math 381 Discrete Mathematical Modeling Instructor: Sean Griffin Email: stgriff@uw.edu Office Hours: Wed/Fri 1-2pm in PDL C-552 TA: Varodom (Smart) Theplertboon Email: vthep@uw.edu Office Hours: Wed 2-4pm

More information

Kinematics, Distance-Time & Speed-Time Graphs

Kinematics, Distance-Time & Speed-Time Graphs Kinematics, Distance-Time & -Time Graphs Question Paper 3 Level IGCSE Subject Maths (58) Exam Board Cambridge International Examinations (CIE) Paper Type Extended Topic Algebra and graphs Sub-Topic Kinematics,

More information

Chapter Two B: Linear Expressions, Equations, and Inequalities

Chapter Two B: Linear Expressions, Equations, and Inequalities Chapter Two B: Linear Expressions, Equations, and Inequalities Index: A: Intro to Inequalities (U2L8) Page 1 B: Solving Linear Inequalities (U2L9) Page 7 C: Compound Inequalities (And) (U2L10/11) Page

More information

Unit 2 Solving Equations & Inequalities

Unit 2 Solving Equations & Inequalities Coordinate Algebra Unit Solving Equations & Inequalities Name: Date: Unit Review Solve each system of linear equations by the given method. 1. Solve by Substitution: 5y 9 x y. Solve by Substitution: 15y

More information

INTRODUCTION TO MATHEMATICAL MODELLING

INTRODUCTION TO MATHEMATICAL MODELLING 306 MATHEMATICS APPENDIX 2 INTRODUCTION TO MATHEMATICAL MODELLING A2.1 Introduction Right from your earlier classes, you have been solving problems related to the real-world around you. For example, you

More information

CHANCE Program. Admissions Mathematics Practice Test. Part One will test your background in basic arithmetic, while Part Two will cover basic algebra.

CHANCE Program. Admissions Mathematics Practice Test. Part One will test your background in basic arithmetic, while Part Two will cover basic algebra. CHANCE Program Admissions Mathematics Practice Test Part One will test your background in basic arithmetic, while Part Two will cover basic algebra. Each part of the test has 30 questions and has been

More information

Chapter Four: Linear Expressions, Equations, and Inequalities

Chapter Four: Linear Expressions, Equations, and Inequalities Chapter Four: Linear Expressions, Equations, and Inequalities Index: A: Intro to Inequalities (U2L8) B: Solving Linear Inequalities (U2L9) C: Compound Inequalities (And) (U2L10/11) D: Compound Inequalities

More information

Confidence intervals CE 311S

Confidence intervals CE 311S CE 311S PREVIEW OF STATISTICS The first part of the class was about probability. P(H) = 0.5 P(T) = 0.5 HTTHHTTTTHHTHTHH If we know how a random process works, what will we see in the field? Preview of

More information

Lesson 8: Representing Proportional Relationships with Equations

Lesson 8: Representing Proportional Relationships with Equations Lesson 8: Representing Proportional Relationships with Equations Student Outcomes Students use the constant of proportionality to represent proportional relationships by equations in real world contexts

More information

Uses of duality. Geoff Gordon & Ryan Tibshirani Optimization /

Uses of duality. Geoff Gordon & Ryan Tibshirani Optimization / Uses of duality Geoff Gordon & Ryan Tibshirani Optimization 10-725 / 36-725 1 Remember conjugate functions Given f : R n R, the function is called its conjugate f (y) = max x R n yt x f(x) Conjugates appear

More information

Algebra 1 STAAR Review Name: Date:

Algebra 1 STAAR Review Name: Date: Algebra 1 STAAR Review Name: Date: 1. Which graph does not represent y as a function of x? I. II. III. A) I only B) II only C) III only D) I and III E) I and II 2. Which expression is equivalent to? 3.

More information

BINOMIAL DISTRIBUTION

BINOMIAL DISTRIBUTION BINOMIAL DISTRIBUTION The binomial distribution is a particular type of discrete pmf. It describes random variables which satisfy the following conditions: 1 You perform n identical experiments (called

More information

SOME FACTORS INFLUENCING THE REGULARITY OF SHORT HEADWAY URBAN BUS OPERATION*

SOME FACTORS INFLUENCING THE REGULARITY OF SHORT HEADWAY URBAN BUS OPERATION* NZOR volume 4 number 2 July 1976 SOME FACTORS INFLUENCING THE REGULARITY OF SHORT HEADWAY URBAN BUS OPERATION* W.J, Frith M inistry of Transport W ellington S u m m a r y T h e i m p o r t a n c e o f

More information

Simple Regression Model. January 24, 2011

Simple Regression Model. January 24, 2011 Simple Regression Model January 24, 2011 Outline Descriptive Analysis Causal Estimation Forecasting Regression Model We are actually going to derive the linear regression model in 3 very different ways

More information

3) y = - 1 x + 2 and state the intercept(s), if any.

3) y = - 1 x + 2 and state the intercept(s), if any. Chapter 1, Sections 1-3 Review Match the story with the correct figure. 1) Mark started out by walking up a hill for minutes. For the next minutes he walked down a steep hill to an elevation lower than

More information

Irish Maths Teachers Association, Cork Branch

Irish Maths Teachers Association, Cork Branch The π Quiz 06 Round Q. A disc of radius 4 cm is removed from a larger disc of diameter 4 cm as shown. Find the remaining area correct to one decimal place. Q. Solve x x and give your solutions correct

More information

Unit 4 Advanced Functions Review Day

Unit 4 Advanced Functions Review Day Unit 4 Advanced Functions Review Day Warm-up! Find the domain and range of the following functions. Then, tell how they are changed from their parent graph. (Hint: Remember that the order of transformations

More information

Immaculate Heart Academy Summer Math Assignment for Algebra I Honors Course Code: 5130

Immaculate Heart Academy Summer Math Assignment for Algebra I Honors Course Code: 5130 Immaculate Heart Academy Summer Math Assignment for Algebra I Honors Course Code: 10 LEARN PRACTICE EXCEL You are taking Algebra I Honors in the fall. A mastery of and proficiency in performing the following

More information

CSE355 SUMMER 2018 LECTURES TURING MACHINES AND (UN)DECIDABILITY

CSE355 SUMMER 2018 LECTURES TURING MACHINES AND (UN)DECIDABILITY CSE355 SUMMER 2018 LECTURES TURING MACHINES AND (UN)DECIDABILITY RYAN DOUGHERTY If we want to talk about a program running on a real computer, consider the following: when a program reads an instruction,

More information

Combinatorial Auction-Based Allocation of Virtual Machine Instances in Clouds

Combinatorial Auction-Based Allocation of Virtual Machine Instances in Clouds Combinatorial Auction-Based Allocation of Virtual Machine Instances in Clouds Sharrukh Zaman and Daniel Grosu Department of Computer Science Wayne State University Detroit, Michigan 48202, USA sharrukh@wayne.edu,

More information

x 4 = 40 +2x 5 +6x x 6 x 1 = 10 2x x 6 x 3 = 20 +x 5 x x 6 z = 540 3x 5 x 2 3x 6 x 4 x 5 x 6 x x

x 4 = 40 +2x 5 +6x x 6 x 1 = 10 2x x 6 x 3 = 20 +x 5 x x 6 z = 540 3x 5 x 2 3x 6 x 4 x 5 x 6 x x MATH 4 A Sensitivity Analysis Example from lectures The following examples have been sometimes given in lectures and so the fractions are rather unpleasant for testing purposes. Note that each question

More information

Module 4 Linear Equations

Module 4 Linear Equations Module 4 Linear Equations Oct 20 9:19 PM Lesson 1 Writing Equations Using Symbols Dec 1 10:40 PM 1 5(b 6) Reviewing Distributive Property 10( 5 + x) 3(9 + a) = 54 Feb 23 10:31 PM Mathematical Statement

More information

Lecturers: Jan Boone (ANR: ) and Clemens Fiedler

Lecturers: Jan Boone (ANR: ) and Clemens Fiedler cover page for a written examination/test Name of subject: Competition Policy and Regulation Subject code: 30L303 Date of examination: 8-06-016 Length of examination: 3 hours Lecturers: Jan Boone (ANR:

More information

Software Testing Lecture 2

Software Testing Lecture 2 Software Testing Lecture 2 Justin Pearson September 25, 2014 1 / 1 Test Driven Development Test driven development (TDD) is a way of programming where all your development is driven by tests. Write tests

More information

For each of the following questions, give clear and complete evidence for your choice in the space provided.

For each of the following questions, give clear and complete evidence for your choice in the space provided. Name (printed) First Day Stamp For each of the following questions, give clear and complete evidence for your choice in the space provided. 1. An astronomer observes that a certain heavenly body is moving

More information

Calculus I. Activity Collection. Featuring real-world contexts: by Frank C. Wilson

Calculus I. Activity Collection. Featuring real-world contexts:  by Frank C. Wilson Calculus I by Frank C. ilson Activity Collection Featuring real-world contexts: Growing Money High School Students Infant Growth Rates Living with AIDS Movie Ticket Prices PreK - Grade 8 Students Shipping

More information

Languages, regular languages, finite automata

Languages, regular languages, finite automata Notes on Computer Theory Last updated: January, 2018 Languages, regular languages, finite automata Content largely taken from Richards [1] and Sipser [2] 1 Languages An alphabet is a finite set of characters,

More information

5-3B Systems Review Puzzle

5-3B Systems Review Puzzle 5-3B Systems Review Puzzle x + y = 4 x y = -2 2x + y = -4 2x + 3y = 4 2x + y = 1 4x 2y = 6 2x + y = 1 x + y = 1 3x 2y = 4-2x + 2y = -1 x = -2y + 1 4 = x + y y = 2 2x x = y 5 y = 4 + 3x 2x + 1 = y x y =

More information

Alectra Utilities List of Station Capacity

Alectra Utilities List of Station Capacity lectra Utilities List of Station Capacity s per Distribution System Code this list represents the llocated Capacity on stations owned by lectra Utilities (formerly PowerStream) as of July 1st, 2018. llocated

More information

x 1 + x 2 2 x 1 x 2 1 x 2 2 min 3x 1 + 2x 2

x 1 + x 2 2 x 1 x 2 1 x 2 2 min 3x 1 + 2x 2 Lecture 1 LPs: Algebraic View 1.1 Introduction to Linear Programming Linear programs began to get a lot of attention in 1940 s, when people were interested in minimizing costs of various systems while

More information

Warm Up. Unit #1: Basics of Algebra

Warm Up. Unit #1: Basics of Algebra 1) Write an equation of the given points ( 3, 4) & (5, 6) Warm Up 2) Which of the following choices is the Associative Property 1) 4(x + 2) = 4x + 8 2) 4 + 5 = 5 + 4 3) 5 + ( 5) = 0 4) 4 + (3 + 1) = (4

More information

The Two Time Pad Encryption System

The Two Time Pad Encryption System Hardware Random Number Generators This document describe the use and function of a one-time-pad style encryption system for field and educational use. You may download sheets free from www.randomserver.dyndns.org/client/random.php

More information

UNIT 28 Straight Lines: CSEC Revision Test

UNIT 28 Straight Lines: CSEC Revision Test UNIT 8 Straight Lines: UNIT 8 Straight Lines ( ). The line segment BC passes through the point A, and has a gradient of. (a) Express the equation of the line segment BC in the form y = mx + c. ( marks)

More information

Going to a Show AT THE. Milwaukee Youth Arts Center

Going to a Show AT THE. Milwaukee Youth Arts Center Going to a Show AT THE Milwaukee Youth Arts Center I am going to see a First Stage show at the Milwaukee Youth Arts Center. I am going to see the show with 2 Watching a play is like watching TV or a movie,

More information

Secure Vickrey Auctions without Threshold Trust

Secure Vickrey Auctions without Threshold Trust Secure Vickrey Auctions without Threshold Trust Helger Lipmaa Helsinki University of Technology, {helger}@tcs.hut.fi N. Asokan, Valtteri Niemi Nokia Research Center, {n.asokan,valtteri.niemi}@nokia.com

More information