Starting from:

$30

E880-Problem Set 6 Solved

1            Integration
EvaluateR01 x 1/3dx using(A)Trapezoidrule,(B)Gauss-ChebyshevQuadratureand(C)Gauss-Legendre quadrature. Try 3, 5 and 11 nodes with each approach. Compute the exact integral, report relative errors for each method & number of nodes, and comment on relative precision of the methods.

You have to code everything yourself here, but you can take the Gaussian quadrature nodes and weights from the table in the Judd textbook).

2            Monte-Carlo
Evaluate R[0,1]3 ex+2y+3zdxdydz using (A) pseudo-random numbers from Matlab’s rand(), (B) uniformly spaced grid. For (A), use the number of draws of the form 100n with n = 1,2,...,30. For (C), use n equally spaced nodes along each dimension with n ≥ 5 and n3 ≤ 3000. Compute the true value of the integral, and plot the relative errors vs. number of integrand evaluations. Comment on precision of different methods, and ease of implementation.

You have to code everything yourself here other than obtaining the pseudo-random numbers.

More products