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

Size: px
Start display at page:

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

Transcription

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

2 Historical Numeric (1995) Numarray (for large arrays) scipy.core (briefly, around 2005) numpy (2005) Luis Pedro Coelho (Programming for Scientists) Numpy October 22, 2012 (2 / 26)

3 Currently numpy 1.6 de facto standard very stable Luis Pedro Coelho (Programming for Scientists) Numpy October 22, 2012 (3 / 26)

4 Basic Type numpy.array or numpy.ndarray. Multi-dimensional array of numbers. Luis Pedro Coelho (Programming for Scientists) Numpy October 22, 2012 (4 / 26)

5 numpy example import numpy a s np A = np. array ( [ [ 0, 1, 2 ], [ 2, 3, 4 ], [ 4, 5, 6 ], [ 6, 7, 8 ] ] ) p r i n t A[ 0, 0 ] p r i n t A[ 0, 1 ] p r i n t A[ 1, 0 ] Luis Pedro Coelho (Programming for Scientists) Numpy October 22, 2012 (5 / 26)

6 Some Array Properties import numpy a s np A = np. array ( [ [ 0, 1, 2 ], [ 2, 3, 4 ], [ 4, 5, 6 ], [ 6, 7, 8 ] ] ) p r i n t A. shape p r i n t A. s i z e Luis Pedro Coelho (Programming for Scientists) Numpy October 22, 2012 (6 / 26)

7 Some Array Functions... p r i n t A. max( ) p r i n t A. min ( ) max(): maximum min(): minimum ptp(): spread (max - min) sum(): sum std(): standard deviation Luis Pedro Coelho (Programming for Scientists) Numpy October 22, 2012 (7 / 26)

8 Other Functions np.exp np.sin All of these work element-wise! Luis Pedro Coelho (Programming for Scientists) Numpy October 22, 2012 (8 / 26)

9 Arithmetic Operations import numpy a s np A = np. array ( [ 0, 1, 2, 3 ] ) B = np. array ( [ 1, 1, 2, 2 ] ) p r i n t A + B p r i n t A * B p r i n t A / B Luis Pedro Coelho (Programming for Scientists) Numpy October 22, 2012 (9 / 26)

10 Broadcasting Mixing arrays of different dimensions import numpy a s np A = np. array ( [ [ 0, 0, 1 ], [ 1, 1, 2 ], [ 1, 2, 2 ], [ 3, 2, 2 ] ] ) B = np. array ( [ 2, 1, 2 ] ) p r i n t A + B p r i n t A * B Luis Pedro Coelho (Programming for Scientists) Numpy October 22, 2012 (10 / 26)

11 Broadcasting Special case: scalar. import numpy a s np A = np. arange ( 100 ) p r i n t A + 2 A += 2 Luis Pedro Coelho (Programming for Scientists) Numpy October 22, 2012 (11 / 26)

12 Data Types numpy.ndarray is a homogeneous array of numbers. Types Boolean integers floating point numbers Luis Pedro Coelho (Programming for Scientists) Numpy October 22, 2012 (12 / 26)

13 Object Construction import numpy a s np A = np. array ( [ 0, 1, 1 ], f l o a t ) A = np. array ( [ 0, 1, 1 ], bool ) Luis Pedro Coelho (Programming for Scientists) Numpy October 22, 2012 (13 / 26)

14 Reduction A = np. array ( [ [ 0, 0, 1 ], [ 1, 2, 3 ], [ 2, 4, 2 ], [ 1, 0, 1 ] ] ) p r i n t A. max( 0 ) p r i n t A. max( 1 ) p r i n t A. max( ) prints [2,4,3] [1,3,4,1] 4 The same is true for many other functions. Luis Pedro Coelho (Programming for Scientists) Numpy October 22, 2012 (14 / 26)

15 Slicing import numpy a s np A = np. array ( [ [ 0, 1, 2 ], [ 2, 3, 4 ], [ 4, 5, 6 ], [ 6, 7, 8 ] ] ) p r i n t A[ 0 ] p r i n t A[ 0 ]. shape p r i n t A[ 1 ] p r i n t A[ :, 2 ] Luis Pedro Coelho (Programming for Scientists) Numpy October 22, 2012 (15 / 26)

16 Two minute break Talk to your neighbours Play around in Python Ask questions Luis Pedro Coelho (Programming for Scientists) Numpy October 22, 2012 (16 / 26)

17 Slices Share Memory! import numpy a s np A = np. array ( [ [ 0, 1, 2 ], [ 2, 3, 4 ], [ 4, 5, 6 ], [ 6, 7, 8 ] ] ) B = A[ 0 ] B[ 0 ] = - 1 p r i n t A[ 0, 0 ] Luis Pedro Coelho (Programming for Scientists) Numpy October 22, 2012 (17 / 26)

18 Pass is By Reference def double (A) : A *= 2 A = np. arange ( 20 ) double (A) Luis Pedro Coelho (Programming for Scientists) Numpy October 22, 2012 (18 / 26)

19 Pass is By Reference def double (A) : A *= 2 A = np. arange ( 20 ) double (A) A = np. arange ( 20 ) B = A. copy ( ) Luis Pedro Coelho (Programming for Scientists) Numpy October 22, 2012 (18 / 26)

20 Logical Arrays A = np. array ( [ - 1, 0, 1, 2, - 2, 3, 4, - 2 ] ) p r i n t (A > 0 ) Luis Pedro Coelho (Programming for Scientists) Numpy October 22, 2012 (19 / 26)

21 Logical Arrays II A = np. array ( [ - 1, 0, 1, 2, - 2, 3, 4, - 2 ] ) p r i n t ( (A > 0 ) & (A < 3 ) ). mean( ) What does this do? Luis Pedro Coelho (Programming for Scientists) Numpy October 22, 2012 (20 / 26)

22 Logical Indexing A[A < 0 ] = 0 or A *= (A > 0 ) Luis Pedro Coelho (Programming for Scientists) Numpy October 22, 2012 (21 / 26)

23 Logical Indexing p r i n t Mean o f p o s i t i v e s, A[A > 0 ]. mean( ) Luis Pedro Coelho (Programming for Scientists) Numpy October 22, 2012 (22 / 26)

24 Some Helper Functions Constructing Arrays A = np. z e r o s ( ( 10, 10 ), i n t ) B = np. ones ( 10 ) C = np. arange ( 100 ). reshape ( ( 10, 10 ) )... Multiple Dimensions img = np. z e r o s ( ( 1024, 1024, 3 ) ) Luis Pedro Coelho (Programming for Scientists) Numpy October 22, 2012 (23 / 26)

25 Documentation Luis Pedro Coelho (Programming for Scientists) Numpy October 22, 2012 (24 / 26)

26 Matplotlib Matplotlib is a plotting library for Python. import pylab import numpy a s np X = np. l i n s p a c e ( - 4,+4, 1000 ) pylab. p l o t (X, np. exp ( -X**2 ) ) pylab. x l a b e l ( r $x$ ) pylab. y l a b e l ( r $\exp ( - x^{2} ) $ ) pylab. s a v e f i g ( gaussian. pdf ) Luis Pedro Coelho (Programming for Scientists) Numpy October 22, 2012 (25 / 26)

27 Matplotlib Example exp( x 2 ) x Luis Pedro Coelho (Programming for Scientists) Numpy October 22, 2012 (26 / 26)

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

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

Skriptsprachen. Numpy und Scipy. Kai Dührkop. Lehrstuhl fuer Bioinformatik Friedrich-Schiller-Universitaet Jena

Skriptsprachen. Numpy und Scipy. Kai Dührkop. Lehrstuhl fuer Bioinformatik Friedrich-Schiller-Universitaet Jena Skriptsprachen Numpy und Scipy Kai Dührkop Lehrstuhl fuer Bioinformatik Friedrich-Schiller-Universitaet Jena kai.duehrkop@uni-jena.de 24. September 2015 24. September 2015 1 / 37 Numpy Numpy Numerische

More information

Introduction to Python Programming

Introduction to Python Programming Introduction to Python Programming Luis Pedro Coelho Programming for Scientists October 22, 2012 Luis Pedro Coelho (Programming for Scientists) Python I October 22, 2012 (1 / 26) Python Let s digress for

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

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

DM534 - Introduction to Computer Science

DM534 - Introduction to Computer Science Department of Mathematics and Computer Science University of Southern Denmark, Odense October 21, 2016 Marco Chiarandini DM534 - Introduction to Computer Science Training Session, Week 41-43, Autumn 2016

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

ECE 5615/4615 Computer Project

ECE 5615/4615 Computer Project Set #1p Due Friday March 17, 017 ECE 5615/4615 Computer Project The details of this first computer project are described below. This being a form of take-home exam means that each person is to do his/her

More information

MODELS USING MATRICES WITH PYTHON

MODELS USING MATRICES WITH PYTHON MODELS USING MATRICES WITH PYTHON José M. Garrido Department of Computer Science May 2016 College of Computing and Software Engineering Kennesaw State University c 2015, J. M. Garrido Models Using Matrices

More information

Outline Python, Numpy, and Matplotlib Making Models with Polynomials Making Models with Monte Carlo Error, Accuracy and Convergence Floating Point Mod

Outline Python, Numpy, and Matplotlib Making Models with Polynomials Making Models with Monte Carlo Error, Accuracy and Convergence Floating Point Mod Outline Python, Numpy, and Matplotlib Making Models with Polynomials Making Models with Monte Carlo Error, Accuracy and Convergence Floating Point Modeling the World with Arrays The World in a Vector What

More information

Congratulations! You passed!

Congratulations! You passed! /8/07 Coursera Online Courses From Top Universities. Join for Free Coursera 0/0 (00%) Quiz, 0 questions Congratulations! You passed! Next Item /. What does a neuron compute? A neuron computes a linear

More information

5615 Chapter 3. April 8, Set #3 RP Simulation 3 Working with rp1 in the Notebook Proper Numerical Integration 5

5615 Chapter 3. April 8, Set #3 RP Simulation 3 Working with rp1 in the Notebook Proper Numerical Integration 5 5615 Chapter 3 April 8, 2015 Contents Mixed RV and Moments 2 Simulation............................................... 2 Set #3 RP Simulation 3 Working with rp1 in the Notebook Proper.............................

More information

Python Analysis. PHYS 224 October 1/2, 2015

Python Analysis. PHYS 224 October 1/2, 2015 Python Analysis PHYS 224 October 1/2, 2015 Goals Two things to teach in this lecture 1. How to use python to fit data 2. How to interpret what python gives you Some references: http://nbviewer.ipython.org/url/media.usm.maine.edu/~pauln/

More information

f = Xw + b, We can compute the total square error of the function values above, compared to the observed training set values:

f = Xw + b, We can compute the total square error of the function values above, compared to the observed training set values: Linear regression Much of machine learning is about fitting functions to data. That may not sound like an exciting activity that will give us artificial intelligence. However, representing and fitting

More information

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

AMLD Deep Learning in PyTorch. 2. PyTorch tensors

AMLD Deep Learning in PyTorch. 2. PyTorch tensors AMLD Deep Learning in PyTorch 2. PyTorch tensors François Fleuret http://fleuret.org/amld/ February 10, 2018 ÉCOLE POLYTECHNIQUE FÉDÉRALE DE LAUSANNE PyTorch s tensors François Fleuret AMLD Deep Learning

More information

Computational Methods for Nonlinear Systems

Computational Methods for Nonlinear Systems Computational Methods for Nonlinear Systems Cornell Physics 682 / CIS 629 James P. Sethna Christopher R. Myers Computational Methods for Nonlinear Systems Graduate computational science laboratory course

More information

NUMERICAL ANALYSIS WEEKLY OVERVIEW

NUMERICAL ANALYSIS WEEKLY OVERVIEW NUMERICAL ANALYSIS WEEKLY OVERVIEW M. AUTH 1. Monday 28 August Students are encouraged to download Anaconda Python. Anaconda is a version of Python that comes with some numerical packages (numpy and matplotlib)

More information

Conditioning and Stability

Conditioning and Stability Lab 17 Conditioning and Stability Lab Objective: Explore the condition of problems and the stability of algorithms. The condition number of a function measures how sensitive that function is to changes

More information

Python Analysis. PHYS 224 September 25/26, 2014

Python Analysis. PHYS 224 September 25/26, 2014 Python Analysis PHYS 224 September 25/26, 2014 Goals Two things to teach in this lecture 1. How to use python to fit data 2. How to interpret what python gives you Some references: http://nbviewer.ipython.org/url/media.usm.maine.edu/~pauln/

More information

I. Numerical Computing

I. Numerical Computing I. Numerical Computing A. Lectures 1-3: Foundations of Numerical Computing Lecture 1 Intro to numerical computing Understand difference and pros/cons of analytical versus numerical solutions Lecture 2

More information

Lectures about Python, useful both for beginners and experts, can be found at (http://scipy-lectures.github.io).

Lectures about Python, useful both for beginners and experts, can be found at  (http://scipy-lectures.github.io). Random Matrix Theory (Sethna, "Entropy, Order Parameters, and Complexity", ex. 1.6, developed with Piet Brouwer) 2016, James Sethna, all rights reserved. This is an ipython notebook. This hints file is

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

Image Processing in Numpy

Image Processing in Numpy Version: January 17, 2017 Computer Vision Laboratory, Linköping University 1 Introduction Image Processing in Numpy Exercises During this exercise, you will become familiar with image processing in Python.

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

LECTURE 3 LINEAR ALGEBRA AND SINGULAR VALUE DECOMPOSITION

LECTURE 3 LINEAR ALGEBRA AND SINGULAR VALUE DECOMPOSITION SCIENTIFIC DATA COMPUTING 1 MTAT.08.042 LECTURE 3 LINEAR ALGEBRA AND SINGULAR VALUE DECOMPOSITION Prepared by: Amnir Hadachi Institute of Computer Science, University of Tartu amnir.hadachi@ut.ee OUTLINE

More information

Jug: Executing Parallel Tasks in Python

Jug: Executing Parallel Tasks in Python Jug: Executing Parallel Tasks in Python Luis Pedro Coelho EMBL 21 May 2013 Luis Pedro Coelho (EMBL) Jug 21 May 2013 (1 / 24) Jug: Coarse Parallel Tasks in Python Parallel Python code Memoization Luis Pedro

More information

CS 237 Fall 2018, Homework 07 Solution

CS 237 Fall 2018, Homework 07 Solution CS 237 Fall 2018, Homework 07 Solution Due date: Thursday November 1st at 11:59 pm (10% off if up to 24 hours late) via Gradescope General Instructions Please complete this notebook by filling in solutions

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

Satellite project, AST 1100

Satellite project, AST 1100 Satellite project, AST 1100 Part 4: Skynet The goal in this part is to develop software that the satellite can use to orient itself in the star system. That is, that it can find its own position, velocity

More information

ECE521 W17 Tutorial 1. Renjie Liao & Min Bai

ECE521 W17 Tutorial 1. Renjie Liao & Min Bai ECE521 W17 Tutorial 1 Renjie Liao & Min Bai Schedule Linear Algebra Review Matrices, vectors Basic operations Introduction to TensorFlow NumPy Computational Graphs Basic Examples Linear Algebra Review

More information

DM559 Linear and Integer Programming. Lecture 6 Rank and Range. Marco Chiarandini

DM559 Linear and Integer Programming. Lecture 6 Rank and Range. Marco Chiarandini DM559 Linear and Integer Programming Lecture 6 and Marco Chiarandini Department of Mathematics & Computer Science University of Southern Denmark Outline 1. 2. 3. 2 Outline 1. 2. 3. 3 Exercise Solve the

More information

A Glimpse at Scipy FOSSEE. June Abstract This document shows a glimpse of the features of Scipy that will be explored during this course.

A Glimpse at Scipy FOSSEE. June Abstract This document shows a glimpse of the features of Scipy that will be explored during this course. A Glimpse at Scipy FOSSEE June 010 Abstract This document shows a glimpse of the features of Scipy that will be explored during this course. 1 Introduction SciPy is open-source software for mathematics,

More information

DM559 Linear and integer programming

DM559 Linear and integer programming Department of Mathematics and Computer Science University of Southern Denmark, Odense March 8, 2018 Marco Chiarandini DM559 Linear and integer programming Sheet 4, Spring 2018 [pdf format] Included. Exercise

More information

Continuous wavelet transform Python module

Continuous wavelet transform Python module Continuous wavelet transform Python module Erwin Verwichte University of Warwick erwin.verwichte@warwick.ac.uk 31 Oct 017 1 Introduction A continuous wavelet is a well-known fundamental tool that allows

More information

Section Vectors

Section Vectors Section 1.2 - Vectors Maggie Myers Robert A. van de Geijn The University of Texas at Austin Practical Linear Algebra Fall 2009 http://z.cs.utexas.edu/wiki/pla.wiki/ 1 Vectors We will call a one-dimensional

More information

Vectorization. Yu Wu, Ishan Patil. October 13, 2017

Vectorization. Yu Wu, Ishan Patil. October 13, 2017 Vectorization Yu Wu, Ishan Patil October 13, 2017 Exercises to be covered We will implement some examples of image classification algorithms using a subset of the MNIST dataset logistic regression for

More information

: Approximation and Online Algorithms with Applications Lecture Note 2: NP-Hardness

: Approximation and Online Algorithms with Applications Lecture Note 2: NP-Hardness 4810-1183: Approximation and Online Algorithms with Applications Lecture Note 2: NP-Hardness Introduction Suppose that you submitted a research manuscript to a journal. It is very unlikely that your paper

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

Elastic Network Models

Elastic Network Models Elastic Network Models Release 1.5.1 Ahmet Bakan December 24, 2013 CONTENTS 1 Introduction 1 1.1 Required Programs........................................... 1 1.2 Recommended Programs.......................................

More information

HW5 computer problem: modelling a dye molecule Objectives By the end of this lab you should: Know how to manipulate complex numbers and matrices. Prog

HW5 computer problem: modelling a dye molecule Objectives By the end of this lab you should: Know how to manipulate complex numbers and matrices. Prog HW5 computer problem: modelling a dye molecule Objectives By the end of this lab you should: Know how to manipulate complex numbers and matrices. Programming environment: Spyder. To implement this, do

More information

Conjugate-Gradient. Learn about the Conjugate-Gradient Algorithm and its Uses. Descent Algorithms and the Conjugate-Gradient Method. Qx = b.

Conjugate-Gradient. Learn about the Conjugate-Gradient Algorithm and its Uses. Descent Algorithms and the Conjugate-Gradient Method. Qx = b. Lab 1 Conjugate-Gradient Lab Objective: Learn about the Conjugate-Gradient Algorithm and its Uses Descent Algorithms and the Conjugate-Gradient Method There are many possibilities for solving a linear

More information

Numerical Linear Algebra

Numerical Linear Algebra Numerical Linear Algebra Carlos Hurtado Department of Economics University of Illinois at Urbana-Champaign hrtdmrt2@illinois.edu Sep 19th, 2017 C. Hurtado (UIUC - Economics) Numerical Methods On the Agenda

More information

Complex Numbers. A complex number z = x + iy can be written in polar coordinates as re i where

Complex Numbers. A complex number z = x + iy can be written in polar coordinates as re i where Lab 20 Complex Numbers Lab Objective: Create visualizations of complex functions. Visually estimate their zeros and poles, and gain intuition about their behavior in the complex plane. Representations

More information

Managing Uncertainty

Managing Uncertainty Managing Uncertainty Bayesian Linear Regression and Kalman Filter December 4, 2017 Objectives The goal of this lab is multiple: 1. First it is a reminder of some central elementary notions of Bayesian

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

Gradient Descent Methods

Gradient Descent Methods Lab 18 Gradient Descent Methods Lab Objective: Many optimization methods fall under the umbrella of descent algorithms. The idea is to choose an initial guess, identify a direction from this point along

More information

Computational Methods for Nonlinear Systems

Computational Methods for Nonlinear Systems Computational Methods for Nonlinear Systems Cornell Physics 682 / CIS 629 Chris Myers Computational Methods for Nonlinear Systems Graduate computational science laboratory course developed by Myers & Sethna

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

Tools for Feature Extraction: Exploring essentia

Tools for Feature Extraction: Exploring essentia Tools for Feature Extraction: Exploring essentia MUS-15 Andrea Hanke July 5, 2017 Introduction In the research on Music Information Retrieval, it is attempted to automatically classify a piece of music

More information

Crash Course on TensorFlow! Vincent Lepetit!

Crash Course on TensorFlow! Vincent Lepetit! Crash Course on TensorFlow Vincent Lepetit 1 TensorFlow Created by Google for easily implementing Deep Networks; Library for Python, but can also be used with C and Java; Exists for Linux, Mac OSX, Windows;

More information

DEPARTMENT OF COMPUTER SCIENCE AUTUMN SEMESTER MACHINE LEARNING AND ADAPTIVE INTELLIGENCE

DEPARTMENT OF COMPUTER SCIENCE AUTUMN SEMESTER MACHINE LEARNING AND ADAPTIVE INTELLIGENCE Data Provided: None DEPARTMENT OF COMPUTER SCIENCE AUTUMN SEMESTER 204 205 MACHINE LEARNING AND ADAPTIVE INTELLIGENCE hour Please note that the rubric of this paper is made different from many other papers.

More information

THIS appendix contains a few programs and functions that are used in the

THIS appendix contains a few programs and functions that are used in the APPENDIX E USEFUL PROGRAMS THIS appendix contains a few programs and functions that are used in the main text. All of these are also available for download in the on-line resources. E.1 GAUSSIAN QUADRATURE

More information

1 Probability Review. 1.1 Sample Spaces

1 Probability Review. 1.1 Sample Spaces 1 Probability Review Probability is a critical tool for modern data analysis. It arises in dealing with uncertainty, in randomized algorithms, and in Bayesian analysis. To understand any of these concepts

More information

Computing the coefficients for the power series solution of the Lane- Emden equation with the Python

Computing the coefficients for the power series solution of the Lane- Emden equation with the Python Computing the coefficients for the power series solution of the Lane- Emden equation with the Python library SymPy 1/25/15 Klaus Rohe, D-85625 Glonn, email: klaus-rohe@t-online.de Abstract It is shown

More information

1. Write a program to calculate distance traveled by light

1. Write a program to calculate distance traveled by light G. H. R a i s o n i C o l l e g e O f E n g i n e e r i n g D i g d o h H i l l s, H i n g n a R o a d, N a g p u r D e p a r t m e n t O f C o m p u t e r S c i e n c e & E n g g P r a c t i c a l M a

More information

NumPy 1.5. open source. Beginner's Guide. v g I. performance, Python based free open source NumPy. An action-packed guide for the easy-to-use, high

NumPy 1.5. open source. Beginner's Guide. v g I. performance, Python based free open source NumPy. An action-packed guide for the easy-to-use, high NumPy 1.5 Beginner's Guide An actionpacked guide for the easytouse, high performance, Python based free open source NumPy mathematical library using realworld examples Ivan Idris.; 'J 'A,, v g I open source

More information

Post s Theorem and Blockchain Languages

Post s Theorem and Blockchain Languages Post s Theorem and Blockchain Languages A Short Course in the Theory of Computation Russell O Connor roconnor@blockstream.com BPASE, January 26, 2017 1 / 35 morpheus (logician): Tell me Neo, what is the

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

Lecture 22: Section 4.7

Lecture 22: Section 4.7 Lecture 22: Section 47 Shuanglin Shao December 2, 213 Row Space, Column Space, and Null Space Definition For an m n, a 11 a 12 a 1n a 21 a 22 a 2n A = a m1 a m2 a mn, the vectors r 1 = [ a 11 a 12 a 1n

More information

Worksheet 1: Integrators

Worksheet 1: Integrators Simulation Methods in Physics I WS 2014/2015 Worksheet 1: Integrators Olaf Lenz Alexander Schlaich Stefan Kesselheim Florian Fahrenberger Peter Košovan October 22, 2014 Institute for Computational Physics,

More information

Stream Ciphers. Çetin Kaya Koç Winter / 20

Stream Ciphers. Çetin Kaya Koç   Winter / 20 Çetin Kaya Koç http://koclab.cs.ucsb.edu Winter 2016 1 / 20 Linear Congruential Generators A linear congruential generator produces a sequence of integers x i for i = 1,2,... starting with the given initial

More information

- Why aren t there more quantum algorithms? - Quantum Programming Languages. By : Amanda Cieslak and Ahmana Tarin

- Why aren t there more quantum algorithms? - Quantum Programming Languages. By : Amanda Cieslak and Ahmana Tarin - Why aren t there more quantum algorithms? - Quantum Programming Languages By : Amanda Cieslak and Ahmana Tarin Why aren t there more quantum algorithms? there are only a few problems for which quantum

More information

Python & Numpy A tutorial

Python & Numpy A tutorial Python & Numpy A tutorial Devert Alexandre School of Software Engineering of USTC 13 February 2012 Slide 1/38 Table of Contents 1 Why Python & Numpy 2 First steps with Python 3 Fun with lists 4 Quick tour

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

Name: Student number:

Name: Student number: UNIVERSITY OF TORONTO Faculty of Arts and Science APRIL 2018 EXAMINATIONS CSC321H1S Duration 3 hours No Aids Allowed Name: Student number: This is a closed-book test. It is marked out of 35 marks. Please

More information

TELECOMMUNICATIONS THEORY

TELECOMMUNICATIONS THEORY Aurimas ANSKAITIS TELECOMMUNICATIONS THEORY Project No VP1-2.2-ŠMM-07-K-01-047 The Essential Renewal of Undergraduates Study Programs of VGTU Electronics Faculty Vilnius Technika 2012 VILNIUS GEDIMINAS

More information

STATISTICAL THINKING IN PYTHON I. Probability density functions

STATISTICAL THINKING IN PYTHON I. Probability density functions STATISTICAL THINKING IN PYTHON I Probability density functions Continuous variables Quantities that can take any value, not just discrete values Michelson's speed of light experiment measured speed of

More information

How many hours would you estimate that you spent on this assignment?

How many hours would you estimate that you spent on this assignment? The first page of your homework submission must be a cover sheet answering the following questions. Do not leave it until the last minute; it s fine to fill out the cover sheet before you have completely

More information

Learning Deep Architectures for AI. Part II - Vijay Chakilam

Learning Deep Architectures for AI. Part II - Vijay Chakilam Learning Deep Architectures for AI - Yoshua Bengio Part II - Vijay Chakilam Limitations of Perceptron x1 W, b 0,1 1,1 y x2 weight plane output =1 output =0 There is no value for W and b such that the model

More information

Applied Machine Learning Lecture 2, part 1: Basic linear algebra; linear algebra in NumPy and SciPy. Richard Johansson

Applied Machine Learning Lecture 2, part 1: Basic linear algebra; linear algebra in NumPy and SciPy. Richard Johansson Applied Machine Learning Lecture 2, part 1: Basic linear algebra; linear algebra in NumPy and SciPy Richard Johansson linear algebra linear algebra is the branch of mathematics that deals with relationships

More information

Complex Numbers. Visualize complex functions to estimate their zeros and poles.

Complex Numbers. Visualize complex functions to estimate their zeros and poles. Lab 1 Complex Numbers Lab Objective: Visualize complex functions to estimate their zeros and poles. Polar Representation of Complex Numbers Any complex number z = x + iy can be written in polar coordinates

More information

Best Practices. Nicola Chiapolini. Physik-Institut University of Zurich. June 8, 2015

Best Practices. Nicola Chiapolini. Physik-Institut University of Zurich. June 8, 2015 Nicola Chiapolini, June 8, 2015 1 / 26 Best Practices Nicola Chiapolini Physik-Institut University of Zurich June 8, 2015 Based on talk by Valentin Haenel https://github.com/esc/best-practices-talk This

More information

Chapter 1: Systems of linear equations and matrices. Section 1.1: Introduction to systems of linear equations

Chapter 1: Systems of linear equations and matrices. Section 1.1: Introduction to systems of linear equations Chapter 1: Systems of linear equations and matrices Section 1.1: Introduction to systems of linear equations Definition: A linear equation in n variables can be expressed in the form a 1 x 1 + a 2 x 2

More information

ECE521: Inference Algorithms and Machine Learning University of Toronto. Assignment 1: k-nn and Linear Regression

ECE521: Inference Algorithms and Machine Learning University of Toronto. Assignment 1: k-nn and Linear Regression ECE521: Inference Algorithms and Machine Learning University of Toronto Assignment 1: k-nn and Linear Regression TA: Use Piazza for Q&A Due date: Feb 7 midnight, 2017 Electronic submission to: ece521ta@gmailcom

More information

Linear Transformations

Linear Transformations Lab 4 Linear Transformations Lab Objective: Linear transformations are the most basic and essential operators in vector space theory. In this lab we visually explore how linear transformations alter points

More information

1. Quantization Signal to Noise Ratio (SNR).

1. Quantization Signal to Noise Ratio (SNR). Digital Signal Processing 2/ Advanced Digital Signal Processing Lecture 2, Quantization, SNR Gerald Schuller, TU Ilmenau 1. Quantization Signal to Noise Ratio (SNR). Assume we have a A/D converter with

More information

COMS 6100 Class Notes

COMS 6100 Class Notes COMS 6100 Class Notes Daniel Solus September 20, 2016 1 General Remarks The Lecture notes submitted by the class have been very good. Integer division seemed to be a common oversight when working the Fortran

More information

MATRICES. a m,1 a m,n A =

MATRICES. a m,1 a m,n A = MATRICES Matrices are rectangular arrays of real or complex numbers With them, we define arithmetic operations that are generalizations of those for real and complex numbers The general form a matrix of

More information

IAST Documentation. Release Cory M. Simon

IAST Documentation. Release Cory M. Simon IAST Documentation Release 0.0.0 Cory M. Simon November 02, 2015 Contents 1 Installation 3 2 New to Python? 5 3 pyiast tutorial 7 3.1 Import the pure-component isotherm data................................

More information

Lab 4: Working with arrays and eigenvalues

Lab 4: Working with arrays and eigenvalues Lab 4: Working with arrays and eigenvalues March 23, 2017 The purpose of this lab is to get familiar with manipulating data arrays in numpy. Browser use: This lab introduces the use of a number of Python

More information

UC Berkeley Department of Electrical Engineering and Computer Science Department of Statistics. EECS 281A / STAT 241A Statistical Learning Theory

UC Berkeley Department of Electrical Engineering and Computer Science Department of Statistics. EECS 281A / STAT 241A Statistical Learning Theory UC Berkeley Department of Electrical Engineering and Computer Science Department of Statistics EECS 281A / STAT 241A Statistical Learning Theory Solutions to Problem Set 2 Fall 2011 Issued: Wednesday,

More information

von Neumann Architecture

von Neumann Architecture Computing with DNA & Review and Study Suggestions 1 Wednesday, April 29, 2009 von Neumann Architecture Refers to the existing computer architectures consisting of a processing unit a single separate storage

More information

4 Linear Algebra Review

4 Linear Algebra Review 4 Linear Algebra Review For this topic we quickly review many key aspects of linear algebra that will be necessary for the remainder of the course 41 Vectors and Matrices For the context of data analysis,

More information

Introduction to Quantum Optimization using D-WAVE 2X

Introduction to Quantum Optimization using D-WAVE 2X Introduction to Quantum Optimization using D-WAVE 2X Thamme Gowda January 27, 2018 Development of efficient algorithms has been a goal ever since computers were started to use for solving real world problems.

More information

Write a simple 1D DFT code in Python

Write a simple 1D DFT code in Python Write a simple 1D DFT code in Python Ask Hjorth Larsen, asklarsen@gmail.com Keenan Lyon, lyon.keenan@gmail.com September 15, 2018 Overview Our goal is to write our own KohnSham (KS) density functional

More information

Symbolic computing 1: Proofs with SymPy

Symbolic computing 1: Proofs with SymPy Bachelor of Ecole Polytechnique Computational Mathematics, year 2, semester Lecturer: Lucas Gerin (send mail) (mailto:lucas.gerin@polytechnique.edu) Symbolic computing : Proofs with SymPy π 3072 3 + 2

More information

FilterPy Documentation

FilterPy Documentation FilterPy Documentation Release 1.4.4 Roger R. Labbe Aug 24, 2018 Contents 1 Installation 3 1.1 Installation with pip (recommended)................................... 3 1.2 Installation with GitHub.........................................

More information

Self-reproducing programs. And Introduction to logic. COS 116, Spring 2012 Adam Finkelstein

Self-reproducing programs. And Introduction to logic. COS 116, Spring 2012 Adam Finkelstein Self-reproducing programs. And Introduction to logic. COS 6, Spring 22 Adam Finkelstein Midterm One week from today in class Mar 5 Covers lectures, labs, homework, readings to date Old midterms will be

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

MA008/MIIZ01 Design and Analysis of Algorithms Lecture Notes 2

MA008/MIIZ01 Design and Analysis of Algorithms Lecture Notes 2 MA008 p.1/36 MA008/MIIZ01 Design and Analysis of Algorithms Lecture Notes 2 Dr. Markus Hagenbuchner markus@uow.edu.au. MA008 p.2/36 Content of lecture 2 Examples Review data structures Data types vs. data

More information

Consider the following example of a linear system:

Consider the following example of a linear system: LINEAR SYSTEMS Consider the following example of a linear system: Its unique solution is x + 2x 2 + 3x 3 = 5 x + x 3 = 3 3x + x 2 + 3x 3 = 3 x =, x 2 = 0, x 3 = 2 In general we want to solve n equations

More information

Expander Construction in VNC 1

Expander Construction in VNC 1 Expander Construction in VNC 1 Sam Buss joint work with Valentine Kabanets, Antonina Kolokolova & Michal Koucký Prague Workshop on Bounded Arithmetic November 2-3, 2017 Talk outline I. Combinatorial construction

More information

Name: Jesper Toft Kristensen Spring 2014 Chapter: 2

Name: Jesper Toft Kristensen Spring 2014 Chapter: 2 Name: Jesper Toft Kristensen Spring 2014 Chapter: 2 Problem 2.1 Random walks in grade space: The random walk is applicable in many settings. Let us try applying it to a multiple-choice test! We will perform

More information

EDS-TEM quanti cation of core shell nanoparticles

EDS-TEM quanti cation of core shell nanoparticles EDS-TEM quanti cation of core shell nanoparticles Using machine learning methods, the composition of embedded nanostructures can be accurately measured Demonstrated by D. Roussow et al., Nano Letters,

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: Tuesday, December

More information

Keeping the Chandra Satellite Cool with Python

Keeping the Chandra Satellite Cool with Python Keeping the Chandra Satellite Cool with Python Tom Aldcroft CXC Operations Science Support Smithsonian Astrophysical Observatory SciPy2010 conference July 1, 2010 Chandra satellite (at launch) Chandra

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

Computational Physics HW2

Computational Physics HW2 Computational Physics HW2 Luke Bouma July 27, 2015 1 Plotting experimental data 1.1 Plotting sunspots.txt in Python: The figure above is the output from from numpy import l o a d t x t data = l o a d t

More information