Question: Help me with questions 3 that's my solution from question 2 n1 Web VPython 3.2 #Question1 ##Defining variables value_of_Area = 0.0 incount = 0 MArea

Help me with questions 3 that's my solution from question 2 n1 Web VPython 3.2
#Question1 ##Defining variables value_of_Area = 0.0 incount = 0 MArea = 0 averageArea = 0 i = 0 j = 0 x_min = -1 x_max = 2 y_min = 0 y_max = 2
##Defining graphical displays gdisplay() inside = gdots(color=color.red) outside = gdots(color=color.blue) gdisplay()
##Double integral function def f(x, y): return x2 + y2
##Processing for j in range(1, M+1): i = 0 incount = 0 value_of_Area = 0
outside.delete() inside.delete()
for i in range(1, N+1): rate(1000) x_coord = x_min + random()*(x_max - x_min) y_coord = y_min + random()*(y_max - y_min) if f(x_coord, y_coord)
Web VPython 3.2 ##Question2 ###Defining variables x_min = -1 x_max = 3 incount = 0 value_of_Area = 0.0 MArea = 0 averageArea = 0 ###Processing for j in range(1, m+1): incount = 0 value_of_Area = 0.0
for i in range(1, N+1): x_coord = x_min + random()*(x_max - x_min)
if x_coord >= x_min and x_coord
value_of_Area = (x_max - x_min)*(incount/N)
MArea += value_of_Area
averageArea = MArea/m print("Area estimate using throwing stones method = ", averageArea) And here's the code for mean value method: N = 1000 Defining variables x_min = -1 x_max = 3 value_of_Area = 0.0 ###Processing for i in range(1, N+1): x_coord = x


If we wanted to calculate the properties of a magnesium atom (12 electrons) we would integrate some function over the coordinates of each electron - a 36D integral. This could take us a while to do. As an exercise, use the mean value MC approach to evaluate the following 10D integral that has an analytical solution of 156/6. Following the same evaluation route as you did in A,B and C in question 1. I=01dx101dx201dx10(x1+x2++x10)2 Please include your code as well as the graphs and associated comments in your report. Question 1 Thus far we have used the Throwing stones method to integrate a function of one variable. Now extend this to determine the integral of I=1202x2+y2dxdy Firstly, visualise this then determine the integral in Excel. Once again set up a workbook and determine for the same N and M values as previously this is to help you understand the system. Adapt your VPython code do the following: Integrate x2 between -1 and 3 between using both the stone throwing approach and the mean value approach. 1. For m=1&N=1000, what do you observe if you plot N vs calculated value of the function for both methods? 2. For N=102,103,104,105,106 and m=16 plot the N vs absolute error for both methods. What relationship fits this distribution of points? Comment on what you observe 3. Now plot N against the Standard Deviation (the Variance) for both methods and comment on what you observe. Please include your well commented codes as well as the requested graphs and associated comments in your report
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
