815.worksheet08 - a) Standard Trapezoidal rule, with 2...

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

View Full Document Right Arrow Icon
Biostatistics 615 / 815 Problem Set 7 Due November 17, 2004 Random Number Generation 1. An old text book on computer simulation recommends the following sequence of pseudo-random numbers: I j+1 = a I j mod m, with a = 20,403 and m = 2 15 . What is the period of this random number generator, that is, how many numbers can be generated before the sequence repeats itself? 2. Consider the following formula for generating pseudo-random sequences: I j+1 = ( a I j + c ) mod m When c = 1 and m = 32, examine the resulting sequences when: a) a = 13 b) a = 17 c) a = 19 d) a = 10 Which of the three sequences appear random? Do all sequences have a full period (32 is the maximum period in this case)? Integration 3. Implement code to calculate the integral of the function f(x) = (1 + x)/(1 + x 2 ) in the interval (2, 4) using each of the following numerical methods:
Background image of page 1

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

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

Unformatted text preview: a) Standard Trapezoidal rule, with 2 function evaluations. b) Trapezoidal rule with 3 function evaluations. c) Simpon’s rule with 3 function evaluations. d) Two point Gaussian quadrature. The exact integral is approximately 0.83. How do you explain the differences between the 4 results above? 4. Consider the function f(x) = sqrt(x) * log(x) for x > 0 , and let f(0) = 0 . Implement code to calculate the integral of this function in the interval (0,1) using each of the following numerical methods: a) Adaptive quadrature, using the trapezoidal rule, until a relative precision of 10-5 is reached. b) Adaptive quadrature, using Simpson’s rule, until a relative precision of 10-5 is reached. c) Four point Gaussian quadrature. How many function evaluations where required in each case?...
View Full Document

This note was uploaded on 12/26/2011 for the course BIO 615 taught by Professor Abecasis during the Fall '10 term at University of Michigan.

Page1 / 2

815.worksheet08 - a) Standard Trapezoidal rule, with 2...

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