math.geometry
areas, volumes and surface areas of circles, spheres, boxes, triangles and other shapes
Areas and volumes of common shapes, from their measurements.
good to know
Section titled “good to know”Give lengths with units and the answer has the right units: circle_area(3 cm) is in cm². Plain numbers give plain numbers.
Tags: geometry
circle_areathe area of a circle of radius rcircumferencethe distance around a circle of radius rsphere_volumethe volume of a sphere of radius rsphere_areathe surface area of a sphere of radius rcylinder_volumethe volume of a cylinder with base radius r and height hcylinder_areathe total surface area of a closed cylinder with base radius r and height hcone_volumethe volume of a cone with base radius r and height hcone_areathe total surface area of a cone with base radius r and height h, base includedbox_volumethe volume of a box with sides a, b and cbox_areathe surface area of a box with sides a, b and cpyramid_volumethe volume of a pyramid with base area base and height htetrahedron_volumethe volume of a regular tetrahedron with edge length atriangle_areathe area of a triangle from its base and heighttrapezoid_areathe area of a trapezoid with parallel sides a and b, and height hparallelogram_areathe area of a parallelogram from its base and heightpolygon_areathe area of a polygon from its corners in order, each a list [x, y]
Functions
Section titled “Functions”circle_area
Section titled “circle_area”circle_area(r: any) -> any
the area of a circle of radius r
1circle_area(3 cm)28.2743 cm^22circle_area(1)3.14159See also circumference, sphere_area
circumference
Section titled “circumference”circumference(r: any) -> any
the distance around a circle of radius r
1circumference(3 cm)18.8496 cmSee also circle_area
sphere_volume
Section titled “sphere_volume”sphere_volume(r: any) -> any
the volume of a sphere of radius r
1sphere_volume(2 m)33.5103 m^3See also sphere_area
sphere_area
Section titled “sphere_area”sphere_area(r: any) -> any
the surface area of a sphere of radius r
1sphere_area(2 m)50.2655 m^2See also sphere_volume, circle_area
cylinder_volume
Section titled “cylinder_volume”cylinder_volume(r: any, h: any) -> any
the volume of a cylinder with base radius r and height h
1cylinder_volume(3 cm, 10 cm)282.743 cm^3See also cylinder_area, cone_volume
cylinder_area
Section titled “cylinder_area”cylinder_area(r: any, h: any) -> any
the total surface area of a closed cylinder with base radius r and height h
1cylinder_area(3 cm, 10 cm)245.044 cm^2See also cylinder_volume
cone_volume
Section titled “cone_volume”cone_volume(r: any, h: any) -> any
the volume of a cone with base radius r and height h
1cone_volume(3 cm, 10 cm)94.2478 cm^3See also cone_area, cylinder_volume
cone_area
Section titled “cone_area”cone_area(r: any, h: any) -> any
the total surface area of a cone with base radius r and height h, base included
1cone_area(3 cm, 4 cm)75.3982 cm^2See also cone_volume
box_volume
Section titled “box_volume”box_volume(a: any, b: any, c: any) -> any
the volume of a box with sides a, b and c
1box_volume(2 m, 3 m, 4 m)24 m^3See also box_area
box_area
Section titled “box_area”box_area(a: any, b: any, c: any) -> any
the surface area of a box with sides a, b and c
1box_area(2 m, 3 m, 4 m)52 m^2See also box_volume
pyramid_volume
Section titled “pyramid_volume”pyramid_volume(base: any, h: any) -> any
the volume of a pyramid with base area base and height h
1pyramid_volume(25 m^2, 6 m)50 m^3See also cone_volume
tetrahedron_volume
Section titled “tetrahedron_volume”tetrahedron_volume(a: any) -> any
the volume of a regular tetrahedron with edge length a
1tetrahedron_volume(3 cm)3.18198 cm^3See also pyramid_volume
triangle_area
Section titled “triangle_area”triangle_area(b: any, h: any) -> any / triangle_area(a: any, b: any, c: any) -> any
the area of a triangle from its base and height
Given three side lengths instead, uses Heron’s formula
1triangle_area(6 cm, 4 cm)12 cm^22triangle_area(3, 4, 5)6See also trapezoid_area, parallelogram_area
trapezoid_area
Section titled “trapezoid_area”trapezoid_area(a: any, b: any, h: any) -> any
the area of a trapezoid with parallel sides a and b, and height h
1trapezoid_area(3 cm, 5 cm, 4 cm)16 cm^2See also triangle_area
parallelogram_area
Section titled “parallelogram_area”parallelogram_area(b: any, h: any) -> any
the area of a parallelogram from its base and height
1parallelogram_area(6 cm, 4 cm)24 cm^2See also triangle_area
polygon_area
Section titled “polygon_area”polygon_area(points: list) -> any
the area of a polygon from its corners in order, each a list [x, y]
1polygon_area([[0, 0], [4, 0], [4, 3]])62polygon_area([[0 m, 0 m], [2 m, 0 m], [2 m, 2 m], [0 m, 2 m]])4 m^2See also triangle_area
More examples
Section titled “More examples”geometry
Section titled “geometry”1# the area of a circle of radius 3 cm2circle_area(3 cm)28.2743 cm^23# how much a 10 cm sphere holds, in liters4sphere_volume(10 cm) to L4.18879 L5# the area of a 3-4-5 triangle6triangle_area(3, 4, 5)67# the area of a polygon from its corners8polygon_area([[0, 0], [4, 0], [4, 3]])6Example results generated on 2026-11-04. Ones using now, today or randomness will differ when you run them.