Part VI. Scientific Computing in Python

Size: px
Start display at page:

Download "Part VI. Scientific Computing in Python"

Transcription

1 Part VI Scientific Computing in Python Compact GRS, June 03-07,

2 More on Maths Module math Constants pi and e Functions that operate on int and float All return values float ceil (x) floor (x) exp (x) fabs ( x) # same as globally defined abs () ldexp (x, i) # x * 2** i log (x [, base ]) log10 (x) # == log (x, 10) modf ( x) # ( fractional, integer part ) pow (x, y) # x**y sqrt (x) Compact GRS, June 03-07,

3 Module math (2) Trigonometric functions assume radians cos (x); cosh (x); acos (x) sin (x);... tan (x);... degrees ( x) # rad -> deg radians ( x) # deg -> rad Compact GRS, June 03-07,

4 Module math (2) Trigonometric functions assume radians cos (x); cosh (x); acos (x) sin (x);... tan (x);... degrees ( x) # rad -> deg radians ( x) # deg -> rad inf/nan float (" inf ") float ("-inf ") float (" nan ") Compact GRS, June 03-07,

5 Module math (2) Trigonometric functions assume radians cos (x); cosh (x); acos (x) sin (x);... tan (x);... degrees ( x) # rad -> deg radians ( x) # deg -> rad inf/nan float (" inf ") float ("-inf ") float (" nan ") Use module cmath for complex numbers Compact GRS, June 03-07,

6 Now to Real Maths... Standard sequence types (list, tuple,... ) Can be used as arrays Can contain different types of objects Very flexible, but slow Loops are not very efficient either For efficient scientific computing, other datatypes and methods required Compact GRS, June 03-07,

7 Now to Real Maths... Standard sequence types (list, tuple,... ) Can be used as arrays Can contain different types of objects Very flexible, but slow Loops are not very efficient either For efficient scientific computing, other datatypes and methods required Modules NumPy Matplotlib SciPy Compact GRS, June 03-07,

8 NumPy Compact GRS, June 03-07,

9 Module numpy Homogeneous arrays NumPy provides arbitrary-dimensional homogeneous arrays Example from numpy import * a = array ([[1,2,3],[4,5,6]]) print a type (a) a. shape print a [0,2] a [0,2] = -1 b = a*2 print b Compact GRS, June 03-07,

10 Array creation Create from (nested) sequence type Direct access with method [] a = array ([1,2,3,4,5,6,7,8]) a [1] a = array ([[1,2,3,4],[5,6,7,8]]) a [1,1] a = array ([[[1,2],[3,4]],[[5,6],[7,8]]]) a [1,1,1] Compact GRS, June 03-07,

11 Array creation Create from (nested) sequence type Direct access with method [] a = array ([1,2,3,4,5,6,7,8]) a [1] a = array ([[1,2,3,4],[5,6,7,8]]) a [1,1] a = array ([[[1,2],[3,4]],[[5,6],[7,8]]]) a [1,1,1] Properties of arrays a. ndim # number of dimensions a. shape # dimensions a. size # number of elements a. dtype # data type a. itemsize # number of bytes Compact GRS, June 03-07,

12 Data Types Exact, C/C++-motivated type of array elements can be specified Otherwise, defaults are used Some types (different storage requirements): int_, int8, int16, int32, int64, float_, float8, float16, float32, float64, complex_, complex64, bool_, character, object_ Standard python type names result in default behaviour array ([[1,2,3],[4,5,6]], dtype = int ) array ([[1,2,3],[4,5,6]], dtype = complex ) array ([[1,2,3],[4,5,6]], dtype = int8 ) array ([[1,2,3],[4,5,1000]], dtype = int8 ) # wrong array ([[1,2,3],[4,5, "hi"]], dtype = object ) Exception: object_ stores pointers to objects Compact GRS, June 03-07,

13 Create Arrays (Some) default matrices (optional parameter: dtype) arange ([a,] b [, stride ]) # as range, 1D zeros ( (3,4) ) ones ( (1,3,4) ) empty ( (3,4) ) # uninitialized ( fast ) linspace (a, b [, n]) # n equidistant in [a, b] logspace (a, b [, n]) # 10** a to 10** b identity (n) # 2d fromfunction ( lambda i,j: i+j, (3,4), dtype = int ) def f(i,j): return i+j fromfunction (f, (3,4), dtype = int ) Compact GRS, June 03-07,

14 Manipulate Arrays Reshaping arrays a = arange (12) b = a. reshape ((3,4)) a. resize ((3,4)) # in - place! a. transpose () a. flatten () # Example use - case : a = arange (144) a. resize ((12,12)) Compact GRS, June 03-07,

15 Create Arrays (2) Create/Copy from existing data a = arange (12); a. resize ((3,4)) copy (a) diag (a); tril (a); triu (a) empty_ like ( a) # copy shape zeros_like (a) ones_like (a) a = loadtxt (" matrix. txt ") # fromfile () if binary # plenty of options : comments, delim., usecols,... Matrix output a. tolist () savetxt (" matrix. txt ", a) # tofile () if binary Compact GRS, June 03-07,

16 Array Access and Manipulation Typical slicing operations can be used Separate dimensions by comma a = arange (20); a. resize ((4,5)) a [1] a [1:2,:] a [:,::2] a [::2,::2] a [::2,::2] = [[0, -2, -4],[ -10, -12, -14]] a [1::2,1::2] = -1*a [1::2,1::2] Selective access a[ a > 3] a[ a > 3] = -1 Compact GRS, June 03-07,

17 Array Access Iterating over entries for row in a: print row b = arange (30); b. resize ((2,3,4)) for row in b: for col in row : print col for entry in a. flat : print entry Compact GRS, June 03-07,

18 Computing with Arrays Fast built-in methods working on arrays a = arange (12); a. resize ((3,4)) 3*a a **2 a+a^2 sin (a) sqrt (a) prod (a) sum (a) it = transpose ( a) x = array ([1,2,3]) y = array ([10,20,30]) inner (x, y) dot (it, x) cross (x,y) Compact GRS, June 03-07,

19 Computing with Arrays There is much more... var () cov () std () mean () median () min () max () svd () tensordot ()... Matrices (with mat) are subclasses of ndarray, but strictly two-dimensional, with additional attributes m = mat (a) m. T # transpose m. I # inverse m. A # as 2d array m. H # conjugate transpose Compact GRS, June 03-07,

20 Submodules Module numpy.random Draw from plenty of different distributions More powerful than module random Work on and return arrays from numpy. random import * binomial (10, 0.5) # 10 trials, success 50% binomial (10, 0.5, 15) randint (0, 10, 15) # [0,10), int rand () # [0,1) rand (3,4) # (3 x4) array Compact GRS, June 03-07,

21 Submodules (2) Module numpy.linalg Core linear algebra tools norm (a); norm (x) inv (a) solve (a, b) # LAPACK LU decomp. det (a) eig (a) cholesky ( a) Compact GRS, June 03-07,

22 Submodules (2) Module numpy.linalg Core linear algebra tools norm (a); norm (x) inv (a) solve (a, b) # LAPACK LU decomp. det (a) eig (a) cholesky ( a) Module numpy.fft Fourier transforms Compact GRS, June 03-07,

23 Submodules (2) Module numpy.linalg Core linear algebra tools norm (a); norm (x) inv (a) solve (a, b) # LAPACK LU decomp. det (a) eig (a) cholesky ( a) Module numpy.fft Fourier transforms There is more... Compact GRS, June 03-07,

24 Version Mania Current Situation SciPy Matplotlib NumPy pylab IPython python Compact GRS, June 03-07,

25 Version Mania Problems: Numpy, scipy, pylab, ipython and matplotlib often used simultaneously The packages depend on each other (matplotlib uese numpy arrays, e.g.) Depending on OS (version), different packages may have to be installed (i.e. the module name in import command may be different!). Vision: All in one (new) module PyLab! exists as unofficial package Attention Name: again pylab! Compact GRS, June 03-07,

26 Matplotlib Compact GRS, June 03-07,

27 Matplotlib What is it? Object-oriented library for plotting 2D Designed to be similar to the matlab plotting functionality Designed to plot scientific data, built on numpy datastructures Compact GRS, June 03-07,

28 Several Ways to do the Same python/ipython interactive > ipython import scipy, matplotlib. pylab x = scipy. randn (10000) matplotlib. pylab. hist (x, 100) > ipython import numpy. random, matplotlib. pylab x = numpy. random. randn (10000) matplotlib. pylab. hist (x, 100) ipython in pylab mode > ipython - pylab x = randn (10000) hist (x, 100) Compact GRS, June 03-07,

29 Example - First Plot partially taken from from pylab import * x = arange (0.0, 2* pi, 0.01) y = sin (x) plot (x, y, linewidth =4) plot (x,y) xlabel ( Label for x axis ) ylabel ( Label for y axis ) title ( Simple plot of sin ) grid ( True ) show () Compact GRS, June 03-07,

30 Example Using Subplots from pylab import * def f(t): s1 = cos (2* pi*t) e1 = exp (-t) return multiply (s1,e1) t1 = arange (0.0, 5.0, 0.1) t2 = arange (0.0, 5.0, 0.02) t3 = arange (0.0, 2.0, 0.01) show () # gives error but helps ; -) subplot (2,1,1) # rows, columns, which to show plot (t1, f(t1), go, t2, f(t2), k-- ) subplot (2,1,2) plot (t3, cos (2* pi*t3), r. ) Compact GRS, June 03-07,

31 Example Using Subplots # previous slide continued subplot (2,1,1) grid ( True ) title ( A tale of 2 subplots ) ylabel ( Damped oscillation ) subplot (2,1,2) grid ( True ) xlabel ( time (s) ) ylabel ( Undamped ) Compact GRS, June 03-07,

32 Example - Histogram # start ipython - pylab or use imports : # from matplotlib. mlab import * # from matplotlib. pyplot import * from numpy import * mu, sigma = 100, 15 x = mu + sigma * random. randn (10000) n, bins, patches = hist (x, 50, normed =1, \ facecolor = green, alpha =0.75) # add a best fit line y = normpdf ( bins, mu, sigma ) plot (bins, y, r--, linewidth =1) axis ([40, 160, 0, 0.03]) plt. show () Compact GRS, June 03-07,

33 SciPy Compact GRS, June 03-07,

34 More than NumPy? SciPy depends on NumPy Built to work on NumPy arrays Providing functionality for mathematics, science and engineering Still under development NumPy is mostly about (N-dimensional) arrays SciPy comprises a large number of tools using these arrays SciPy includes the NumPy functionality (only one import necessary) A lot more libraries for scientific computing are available, some of them using NumPy and SciPy Here, just a short overview will be given for more material (incl. the content of the following slides) Compact GRS, June 03-07,

35 SciPy Organisation - Subpackages cluster Clustering algorithms constants Physical and mathematical constants fftpack Fast Fourier Transform routines integrate Integration and ordinary differential equation solvers interpolate Interpolation and smoothing splines io Input and Output linalg Linear algebra maxentropy Maximum entropy methods ndimage N-dimensional image processing odr Orthogonal distance regression optimize Optimization and root-finding routines signal Signal processing sparse Sparse matrices and associated routines spatial Spatial data structures and algorithms special Special functions stats Statistical distributions and functions weave C/C++ integration Compact GRS, June 03-07,

36 Special Functions Airy functions Elliptic functions Bessel functions (+ Zeros, Integrals, Derivatives, Spherical, Ricatti-) Struve functions A large number of statistical functions Gamma functions Legendre functions Orthogonal polynomials (Legendre, Chebyshev, Jacobi,...) Hypergeometric functios parabolic cylinder functions Mathieu functions Spheroidal wave functions Kelvin functions... Compact GRS, June 03-07,

37 Example: Interpolation - Linear import numpy as np import matplotlib. pyplot as plt from scipy import interpolate x = np. arange (0,10) y = np.exp (-x /3.0) f = interpolate. interp1d (x, y) xnew = np. arange (0,9,0.1) plt. plot (x,y, o,xnew,f( xnew ), - ) plt. title ( Linear interpolation ) plt. show () Compact GRS, June 03-07,

38 Example: Interpolation - Cubic Spline import numpy as np import matplotlib. pyplot as plt from scipy import interpolate x = np. arange (0, 2.25* np.pi, np.pi /4) y = np.sin (x) spline = interpolate. splrep (x,y,s =0) xnew = np. arange (0,2.02* np.pi,np.pi /50) ynew = interpolate. splev ( xnew, spline ) plt. plot (x,y, o,xnew, ynew ) plt. legend ([ Linear, Cubic Spline ]) plt. axis ([ -0.05,6.33, -1.05,1.05]) plt. title ( Cubic - spline interpolation ) plt. show () Compact GRS, June 03-07,

Tentative NumPy Tutorial

Tentative NumPy Tutorial Tentative NumPy Tutorial This tutorial is unfinished. The original authors were not NumPy experts nor native English speakers so it needs reviewing. Please do not hesitate to click the edit button. You

More information

Intro to scientific programming (with Python) Pietro Berkes, Brandeis University

Intro to scientific programming (with Python) Pietro Berkes, Brandeis University Intro to scientific programming (with Python) Pietro Berkes, Brandeis University Next 4 lessons: Outline Scientific programming: best practices Classical learning (Hoepfield network) Probabilistic learning

More information

Scientific Programming in Python

Scientific Programming in Python UCSD March 9, 2009 What is Python? Python in a very high level (scripting) language which has gained widespread popularity in recent years. It is: What is Python? Python in a very high level (scripting)

More information

CUDAMat: a CUDA-based matrix class for Python

CUDAMat: a CUDA-based matrix class for Python Department of Computer Science 6 King s College Rd, Toronto University of Toronto M5S 3G4, Canada http://learning.cs.toronto.edu fax: +1 416 978 1455 November 25, 2009 UTML TR 2009 004 CUDAMat: a CUDA-based

More information

Exercise 0. Although Python(x,y) comes already with a great variety of scientic Python packages, we might have to install additional dependencies:

Exercise 0. Although Python(x,y) comes already with a great variety of scientic Python packages, we might have to install additional dependencies: Exercise 0 Deadline: None Computer Setup Windows Download Python(x,y) via http://code.google.com/p/pythonxy/wiki/downloads and install it. Make sure that before installation the installer does not complain

More information

5: Magnitude 6: Convert to Polar 7: Convert to Rectangular

5: Magnitude 6: Convert to Polar 7: Convert to Rectangular TI-NSPIRE CALCULATOR MENUS 1: Tools > 1: Define 2: Recall Definition --------------- 3: Delete Variable 4: Clear a-z 5: Clear History --------------- 6: Insert Comment 2: Number > 1: Convert to Decimal

More information

Python. Python. 1 Python. M.Ulvrova, L.Pouilloux (ENS LYON) Informatique L3 Automne 2011 1 / 25

Python. Python. 1 Python. M.Ulvrova, L.Pouilloux (ENS LYON) Informatique L3 Automne 2011 1 / 25 Python 1 Python M.Ulvrova, L.Pouilloux (ENS LYON) Informatique L3 Automne 2011 1 / 25 Python makes you fly M.Ulvrova, L.Pouilloux (ENS LYON) Informatique L3 Automne 2011 2 / 25 Let s start ipython vs python

More information

2+2 Just type and press enter and the answer comes up ans = 4

2+2 Just type and press enter and the answer comes up ans = 4 Demonstration Red text = commands entered in the command window Black text = Matlab responses Blue text = comments 2+2 Just type and press enter and the answer comes up 4 sin(4)^2.5728 The elementary functions

More information

(!' ) "' # "*# "!(!' +,

(!' ) ' # *# !(!' +, MATLAB is a numeric computation software for engineering and scientific calculations. The name MATLAB stands for MATRIX LABORATORY. MATLAB is primarily a tool for matrix computations. It was developed

More information

Financial Econometrics MFE MATLAB Introduction. Kevin Sheppard University of Oxford

Financial Econometrics MFE MATLAB Introduction. Kevin Sheppard University of Oxford Financial Econometrics MFE MATLAB Introduction Kevin Sheppard University of Oxford October 21, 2013 2007-2013 Kevin Sheppard 2 Contents Introduction i 1 Getting Started 1 2 Basic Input and Operators 5

More information

Assignment 2: Option Pricing and the Black-Scholes formula The University of British Columbia Science One CS 2015-2016 Instructor: Michael Gelbart

Assignment 2: Option Pricing and the Black-Scholes formula The University of British Columbia Science One CS 2015-2016 Instructor: Michael Gelbart Assignment 2: Option Pricing and the Black-Scholes formula The University of British Columbia Science One CS 2015-2016 Instructor: Michael Gelbart Overview Due Thursday, November 12th at 11:59pm Last updated

More information

Recall the basic property of the transpose (for any A): v A t Aw = v w, v, w R n.

Recall the basic property of the transpose (for any A): v A t Aw = v w, v, w R n. ORTHOGONAL MATRICES Informally, an orthogonal n n matrix is the n-dimensional analogue of the rotation matrices R θ in R 2. When does a linear transformation of R 3 (or R n ) deserve to be called a rotation?

More information

Data Visualization. Christopher Simpkins [email protected]

Data Visualization. Christopher Simpkins chris.simpkins@gatech.edu Data Visualization Christopher Simpkins [email protected] Data Visualization Data visualization is an activity in the exploratory data analysis process in which we try to figure out what story

More information

Below is a very brief tutorial on the basic capabilities of Excel. Refer to the Excel help files for more information.

Below is a very brief tutorial on the basic capabilities of Excel. Refer to the Excel help files for more information. Excel Tutorial Below is a very brief tutorial on the basic capabilities of Excel. Refer to the Excel help files for more information. Working with Data Entering and Formatting Data Before entering data

More information

MATLAB Basics MATLAB numbers and numeric formats

MATLAB Basics MATLAB numbers and numeric formats MATLAB Basics MATLAB numbers and numeric formats All numerical variables are stored in MATLAB in double precision floating-point form. (In fact it is possible to force some variables to be of other types

More information

CIS 192: Lecture 13 Scientific Computing and Unit Testing

CIS 192: Lecture 13 Scientific Computing and Unit Testing CIS 192: Lecture 13 Scientific Computing and Unit Testing Lili Dworkin University of Pennsylvania Scientific Computing I Python is really popular in the scientific and statistical computing world I Why?

More information

FX 115 MS Training guide. FX 115 MS Calculator. Applicable activities. Quick Reference Guide (inside the calculator cover)

FX 115 MS Training guide. FX 115 MS Calculator. Applicable activities. Quick Reference Guide (inside the calculator cover) Tools FX 115 MS Calculator Handouts Other materials Applicable activities Quick Reference Guide (inside the calculator cover) Key Points/ Overview Advanced scientific calculator Two line display VPAM to

More information

AMATH 352 Lecture 3 MATLAB Tutorial Starting MATLAB Entering Variables

AMATH 352 Lecture 3 MATLAB Tutorial Starting MATLAB Entering Variables AMATH 352 Lecture 3 MATLAB Tutorial MATLAB (short for MATrix LABoratory) is a very useful piece of software for numerical analysis. It provides an environment for computation and the visualization. Learning

More information

Chemical and Biological Engineering Calculations using Python 3. Jeffrey J. Heys

Chemical and Biological Engineering Calculations using Python 3. Jeffrey J. Heys Chemical and Biological Engineering Calculations using Python 3 Jeffrey J. Heys Copyright c 2014 Jeffrey Heys All rights reserved. This version is being made available at no cost. Please acknowledge access

More information

Linear Algebra Review. Vectors

Linear Algebra Review. Vectors Linear Algebra Review By Tim K. Marks UCSD Borrows heavily from: Jana Kosecka [email protected] http://cs.gmu.edu/~kosecka/cs682.html Virginia de Sa Cogsci 8F Linear Algebra review UCSD Vectors The length

More information

Python for Chemistry in 21 days

Python for Chemistry in 21 days minutes Python for Chemistry in 21 days Dr. Noel O'Boyle Dr. John Mitchell and Prof. Peter Murray-Rust UCC Talk, Sept 2005 Available at http://www-mitchell.ch.cam.ac.uk/noel/ Introduction This talk will

More information

Simulation Tools. Python for MATLAB Users I. Claus Führer. Automn 2009. Claus Führer Simulation Tools Automn 2009 1 / 65

Simulation Tools. Python for MATLAB Users I. Claus Führer. Automn 2009. Claus Führer Simulation Tools Automn 2009 1 / 65 Simulation Tools Python for MATLAB Users I Claus Führer Automn 2009 Claus Führer Simulation Tools Automn 2009 1 / 65 1 Preface 2 Python vs Other Languages 3 Examples and Demo 4 Python Basics Basic Operations

More information

Engineering Problem Solving and Excel. EGN 1006 Introduction to Engineering

Engineering Problem Solving and Excel. EGN 1006 Introduction to Engineering Engineering Problem Solving and Excel EGN 1006 Introduction to Engineering Mathematical Solution Procedures Commonly Used in Engineering Analysis Data Analysis Techniques (Statistics) Curve Fitting techniques

More information

Analysis of System Performance IN2072 Chapter M Matlab Tutorial

Analysis of System Performance IN2072 Chapter M Matlab Tutorial Chair for Network Architectures and Services Prof. Carle Department of Computer Science TU München Analysis of System Performance IN2072 Chapter M Matlab Tutorial Dr. Alexander Klein Prof. Dr.-Ing. Georg

More information

Python for Computational Science and Engineering

Python for Computational Science and Engineering Introduction to Python for Computational Science and Engineering (A beginner s guide) Hans Fangohr Faculty of Engineering and the Environment University of Southampton September 7, 2015 2 Contents 1 Introduction

More information

Python programming guide for Earth Scientists. Maarten J. Waterloo and Vincent E.A. Post

Python programming guide for Earth Scientists. Maarten J. Waterloo and Vincent E.A. Post Python programming guide for Earth Scientists Maarten J. Waterloo and Vincent E.A. Post Amsterdam Critical Zone Hydrology group September 2015 Cover page: Meteorological tower in an abandoned agricultural

More information

AN INTRODUCTION TO NUMERICAL METHODS AND ANALYSIS

AN INTRODUCTION TO NUMERICAL METHODS AND ANALYSIS AN INTRODUCTION TO NUMERICAL METHODS AND ANALYSIS Revised Edition James Epperson Mathematical Reviews BICENTENNIAL 0, 1 8 0 7 z ewiley wu 2007 r71 BICENTENNIAL WILEY-INTERSCIENCE A John Wiley & Sons, Inc.,

More information

Introduction to Matlab

Introduction to Matlab Introduction to Matlab Social Science Research Lab American University, Washington, D.C. Web. www.american.edu/provost/ctrl/pclabs.cfm Tel. x3862 Email. [email protected] Course Objective This course provides

More information

CD-ROM Appendix E: Matlab

CD-ROM Appendix E: Matlab CD-ROM Appendix E: Matlab Susan A. Fugett Matlab version 7 or 6.5 is a very powerful tool useful for many kinds of mathematical tasks. For the purposes of this text, however, Matlab 7 or 6.5 will be used

More information

MATLAB LECTURE NOTES. Dr. ADİL YÜCEL. Istanbul Technical University Department of Mechanical Engineering

MATLAB LECTURE NOTES. Dr. ADİL YÜCEL. Istanbul Technical University Department of Mechanical Engineering MATLAB LECTURE NOTES Dr. ADİL YÜCEL Istanbul Technical University Department of Mechanical Engineering MATLAB LECTURE NOTES Student Name Student ID Dr. ADİL YÜCEL Istanbul Technical University Department

More information

Python for Scientific Computing. http://bender.astro.sunysb.edu/classes/python-science

Python for Scientific Computing. http://bender.astro.sunysb.edu/classes/python-science http://bender.astro.sunysb.edu/classes/python-science Course Goals Simply: to learn how to use python to do Numerical analysis Data analysis Plotting and visualizations Symbol mathematics Write applications...

More information

December 4, 2013 MATH 171 BASIC LINEAR ALGEBRA B. KITCHENS

December 4, 2013 MATH 171 BASIC LINEAR ALGEBRA B. KITCHENS December 4, 2013 MATH 171 BASIC LINEAR ALGEBRA B KITCHENS The equation 1 Lines in two-dimensional space (1) 2x y = 3 describes a line in two-dimensional space The coefficients of x and y in the equation

More information

Advanced Functions and Modules

Advanced Functions and Modules Advanced Functions and Modules CB2-101 Introduction to Scientific Computing November 19, 2015 Emidio Capriotti http://biofold.org/ Institute for Mathematical Modeling of Biological Systems Department of

More information

Linear Algebra Notes for Marsden and Tromba Vector Calculus

Linear Algebra Notes for Marsden and Tromba Vector Calculus Linear Algebra Notes for Marsden and Tromba Vector Calculus n-dimensional Euclidean Space and Matrices Definition of n space As was learned in Math b, a point in Euclidean three space can be thought of

More information

1 Introduction to Matrices

1 Introduction to Matrices 1 Introduction to Matrices In this section, important definitions and results from matrix algebra that are useful in regression analysis are introduced. While all statements below regarding the columns

More information

Display Format To change the exponential display format, press the [MODE] key 3 times.

Display Format To change the exponential display format, press the [MODE] key 3 times. Tools FX 300 MS Calculator Overhead OH 300 MS Handouts Other materials Applicable activities Activities for the Classroom FX-300 Scientific Calculator Quick Reference Guide (inside the calculator cover)

More information

WESTMORELAND COUNTY PUBLIC SCHOOLS 2011 2012 Integrated Instructional Pacing Guide and Checklist Computer Math

WESTMORELAND COUNTY PUBLIC SCHOOLS 2011 2012 Integrated Instructional Pacing Guide and Checklist Computer Math Textbook Correlation WESTMORELAND COUNTY PUBLIC SCHOOLS 2011 2012 Integrated Instructional Pacing Guide and Checklist Computer Math Following Directions Unit FIRST QUARTER AND SECOND QUARTER Logic Unit

More information

Nonlinear Iterative Partial Least Squares Method

Nonlinear Iterative Partial Least Squares Method Numerical Methods for Determining Principal Component Analysis Abstract Factors Béchu, S., Richard-Plouet, M., Fernandez, V., Walton, J., and Fairley, N. (2016) Developments in numerical treatments for

More information

Gamma Distribution Fitting

Gamma Distribution Fitting Chapter 552 Gamma Distribution Fitting Introduction This module fits the gamma probability distributions to a complete or censored set of individual or grouped data values. It outputs various statistics

More information

CS3220 Lecture Notes: QR factorization and orthogonal transformations

CS3220 Lecture Notes: QR factorization and orthogonal transformations CS3220 Lecture Notes: QR factorization and orthogonal transformations Steve Marschner Cornell University 11 March 2009 In this lecture I ll talk about orthogonal matrices and their properties, discuss

More information

Computational Physics With Python. Dr. Eric Ayars California State University, Chico

Computational Physics With Python. Dr. Eric Ayars California State University, Chico Computational Physics With Python Dr. Eric Ayars California State University, Chico ii Copyright c 2013 Eric Ayars except where otherwise noted. Version 0.9, August 18, 2013 Contents Preface.................................

More information

Introduction to Matrices for Engineers

Introduction to Matrices for Engineers Introduction to Matrices for Engineers C.T.J. Dodson, School of Mathematics, Manchester Universit 1 What is a Matrix? A matrix is a rectangular arra of elements, usuall numbers, e.g. 1 0-8 4 0-1 1 0 11

More information

Postprocessing with Python

Postprocessing with Python Postprocessing with Python Boris Dintrans (CNRS & University of Toulouse) [email protected] Collaborator: Thomas Gastine (PhD) Outline Outline Introduction - what s Python and why using it? - Installation

More information

Linear Algebra and TI 89

Linear Algebra and TI 89 Linear Algebra and TI 89 Abdul Hassen and Jay Schiffman This short manual is a quick guide to the use of TI89 for Linear Algebra. We do this in two sections. In the first section, we will go over the editing

More information

CRASH COURSE PYTHON. Het begint met een idee

CRASH COURSE PYTHON. Het begint met een idee CRASH COURSE PYTHON nr. Het begint met een idee This talk Not a programming course For data analysts, who want to learn Python For optimizers, who are fed up with Matlab 2 Python Scripting language expensive

More information

Mean value theorem, Taylors Theorem, Maxima and Minima.

Mean value theorem, Taylors Theorem, Maxima and Minima. MA 001 Preparatory Mathematics I. Complex numbers as ordered pairs. Argand s diagram. Triangle inequality. De Moivre s Theorem. Algebra: Quadratic equations and express-ions. Permutations and Combinations.

More information

Modeling with Python

Modeling with Python H Modeling with Python In this appendix a brief description of the Python programming language will be given plus a brief introduction to the Antimony reaction network format and libroadrunner. Python

More information

Content. Chapter 4 Functions 61 4.1 Basic concepts on real functions 62. Credits 11

Content. Chapter 4 Functions 61 4.1 Basic concepts on real functions 62. Credits 11 Content Credits 11 Chapter 1 Arithmetic Refresher 13 1.1 Algebra 14 Real Numbers 14 Real Polynomials 19 1.2 Equations in one variable 21 Linear Equations 21 Quadratic Equations 22 1.3 Exercises 28 Chapter

More information

Lecture 5: Singular Value Decomposition SVD (1)

Lecture 5: Singular Value Decomposition SVD (1) EEM3L1: Numerical and Analytical Techniques Lecture 5: Singular Value Decomposition SVD (1) EE3L1, slide 1, Version 4: 25-Sep-02 Motivation for SVD (1) SVD = Singular Value Decomposition Consider the system

More information

Introduction to the Finite Element Method

Introduction to the Finite Element Method Introduction to the Finite Element Method 09.06.2009 Outline Motivation Partial Differential Equations (PDEs) Finite Difference Method (FDM) Finite Element Method (FEM) References Motivation Figure: cross

More information

Numerical Methods I Eigenvalue Problems

Numerical Methods I Eigenvalue Problems Numerical Methods I Eigenvalue Problems Aleksandar Donev Courant Institute, NYU 1 [email protected] 1 Course G63.2010.001 / G22.2420-001, Fall 2010 September 30th, 2010 A. Donev (Courant Institute)

More information

Mathematics (MAT) MAT 061 Basic Euclidean Geometry 3 Hours. MAT 051 Pre-Algebra 4 Hours

Mathematics (MAT) MAT 061 Basic Euclidean Geometry 3 Hours. MAT 051 Pre-Algebra 4 Hours MAT 051 Pre-Algebra Mathematics (MAT) MAT 051 is designed as a review of the basic operations of arithmetic and an introduction to algebra. The student must earn a grade of C or in order to enroll in MAT

More information

How long is the vector? >> length(x) >> d=size(x) % What are the entries in the matrix d?

How long is the vector? >> length(x) >> d=size(x) % What are the entries in the matrix d? MATLAB : A TUTORIAL 1. Creating vectors..................................... 2 2. Evaluating functions y = f(x), manipulating vectors. 4 3. Plotting............................................ 5 4. Miscellaneous

More information

Operation Count; Numerical Linear Algebra

Operation Count; Numerical Linear Algebra 10 Operation Count; Numerical Linear Algebra 10.1 Introduction Many computations are limited simply by the sheer number of required additions, multiplications, or function evaluations. If floating-point

More information

Eigenvalues and Eigenvectors

Eigenvalues and Eigenvectors Chapter 6 Eigenvalues and Eigenvectors 6. Introduction to Eigenvalues Linear equations Ax D b come from steady state problems. Eigenvalues have their greatest importance in dynamic problems. The solution

More information

SAMPLE. Computer Algebra System (Classpad 330 using OS 3 or above) Application selector. Icolns that access working zones. Icon panel (Master toolbar)

SAMPLE. Computer Algebra System (Classpad 330 using OS 3 or above) Application selector. Icolns that access working zones. Icon panel (Master toolbar) A P P E N D I X B Computer Algebra System (Classpad 330 using OS 3 or above) B.1 Introduction For reference material on basic operations of the calculator, refer to the free downloadable documentation

More information

Computational Mathematics with Python

Computational Mathematics with Python Boolean Arrays Classes Computational Mathematics with Python Basics Olivier Verdier and Claus Führer 2009-03-24 Olivier Verdier and Claus Führer Computational Mathematics with Python 2009-03-24 1 / 40

More information

Computational Mathematics with Python

Computational Mathematics with Python Computational Mathematics with Python Basics Claus Führer, Jan Erik Solem, Olivier Verdier Spring 2010 Claus Führer, Jan Erik Solem, Olivier Verdier Computational Mathematics with Python Spring 2010 1

More information

Precalculus REVERSE CORRELATION. Content Expectations for. Precalculus. Michigan CONTENT EXPECTATIONS FOR PRECALCULUS CHAPTER/LESSON TITLES

Precalculus REVERSE CORRELATION. Content Expectations for. Precalculus. Michigan CONTENT EXPECTATIONS FOR PRECALCULUS CHAPTER/LESSON TITLES Content Expectations for Precalculus Michigan Precalculus 2011 REVERSE CORRELATION CHAPTER/LESSON TITLES Chapter 0 Preparing for Precalculus 0-1 Sets There are no state-mandated Precalculus 0-2 Operations

More information

MTH 437/537 Introduction to Numerical Analysis I Fall 2015

MTH 437/537 Introduction to Numerical Analysis I Fall 2015 MTH 437/537 Introduction to Numerical Analysis I Fall 2015 Times, places Class: 437/537 MWF 10:00am 10:50pm Math 150 Lab: 437A Tu 8:00 8:50am Math 250 Instructor John Ringland. Office: Math Bldg 206. Phone:

More information

TI-Nspire CAS Graphing Calculator

TI-Nspire CAS Graphing Calculator TI-Nspire CAS Graphing Calculator Contents Opening a New Document 2 Setting Auto/Approximate Mode 2 Setting Degree Mode 2 Copying and Pasting a Expression or Equation 3 Accessing the Catalogue 3 Defining

More information

from ztf_summerschool import source_lightcurve, barycenter_times %matplotlib inline

from ztf_summerschool import source_lightcurve, barycenter_times %matplotlib inline In [2]: # imports import numpy as np import matplotlib.pyplot as plt import astropy.coordinates as coords import astropy.units as u from astropy.time import Time from astroml.time_series import \ lomb_scargle,

More information

A linear combination is a sum of scalars times quantities. Such expressions arise quite frequently and have the form

A linear combination is a sum of scalars times quantities. Such expressions arise quite frequently and have the form Section 1.3 Matrix Products A linear combination is a sum of scalars times quantities. Such expressions arise quite frequently and have the form (scalar #1)(quantity #1) + (scalar #2)(quantity #2) +...

More information

LAYOUT OF THE KEYBOARD

LAYOUT OF THE KEYBOARD Dr. Charles Hofmann, LaSalle [email protected] Dr. Roseanne Hofmann, MCCC [email protected] ------------------------------------------------------------------------------------------------- DISPLAY CONTRAST

More information

The Heat Equation. Lectures INF2320 p. 1/88

The Heat Equation. Lectures INF2320 p. 1/88 The Heat Equation Lectures INF232 p. 1/88 Lectures INF232 p. 2/88 The Heat Equation We study the heat equation: u t = u xx for x (,1), t >, (1) u(,t) = u(1,t) = for t >, (2) u(x,) = f(x) for x (,1), (3)

More information

Programming Exercise 3: Multi-class Classification and Neural Networks

Programming Exercise 3: Multi-class Classification and Neural Networks Programming Exercise 3: Multi-class Classification and Neural Networks Machine Learning November 4, 2011 Introduction In this exercise, you will implement one-vs-all logistic regression and neural networks

More information

[1] Diagonal factorization

[1] Diagonal factorization 8.03 LA.6: Diagonalization and Orthogonal Matrices [ Diagonal factorization [2 Solving systems of first order differential equations [3 Symmetric and Orthonormal Matrices [ Diagonal factorization Recall:

More information

MBA Jump Start Program

MBA Jump Start Program MBA Jump Start Program Module 2: Mathematics Thomas Gilbert Mathematics Module Online Appendix: Basic Mathematical Concepts 2 1 The Number Spectrum Generally we depict numbers increasing from left to right

More information

u = [ 2 4 5] has one row with three components (a 3 v = [2 4 5] has three rows separated by semicolons (a 3 w = 2:5 generates the row vector w = [ 2 3

u = [ 2 4 5] has one row with three components (a 3 v = [2 4 5] has three rows separated by semicolons (a 3 w = 2:5 generates the row vector w = [ 2 3 MATLAB Tutorial You need a small numb e r of basic commands to start using MATLAB. This short tutorial describes those fundamental commands. You need to create vectors and matrices, to change them, and

More information

EXCEL Tutorial: How to use EXCEL for Graphs and Calculations.

EXCEL Tutorial: How to use EXCEL for Graphs and Calculations. EXCEL Tutorial: How to use EXCEL for Graphs and Calculations. Excel is powerful tool and can make your life easier if you are proficient in using it. You will need to use Excel to complete most of your

More information

AMS526: Numerical Analysis I (Numerical Linear Algebra)

AMS526: Numerical Analysis I (Numerical Linear Algebra) AMS526: Numerical Analysis I (Numerical Linear Algebra) Lecture 19: SVD revisited; Software for Linear Algebra Xiangmin Jiao Stony Brook University Xiangmin Jiao Numerical Analysis I 1 / 9 Outline 1 Computing

More information

Quick Tour of Mathcad and Examples

Quick Tour of Mathcad and Examples Fall 6 Quick Tour of Mathcad and Examples Mathcad provides a unique and powerful way to work with equations, numbers, tests and graphs. Features Arithmetic Functions Plot functions Define you own variables

More information

The NumPy array: a structure for efficient numerical computation

The NumPy array: a structure for efficient numerical computation The NumPy array: a structure for efficient numerical computation Stéfan van der Walt, Stellenbosch University South Africa S. Chris Colbert, Enthought USA Gael Varoquaux, INRIA Saclay France arxiv:1102.1523v1

More information

ANSA and μeta as a CAE Software Development Platform

ANSA and μeta as a CAE Software Development Platform ANSA and μeta as a CAE Software Development Platform Michael Giannakidis, Yianni Kolokythas BETA CAE Systems SA, Thessaloniki, Greece Overview What have we have done so far Current state Future direction

More information

Matrix Multiplication

Matrix Multiplication Matrix Multiplication CPS343 Parallel and High Performance Computing Spring 2016 CPS343 (Parallel and HPC) Matrix Multiplication Spring 2016 1 / 32 Outline 1 Matrix operations Importance Dense and sparse

More information

Java Modules for Time Series Analysis

Java Modules for Time Series Analysis Java Modules for Time Series Analysis Agenda Clustering Non-normal distributions Multifactor modeling Implied ratings Time series prediction 1. Clustering + Cluster 1 Synthetic Clustering + Time series

More information

Similarity and Diagonalization. Similar Matrices

Similarity and Diagonalization. Similar Matrices MATH022 Linear Algebra Brief lecture notes 48 Similarity and Diagonalization Similar Matrices Let A and B be n n matrices. We say that A is similar to B if there is an invertible n n matrix P such that

More information

Programming Computer Vision with Python. Jan Erik Solem

Programming Computer Vision with Python. Jan Erik Solem Programming Computer Vision with Python Jan Erik Solem Programming Computer Vision with Python Copyright 2012 Jan Erik Solem. This version of the work is a pre-production draft made available under the

More information

Basic Concepts in Matlab

Basic Concepts in Matlab Basic Concepts in Matlab Michael G. Kay Fitts Dept. of Industrial and Systems Engineering North Carolina State University Raleigh, NC 769-7906, USA [email protected] September 00 Contents. The Matlab Environment.

More information

CITY UNIVERSITY LONDON. BEng Degree in Computer Systems Engineering Part II BSc Degree in Computer Systems Engineering Part III PART 2 EXAMINATION

CITY UNIVERSITY LONDON. BEng Degree in Computer Systems Engineering Part II BSc Degree in Computer Systems Engineering Part III PART 2 EXAMINATION No: CITY UNIVERSITY LONDON BEng Degree in Computer Systems Engineering Part II BSc Degree in Computer Systems Engineering Part III PART 2 EXAMINATION ENGINEERING MATHEMATICS 2 (resit) EX2005 Date: August

More information

GRADES 7, 8, AND 9 BIG IDEAS

GRADES 7, 8, AND 9 BIG IDEAS Table 1: Strand A: BIG IDEAS: MATH: NUMBER Introduce perfect squares, square roots, and all applications Introduce rational numbers (positive and negative) Introduce the meaning of negative exponents for

More information

GeoGebra. 10 lessons. Gerrit Stols

GeoGebra. 10 lessons. Gerrit Stols GeoGebra in 10 lessons Gerrit Stols Acknowledgements GeoGebra is dynamic mathematics open source (free) software for learning and teaching mathematics in schools. It was developed by Markus Hohenwarter

More information

3. Interpolation. Closing the Gaps of Discretization... Beyond Polynomials

3. Interpolation. Closing the Gaps of Discretization... Beyond Polynomials 3. Interpolation Closing the Gaps of Discretization... Beyond Polynomials Closing the Gaps of Discretization... Beyond Polynomials, December 19, 2012 1 3.3. Polynomial Splines Idea of Polynomial Splines

More information

Electrical Engineering 103 Applied Numerical Computing

Electrical Engineering 103 Applied Numerical Computing UCLA Fall Quarter 2011-12 Electrical Engineering 103 Applied Numerical Computing Professor L Vandenberghe Notes written in collaboration with S Boyd (Stanford Univ) Contents I Matrix theory 1 1 Vectors

More information

CONCEPT-II. Overview of demo examples

CONCEPT-II. Overview of demo examples CONCEPT-II CONCEPT-II is a frequency domain method of moment (MoM) code, under development at the Institute of Electromagnetic Theory at the Technische Universität Hamburg-Harburg (www.tet.tuhh.de). Overview

More information

Variance Reduction. Pricing American Options. Monte Carlo Option Pricing. Delta and Common Random Numbers

Variance Reduction. Pricing American Options. Monte Carlo Option Pricing. Delta and Common Random Numbers Variance Reduction The statistical efficiency of Monte Carlo simulation can be measured by the variance of its output If this variance can be lowered without changing the expected value, fewer replications

More information

Numerical Analysis Introduction. Student Audience. Prerequisites. Technology.

Numerical Analysis Introduction. Student Audience. Prerequisites. Technology. Numerical Analysis Douglas Faires, Youngstown State University, (Chair, 2012-2013) Elizabeth Yanik, Emporia State University, (Chair, 2013-2015) Graeme Fairweather, Executive Editor, Mathematical Reviews,

More information

Lecture 2 Matrix Operations

Lecture 2 Matrix Operations Lecture 2 Matrix Operations transpose, sum & difference, scalar multiplication matrix multiplication, matrix-vector product matrix inverse 2 1 Matrix transpose transpose of m n matrix A, denoted A T or

More information

NUMERICAL ANALYSIS PROGRAMS

NUMERICAL ANALYSIS PROGRAMS NUMERICAL ANALYSIS PROGRAMS I. About the Program Disk This disk included with Numerical Analysis, Seventh Edition by Burden and Faires contains a C, FORTRAN, Maple, Mathematica, MATLAB, and Pascal program

More information

Numerical Recipes in C++

Numerical Recipes in C++ Numerical Recipes in C++ The Art of Scientific Computing Second Edition William H. Press Los Alamos National Laboratory Saul A. Teukolsky Department of Physics, Cornell University William T. Vetterling

More information

A Brief Introduction to SPSS Factor Analysis

A Brief Introduction to SPSS Factor Analysis A Brief Introduction to SPSS Factor Analysis SPSS has a procedure that conducts exploratory factor analysis. Before launching into a step by step example of how to use this procedure, it is recommended

More information

WEEK #3, Lecture 1: Sparse Systems, MATLAB Graphics

WEEK #3, Lecture 1: Sparse Systems, MATLAB Graphics WEEK #3, Lecture 1: Sparse Systems, MATLAB Graphics Visualization of Matrices Good visuals anchor any presentation. MATLAB has a wide variety of ways to display data and calculation results that can be

More information

http://school-maths.com Gerrit Stols

http://school-maths.com Gerrit Stols For more info and downloads go to: http://school-maths.com Gerrit Stols Acknowledgements GeoGebra is dynamic mathematics open source (free) software for learning and teaching mathematics in schools. It

More information

The KaleidaGraph Guide to Curve Fitting

The KaleidaGraph Guide to Curve Fitting The KaleidaGraph Guide to Curve Fitting Contents Chapter 1 Curve Fitting Overview 1.1 Purpose of Curve Fitting... 5 1.2 Types of Curve Fits... 5 Least Squares Curve Fits... 5 Nonlinear Curve Fits... 6

More information

Computational Mathematics with Python

Computational Mathematics with Python Numerical Analysis, Lund University, 2011 1 Computational Mathematics with Python Chapter 1: Basics Numerical Analysis, Lund University Claus Führer, Jan Erik Solem, Olivier Verdier, Tony Stillfjord Spring

More information

MACHINE LEARNING IN HIGH ENERGY PHYSICS

MACHINE LEARNING IN HIGH ENERGY PHYSICS MACHINE LEARNING IN HIGH ENERGY PHYSICS LECTURE #1 Alex Rogozhnikov, 2015 INTRO NOTES 4 days two lectures, two practice seminars every day this is introductory track to machine learning kaggle competition!

More information