Вы находитесь на странице: 1из 3

Chris Adamczyk

Problem Statement:
Determine the cost of gold plating the dome atop of the building that hosts the House of
Representatives when the dome is a prolate spheroid and has polar radius of 52 feet, an
equatorial radius of 42 feet, and gold is quoted at $500 per square foot.

Input/Output:
 Input
o Equatorial radius (eq_rad) (42 Feet)
o Polar radius (pol_rad) (52 feet)
o Cost of gold (goldcost) ($500/sq.ft)
 Output
o Cost of plating dome (total_cost)
o Total surface area of the dome (sa)
o Number of sheets required (num_sheets)
o The percent error if the dome had been a hemisphere, using the polar
radius as the radius of the hemisphere (error)

Hand Example:
How do you find the surface area of a prolate spheroid?

Sa=51518.9 square feet


Num_sheets=51519

How do you determine the total cost?


o totalcost=num_sheets*500
o totalcost=51518.9*500
o totalcost=$25759425.78

Algorithm Development
o User input of radii and gold cost
o Calculate surface area of prolate in square feet
o Multiply surface area by cost of gold
o Print result

Matlab Script
clc
clear

%use this program to find out the cost of plating the dome of the house of
%Rep. in gold.

%ask the user to input the equatorial and polar radii, along with the cost
%of gold
eq_rad=input('What is the equatorial radius in feet? ');
pol_rad=input('What is the Polar Radius in feet? ');
gold=input('What is the cost per sheet of gold? ');

%multiply the radii by 2 to get the diameters


a=eq_rad*2;
c=pol_rad*2;

%do out the math for the surface area of a prolate


a1=2*pi*a^2;
a2=(2*pi*a*c^2)/sqrt(c^2-a^2);
a3=asin((sqrt(c^2-a^2))/c);
a4=(a1+(a2*a3));
sa=a4/2;

%the numberof sheets must be rounded up to the nearest whole number because
%fractional sheets are probably not an option
num_sheets=ceil(sa);

%calculate the cost of the gold


total_cost=gold*num_sheets;

%now we will calculate the percent error of square feet if the dome had been a
hemisphere,
%using the polar radius
hemi_1=(4*pi*pol_rad^2)/2;

%now calculate the percent error


error=(abs(hemi_1-sa)/sa)*100;

%now output your values


fprintf('The surface area of the dome is: %g ', sa), disp('square feet');
fprintf('The number of sheets required is: %g \n', num_sheets);
fprintf('The total cost of plating the dome is: $%g \n', total_cost);
fprintf('The percent error if the area had been calculated as a hemisphere using the polar
radius is: %g \n', error)

Вам также может понравиться