import pandas as pd d = {"A":[1,2,np.nan], "B":[5,np.nan,np.nan], "C":[1,2,3]} In [9]: Out[8]: {'A': [1, 2, nan], 'B': [5, nan, nan], 'C': [1, 2, 3]}

Size: px
Start display at page:

Download "import pandas as pd d = {"A":[1,2,np.nan], "B":[5,np.nan,np.nan], "C":[1,2,3]} In [9]: Out[8]: {'A': [1, 2, nan], 'B': [5, nan, nan], 'C': [1, 2, 3]}"

Transcription

1 In [4]: import numpy as np In [5]: import pandas as pd In [7]: d = {"":[1,2,np.nan], "B":[5,np.nan,np.nan], "C":[1,2,3]} In [8]: d Out[8]: {'': [1, 2, nan], 'B': [5, nan, nan], 'C': [1, 2, 3]} In [9]: = pd.dataframe(d) In [10]: Out[10]: B C NaN 2 2 NaN NaN 3 In [11]:.dropna() Out[11]: B C

2 In [12]: Out[12]: B C NaN 2 2 NaN NaN 3 In [13]:.dropna(axis = 1) Out[13]: C In [14]: Out[14]: B C NaN 2 2 NaN NaN 3 In [16]:.dropna(thresh = 2) Out[16]: B C NaN 2

3 In [17]:.fillna(value = "FILL VLUE") Out[17]: B C FILL VLUE 2 2 FILL VLUE FILL VLUE 3 In [18]: [""].fillna(value = [""].mean()) Out[18]: Name:, dtype: float64 In [19]: Out[19]: B C NaN 2 2 NaN NaN 3 Groupby with Pandas In [20]: # Create dataframe data = {'Company':['GOOG','GOOG','MSFT','MSFT','FB','FB'], 'Person':['Sam','Charlie','my','Vanessa','Carl','Sarah'], 'Sales':[200,120,340,124,243,350]}

4 In [21]: Out[21]: data {'Company': ['GOOG', 'GOOG', 'MSFT', 'MSFT', 'FB', 'FB'], 'Person': ['Sam', 'Charlie', 'my', 'Vanessa', 'Carl', 'Sarah'], 'Sales': [200, 120, 340, 124, 243, 350]} In [22]: = pd.dataframe(data) In [23]: Out[23]: Company Person Sales 0 GOOG Sam GOOG Charlie MSFT my MSFT Vanessa FB Carl FB Sarah 350 In [24]: bycomp =.groupby("company") In [25]: Out[25]: bycomp <pandas.core.groupby.dataframegroupby object at 0x B590>

5 In [26]: Out[26]: bycomp.mean() Sales Company FB GOOG MSFT In [28]: Out[28]: bycomp.sum() Sales Company FB 593 GOOG 320 MSFT 464 In [29]: bycomp.sum().loc["fb"] Out[29]: Sales 593 Name: FB, dtype: int64 In [30]:.groupby("Company").sum().loc["FB"] Out[30]: Sales 593 Name: FB, dtype: int64

6 In [31]: Out[31]:.groupby("Company").count() Person Sales Company FB 2 2 GOOG 2 2 MSFT 2 2 In [32]: Out[32]:.groupby("Company").describe() Sales count mean std min 25% 50% 75% max Company FB GOOG MSFT

7 In [33]: Out[33]:.groupby("Company").describe().transpose() Company FB GOOG MSFT Sales count mean std min % % % max In [36]:.groupby("Company").describe().loc["FB"] Out[36]: Sales count mean std min % % % max Name: FB, dtype: float64 Merging, joining and concatenating In [37]: 1 = pd.dataframe({'': ['0', '1', '2', '3'], 'B': ['B0', 'B1', 'B2', 'B3'], 'C': ['C0', 'C1', 'C2', 'C3'], 'D': ['D0', 'D1', 'D2', 'D3']}, index = [0, 1, 2, 3])

8 In [38]: 2 = pd.dataframe({'': ['4', '5', '6', '7'], 'B': ['B4', 'B5', 'B6', 'B7'], 'C': ['C4', 'C5', 'C6', 'C7'], 'D': ['D4', 'D5', 'D6', 'D7']}, index = [4, 5, 6, 7]) In [39]: 3 = pd.dataframe({'': ['8', '9', '10', '11'], 'B': ['B8', 'B9', 'B10', 'B11'], 'C': ['C8', 'C9', 'C10', 'C11'], 'D': ['D8', 'D9', 'D10', 'D11']}, index = [8, 9, 10, 11]) In [40]: Out[40]: 1 B C D 0 0 B0 C0 D0 1 1 B1 C1 D1 2 2 B2 C2 D2 3 3 B3 C3 D3 In [41]: 2 Out[41]: B C D 4 4 B4 C4 D4 5 5 B5 C5 D5 6 6 B6 C6 D6 7 7 B7 C7 D7

9 In [42]: 3 Out[42]: B C D 8 8 B8 C8 D8 9 9 B9 C9 D B10 C10 D B11 C11 D11 In [44]: Out[44]: pd.concat([1,2,3]) # by passing a list to the concat function B C D 0 0 B0 C0 D0 1 1 B1 C1 D1 2 2 B2 C2 D2 3 3 B3 C3 D3 4 4 B4 C4 D4 5 5 B5 C5 D5 6 6 B6 C6 D6 7 7 B7 C7 D7 8 8 B8 C8 D8 9 9 B9 C9 D B10 C10 D B11 C11 D11

10 In [45]: left = pd.dataframe({'key': ['K0', 'K1', 'K2', 'K3'], '': ['0', '1', '2', '3'], 'B': ['B0', 'B1', 'B2', 'B3']}) right = pd.dataframe({'key': ['K0', 'K1', 'K2', 'K3'], 'C': ['C0', 'C1', 'C2', 'C3'], 'D': ['D0', 'D1', 'D2', 'D3']}) In [46]: Out[46]: left B key 0 0 B0 K0 1 1 B1 K1 2 2 B2 K2 3 3 B3 K3 In [47]: Out[47]: right C D key 0 C0 D0 K0 1 C1 D1 K1 2 C2 D2 K2 3 C3 D3 K3

11 In [48]: Out[48]: pd.merge(left, right, how = "inner", on = "key") B key C D 0 0 B0 K0 C0 D0 1 1 B1 K1 C1 D1 2 2 B2 K2 C2 D2 3 3 B3 K3 C3 D3 In [49]: left = pd.dataframe({'key1': ['K0', 'K0', 'K1', 'K2'], 'key2': ['K0', 'K1', 'K0', 'K1'], '': ['0', '1', '2', '3'], 'B': ['B0', 'B1', 'B2', 'B3']}) right = pd.dataframe({'key1': ['K0', 'K1', 'K1', 'K2'], 'key2': ['K0', 'K0', 'K0', 'K0'], 'C': ['C0', 'C1', 'C2', 'C3'], 'D': ['D0', 'D1', 'D2', 'D3']}) In [50]: Out[50]: left B key1 key2 0 0 B0 K0 K0 1 1 B1 K0 K1 2 2 B2 K1 K0 3 3 B3 K2 K1

12 In [51]: Out[51]: right C D key1 key2 0 C0 D0 K0 K0 1 C1 D1 K1 K0 2 C2 D2 K1 K0 3 C3 D3 K2 K0 In [52]: Out[52]: pd.merge(left, right, how = "inner", on = ["key1", "key2"]) B key1 key2 C D 0 0 B0 K0 K0 C0 D0 1 2 B2 K1 K0 C1 D1 2 2 B2 K1 K0 C2 D2 In [53]: left = pd.dataframe({'': ['0', '1', '2'], 'B': ['B0', 'B1', 'B2']}, index=['k0', 'K1', 'K2']) right = pd.dataframe({'c': ['C0', 'C2', 'C3'], 'D': ['D0', 'D2', 'D3']}, index=['k0', 'K2', 'K3']) In [54]: left Out[54]: B K0 0 B0 K1 1 B1 K2 2 B2

13 In [55]: right Out[55]: C D K0 C0 D0 K2 C2 D2 K3 C3 D3 In [56]: Out[56]: left.join(right) B C D K0 0 B0 C0 D0 K1 1 B1 NaN NaN K2 2 B2 C2 D2 Operations with Pandas In [57]: = pd.dataframe({'col1':[1,2,3,4],'col2':[444,555,666,444],'col3':['abc','def','ghi','xyz']}) In [58]: Out[58]: abc def ghi

14 In [59]: Out[59]:.head() abc def ghi In [60]: Out[60]: ["col2"].unique() array([444, 555, 666], dtype=int64) In [61]: len(["col2"].unique()) Out[61]: 3 In [63]: # or ["col2"].nunique() Out[63]: 3 In [64]: ["col2"].value_counts() Out[64]: Name: col2, dtype: int64 Selecting data

15 In [65]: Out[65]: abc def ghi In [68]: [["col1"] > 2] Out[68]: ghi If you want to combine conditions, you need to wrap them in parentheses In [69]: [(["col1"] > 1) & (["col2"] == 444)] Out[69]: The apply method powerful tool

16 In [70]: def times2(x): return x * 2 In [71]: Out[71]: abc def ghi In [72]: ["col1"].sum() Out[72]: 10 In [73]: ['col1'].apply(times2) Out[73]: Name: col1, dtype: int64 In [74]: ["col3"] Out[74]: 0 abc 1 def 2 ghi 3 xyz Name: col3, dtype: object

17 In [75]: ["col3"].apply(len) Out[75]: Name: col3, dtype: int64 Truly, the most remarkable feature of pandas in combining lambda expressions with methods like apply In [76]: ['col2'].apply(lambda x: x*2) Out[76]: Name: col2, dtype: int64 In [77]: Out[77]: abc def ghi

18 In [78]:.drop("col1", axis = 1) Out[78]: col2 col abc def ghi xyz In [79]: Out[79]:.columns Index(['col1', 'col2', 'col3'], dtype='object') In [81]: Out[81]: abc def ghi In [82]: Out[82]:.index RangeIndex(start=0, stop=4, step=1) Sorting and Ordering a data frame

19 In [83]: Out[83]: abc def ghi In [84]: Out[84]:.sort_values(by = 'col2') abc def ghi In [87]: Out[87]:.sort_values('col3') abc def ghi

20 In [88]: Out[88]:.isnull() 0 False False False 1 False False False 2 False False False 3 False False False The Pivot table In [89]: data = {'':['foo','foo','foo','bar','bar','bar'], 'B':['one','one','two','two','one','one'], 'C':['x','y','x','y','x','y'], 'D':[1,3,2,5,4,1]} = pd.dataframe(data) In [90]: Out[90]: data {'': ['foo', 'foo', 'foo', 'bar', 'bar', 'bar'], 'B': ['one', 'one', 'two', 'two', 'one', 'one'], 'C': ['x', 'y', 'x', 'y', 'x', 'y'], 'D': [1, 3, 2, 5, 4, 1]}

21 In [91]: Out[91]: B C D 0 foo one x 1 1 foo one y 3 2 foo two x 2 3 bar two y 5 4 bar one x 4 5 bar one y 1 In [93]: Out[93]: pd.pivot_table(data =, values = "D", index = ["", "B"], columns = ["C"]) C x y B bar one two NaN 5.0 foo one two 2.0 NaN

PANDAS FOUNDATIONS. pandas Foundations

PANDAS FOUNDATIONS. pandas Foundations PANDAS FOUNDATIONS pandas Foundations What is pandas? Python library for data analysis High-performance containers for data analysis Data structures with a lot of functionality Meaningful labels Time series

More information

Quiz3_NaiveBayesTest

Quiz3_NaiveBayesTest Quiz3_NaiveBayesTest November 8, 2018 In [1]: import numpy as np import pandas as pd data = pd.read_csv("weatherx.csv") data Out[1]: Outlook Temp Humidity Windy 0 Sunny hot high False no 1 Sunny hot high

More information

Creative Data Mining

Creative Data Mining Creative Data Mining Using ML algorithms in python Artem Chirkin Dr. Daniel Zünd Danielle Griego Lecture 7 0.04.207 /7 What we will cover today Outline Getting started Explore dataset content Inspect visually

More information

Propensity Score Matching

Propensity Score Matching Propensity Score Matching This notebook illustrates how to do propensity score matching in Python. Original dataset available at: http://biostat.mc.vanderbilt.edu/wiki/main/datasets (http://biostat.mc.vanderbilt.edu/wiki/main/datasets)

More information

2 Getting Started with Numerical Computations in Python

2 Getting Started with Numerical Computations in Python 1 Documentation and Resources * Download: o Requirements: Python, IPython, Numpy, Scipy, Matplotlib o Windows: google "windows download (Python,IPython,Numpy,Scipy,Matplotlib" o Debian based: sudo apt-get

More information

Numpy. Luis Pedro Coelho. October 22, Programming for Scientists. Luis Pedro Coelho (Programming for Scientists) Numpy October 22, 2012 (1 / 26)

Numpy. Luis Pedro Coelho. October 22, Programming for Scientists. Luis Pedro Coelho (Programming for Scientists) Numpy October 22, 2012 (1 / 26) Numpy Luis Pedro Coelho Programming for Scientists October 22, 2012 Luis Pedro Coelho (Programming for Scientists) Numpy October 22, 2012 (1 / 26) Historical Numeric (1995) Numarray (for large arrays)

More information

Introduction to Python

Introduction to Python Introduction to Python Luis Pedro Coelho Institute for Molecular Medicine (Lisbon) Lisbon Machine Learning School II Luis Pedro Coelho (IMM) Introduction to Python Lisbon Machine Learning School II (1

More information

EP219:Data Analysis And Interpretation

EP219:Data Analysis And Interpretation EP219:Data Analysis And Interpretation Report: Week 1 Team Poisson ous 28 July 2017 to 4 August 2017 1 Contents 1 Problem Statement 3 2 Python Program 3 3 Histograms 6 4 Inference 7 5 Team responsibilities

More information

/Users/jenskremkow/Science/Courses/python-summerschool-berlin/faculty/Day2/examples numpy.py September 2,

/Users/jenskremkow/Science/Courses/python-summerschool-berlin/faculty/Day2/examples numpy.py September 2, /Users/jenskremkow/Science/Courses/python-summerschool-berlin/faculty/Day2/examples numpy.py September 2, 2009 1 Numpy Many of the examples are taken from: http://www.scipy.org/cookbook Building Arrays

More information

Introduction to Python

Introduction to Python Introduction to Python Luis Pedro Coelho luis@luispedro.org @luispedrocoelho European Molecular Biology Laboratory Lisbon Machine Learning School 2015 Luis Pedro Coelho (@luispedrocoelho) Introduction

More information

Data Intensive Computing Handout 11 Spark: Transitive Closure

Data Intensive Computing Handout 11 Spark: Transitive Closure Data Intensive Computing Handout 11 Spark: Transitive Closure from random import Random spark/transitive_closure.py num edges = 3000 num vertices = 500 rand = Random(42) def generate g raph ( ) : edges

More information

5.1 Triangle Congruence Postulates

5.1 Triangle Congruence Postulates 5.1 Triangle Congruence Postulates Congruent Figures: Figures that are the same shape and size. All corresponding angles are congruent All corresponding sides are congruent Name: How are congruent figures

More information

Counting, symbols, positions, powers, choice, arithmetic, binary, translation, hex, addresses, and gates.

Counting, symbols, positions, powers, choice, arithmetic, binary, translation, hex, addresses, and gates. Counting, symbols, positions, powers, choice, arithmetic, binary, translation, he, addresses, and gates. Counting. Suppose the concern is a collection of objects. As an eample, let the objects be denoted

More information

Eigenvalue problems III: Advanced Numerical Methods

Eigenvalue problems III: Advanced Numerical Methods Eigenvalue problems III: Advanced Numerical Methods Sam Sinayoko Computational Methods 10 Contents 1 Learning Outcomes 2 2 Introduction 2 3 Inverse Power method: finding the smallest eigenvalue of a symmetric

More information

Definition of the Drazin Inverse

Definition of the Drazin Inverse 15 The Drazin Inverse Lab Objective: The Drazin inverse of a matrix is a pseudoinverse which preserves certain spectral properties of the matrix. In this lab, we compute the Drazin inverse using the Schur

More information

timeseries talk November 10, 2015

timeseries talk November 10, 2015 timeseries talk November 10, 2015 1 Time series Analysis and the noise model 1.0.1 Mark Bakker 1.0.2 TU Delft Voorbeeld: Buis B58C0698 nabij Weert In [1]: import numpy as np import pandas as pd from pandas.tools.plotting

More information

Sorting Algorithms. We have already seen: Selection-sort Insertion-sort Heap-sort. We will see: Bubble-sort Merge-sort Quick-sort

Sorting Algorithms. We have already seen: Selection-sort Insertion-sort Heap-sort. We will see: Bubble-sort Merge-sort Quick-sort Sorting Algorithms We have already seen: Selection-sort Insertion-sort Heap-sort We will see: Bubble-sort Merge-sort Quick-sort We will show that: O(n log n) is optimal for comparison based sorting. Bubble-Sort

More information

Iterative Solvers. Lab 6. Iterative Methods

Iterative Solvers. Lab 6. Iterative Methods Lab 6 Iterative Solvers Lab Objective: Many real-world problems of the form Ax = b have tens of thousands of parameters Solving such systems with Gaussian elimination or matrix factorizations could require

More information

CMPSCI 105 Final Exam Spring 2016 Professor William T. Verts CMPSCI 105 Final Exam Spring 2016 May 5, 2016 Professor William T. Verts Solution Key

CMPSCI 105 Final Exam Spring 2016 Professor William T. Verts CMPSCI 105 Final Exam Spring 2016 May 5, 2016 Professor William T. Verts Solution Key CMPSCI 105 Final Exam Spring 2016 May 5, 2016 Professor William T. Verts Solution Key Page 1 of 6 GENERAL KNOWLEDGE, SPECIAL TOPICS, & REVIEW 10 Points One point each question. Answer any ten. Answer

More information

2. (25%) Suppose you have an array of 1234 records in which only a few are out of order and they are not very far from their correct positions. Which

2. (25%) Suppose you have an array of 1234 records in which only a few are out of order and they are not very far from their correct positions. Which COT 6401 The Analysis of Algorithms Midterm Test Open books and notes Name - SSN - 1. (25%) Suppose that the function F is dened for all power of 2 and is described by the following recurrence equation

More information

Lambda-Calculus (cont): Fixpoints, Naming. Lecture 10 CS 565 2/10/08

Lambda-Calculus (cont): Fixpoints, Naming. Lecture 10 CS 565 2/10/08 Lambda-Calculus (cont): Fixpoints, Naming Lecture 10 CS 565 2/10/08 Recursion and Divergence Consider the application: Ω ((λ x. (x x)) (λ x. (x x))) Ω evaluates to itself in one step. It has no normal

More information

Section 1.1 Notes. Real Numbers

Section 1.1 Notes. Real Numbers Section 1.1 Notes Real Numbers 1 Types of Real Numbers The Natural Numbers 1,,, 4, 5, 6,... These are also sometimes called counting numbers. Denoted by the symbol N Integers..., 6, 5, 4,,, 1, 0, 1,,,

More information

The Reachability-Bound Problem. Gulwani and Zuleger PLDI 10

The Reachability-Bound Problem. Gulwani and Zuleger PLDI 10 The Reachability-Bound Problem Gulwani and Zuleger PLDI 10 CS252r Spring 2011 The Reachability-Bound problem Find a symbolic worst case bound on the number of times a program point is reached Intra-procedural:

More information

Error, Accuracy and Convergence

Error, Accuracy and Convergence Error, Accuracy and Convergence Error in Numerical Methods i Every result we compute in Numerical Methods is inaccurate. What is our model of that error? Approximate Result = True Value + Error. x = x

More information

Exercise 5 Release: Due:

Exercise 5 Release: Due: Stochastic Modeling and Simulation Winter 28 Prof. Dr. I. F. Sbalzarini, Dr. Christoph Zechner (MPI-CBG/CSBD TU Dresden, 87 Dresden, Germany Exercise 5 Release: 8..28 Due: 5..28 Question : Variance of

More information

Introduction to TensorFlow

Introduction to TensorFlow Large Scale Data Analysis Using Deep Learning (Prof. U Kang) Introduction to TensorFlow 2017.04.17 Beunguk Ahn ( beunguk.ahn@gmail.com) 1 What is TensorFlow? Consturction Phase Execution Phase Examples

More information

Name Class Date. Tell whether each expression is a numerical expression or a variable expression. For a variable expression, name the variable.

Name Class Date. Tell whether each expression is a numerical expression or a variable expression. For a variable expression, name the variable. Practice 1-1 Variables and Expressions Write an expression for each quantity. 1. the value in cents of 5 quarters 2. the value in cents of q quarters 3. the number of months in 7 years the number of months

More information

Numbers, proof and all that jazz.

Numbers, proof and all that jazz. CHAPTER 1 Numbers, proof and all that jazz. There is a fundamental difference between mathematics and other sciences. In most sciences, one does experiments to determine laws. A law will remain a law,

More information

UNC Charlotte 2009 Comprehensive March 9, 2009

UNC Charlotte 2009 Comprehensive March 9, 2009 March 9, 2009 1. Danica was driving in a 500 mile race. After 250 miles, Danica s average speed was 150 miles per hour. Approximately how fast should Danica drive the second half of the race if she wants

More information

Ack: 1. LD Garcia, MTH 199, Sam Houston State University 2. Linear Algebra and Its Applications - Gilbert Strang

Ack: 1. LD Garcia, MTH 199, Sam Houston State University 2. Linear Algebra and Its Applications - Gilbert Strang Gaussian Elimination CS6015 : Linear Algebra Ack: 1. LD Garcia, MTH 199, Sam Houston State University 2. Linear Algebra and Its Applications - Gilbert Strang The Gaussian Elimination Method The Gaussian

More information

The Metropolis Algorithm

The Metropolis Algorithm 16 Metropolis Algorithm Lab Objective: Understand the basic principles of the Metropolis algorithm and apply these ideas to the Ising Model. The Metropolis Algorithm Sampling from a given probability distribution

More information

Notater: INF3331. Veronika Heimsbakk December 4, Introduction 3

Notater: INF3331. Veronika Heimsbakk December 4, Introduction 3 Notater: INF3331 Veronika Heimsbakk veronahe@student.matnat.uio.no December 4, 2013 Contents 1 Introduction 3 2 Bash 3 2.1 Variables.............................. 3 2.2 Loops...............................

More information

CS3719 Theory of Computation and Algorithms

CS3719 Theory of Computation and Algorithms CS3719 Theory of Computation and Algorithms Any mechanically (automatically) discretely computation of problem solving contains at least three components: - problem description - computational tool - analysis

More information

Finding similar items

Finding similar items Finding similar items CSE 344, section 10 June 2, 2011 In this section, we ll go through some examples of finding similar item sets. We ll directly compare all pairs of sets being considered using the

More information

Slide 1 Math 1520, Lecture 21

Slide 1 Math 1520, Lecture 21 Slide 1 Math 1520, Lecture 21 This lecture is concerned with a posteriori probability, which is the probability that a previous event had occurred given the outcome of a later event. Slide 2 Conditional

More information

Hot spot Analysis with Clustering on NIJ Data Set The Data Set:

Hot spot Analysis with Clustering on NIJ Data Set The Data Set: Hot spot Analysis with Clustering on NIJ Data Set The Data Set: The data set consists of Category, Call groups, final case type, case desc, Date, X-coordinates, Y- coordinates and census-tract. X-coordinates

More information

CS6901: review of Theory of Computation and Algorithms

CS6901: review of Theory of Computation and Algorithms CS6901: review of Theory of Computation and Algorithms Any mechanically (automatically) discretely computation of problem solving contains at least three components: - problem description - computational

More information

Kevin James. MTHSC 3110 Section 4.3 Linear Independence in Vector Sp

Kevin James. MTHSC 3110 Section 4.3 Linear Independence in Vector Sp MTHSC 3 Section 4.3 Linear Independence in Vector Spaces; Bases Definition Let V be a vector space and let { v. v 2,..., v p } V. If the only solution to the equation x v + x 2 v 2 + + x p v p = is the

More information

Quiz Queue II. III. ( ) ( ) =1.3333

Quiz Queue II. III. ( ) ( ) =1.3333 Quiz Queue UMJ, a mail-order company, receives calls to place orders at an average of 7.5 minutes intervals. UMJ hires one operator and can handle each call in about every 5 minutes on average. The inter-arrival

More information

Structuring the verification of heap-manipulating programs

Structuring the verification of heap-manipulating programs Structuring the verification of heap-manipulating programs Aleksandar Nanevski (IMDEA Madrid) Viktor Vafeiadis (MSR / Univ. of Cambridge) Josh Berdine (MSR Cambridge) Hoare/Separation Logic Hoare logic

More information

Decision Mathematics D1

Decision Mathematics D1 Pearson Edexcel GCE Decision Mathematics D1 Advanced/Advanced Subsidiary Friday 17 June 2016 Afternoon Time: 1 hour 30 minutes Paper Reference 6689/01 You must have: D1 Answer Book Candidates may use any

More information

Algorithmic verification

Algorithmic verification Algorithmic verification Ahmed Rezine IDA, Linköpings Universitet Hösttermin 2018 Outline Overview Model checking Symbolic execution Outline Overview Model checking Symbolic execution Program verification

More information

Stochastic Processes and Advanced Mathematical Finance. Duration of the Gambler s Ruin

Stochastic Processes and Advanced Mathematical Finance. Duration of the Gambler s Ruin Steven R. Dunbar Department of Mathematics 203 Avery Hall University of Nebraska-Lincoln Lincoln, NE 68588-0130 http://www.math.unl.edu Voice: 402-472-3731 Fax: 402-472-8466 Stochastic Processes and Advanced

More information

Chapter 1: Foundations for Algebra

Chapter 1: Foundations for Algebra Chapter 1: Foundations for Algebra 1 Unit 1: Vocabulary 1) Natural Numbers 2) Whole Numbers 3) Integers 4) Rational Numbers 5) Irrational Numbers 6) Real Numbers 7) Terminating Decimal 8) Repeating Decimal

More information

Recurrence Relations

Recurrence Relations Recurrence Relations Winter 2017 Recurrence Relations Recurrence Relations A recurrence relation for the sequence {a n } is an equation that expresses a n in terms of one or more of the previous terms

More information

The Simplex Method. Formulate Constrained Maximization or Minimization Problem. Convert to Standard Form. Convert to Canonical Form

The Simplex Method. Formulate Constrained Maximization or Minimization Problem. Convert to Standard Form. Convert to Canonical Form The Simplex Method 1 The Simplex Method Formulate Constrained Maximization or Minimization Problem Convert to Standard Form Convert to Canonical Form Set Up the Tableau and the Initial Basic Feasible Solution

More information

Advanced Implementations of Tables: Balanced Search Trees and Hashing

Advanced Implementations of Tables: Balanced Search Trees and Hashing Advanced Implementations of Tables: Balanced Search Trees and Hashing Balanced Search Trees Binary search tree operations such as insert, delete, retrieve, etc. depend on the length of the path to the

More information

CS 2210 Discrete Structures Advanced Counting. Fall 2017 Sukumar Ghosh

CS 2210 Discrete Structures Advanced Counting. Fall 2017 Sukumar Ghosh CS 2210 Discrete Structures Advanced Counting Fall 2017 Sukumar Ghosh Compound Interest A person deposits $10,000 in a savings account that yields 10% interest annually. How much will be there in the account

More information

Lecture 26. Sequence Algorithms (Continued)

Lecture 26. Sequence Algorithms (Continued) Lecture 26 Sequence Algorithms (Continued) Announcements for This Lecture Lab/Finals Lab 12 is the final lab Can use Consulting hours Due next Wednesday 9:30 Final: Dec 10 th 2:00-4:30pm Study guide is

More information

Fast Sorting and Selection. A Lower Bound for Worst Case

Fast Sorting and Selection. A Lower Bound for Worst Case Presentation for use with the textbook, Algorithm Design and Applications, by M. T. Goodrich and R. Tamassia, Wiley, 0 Fast Sorting and Selection USGS NEIC. Public domain government image. A Lower Bound

More information

Algorithm Analysis, Asymptotic notations CISC4080 CIS, Fordham Univ. Instructor: X. Zhang

Algorithm Analysis, Asymptotic notations CISC4080 CIS, Fordham Univ. Instructor: X. Zhang Algorithm Analysis, Asymptotic notations CISC4080 CIS, Fordham Univ. Instructor: X. Zhang Last class Introduction to algorithm analysis: fibonacci seq calculation counting number of computer steps recursive

More information

Fundamentals of Programming. Efficiency of algorithms November 5, 2017

Fundamentals of Programming. Efficiency of algorithms November 5, 2017 15-112 Fundamentals of Programming Efficiency of algorithms November 5, 2017 Complexity of sorting algorithms Selection Sort Bubble Sort Insertion Sort Efficiency of Algorithms A computer program should

More information

Learning Deep Broadband Hongjoo LEE

Learning Deep Broadband Hongjoo LEE Learning Deep Broadband Network@HOME Hongjoo LEE Who am I? Machine Learning Engineer Software Engineer Fraud Detection System Software Defect Prediction Email Services (40+ mil. users) High traffic server

More information

The P/Q Mathematics Study Guide

The P/Q Mathematics Study Guide The P/Q Mathematics Study Guide Copyright 007 by Lawrence Perez and Patrick Quigley All Rights Reserved Table of Contents Ch. Numerical Operations - Integers... - Fractions... - Proportion and Percent...

More information

Test 2 Solutions - Python Edition

Test 2 Solutions - Python Edition 'XNH8QLYHUVLW\ (GPXQG73UDWW-U6FKRRORI(QJLQHHULQJ EGR 103L Fall 2017 Test 2 Solutions - Python Edition Michael R. Gustafson II Name (please print) NET ID (please print): In keeping with the Community Standard,

More information

1 Problem 1 Solution. 1.1 Common Mistakes. In order to show that the matrix L k is the inverse of the matrix M k, we need to show that

1 Problem 1 Solution. 1.1 Common Mistakes. In order to show that the matrix L k is the inverse of the matrix M k, we need to show that 1 Problem 1 Solution In order to show that the matrix L k is the inverse of the matrix M k, we need to show that Since we need to show that Since L k M k = I (or M k L k = I). L k = I + m k e T k, M k

More information

Deterministic Operations Research, ME 366Q and ORI 391 Chapter 2: Homework #2 Solutions

Deterministic Operations Research, ME 366Q and ORI 391 Chapter 2: Homework #2 Solutions Deterministic Operations Research, ME 366Q and ORI 391 Chapter 2: Homework #2 Solutions 11. Consider the following linear program. Maximize z = 6x 1 + 3x 2 subject to x 1 + 2x 2 2x 1 + x 2 20 x 1 x 2 x

More information

Geometry Chapter 2 Practice Free Response Test

Geometry Chapter 2 Practice Free Response Test Geometry Chapter 2 Practice Free Response Test Directions: Read each question carefully. Show ALL work. No work, No credit. This is a closed note and book test.. Identify Hypothesis and Conclusion of the

More information

CSCI-141 Exam 1 Review September 19, 2015 Presented by the RIT Computer Science Community

CSCI-141 Exam 1 Review September 19, 2015 Presented by the RIT Computer Science Community CSCI-141 Exam 1 Review September 19, 2015 Presented by the RIT Computer Science Community http://csc.cs.rit.edu 1. Python basics (a) The programming language Python (circle the best answer): i. is primarily

More information

On the Simulation of Random Events or How to calculate the number of cars arriving at an intersection in any given period of time

On the Simulation of Random Events or How to calculate the number of cars arriving at an intersection in any given period of time On the Simulation of Random Events or How to calculate the number of cars arriving at an intersection in any given period of time David Vernon Carnegie Mellon University in Rwanda February 10, 2017 Abstract

More information

Force & Motion Task Cards

Force & Motion Task Cards Force & Motion Task Cards By: Plan Teach Grade Repeat 5.NBT.5 Plan, Teach, Grade, Repeat Differentiated Versions North Carolina Essential Standards 5.P.1 Understand force, motion and the relationship between

More information

<br /> D. Thiebaut <br />August """Example of DNNRegressor for Housing dataset.""" In [94]:

<br /> D. Thiebaut <br />August Example of DNNRegressor for Housing dataset. In [94]: sklearn Tutorial: Linear Regression on Boston Data This is following the https://github.com/tensorflow/tensorflow/blob/maste

More information

CH 6 THE ORDER OF OPERATIONS

CH 6 THE ORDER OF OPERATIONS 43 CH 6 THE ORDER OF OPERATIONS Introduction T here are a variety of operations we perform in math, including addition, multiplication, and squaring. When we re confronted with an expression that has a

More information

LESSON ASSIGNMENT. After completing this lesson, you should be able to:

LESSON ASSIGNMENT. After completing this lesson, you should be able to: LESSON ASSIGNMENT LESSON 1 General Mathematics Review. TEXT ASSIGNMENT Paragraphs 1-1 through 1-49. LESSON OBJECTIVES After completing this lesson, you should be able to: 1-1. Identify and apply the properties

More information

Review Notes for Linear Algebra True or False Last Updated: February 22, 2010

Review Notes for Linear Algebra True or False Last Updated: February 22, 2010 Review Notes for Linear Algebra True or False Last Updated: February 22, 2010 Chapter 4 [ Vector Spaces 4.1 If {v 1,v 2,,v n } and {w 1,w 2,,w n } are linearly independent, then {v 1 +w 1,v 2 +w 2,,v n

More information

NAME: Mathematics 133, Fall 2013, Examination 3

NAME: Mathematics 133, Fall 2013, Examination 3 NAME: Mathematics 133, Fall 2013, Examination 3 INSTRUCTIONS: Work all questions, and unless indicated otherwise give reasons for your answers. If the problem does not explicitly state that the underlying

More information

Benchmark Test Modules 1 7

Benchmark Test Modules 1 7 . What is the solution of 50 = x 3?. Does each equation have at least one solution? A 8x + = 8x 4 x = 5x + C 6x + 9 = 6x + 9 D 5 x = 0 x 3. Solve x + 7= 9 x. What is the value of x? 4. A living room of

More information

Lecture 3: Matrix and Matrix Operations

Lecture 3: Matrix and Matrix Operations Lecture 3: Matrix and Matrix Operations Representation, row vector, column vector, element of a matrix. Examples of matrix representations Tables and spreadsheets Scalar-Matrix operation: Scaling a matrix

More information

Bishop Kelley High School Summer Math Program Course: Algebra 2 A

Bishop Kelley High School Summer Math Program Course: Algebra 2 A 06 07 Bishop Kelley High School Summer Math Program Course: Algebra A NAME: DIRECTIONS: Show all work in packet!!! The first 6 pages of this packet provide eamples as to how to work some of the problems

More information

More AMC 8 Problems. Dr. Titu Andreescu. November 9, 2013

More AMC 8 Problems. Dr. Titu Andreescu. November 9, 2013 More AMC 8 Problems Dr. Titu Andreescu November 9, 2013 Problems 1. Complete 12 + 12 6 2 3 with one set of brackets ( ) in order to obtain 12. 2. Evaluate 10000000 100000 90. 3. I am thinking of two numbers.

More information

and r = ( x + 2 ), we substitute r into the equation for A and

and r = ( x + 2 ), we substitute r into the equation for A and Elementary Algebra Accuplacer Review Problem Solutions 1. The correct answer is C. We can substitute 2 in for k in the expression and follow order of operations: 2. The correct answer is D. Since distribute.

More information

SKLearn Tutorial: DNN on Boston Data

SKLearn Tutorial: DNN on Boston Data SKLearn Tutorial: DNN on Boston Data This tutorial follows very closely two other good tutorials and merges elements from both: https://github.com/tensorflow/tensorflow/blob/master/tensorflow/examples/skflow/boston.py

More information

Gauss-Seidel method. Dr. Motilal Panigrahi. Dr. Motilal Panigrahi, Nirma University

Gauss-Seidel method. Dr. Motilal Panigrahi. Dr. Motilal Panigrahi, Nirma University Gauss-Seidel method Dr. Motilal Panigrahi Solving system of linear equations We discussed Gaussian elimination with partial pivoting Gaussian elimination was an exact method or closed method Now we will

More information

Modeling Rare Events

Modeling Rare Events Modeling Rare Events Chapter 4 Lecture 15 Yiren Ding Shanghai Qibao Dwight High School April 24, 2016 Yiren Ding Modeling Rare Events 1 / 48 Outline 1 The Poisson Process Three Properties Stronger Property

More information

CS 237 Fall 2018, Homework 06 Solution

CS 237 Fall 2018, Homework 06 Solution 0/9/20 hw06.solution CS 237 Fall 20, Homework 06 Solution Due date: Thursday October th at :59 pm (0% off if up to 24 hours late) via Gradescope General Instructions Please complete this notebook by filling

More information

(a) Find the actual area of the shed on the plan. Write your answer in the space below.

(a) Find the actual area of the shed on the plan. Write your answer in the space below. 1) Look at the plan of a garden below. In one corner of the garden is a shed. The garden and the shed are both rectangular. The ground in the shed is made of concrete. The garden is covered with grass.

More information

ELEMENTARY NUMBER THEORY AND METHODS OF PROOF

ELEMENTARY NUMBER THEORY AND METHODS OF PROOF CHAPTER 4 ELEMENTARY NUMBER THEORY AND METHODS OF PROOF Copyright Cengage Learning. All rights reserved. SECTION 4.5 Direct Proof and Counterexample V: Floor and Ceiling Copyright Cengage Learning. All

More information

Chapter 6 Summary 6.1. Using the Hypotenuse-Leg (HL) Congruence Theorem. Example

Chapter 6 Summary 6.1. Using the Hypotenuse-Leg (HL) Congruence Theorem. Example Chapter Summary Key Terms corresponding parts of congruent triangles are congruent (CPCTC) (.2) vertex angle of an isosceles triangle (.3) inverse (.4) contrapositive (.4) direct proof (.4) indirect proof

More information

Table of mathematical symbols - Wikipedia, the free encyclopedia

Table of mathematical symbols - Wikipedia, the free encyclopedia Página 1 de 13 Table of mathematical symbols From Wikipedia, the free encyclopedia For the HTML codes of mathematical symbols see mathematical HTML. Note: This article contains special characters. The

More information

FORM 3 MATHEMATICS TIME: 30 minutes (Non Calculator Paper) INSTRUCTIONS TO CANDIDATES

FORM 3 MATHEMATICS TIME: 30 minutes (Non Calculator Paper) INSTRUCTIONS TO CANDIDATES DIRECTORATE FOR QUALITY AND STANDARDS IN EDUCATION Department for Curriculum Management and elearning Educational Assessment Unit Annual Examinations for Secondary Schools 2012 A FORM 3 MATHEMATICS TIME:

More information

Complexity, P and NP

Complexity, P and NP Complexity, P and NP EECS 477 Lecture 21, 11/26/2002 Last week Lower bound arguments Information theoretic (12.2) Decision trees (sorting) Adversary arguments (12.3) Maximum of an array Graph connectivity

More information

SAT, Coloring, Hamiltonian Cycle, TSP

SAT, Coloring, Hamiltonian Cycle, TSP 1 SAT, Coloring, Hamiltonian Cycle, TSP Slides by Carl Kingsford Apr. 28, 2014 Sects. 8.2, 8.7, 8.5 2 Boolean Formulas Boolean Formulas: Variables: x 1, x 2, x 3 (can be either true or false) Terms: t

More information

If x = 3, what is the value of 2x 2 + 5x?

If x = 3, what is the value of 2x 2 + 5x? Asha receives $10 000. Asha keeps half his money and gives the rest to Bertha. Bertha keeps half her money and gives the rest to Calvin. Calvin keeps half his money and gives the rest to Dane. Dane keeps

More information

Numerical Analysis Fall. Gauss Elimination

Numerical Analysis Fall. Gauss Elimination Numerical Analysis 2015 Fall Gauss Elimination Solving systems m g g m m g x x x k k k k k k k k k 3 2 1 3 2 1 3 3 3 2 3 2 2 2 1 0 0 Graphical Method For small sets of simultaneous equations, graphing

More information

2.1: Algebraic Expressions

2.1: Algebraic Expressions .1: Algebraic Expressions Algebra uses letters, called variables, such as x and y, to represent numbers. Algebraic expressions are combinations of variables and numbers using the operations of addition,

More information

Python. chrysn

Python. chrysn Python chrysn 2008-09-25 Introduction Structure, Language & Syntax Strengths & Weaknesses Introduction Structure, Language & Syntax Strengths & Weaknesses Python Python is an interpreted,

More information

Advanced Algorithmics (6EAP)

Advanced Algorithmics (6EAP) Advanced Algorithmics (6EAP) MTAT.03.238 Order of growth maths Jaak Vilo 2017 fall Jaak Vilo 1 Program execution on input of size n How many steps/cycles a processor would need to do How to relate algorithm

More information

Course Announcements. Bacon is due next Monday. Next lab is about drawing UIs. Today s lecture will help thinking about your DB interface.

Course Announcements. Bacon is due next Monday. Next lab is about drawing UIs. Today s lecture will help thinking about your DB interface. Course Announcements Bacon is due next Monday. Today s lecture will help thinking about your DB interface. Next lab is about drawing UIs. John Jannotti (cs32) ORMs Mar 9, 2017 1 / 24 ORMs John Jannotti

More information

Functions in Python L435/L555. Dept. of Linguistics, Indiana University Fall Functions in Python. Functions.

Functions in Python L435/L555. Dept. of Linguistics, Indiana University Fall Functions in Python. Functions. L435/L555 Dept. of Linguistics, Indiana University Fall 2016 1 / 18 What is a function? Definition A function is something you can call (possibly with some parameters, i.e., the things in parentheses),

More information

APPENDIX B: Review of Basic Arithmetic

APPENDIX B: Review of Basic Arithmetic APPENDIX B: Review of Basic Arithmetic Personal Trainer Algebra Click Algebra in the Personal Trainer for an interactive review of these concepts. Equality = Is equal to 3 = 3 Three equals three. 3 = +3

More information

STATISTICAL THINKING IN PYTHON I. Introduction to summary statistics: The sample mean and median

STATISTICAL THINKING IN PYTHON I. Introduction to summary statistics: The sample mean and median STATISTICAL THINKING IN PYTHON I Introduction to summary statistics: The sample mean and median 2008 US swing state election results Data retrieved from Data.gov (https://www.data.gov/) 2008 US swing state

More information

Practical Information

Practical Information MA2501 Numerical Methods Spring 2018 Norwegian University of Science and Technology Department of Mathematical Sciences Semester Project Practical Information This project counts for 30 % of the final

More information

CH 17 THE DISTRIBUTIVE PROPERTY

CH 17 THE DISTRIBUTIVE PROPERTY 153 CH 17 THE DISTRIBUTIVE PROPERTY Introduction W e re becoming quite skillful at solving equations. But like a mutating virus, there are always new varieties of equations confronting us. For example,

More information

Graphics Programming I

Graphics Programming I Graphics Programming I Agenda: Linear algebra primer Transformations in OpenGL Timing for animation Begin first programming assignment Linear algebra primer Three important data types: Scalar values Row

More information

Computer Algorithms CISC4080 CIS, Fordham Univ. Outline. Last class. Instructor: X. Zhang Lecture 2

Computer Algorithms CISC4080 CIS, Fordham Univ. Outline. Last class. Instructor: X. Zhang Lecture 2 Computer Algorithms CISC4080 CIS, Fordham Univ. Instructor: X. Zhang Lecture 2 Outline Introduction to algorithm analysis: fibonacci seq calculation counting number of computer steps recursive formula

More information

Computer Algorithms CISC4080 CIS, Fordham Univ. Instructor: X. Zhang Lecture 2

Computer Algorithms CISC4080 CIS, Fordham Univ. Instructor: X. Zhang Lecture 2 Computer Algorithms CISC4080 CIS, Fordham Univ. Instructor: X. Zhang Lecture 2 Outline Introduction to algorithm analysis: fibonacci seq calculation counting number of computer steps recursive formula

More information

Elementary Sorts 1 / 18

Elementary Sorts 1 / 18 Elementary Sorts 1 / 18 Outline 1 Rules of the Game 2 Selection Sort 3 Insertion Sort 4 Shell Sort 5 Visualizing Sorting Algorithms 6 Comparing Sorting Algorithms 2 / 18 Rules of the Game Sorting is the

More information

SMT and Z3. Nikolaj Bjørner Microsoft Research ReRISE Winter School, Linz, Austria February 5, 2014

SMT and Z3. Nikolaj Bjørner Microsoft Research ReRISE Winter School, Linz, Austria February 5, 2014 SMT and Z3 Nikolaj Bjørner Microsoft Research ReRISE Winter School, Linz, Austria February 5, 2014 Plan Mon An invitation to SMT with Z3 Tue Equalities and Theory Combination Wed Theories: Arithmetic,

More information

Exercise 1 (15 points)

Exercise 1 (15 points) Exam System Validation (214012) 8:45-12:15, 25-06-2010 The exercises are worth a total of 90 points. The final grade is 10+pts 10. The exam is open book: copies of slides/papers/notes/etc. are allowed.

More information