Actionscript:

var rad:Number = 1;


var surfaceArea:Number = sphereSurfaceArea(rad);

var volume:Number = sphereVolume(rad)

trace("surface area: ", surfaceArea);

trace("volume:", volume);

trace("volume / surface area:", volume / surfaceArea);


function sphereSurfaceArea(r:Number):Number{

return 4 * Math.PI * r * r;

}


function sphereVolume(r:Number):Number{

return r * r * r * (4.0/3.0) * Math.PI;

}


/*outputs:

surface area: 12.566370614359172

volume: 4.1887902047863905

volume / surface area: 0.3333333333333333

*/
Last night I was feeling curious about sphere volume and sphere surface area... I used WolframAlpha to find the neccessary equations and then wrote the above code snippet...
Check out how WolframAlpha does it:
surface area of a sphere
surface area of a sphere with radius 10
sphere volume
sphere volume with radius 10
2 Comments
volume to surface area will always be r / 3.0
after regularly picking up ninja scrolls on a daily basis , i’m keen to see what samurai action this is leading to…
That makes sense…. thanks…. not sure exactly where I was going with this…