Multiple Runs
This commit is contained in:
@@ -1,24 +1,31 @@
|
||||
tic;
|
||||
samples = 10000000;
|
||||
samples = 100000;
|
||||
xBounds = LinearBounds(0,20);
|
||||
yBounds = LinearBounds(-10,150000);
|
||||
bounds = Bounds(xBounds,yBounds);
|
||||
pointsInside = 0;
|
||||
realValue = realIntegral(bounds.x);
|
||||
listOfErrors = [];
|
||||
listOfIntegrals = [];
|
||||
|
||||
for i = 0:samples
|
||||
for i = 1:20
|
||||
for ii = 0:samples
|
||||
toTestPoint = bounds.getRandomPoint;
|
||||
if getIsInside(toTestPoint)
|
||||
pointsInside = pointsInside+1;
|
||||
end
|
||||
end
|
||||
listOfIntegrals(i) = pointsInside/samples*bounds.area;
|
||||
listOfErrors(i) = abs(listOfIntegrals(i) - realValue);
|
||||
pointsInside = 0;
|
||||
end
|
||||
|
||||
|
||||
format longG
|
||||
integral = (pointsInside/samples)*bounds.area
|
||||
realValue
|
||||
error = abs(realValue-integral)
|
||||
samples
|
||||
listOfErrors
|
||||
listOfIntegrals
|
||||
toc
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user