Cody

Problem 1315. Volume of a sphere given its surface area

Solution 3414663

Submitted on 26 Oct 2020 by Wesley Maa
This solution is locked. To view this solution, you need to provide a solution of the same size or smaller.

Test Suite

Test Status Code Input and Output
1   Pass
x = 4*pi; y_correct = 4*pi/3; assert(abs(sphere_volume(x) - y_correct) < tolerance)

y = 4.1888

2   Pass
x = 36*pi; y_correct = 36*pi; assert(abs(sphere_volume(x) - y_correct) < tolerance)

y = 113.0973

3   Pass
x = 6; y_correct = sqrt(6/pi); assert(abs(sphere_volume(x) - y_correct) < tolerance)

y = 1.3820

4   Pass
x = pi; y_correct = pi/6; assert(abs(sphere_volume(x) - y_correct) < tolerance)

y = 0.5236

5   Pass
x = 10*pi; y_correct = 16.5576; assert(abs(sphere_volume(x) - y_correct) < tolerance)

y = 16.5576

6   Pass
x = 17*pi; y_correct = 36.7005; assert(abs(sphere_volume(x) - y_correct) < tolerance)

y = 36.7005

7   Pass
x = 42; y_correct = 25.5946; assert(abs(sphere_volume(x) - y_correct) < tolerance)

y = 25.5946

8   Pass
x = 1/pi; y_correct = 0.0169; assert(abs(sphere_volume(x) - y_correct) < tolerance)

y = 0.0169

Suggested Problems

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!