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

Size: px
Start display at page:

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

Transcription

1 5615 Chapter 3 April 8, 2015 Contents Mixed RV and Moments 2 Simulation Set #3 RP Simulation 3 Working with rp1 in the Notebook Proper Numerical Integration 5 Working with the Covariance Matrix 6 Random Processes 7 Autocorrelation Function Estimation Example: AR(1) Process Correlated Random Gaussian Signal Generator In [1]: %pylab inline #%matplotlib qt from future import division # use so 1/2 = 0.5, etc. import ssd import scipy.signal as signal from IPython.display import Image, SVG Populating the interactive namespace from numpy and matplotlib In [2]: pylab.rcparams[ savefig.dpi ] = 100 # default 72 #pylab.rcparams[ figure.figsize ] = (6.0, 4.0) # default (6,4) %config InlineBackend.figure_formats=[ png ] # default for inline viewing #%config InlineBackend.figure_formats=[ svg ] # SVG inline viewing #%config InlineBackend.figure_formats=[ pdf ] # render pdf figs for LaTeX 1

2 Mixed RV and Moments For mixed RV you may find it useful to consider the conditional expectation where A B = and A B = S. Simulation In [8]: v =randint(0,2,10000) mean(v) Out[8]: In [9]: N= x1 = randint(0,2,n) x2 = randn(n) # RV x x = x1*x2 # RV y y = (x-3)*(x-1) E{h(x)} = P (A) E{h(x) A} + P (B) E{h(x) B} (1) In [14]: figure(figsize=(6,3)) hist(x,50,normed=true,cumulative=false); xlabel(r x ) ylabel(r Probability Density ) title(r Density Estimate $f_x(x)$ ) grid(); figure(figsize=(6,3)) hist(y,100,(-1,5),normed=true); ylim([0,1]) xlabel(r y ) ylabel(r Probability Density ) title(r Density Estimate $f_y(y)$ ) grid(); 2

3 In [11]: print( mean on x = %6.4f, var on x = %6.4f % (mean(x),var(x))) mean on x = , var on x = In [12]: print( mean on y = %6.4f, var on y = %6.4f % (mean(y),var(y))) mean on y = , var on y = Set #3 RP Simulation In problem #2 of Set #3 you need to generate a discrete-time random process ensemble. The function below does just that. If you chose to work with this function without the %pylab command invoked in IPython, then you will need to modify the code to include the numpy namespace alias you use and also do your own importing of matplotlib for graphics, e.g., # RP1 Test Script rp1_test.py import numpy as np import matplotlib.pyplot as plt def rp1(m,n): V = RP1(M,N) Random Process #1 from McClellan a = 0.02 b = 5 n = np.arange(1,n+1) Mc = np.ones((m,1))*b*np.sin((n*np.pi/n)) 3

4 Ac = a*np.ones((m,1))*n v = (np.random.rand(m,n)-0.5)*mc + Ac return v if name == main : v = rp1(10,100) plt.figure(figsize=(7,5)) plt.plot(v[0,:]) plt.plot(v[5,:]) plt.title(r Plot Some Sample Functions ) plt.ylabel(r Amplitude ) plt.xlabel(r Sample Index ) plt.grid() plt.show() I recommend against this unless you feel real comfortable with these aspects of Python. The IPython notebook offers a much more comfortable and interactive environment. In the IPython qtterminal for example you can run this script using the %run magic, i.e.,: > %run rp1_test.py You can also run this script right from the terminal window as: c:\>python rp1_test.py In [1]: # If you run this cell it will pop up a plot window outside the browser that will be modal, # meaning the the cell keeps running until you close the plot window. %run rp1_test.py On the positive side, by putting rp1() into a Python source file, you can now import the file into your workspace and have access to the single def(): In [3]: import rp1_test In [4]: rp1_test.rp1(3,3) Out[4]: array([[ , , 0.06 ], [ , , 0.06 ], [ , , 0.06 ]]) Working with rp1 in the Notebook Proper In [22]: def rp1(m,n): V = RP1(M,N) Random Process #1 from McClellan a = 0.02 b = 5 n = arange(1,n+1) Mc = ones((m,1))*b*sin((n*pi/n)) Ac = a*ones((m,1))*n v = (rand(m,n)-0.5)*mc + Ac return v In [23]: rp1(5,6) 4

5 Out[23]: array([[ , , , , , 0.12 ], [ , , , , , 0.12 ], [ , , , , , 0.12 ], [ , , , , , 0.12 ], [ , , , , , 0.12 ]]) In [24]: v = rp1(10000,1000) Numerical Integration In [16]: import scipy.integrate as integrate Consider the joint pdf f xy (x, y) = abe ax e by u(x)u(y) (2) We wish to find the probability P R associated with the triangle shape region shown below: In [60]: Image( 5615 Chapter 3_files/project5615_fig1.png,width= 80% ) Out[60]: We will use the scipy integrate module to numerically integrate this function in two dimensions. The appriate function is dblquad() import scipy.integrate as integrate This function gives you some nice options. In particular you can make the limits of the inner inegral a function of the outer integration variable, and you can pass parameters of the function being integrated into the function call. 5

6 In the case of P R we desire P R = 1 2 x 0 x f xy (x, y) dydx (3) In the case of this example numerical integration is not required and it can be shown that P R = b [ 1 e (b+a)] b [ b + a b 1 e 2a 1 e (b 1)] (4) This is good however, as you can try out dblquad() and veryify that the numerical solution matches the theoretical solution. Below I define three simple Python functions to support the needs of the numerical integration. Note: The y variable must come first in the integrand function. In [52]: def fxy1(y,x,b,a): return a*b*exp(-a*x)*exp(-b*y) def g(x): return x def h(x): return 2-x In [59]: #integrate.dblquad(f_integrand,x_low,x_up,g_of_x,h_of_x,args=(a1,a2,..)) integrate.dblquad(fxy1,0,1,g,h,args=(8,5)) Out[59]: ( , e-12) Compare with theory for the case a = 5 and b = 8. In [58]: a = 5 b = 8 PR_thy = a/(a+b)*(1-e**(-(a+b))) - a/(a-1)*e**(-2*b)*(1 - e**(-(a-1))) PR_thy Out[58]: Working with the Covariance Matrix Working with the covariance matrix can mean many things. An example of interest is finding the variance of a random variable that is obtained via a linear transformation of a random vector. Suppose that the scalar rv z can be written as z = AX + b (5) where A = [a 1, a 2,..., a N ], random vector X = [x 1, x 2,..., x N ] t has N N covariance matrix C x (or K x ) and mean vector [m x1, m x2,..., m xn ] t, and b is a constant. The mean of X is and m x = E { AX + b } = Am x + b (6) 6

7 Random Processes σ 2 z = E { (z m z ) 2} (7) Autocorrelation Function Estimation In [4]: x = 0.5*randn(100) In [3]: import digitalcom as dc = E { (AX + b m z ) 2} = E { (AX + b Am x b) 2} (8) = E { (AX + Am x ) 2} = E { ([A(X m x )][A(X m x )] t} (9) = AE { (X m x )(X m x ) t} A t (10) = AC x A t (11) r xy,lags = xcorr(x,y,nlags): The function below can be used to efficiently compute the auto- and cross-correlation functions of both real and complex signals. A transform domain approach is used. A drawback of this function is that it currently only outputs correlation coefficient normalized form for r xx [k] and r xy [k], which is equivalent to energy normalization. Mathematically this can be viewed as r xx [k]/r xx [0] and r xy /r xy [0], respectively. In [6]: def xcorr(x1,x2,nlags): r12, k = xcorr(x1,x2,nlags), r12 and k are ndarray s Compute the energy normalized cross correlation between the sequences x1 and x2. If x1 = x2 the cross correlation is the autocorrelation. The number of lags sets how many lags to return centered about zero K = 2*(len(x1)/2) X1 = fft.fft(x1[:k]) X2 = fft.fft(x2[:k]) E1 = sum(abs(x1[:k])**2) E2 = sum(abs(x2[:k])**2) r12 = np.fft.ifft(x1*np.conj(x2))/np.sqrt(e1*e2) k = np.arange(k) - K/2 r12 = np.fft.fftshift(r12) idx = mlab.find(abs(k) <= Nlags) return r12[idx], k[idx] r xx,lags = xcorr bias(x,nlags): The function below steps back from trying to be fast and efficient, to just calculating the biased autocorrelation function in the time domain. This time-averaged autocorreation function estimate takes the mathematical form r xx [k] = 1 N N 1 n=0 For small sample sizes, i.e., small N the calculation is still very fast. x[n]x[n k] (12) In [47]: def xcorr_bias(x,nlags): A slow time domain, biased, auto correlation estmation. Easily modified to do cross correlation and handle complex signals. 7

8 Example: AR(1) Process Mark Wickert, April 2015 N = len(x) rxx = zeros(2*nlags+1) k = arange(-nlags,nlags+1) for n,nk in enumerate(k): if nk < 0: rxx[n] = sum(x[0:n+nk]*x[-nk:])/n elif nk > 0: rxx[n] = sum(x[nk:]*x[:-nk])/n else: rxx[n] = sum(x*x)/n return rxx,k The example below considers an AR(1) process of the form x[n] + a(1)x[n 1] = b(0)v[n] (13) or x[n] = a(1)x[n 1] + b(0)v[n] (14) where v[n] is white noise having unit variance. In this example we further assume that b(0) = 1. In [125]: v = randn(1000) a1 = 0.9 # The a1 is used over the next few cells x = signal.lfilter([1],[1,a1],v) x24 = x[-24:] #last 24 samples x500 = x[-500:] #last 500 samples rx24,lags = xcorr_bias(x24,24) # compute 24 lags either side of zero rx500,lags = xcorr_bias(x500,24) In [126]: rxx24 Out[126]: array([ 0., , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , 0. ]) In [127]: figure(figsize=(6,2.5)) stem(lagsxx,1/(1-(a1)**2)*(-(a1))**abs(lagsxx)) title(r Theoretical $r_{xx}[k]$ for $a(1)$ = %1.2f % a1) ylabel(r Autocorrelation Function ) xlabel(r Lags $k$ ) xlim([-20,20]); grid(); figure(figsize=(6,2.5)) stem(lags,rxx500) title(r Estimated $r_{xx}[k]$ for $N=500$ and $a(1)$ = %1.2f % a1) 8

9 ylabel(r Autocorrelation Function ) xlabel(r Lags $k$ ) xlim([-20,20]); grid(); figure(figsize=(6,2.5)) stem(lags,rxx500) title(r Estimated $r_{xx}[k]$ for $N=24$ and $a(1)$ = %1.2f % a1) ylabel(r Autocorrelation Function ) xlabel(r Lags $k$ ) xlim([-20,20]); grid(); 9

10 Correlated Random Gaussian Signal Generator The simplest approach is to use the function multivariate normal() which is part of Numpy. Suppose you want to create random vector realizations organized as column vectors. Each new realization is accessed by the column index. The rows contain the elements. The function requires as input 1D ndarray of length M describing the mean of the PDF and a M M 2D ndarray containing the covariance matrix. Suppose we wish to create N realizations of the M = 3 normal random vector having mean and covariance matrix X = [ x 1 x 2 x 3 ] t (15) respectively. Generate 4 realizations, so the 2D array has shape (3,4): m x = [ ] t (16) C x = K x = (17) In [117]: y = np.random.multivariate_normal(array([1,2,3]), array([[2,1,-1],[1,3,2],[-1,2,5]]), (4,)).T In [118]: y.shape Out[118]: (3L, 4L) In [119]: y Out[119]: array([[ , , , ], [ , , , ], [ , , , ]]) 10

11 Now generate 1000 realizations and compute the sample mean vector (arra) and the sample mean covariance: In [120]: y = np.random.multivariate_normal(array([1,2,3]), array([[2,1,-1],[1,3,2],[-1,2,5]]), (1000,)).T y.shape Out[120]: (3L, 1000L) In [123]: mean(y,axis=1) Out[123]: array([ , , ]) In [124]: cov(y) Out[124]: array([[ , , ], [ , , ], [ , , ]]) The results look good! 11

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

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

Computer Assignment (CA) No. 11: Autocorrelation And Power Spectral Density

Computer Assignment (CA) No. 11: Autocorrelation And Power Spectral Density Computer Assignment (CA) No. 11: Autocorrelation And Power Spectral Density Problem Statement Recall the autocorrelation function is defined as: N 1 R(τ) = n=0 x[n]x[n τ],τ = 0, 1, 2,..., M Compute and

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

Linear Classification

Linear Classification Linear Classification by Prof. Seungchul Lee isystems Design Lab http://isystems.unist.ac.kr/ UNIS able of Contents I.. Supervised Learning II.. Classification III. 3. Perceptron I. 3.. Linear Classifier

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

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

Uniform and constant electromagnetic fields

Uniform and constant electromagnetic fields Fundamentals of Plasma Physics, Nuclear Fusion and Lasers Single Particle Motion Uniform and constant electromagnetic fields Nuno R. Pinhão 2015, March In this notebook we analyse the movement of individual

More information

Simulated Data Sets and a Demonstration of Central Limit Theorem

Simulated Data Sets and a Demonstration of Central Limit Theorem Simulated Data Sets and a Demonstration of Central Limit Theorem Material to accompany coverage in Hughes and Hase. Introductory section complements Section 3.5, and generates graphs like those in Figs.3.6,

More information

An example to illustrate frequentist and Bayesian approches

An example to illustrate frequentist and Bayesian approches Frequentist_Bayesian_Eample An eample to illustrate frequentist and Bayesian approches This is a trivial eample that illustrates the fundamentally different points of view of the frequentist and Bayesian

More information

Week 2 Assignments. Inferring the Astrophysical Population of Black Hole Binaries. Name: Osase Omoruyi Mentor: Alan Weinstein LIGO SURF 2017

Week 2 Assignments. Inferring the Astrophysical Population of Black Hole Binaries. Name: Osase Omoruyi Mentor: Alan Weinstein LIGO SURF 2017 Week 2 Assignments Inferring the Astrophysical Population of Black Hole Binaries Name: Osase Omoruyi Mentor: Alan Weinstein LIGO SURF 2017 Caltech, CA LIGO Laboratory Astrophysics Group 12th July 2017

More information

Algorithms for Uncertainty Quantification

Algorithms for Uncertainty Quantification Technische Universität München SS 2017 Lehrstuhl für Informatik V Dr. Tobias Neckel M. Sc. Ionuț Farcaș April 26, 2017 Algorithms for Uncertainty Quantification Tutorial 1: Python overview In this worksheet,

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

Perceptron. by Prof. Seungchul Lee Industrial AI Lab POSTECH. Table of Contents

Perceptron. by Prof. Seungchul Lee Industrial AI Lab  POSTECH. Table of Contents Perceptron by Prof. Seungchul Lee Industrial AI Lab http://isystems.unist.ac.kr/ POSTECH Table of Contents I.. Supervised Learning II.. Classification III. 3. Perceptron I. 3.. Linear Classifier II. 3..

More information

Chapter 6. Random Processes

Chapter 6. Random Processes Chapter 6 Random Processes Random Process A random process is a time-varying function that assigns the outcome of a random experiment to each time instant: X(t). For a fixed (sample path): a random process

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

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

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

Lab 4: Quantization, Oversampling, and Noise Shaping

Lab 4: Quantization, Oversampling, and Noise Shaping Lab 4: Quantization, Oversampling, and Noise Shaping Due Friday 04/21/17 Overview: This assignment should be completed with your assigned lab partner(s). Each group must turn in a report composed using

More information

User Guide for Hermir version 0.9: Toolbox for Synthesis of Multivariate Stationary Gaussian and non-gaussian Series

User Guide for Hermir version 0.9: Toolbox for Synthesis of Multivariate Stationary Gaussian and non-gaussian Series User Guide for Hermir version 0.9: Toolbox for Synthesis of Multivariate Stationary Gaussian and non-gaussian Series Hannes Helgason, Vladas Pipiras, and Patrice Abry June 2, 2011 Contents 1 Organization

More information

Driven, damped, pendulum

Driven, damped, pendulum Driven, damped, pendulum Note: The notation and graphs in this notebook parallel those in Chaotic Dynamics by Baker and Gollub. (There's a copy in the department office.) For the driven, damped, pendulum,

More information

A6523 Modeling, Inference, and Mining Jim Cordes, Cornell University. False Positives in Fourier Spectra. For N = DFT length: Lecture 5 Reading

A6523 Modeling, Inference, and Mining Jim Cordes, Cornell University. False Positives in Fourier Spectra. For N = DFT length: Lecture 5 Reading A6523 Modeling, Inference, and Mining Jim Cordes, Cornell University Lecture 5 Reading Notes on web page Stochas

More information

Exercise_set7_programming_exercises

Exercise_set7_programming_exercises Exercise_set7_programming_exercises May 13, 2018 1 Part 1(d) We start by defining some function that will be useful: The functions defining the system, and the Hamiltonian and angular momentum. In [1]:

More information

Gaussian, Markov and stationary processes

Gaussian, Markov and stationary processes Gaussian, Markov and stationary processes Gonzalo Mateos Dept. of ECE and Goergen Institute for Data Science University of Rochester gmateosb@ece.rochester.edu http://www.ece.rochester.edu/~gmateosb/ November

More information

ME 597: AUTONOMOUS MOBILE ROBOTICS SECTION 2 PROBABILITY. Prof. Steven Waslander

ME 597: AUTONOMOUS MOBILE ROBOTICS SECTION 2 PROBABILITY. Prof. Steven Waslander ME 597: AUTONOMOUS MOBILE ROBOTICS SECTION 2 Prof. Steven Waslander p(a): Probability that A is true 0 pa ( ) 1 p( True) 1, p( False) 0 p( A B) p( A) p( B) p( A B) A A B B 2 Discrete Random Variable X

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

Chapter 3 - Derivatives

Chapter 3 - Derivatives Chapter 3 - Derivatives Section 3.1: The derivative at a point The derivative of a function f (x) at a point x = a is equal to the rate of change in f (x) at that point or equivalently the slope of the

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

LECTURES 2-3 : Stochastic Processes, Autocorrelation function. Stationarity.

LECTURES 2-3 : Stochastic Processes, Autocorrelation function. Stationarity. LECTURES 2-3 : Stochastic Processes, Autocorrelation function. Stationarity. Important points of Lecture 1: A time series {X t } is a series of observations taken sequentially over time: x t is an observation

More information

Ch. 12 Linear Bayesian Estimators

Ch. 12 Linear Bayesian Estimators Ch. 1 Linear Bayesian Estimators 1 In chapter 11 we saw: the MMSE estimator takes a simple form when and are jointly Gaussian it is linear and used only the 1 st and nd order moments (means and covariances).

More information

Stochastic processes and Data mining

Stochastic processes and Data mining Stochastic processes and Data mining Meher Krishna Patel Created on : Octorber, 2017 Last updated : May, 2018 More documents are freely available at PythonDSP Table of contents Table of contents i 1 The

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

Numerical Methods Lecture 2 Simultaneous Equations

Numerical Methods Lecture 2 Simultaneous Equations Numerical Methods Lecture 2 Simultaneous Equations Topics: matrix operations solving systems of equations pages 58-62 are a repeat of matrix notes. New material begins on page 63. Matrix operations: Mathcad

More information

Notes on Random Processes

Notes on Random Processes otes on Random Processes Brian Borchers and Rick Aster October 27, 2008 A Brief Review of Probability In this section of the course, we will work with random variables which are denoted by capital letters,

More information

Stochastic Processes. A stochastic process is a function of two variables:

Stochastic Processes. A stochastic process is a function of two variables: Stochastic Processes Stochastic: from Greek stochastikos, proceeding by guesswork, literally, skillful in aiming. A stochastic process is simply a collection of random variables labelled by some parameter:

More information

Laboratory Project 1: Introduction to Random Processes

Laboratory Project 1: Introduction to Random Processes Laboratory Project 1: Introduction to Random Processes Random Processes With Applications (MVE 135) Mats Viberg Department of Signals and Systems Chalmers University of Technology 412 96 Gteborg, Sweden

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

Lorenz Equations. Lab 1. The Lorenz System

Lorenz Equations. Lab 1. The Lorenz System Lab 1 Lorenz Equations Chaos: When the present determines the future, but the approximate present does not approximately determine the future. Edward Lorenz Lab Objective: Investigate the behavior of a

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

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

Lecture Unconstrained optimization. In this lecture we will study the unconstrained problem. minimize f(x), (2.1)

Lecture Unconstrained optimization. In this lecture we will study the unconstrained problem. minimize f(x), (2.1) Lecture 2 In this lecture we will study the unconstrained problem minimize f(x), (2.1) where x R n. Optimality conditions aim to identify properties that potential minimizers need to satisfy in relation

More information

Numerical Methods Lecture 2 Simultaneous Equations

Numerical Methods Lecture 2 Simultaneous Equations CGN 42 - Computer Methods Numerical Methods Lecture 2 Simultaneous Equations Topics: matrix operations solving systems of equations Matrix operations: Adding / subtracting Transpose Multiplication Adding

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

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

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

Statistics for Python

Statistics for Python Statistics for Python An extension module for the Python scripting language Michiel de Hoon, Columbia University 2 September 2010 Statistics for Python, an extension module for the Python scripting language.

More information

Multiple Random Variables

Multiple Random Variables Multiple Random Variables This Version: July 30, 2015 Multiple Random Variables 2 Now we consider models with more than one r.v. These are called multivariate models For instance: height and weight An

More information

Power Spectrum Normalizations for HERA

Power Spectrum Normalizations for HERA Power Spectrum Normalizations for HERA April 4, 2017 by Aaron Parsons 1 Background The relation between the delay-transformed visibility, Ṽ, and the three-dimensional power spectrum of reionization, P

More information

Line Search Algorithms

Line Search Algorithms Lab 1 Line Search Algorithms Investigate various Line-Search algorithms for numerical opti- Lab Objective: mization. Overview of Line Search Algorithms Imagine you are out hiking on a mountain, and you

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

MAS212 Scientific Computing and Simulation

MAS212 Scientific Computing and Simulation MAS212 Scientific Computing and Simulation Dr. Sam Dolan School of Mathematics and Statistics, University of Sheffield Autumn 2017 http://sam-dolan.staff.shef.ac.uk/mas212/ G18 Hicks Building s.dolan@sheffield.ac.uk

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

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

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

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

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

IV. Covariance Analysis

IV. Covariance Analysis IV. Covariance Analysis Autocovariance Remember that when a stochastic process has time values that are interdependent, then we can characterize that interdependency by computing the autocovariance function.

More information

Gaussian random variables inr n

Gaussian random variables inr n Gaussian vectors Lecture 5 Gaussian random variables inr n One-dimensional case One-dimensional Gaussian density with mean and standard deviation (called N, ): fx x exp. Proposition If X N,, then ax b

More information

Basic Linear Algebra in MATLAB

Basic Linear Algebra in MATLAB Basic Linear Algebra in MATLAB 9.29 Optional Lecture 2 In the last optional lecture we learned the the basic type in MATLAB is a matrix of double precision floating point numbers. You learned a number

More information

Designing Information Devices and Systems I Spring 2017 Babak Ayazifar, Vladimir Stojanovic Homework 2

Designing Information Devices and Systems I Spring 2017 Babak Ayazifar, Vladimir Stojanovic Homework 2 EECS 16A Designing Information Devices and Systems I Spring 2017 Babak Ayazifar, Vladimir Stojanovic Homework 2 This homework is due February 6, 2017, at 23:59. Self-grades are due February 9, 2017, at

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

MAT 275 Laboratory 4 MATLAB solvers for First-Order IVP

MAT 275 Laboratory 4 MATLAB solvers for First-Order IVP MAT 275 Laboratory 4 MATLAB solvers for First-Order IVP In this laboratory session we will learn how to. Use MATLAB solvers for solving scalar IVP 2. Use MATLAB solvers for solving higher order ODEs and

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

epistasis Documentation

epistasis Documentation epistasis Documentation Release 0.1 Zach Sailer May 19, 2017 Contents 1 Table of Contents 3 1.1 Setup................................................... 3 1.2 Basic Usage...............................................

More information

Here we consider soliton solutions of the Korteweg-de Vries (KdV) equation. This equation is given by u t + u u x + 3 u

Here we consider soliton solutions of the Korteweg-de Vries (KdV) equation. This equation is given by u t + u u x + 3 u Lab 3 Solitons Lab Objective: We study traveling wave solutions of the Korteweg-de Vries (KdV) equation, using a pseudospectral discretization in space and a Runge-Kutta integration scheme in time. Here

More information

ECE Lecture #10 Overview

ECE Lecture #10 Overview ECE 450 - Lecture #0 Overview Introduction to Random Vectors CDF, PDF Mean Vector, Covariance Matrix Jointly Gaussian RV s: vector form of pdf Introduction to Random (or Stochastic) Processes Definitions

More information

Exploratory data analysis

Exploratory data analysis Exploratory data analysis November 29, 2017 Dr. Khajonpong Akkarajitsakul Department of Computer Engineering, Faculty of Engineering King Mongkut s University of Technology Thonburi Module III Overview

More information

Stochastic Processes

Stochastic Processes Elements of Lecture II Hamid R. Rabiee with thanks to Ali Jalali Overview Reading Assignment Chapter 9 of textbook Further Resources MIT Open Course Ware S. Karlin and H. M. Taylor, A First Course in Stochastic

More information

Random Process. Random Process. Random Process. Introduction to Random Processes

Random Process. Random Process. Random Process. Introduction to Random Processes Random Process A random variable is a function X(e) that maps the set of experiment outcomes to the set of numbers. A random process is a rule that maps every outcome e of an experiment to a function X(t,

More information

lektion10 1 Lektion 10 January 29, Lineare Algebra II

lektion10 1 Lektion 10 January 29, Lineare Algebra II lektion January 29, 28 Table of Contents Lineare Algebra II. Matrixplots.2 Eigenwerte, Eigenvektoren, Jordannormalform.3 Berechung des Rangs.4 Normen.5 Kreuzprodukt 2 Reihenentwicklung (Taylor) In [2]:

More information

Fin System, Inc. Company Report. Temperature Profile Calculators. Team 1 J. C. Stewards, Lead A. B. Williams, Documentation M. D.

Fin System, Inc. Company Report. Temperature Profile Calculators. Team 1 J. C. Stewards, Lead A. B. Williams, Documentation M. D. Fin System, Inc. Company Report Temperature Profile Calculators Team 1 J. C. Stewards, Lead A. B. Williams, Documentation M. D. Daily, Programmer Submitted in Fulfillment of Management Requirements August

More information

CCNY. BME I5100: Biomedical Signal Processing. Stochastic Processes. Lucas C. Parra Biomedical Engineering Department City College of New York

CCNY. BME I5100: Biomedical Signal Processing. Stochastic Processes. Lucas C. Parra Biomedical Engineering Department City College of New York BME I5100: Biomedical Signal Processing Stochastic Processes Lucas C. Parra Biomedical Engineering Department CCNY 1 Schedule Week 1: Introduction Linear, stationary, normal - the stuff biology is not

More information

A Probability Review

A Probability Review A Probability Review Outline: A probability review Shorthand notation: RV stands for random variable EE 527, Detection and Estimation Theory, # 0b 1 A Probability Review Reading: Go over handouts 2 5 in

More information

ECE Lecture #9 Part 2 Overview

ECE Lecture #9 Part 2 Overview ECE 450 - Lecture #9 Part Overview Bivariate Moments Mean or Expected Value of Z = g(x, Y) Correlation and Covariance of RV s Functions of RV s: Z = g(x, Y); finding f Z (z) Method : First find F(z), by

More information

ENSC327 Communications Systems 19: Random Processes. Jie Liang School of Engineering Science Simon Fraser University

ENSC327 Communications Systems 19: Random Processes. Jie Liang School of Engineering Science Simon Fraser University ENSC327 Communications Systems 19: Random Processes Jie Liang School of Engineering Science Simon Fraser University 1 Outline Random processes Stationary random processes Autocorrelation of random processes

More information

(Artificial) Neural Networks in TensorFlow

(Artificial) Neural Networks in TensorFlow (Artificial) Neural Networks in TensorFlow By Prof. Seungchul Lee Industrial AI Lab http://isystems.unist.ac.kr/ POSTECH Table of Contents I. 1. Recall Supervised Learning Setup II. 2. Artificial Neural

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

Statistical signal processing

Statistical signal processing Statistical signal processing Short overview of the fundamentals Outline Random variables Random processes Stationarity Ergodicity Spectral analysis Random variable and processes Intuition: A random variable

More information

Introduction. Spatial Processes & Spatial Patterns

Introduction. Spatial Processes & Spatial Patterns Introduction Spatial data: set of geo-referenced attribute measurements: each measurement is associated with a location (point) or an entity (area/region/object) in geographical (or other) space; the domain

More information

Stochastic Processes. M. Sami Fadali Professor of Electrical Engineering University of Nevada, Reno

Stochastic Processes. M. Sami Fadali Professor of Electrical Engineering University of Nevada, Reno Stochastic Processes M. Sami Fadali Professor of Electrical Engineering University of Nevada, Reno 1 Outline Stochastic (random) processes. Autocorrelation. Crosscorrelation. Spectral density function.

More information

Low-Pass Filter _012 Triple Butterworth Filter to avoid numerical instability for high order filter. In [5]: import numpy as np import matplotlib.pyplot as plt %matplotlib notebook fsz = (7,5) # figure

More information

Matrix-Vector Operations

Matrix-Vector Operations Week3 Matrix-Vector Operations 31 Opening Remarks 311 Timmy Two Space View at edx Homework 3111 Click on the below link to open a browser window with the Timmy Two Space exercise This exercise was suggested

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

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

MATLAB BASICS. Instructor: Prof. Shahrouk Ahmadi. TA: Kartik Bulusu

MATLAB BASICS. Instructor: Prof. Shahrouk Ahmadi. TA: Kartik Bulusu MATLAB BASICS Instructor: Prof. Shahrouk Ahmadi 1. What are M-files TA: Kartik Bulusu M-files are files that contain a collection of MATLAB commands or are used to define new MATLAB functions. For the

More information

Lecture - 30 Stationary Processes

Lecture - 30 Stationary Processes Probability and Random Variables Prof. M. Chakraborty Department of Electronics and Electrical Communication Engineering Indian Institute of Technology, Kharagpur Lecture - 30 Stationary Processes So,

More information

11. Further Issues in Using OLS with TS Data

11. Further Issues in Using OLS with TS Data 11. Further Issues in Using OLS with TS Data With TS, including lags of the dependent variable often allow us to fit much better the variation in y Exact distribution theory is rarely available in TS applications,

More information

+ MATRIX VARIABLES AND TWO DIMENSIONAL ARRAYS

+ MATRIX VARIABLES AND TWO DIMENSIONAL ARRAYS + MATRIX VARIABLES AND TWO DIMENSIONAL ARRAYS Matrices are organized rows and columns of numbers that mathematical operations can be performed on. MATLAB is organized around the rules of matrix operations.

More information

New Mexico Tech Hyd 510

New Mexico Tech Hyd 510 Vectors vector - has magnitude and direction (e.g. velocity, specific discharge, hydraulic gradient) scalar - has magnitude only (e.g. porosity, specific yield, storage coefficient) unit vector - a unit

More information

Designing Information Devices and Systems I Fall 2015 Anant Sahai, Ali Niknejad Homework 2. This homework is due September 14, 2015, at Noon.

Designing Information Devices and Systems I Fall 2015 Anant Sahai, Ali Niknejad Homework 2. This homework is due September 14, 2015, at Noon. EECS 16A Designing Information Devices and Systems I Fall 2015 Anant Sahai, Ali Niknejad Homework 2 This homework is due September 14, 2015, at Noon. Submission Format Your homework submission should consist

More information

Python. Tutorial. Jan Pöschko. March 22, Graz University of Technology

Python. Tutorial. Jan Pöschko. March 22, Graz University of Technology Tutorial Graz University of Technology March 22, 2010 Why? is: very readable easy to learn interpreted & interactive like a UNIX shell, only better object-oriented but not religious about it slower than

More information

MAT 275 Laboratory 4 MATLAB solvers for First-Order IVP

MAT 275 Laboratory 4 MATLAB solvers for First-Order IVP MATLAB sessions: Laboratory 4 MAT 275 Laboratory 4 MATLAB solvers for First-Order IVP In this laboratory session we will learn how to. Use MATLAB solvers for solving scalar IVP 2. Use MATLAB solvers for

More information

Name of the Student: Problems on Discrete & Continuous R.Vs

Name of the Student: Problems on Discrete & Continuous R.Vs Engineering Mathematics 05 SUBJECT NAME : Probability & Random Process SUBJECT CODE : MA6 MATERIAL NAME : University Questions MATERIAL CODE : JM08AM004 REGULATION : R008 UPDATED ON : Nov-Dec 04 (Scan

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

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

1. Introduction. Hang Qian 1 Iowa State University

1. Introduction. Hang Qian 1 Iowa State University Users Guide to the VARDAS Package Hang Qian 1 Iowa State University 1. Introduction The Vector Autoregression (VAR) model is widely used in macroeconomics. However, macroeconomic data are not always observed

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

Bayesian Analysis - A First Example

Bayesian Analysis - A First Example Bayesian Analysis - A First Example This script works through the example in Hoff (29), section 1.2.1 We are interested in a single parameter: θ, the fraction of individuals in a city population with with

More information

P (x). all other X j =x j. If X is a continuous random vector (see p.172), then the marginal distributions of X i are: f(x)dx 1 dx n

P (x). all other X j =x j. If X is a continuous random vector (see p.172), then the marginal distributions of X i are: f(x)dx 1 dx n JOINT DENSITIES - RANDOM VECTORS - REVIEW Joint densities describe probability distributions of a random vector X: an n-dimensional vector of random variables, ie, X = (X 1,, X n ), where all X is are

More information