In geometry, a pyramid is a polyhedron formed by connecting a polygonal base and a point, called the apex. Each base edge and apex form a triangle. It is a conic solid with polygonal base.
A pyramid with an n-sided base will have n + 1 vertices, n + 1 faces, and 2n edges. All pyramids are self-dual.
When unspecified, the base is usually assumed to be square.
If the base is a regular polygon and the apex is above the center of the polygon, an n-gonal pyramid will have Cnv symmetry.
Pyramids are a subclass of the prismatoids.
The volume of a pyramid is where B is the area of the base and h the height from the base to the apex. This works for any location of the apex, provided that h is measured as the perpendicular distance from the plane which contains the base. In 499 AD Aryabhata, a mathematician-astronomer from the classical age of Indian mathematics and Indian astronomy, used this method in the Aryabhatiya (section 2.6) .
The formula can be formally proved using calculus: By similarity, the dimensions of a cross section parallel to the base increase linearly from the apex to the base. Then, the cross section at any heighty is the base scaled by a factor of , where h is the height from the base to the apex. Since the area of any shape is multiplied by the square of the shape's scaling factor, the area of a cross section at height y is . The volume is given by the integral
The volume of a pyramid whose base is an n-sided regular polygon with side length s and whose height is h is therefore:
The volume of a pyramid whose base is a regular n-sided polygon with radius R is therefore:
The same equation, also holds for cones with any base (not necessarily a polyhedron). This can be proven by the same argument as above, or, for sufficiently simple cones, by approximating the cone by pyramids;
The surface area of a pyramid is where B is the base area, P is the base perimeter and L is the slant height: where h is the pyramid altitude and r is the inradius of the base.
class Pyramid{
String name;
double a=2;
double h=4;
void calculate(){
System.out.println(a*a+(a*h*2));
}
void calculate1(){
System.out.println((a*a*h)/3);
}
}
class CalPy{
public static void main(String args[]){
Pyramid p1=new Pyramid();
p1.name="Pyramid-Area";
System.out.println(p1.name);
p1.calculate();
Pyramid p2=new Pyramid();
p2.name="Pyramid-Volume";
System.out.println(p2.name);
p2.calculate1();
}
}
String name;
double a=2;
double h=4;
void calculate(){
System.out.println(a*a+(a*h*2));
}
void calculate1(){
System.out.println((a*a*h)/3);
}
}
class CalPy{
public static void main(String args[]){
Pyramid p1=new Pyramid();
p1.name="Pyramid-Area";
System.out.println(p1.name);
p1.calculate();
Pyramid p2=new Pyramid();
p2.name="Pyramid-Volume";
System.out.println(p2.name);
p2.calculate1();
}
}
0 comments:
Post a Comment