I didn't know how to find r

24 views (last 30 days)
Kinda Al Kindi
Kinda Al Kindi on 14 Oct 2021
Edited: DGM on 7 Nov 2023
A cube has a side of 18cm.
(a) Determine the radius of a sphere that has the same surface area
as the cube.
a=6*18*18
a= @(r ) (4*pi*r.^2)
(b) Determine the radius of a sphere that has the same volume as the cube.

Answers (3)

Jan
Jan on 14 Oct 2021
a = 6 * 18 * 18
a = 4 * pi * r.^2
r = sqrt(6 * 18 * 18 / (4 * pi))

Star Strider
Star Strider on 14 Oct 2021
A different approach —
ac = 6*18*18
ac = 1944
as = @(r) (4*pi*r.^2)
as = function_handle with value:
@(r)(4*pi*r.^2)
r = fzero(@(r) ac - as(r), -1)
r = 12.4378
Check_Equal_Areas = ac - as(r)
Check_Equal_Areas = 0
This solves for the ‘r’ value that makes the sphere area equal to the cube area. See the codumentation for the function to understand how it works.
.

DGM
DGM on 7 Nov 2023
Edited: DGM on 7 Nov 2023
Walter hinted at a symbolic approach to a tangential junk question-as-comment. I figured I'd provide an answer covering both before cleaning up.
% we have a cube and want to find the equivalent sphere
L0 = 15; % cube side length
syms R L positive real
Aexpr = 6*L^2 == 4*pi*R^2;
Vexpr = L^3 == 4/3*pi*R^3;
% radius for area equality
RA = solve(Aexpr,R) % symbolic solution
RA = 
RAnumeric = vpa(subs(RA,L,L0),6) % evaluate
RAnumeric = 
10.3648
% radius for volume equality
RV = solve(Vexpr,R) % symbolic solution
RV = 
RVnumeric = vpa(subs(RV,L,L0),6) % evaluate
RVnumeric = 
9.30526
Maybe we want the opposite:
% we have a sphere and want to find the equivalent cube
R0 = 15; % sphere radius
syms R L positive real
Aexpr = 6*L^2 == 4*pi*R^2;
Vexpr = L^3 == 4/3*pi*R^3;
% side length for area equality
LA = solve(Aexpr,L) % symbolic solution
LA = 
LAnumeric = vpa(subs(LA,R,R0),6) % evaluate
LAnumeric = 
21.708
% side length for volume equality
RV = solve(Vexpr,L) % symbolic solution
RV = 
LVnumeric = vpa(subs(RV,R,R0),6) % evaluate
LVnumeric = 
24.1799

Community Treasure Hunt

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

Start Hunting!