Solver Surface area and Volume of a pyramid.
Algebra
->
Volume
-> Solver Surface area and Volume of a pyramid.
Log On
Geometry: Volume, Metric volume
Geometry
Solvers
Solvers
Lessons
Lessons
Answers archive
Answers
Source code of 'Surface area and Volume of a pyramid.'
This Solver (Surface area and Volume of a pyramid.)
was created by by
hummingbird(0)
:
View Source
,
Show
,
Put on YOUR site
About hummingbird
:
==section input Input the following parameters of the pyramid: L is the length of the square base H is the perpendicular height of the vertex from the base H = *[input h=1] and L = *[input l=1] ==section solution perl if($r<=0 || $l<=0){ print" Please enter the positive values ( >0 ) of parameter!!!"; } else{ my $s = sqrt((1/4)*$l*$l+$h*$h); my $p = 4*$l; my $a = $l*$l; my $sa = (1/2)*$p*$s; my $sa2 = $sa+ $a; my $v = (1/3)*$a*$h; print " This formula is for the square base pyramid whose side length is 'L' and Height of the pyramid is 'H' The surface area (SA) of a pyramid is given by{{{SA = A + ((P*S)/2)}}} where: A is the area of the base P is the perimeter of the base S is the slant height along the bisector of a face (i.e. the length from the midpoint of any edge of the base to the top) {{{S= sqrt((L/2)^2+H^2)}}} L is the length of the square base H is the perpendicular height of the vertex from the base The volume of the cone can be found by the formula {{{V=(1/3)*A*H}}} In our case the desired values are thus: S = {{{sqrt((1/4)*$l*$l+$h*$h) = $s}}} SA = {{{$a+ (1/2)*$p*$s= $sa2}}} SA = {{{$l*$l+ (1/2)*4*$l*$s= $sa2}}} V = {{{(1/3)*$a*$h = $v}}} For more on this topic, refer to <A HREF=Pyramid_%28geometry%29.wikipedia>Pyramid</A> "; } ==section output s, sa, v, ==section check h=3 L=1 s=4.03112887 sa=8.0622577 v=1