Hw5_sol - /usr/bin/env python AST5765/4762 2009 HW5 Solutions NOTE This assignment uses Monte Carlo methods to generate datasets This means that

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
#! /usr/bin/env python # AST5765/4762 2009 HW5 Solutions # NOTE: This assignment uses Monte Carlo methods to generate datasets. # This means that you may get different numbers from those presented # here. In the elimination questions, you may eliminate all 4 bad # points right away, or have one that is within the data's range and # is never gotten rid of. Try running it more than once to get a # sense for how it behaves. import numpy as np import matplotlib.pyplot as plt import numpy.random # 1. N = 1000 #sigp = np.sqrt(N) # appropriate for Gaussian approximation of Poisson #cx = N # appropriate for Gaussian approximation of Poisson Nump = 396 psamp = np.random.poisson(N, Nump) ulo = 0. uhi = 1e5 Numu = 4 usamp = np.random.uniform(ulo, uhi, Numu) samp = np.concatenate((psamp, usamp)) print(samp.mean()) # 1324.9651346859694 smed = np.median(samp.flat) print(smed) # 1001.2992269540773, which is closer to N = 1000. # 2.
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 11/09/2009 for the course AST 4762 taught by Professor Harrington during the Fall '09 term at University of Central Florida.

Page1 / 2

Hw5_sol - /usr/bin/env python AST5765/4762 2009 HW5 Solutions NOTE This assignment uses Monte Carlo methods to generate datasets This means that

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online