Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Problem 2 In n-dimensional space, the solid sphere of radius r at point p is the set of points x such that Dist (x, P)

image text in transcribed
image text in transcribed
Problem 2 In n-dimensional space, the solid sphere of radius r at point p is the set of points x such that Dist (x, P) Er. Write a function VolumeSphereIntersect (P, Q, R, S, T, W) which uses a Monte Carlo method with T trials to compute the volume of the intersection of a sphere of radius R centered at P with a sphere of radius S centered at Q. The function should return a confidence interval with confidence W. Here P and Q are n-dimensional vectors; R, S are positive floating numbers, T is a positive integer: and W is an floating point number between 0 and 1. 30 (It is possible to compute the exact answer, with some geometry and some calculus, but that is not the assignment.) To carry out the Monte Carlo method, use a uniform distribution within the box [B1, Ci] x [B2, C2] x [Bn, Ca] where BR = max(P[K] - R., Q[K] - S) and Ck = min P[K] + R, Q[K] + S). Note that if the distance from P to Q is greater than R + S, then the two spheres do not intersect, and so the function should simply return [0, 0]. Thus for example with P= [1,0, -1] Q=[2, 1,0] R=8 S=3 T=10000 W=0.95 you should generate 10,000 points within the box [-1, 5] x [-2, 4] x [-3, 3). In this case, the sphere around Q is inside the sphere about P, so it is particularly easy to calculate the exact answer: namely, the volume of the sphere around Q, 47 53/3 = 367 = 113.097. The volume of the box is 63 = 216, so the fraction of the points in the box is f = 0.5236. The standard deviation of the fraction o therefore should be about vf(1 - f)/10000 = 0.005. The 95% confidence interval should therefore be about [113 - 1.95 . 0 . 216, 113 + 1.95 . 0 . 216] ~ [111, 115], with, of course, some random variation depending on the particular sample. Thus VolumeSphereIntersect (P, Q, R, S, T, W) should return approximately [111, 115]

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Income Tax Fundamentals 2013

Authors: Gerald E. Whittenburg, Martha Altus Buller, Steven L Gill

31st Edition

1111972516, 978-1285586618, 1285586611, 978-1285613109, 978-1111972516

Students also viewed these Mathematics questions