Hello, dear friend, you can consult us at any time if you have any questions, add WeChat: daixieit

MSDM5004 Part II Assignment 2

2022

1.   Consider the integral

 = 1sin2√100

(a)       Calculate I by adaptive trapezoidal rule method to an approximate

accuracy of  = 10−6  (i.e., correct to six digits after the decimal point).     Start with one single integration slice and work up from there to two, four, eight, and so forth. Have your program print out the number of slices, its    estimate of the integral, and its estimate of the error on the integral, for       each value of the number of slices N, until the target accuracy is reached.

(b)       Calculate I by adaptive Simpson’s rule method to an approximate

accuracy of  = 10−6 . Starting with two integration slices, work up from there to four, eight, and so forth, printing out the results at each step until the required accuracy is reached. Compare the results and the efficiency   with that of part (a).

(c)       Calculate I by Romberg integration technique to an approximate

accuracy of  = 10−6 . Have your program print out a triangular table of    values, as in the lecture notes, of all the Romberg estimates ofthe integral. Compare the results and the efficiency with that of part (a) and (b).

 

 

2.   Debye’s theory of solids gives the heat capacity of a solid at temperature T to be

 = 9 ()3    

where V is the volume of the solid, ρ is the number density of atoms, kB is          Boltzmann’s constant, and θD is the so-called Debye temperature, a property of solids that depends on their density and speed of sound.

(a)       Define dimensionless heat capacity by

    

 =

and dimensionless temperature by


 =       

 

Write a Python function that calculates  for a given value of  by Gaussian quadrature.

(b)       You are asked to find the heat capacity of a sample consisting of 1000

cubic centimeters of solid aluminum, which has a number density of ρ = 6.022 × 1028 m−3 and a Debye temperature of θD = 428 K.

Compute it by the program you wrote in (a) with N = 50 sample points.

Make a graph ofthe heat capacity as a function oftemperature from T = 5 K to T = 500 K.

 

3.         In this question you will estimate the volume of a sphere ofunit radius in ten dimensions using a Monte Carlo method.

Consider the equivalent problem in two dimensions, the area of a circle ofunit radius:

 

The area of the circle, the shaded area above, is given by the integral

 ()

where () = 1 everywhere inside the circle and zero everywhere outside. In other words,


 


() = {1

 


if 2  + 2  ≤ 1

Otherwise


So if we didn’t already know the area of the circle, we could calculate it by Monte Carlo integration. We would generate a set of N random points (xy), where both   x and y are in  the range from −1 to 1. Then the two-dimensional version for this   calculation would be

 

 ≈     ∑ ( , )

 =1

Generalize this method to the ten-dimensional case and write a program to           perform a Monte Carlo calculation ofthe volume of a sphere ofunit radius in ten dimensions.

Ifwe had to do a ten-dimensional integral the traditional way, it would take a very long time. Even with only 100 points along each axis (which wouldn’t give a very accurate result) we’d still have 10010 = 1020 points to sample, which is impossible  on any computer. But using the Monte Carlo method we can get a pretty good        result with a million points or so.

 

 

4.         Consider the integral

 = ∫                 

(a)       Set the artificial cutoff of the upper limit at x = 10 and evaluate the

integral

′  = ∫                  

 

 

State your answer as well as the error estimation. Use number of points N = 1000000.

(b)       State two shortcomings ofthe above direct simple Monte Carlo method.

 

 

Now let us evaluate the integral by sampling points with weight function

1

() ∝               


(c)       Evaluate the integral I by Monte Carlo integration using 1000000 points with weight function () sampled by the transformation method. State your answer and the error estimation. How do they compare with the      results in (a)?

(d)       For practice, also sample 1000000 points with weight () by Metropolis Algorithm to evaluate I. State your answer and the error estimation. How   do they compare with the results of (a) and (c)?