联系方式

  • QQ:99515681
  • 邮箱:99515681@qq.com
  • 工作时间:8:00-23:00
  • 微信:codinghelp

您当前位置:首页 >> Algorithm 算法作业Algorithm 算法作业

日期:2019-12-07 10:15

Math 309 Extra-Credit Project 4 Fall, 2019

The amount of extra-credit will depend on the overall quality of your work. You

must submit a formal Report to show your work. The Report must be typed

and if possible prepare the Report with RMarkdown and submit both the .Rmd

file and the .html files. It is essential that you include proper comments in

your R script so the read can easily read and understand the code lines. I do

expect mathematical expressions, tables, plots, with proper explanations, interpretations,

and meaning summary of your work in the report. A work with

just plugging in numbers and plain numerical answers will get very little credit

or no extra credit at all. You must work independently and require to comply

with the university policy on academic integrity found in the Code of Student

Conduct found at

http://www.lehigh.edu/lts/official/Academic_Integrity_Vignettes.pdf.

1. (a) Show how to use Monte Carlo techniques to approximate the following

sum.∑∞k=0

cos(cos(k))/k!

(b) Use R to implement the Monte Carlo approximation of the sum in

part (a); use at least 10,000 runs.

(c) Show how to use Monte Carlo techniques to approximate the following

integration.

∫ π0cos(x/2)sin(2x)dx

(d) Use R to implement the Monte Carlo approximation of the integration

in part (c); use at least 10,000 runs.

2. (a) Show how to use Monte Carlo techniques to approximate the following

double integration.

(b) Use R to implement the Monte Carlo approximation of the double

integration in part (a); use at least 10,000 runs.

3. Let f(x) = 4/(π(1 + x2)), 0 ≤ x ≤ 1. (a) Explain how can we use the

acceptance-rejection method to generate sample from this distribution.

(b) Use R to implement the proposed algorithm in (a).

(c) Obtain the relative-frequency histogram and overly the true pdf on it.

4. We want to use the acceptance-rejection method to generate continuous

random variable X from a distribution with probability density function

f(x) = (m+n+1)!m!n!

xn(1 − x)

m for 0 ≤ x ≤ 1, n ≥ 1, n ≥ 1 and are integers;

and f(x) is zero otherwise. Suppose we use the pdf of Uniform(0,1) as the

proposal pdf (i.e., g(x) = 1, for 0 ≤ x ≤ 1).

(a) Find an appropriate constant c > 1 (i.e., as small as possible) such

that f(x)/(cg(x)) < 1 for 0 ≤ x ≤ 1.

(b) For n = m = 2, carry out the simulation with at least 5,000 runs.

Find the theoretical values of E(X) and V ar(X) and then compare with

their simulated values.

(c) Obtain the relative-frequency histogram of the simulated values; then

overlay the theoretical pdf.

(d) Repeat (b) and (c) for m = 2 and n = 4.


版权所有:留学生编程辅导网 2020 All Rights Reserved 联系方式:QQ:99515681 微信:codinghelp 电子信箱:99515681@qq.com
免责声明:本站部分内容从网络整理而来,只供参考!如有版权问题可联系本站删除。 站长地图

python代写
微信客服:codinghelp