Skip to content

math.geometry

areas, volumes and surface areas of circles, spheres, boxes, triangles and other shapes

Areas and volumes of common shapes, from their measurements.

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_area the area of a circle of radius r
  • circumference the distance around a circle of radius r
  • sphere_volume the volume of a sphere of radius r
  • sphere_area the surface area of a sphere of radius r
  • cylinder_volume the volume of a cylinder with base radius r and height h
  • cylinder_area the total surface area of a closed cylinder with base radius r and height h
  • cone_volume the volume of a cone with base radius r and height h
  • cone_area the total surface area of a cone with base radius r and height h, base included
  • box_volume the volume of a box with sides a, b and c
  • box_area the surface area of a box with sides a, b and c
  • pyramid_volume the volume of a pyramid with base area base and height h
  • tetrahedron_volume the volume of a regular tetrahedron with edge length a
  • triangle_area the area of a triangle from its base and height
  • trapezoid_area the area of a trapezoid with parallel sides a and b, and height h
  • parallelogram_area the area of a parallelogram from its base and height
  • polygon_area the area of a polygon from its corners in order, each a list [x, y]
circle_area(r: any) -> any

the area of a circle of radius r

1
circle_area(3 cm)28.2743 cm^2
2
circle_area(1)3.14159
Example outputCtrl+Enter to run

See also circumference, sphere_area

circumference(r: any) -> any

the distance around a circle of radius r

1
circumference(3 cm)18.8496 cm
Example outputCtrl+Enter to run

See also circle_area

sphere_volume(r: any) -> any

the volume of a sphere of radius r

1
sphere_volume(2 m)33.5103 m^3
Example outputCtrl+Enter to run

See also sphere_area

sphere_area(r: any) -> any

the surface area of a sphere of radius r

1
sphere_area(2 m)50.2655 m^2
Example outputCtrl+Enter to run

See also sphere_volume, circle_area

cylinder_volume(r: any, h: any) -> any

the volume of a cylinder with base radius r and height h

1
cylinder_volume(3 cm, 10 cm)282.743 cm^3
Example outputCtrl+Enter to run

See also cylinder_area, cone_volume

cylinder_area(r: any, h: any) -> any

the total surface area of a closed cylinder with base radius r and height h

1
cylinder_area(3 cm, 10 cm)245.044 cm^2
Example outputCtrl+Enter to run

See also cylinder_volume

cone_volume(r: any, h: any) -> any

the volume of a cone with base radius r and height h

1
cone_volume(3 cm, 10 cm)94.2478 cm^3
Example outputCtrl+Enter to run

See also cone_area, cylinder_volume

cone_area(r: any, h: any) -> any

the total surface area of a cone with base radius r and height h, base included

1
cone_area(3 cm, 4 cm)75.3982 cm^2
Example outputCtrl+Enter to run

See also cone_volume

box_volume(a: any, b: any, c: any) -> any

the volume of a box with sides a, b and c

1
box_volume(2 m, 3 m, 4 m)24 m^3
Example outputCtrl+Enter to run

See also box_area

box_area(a: any, b: any, c: any) -> any

the surface area of a box with sides a, b and c

1
box_area(2 m, 3 m, 4 m)52 m^2
Example outputCtrl+Enter to run

See also box_volume

pyramid_volume(base: any, h: any) -> any

the volume of a pyramid with base area base and height h

1
pyramid_volume(25 m^2, 6 m)50 m^3
Example outputCtrl+Enter to run

See also cone_volume

tetrahedron_volume(a: any) -> any

the volume of a regular tetrahedron with edge length a

1
tetrahedron_volume(3 cm)3.18198 cm^3
Example outputCtrl+Enter to run

See also pyramid_volume

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

1
triangle_area(6 cm, 4 cm)12 cm^2
2
triangle_area(3, 4, 5)6
Example outputCtrl+Enter to run

See also trapezoid_area, parallelogram_area

trapezoid_area(a: any, b: any, h: any) -> any

the area of a trapezoid with parallel sides a and b, and height h

1
trapezoid_area(3 cm, 5 cm, 4 cm)16 cm^2
Example outputCtrl+Enter to run

See also triangle_area

parallelogram_area(b: any, h: any) -> any

the area of a parallelogram from its base and height

1
parallelogram_area(6 cm, 4 cm)24 cm^2
Example outputCtrl+Enter to run

See also triangle_area

polygon_area(points: list) -> any

the area of a polygon from its corners in order, each a list [x, y]

1
polygon_area([[0, 0], [4, 0], [4, 3]])6
2
polygon_area([[0 m, 0 m], [2 m, 0 m], [2 m, 2 m], [0 m, 2 m]])4 m^2
Example outputCtrl+Enter to run

See also triangle_area

1
# the area of a circle of radius 3 cm
2
circle_area(3 cm)28.2743 cm^2
3
# how much a 10 cm sphere holds, in liters
4
sphere_volume(10 cm) to L4.18879 L
5
# the area of a 3-4-5 triangle
6
triangle_area(3, 4, 5)6
7
# the area of a polygon from its corners
8
polygon_area([[0, 0], [4, 0], [4, 3]])6
Example outputCtrl+Enter to run

Example results generated on 2026-11-04. Ones using now, today or randomness will differ when you run them.