Let the origin be at the bottom left front corner. Let the bottom be the x-y plane with increasing x going from left to right and y going from near to far, while z goes from bottom to top.
Let's consider the 1/48 of the total volume of the solid that is the wedge formed by
y = 1 - sqrt(1 - x^2) -- this is based on (y-1)^2 + x^2 = 1, its a front cylindrical surface
y = 1 - z -- separating this wedge from the one above
x = .5 -- separating from a wedge on another of the star's arms
(the one on the top right)
x = 1 - z -- separating this wedge from the one below
Placing below y = 1 - z and beyond y = 1 - sqrt(1 - x^2) by itself causes this to lie below z = sqrt(1 - x^2).
Integrating is done on ((1-z) - (1 - sqrt(1 - x^2))) dx dz.
The limits of integration on z are from .5 to 1 and on x from 1-z to either .5 or where (1 - sqrt(1 - x^2)) exceeds (1-z) whichever is lower.
The result must be multiplied by 48 to get the volume of the entire object, and then subtracted from 1 to get the portion of the cube that's not in the object.
Private Sub cmdStart_Click()
stp = Val(txtStep.Text)
For z = 0.5 To 1 Step stp
For x = 1 - z To 0.5 Step stp
increm = (1 - z) - (1 - Sqr(1 - x * x))
If increm > 0 Then
t = t + increm
Else
Exit For
End If
DoEvents
Next
Next
Print 48 * t * stp * stp
DoEvents
End Sub
One would expect that the size of the error due to numerical integration would not exceed six times the increment (step size in the above program), as that would be the volume of a cubical shell of that thickness about the cube.
For the integration increments listed at the left, the total volume of the solid comes out to the figure in the right hand column below:
.01 .6906
.001 .6531
.0001 .6491 (the same algorithm in QuickBasic rather than Visual Basic,
however, produces .6494 to this many places.)
Indeed the difference, in getting more precise approximations, is indeed less than six times the increment used in the less precise approximation.
Therefore it would seem that the volume of the solid itself is 0.649, to three places, and the portion removed from the cube is .351 to that accuracy, or 35.1 % removed.
Edited on January 22, 2009, 4:37 pm
|
Posted by Charlie
on 2009-01-22 16:35:01 |