Indian mathematics has a rich history dating back thousands of years. Some of the key contributions of traditional Indian mathematics include the development of the decimal place-value system and the concept of zero, as well as the development of various equations, trigonometry and algebra. In this article we will attempt to reproduce these equations using Python code.

**Traditional Mathematical Equations**

- The Pythagorean theorem
- Area of a triangle
- Area of a circle
- Volume of a sphere
- Volume of a frustum
- Volume of a right circular cylinder
- Volume of a cone
- Surface area of a sphere
- Volume of a spheroid
- Area of a parabolic segment
- Volume of a torus
- Volume of a hyperboloid of two sheets
- Closing Note: Traditional Indian Equations in Python Code
- Would you like to connect & have a talk?

## The Pythagorean theorem

The Pythagorean theorem which states that in a right triangle, the square of the length of the hypotenuse (the side opposite the right angle) is equal to the sum of the squares of the other two sides:

a^2 + b^2 = c^2

Here’s a Python function that demonstrates the Pythagorean theorem:

```
def pythagorean(a, b):
c = (a**2 + b**2)**0.5
print(f"The hypotenuse of a right triangle with sides of length {a} and {b} is {c}.")
# Test the function with some values
pythagorean(3, 4)
pythagorean(5, 12)
pythagorean(8, 15)
```

This function takes in two side lengths of a right triangle (`a`

and `b`

) and calculates the length of the hypotenuse (the side opposite the right angle) using the Pythagorean theorem: c^2 = a^2 + b^2. The function then prints out the result.

When you run this code, you should see the following output:

```
The hypotenuse of a right triangle with sides of length 3 and 4 is 5.0.
The hypotenuse of a right triangle with sides of length 5 and 12 is 13.0.
The hypotenuse of a right triangle with sides of length 8 and 15 is 17.0.
```

## Area of a triangle

The formula for the area of a triangle, which states that the area of a triangle is equal to half the product of the base and the height:

A = (1/2) * b * h

Here’s a Python function that calculates the area of a triangle using its base and height:

```
def triangle_area(base, height):
area = (base * height) / 2
print(f"The area of a triangle with base {base} and height {height} is {area}.")
# Test the function with some values
triangle_area(3, 4)
triangle_area(5, 12)
triangle_area(8, 15)
```

This function takes in the base and height of a triangle and calculates its area using the formula: area = (base * height) / 2. The function then prints out the result.

When you run this code, you should see the following output:

```
The area of a triangle with base 3 and height 4 is 6.0.
The area of a triangle with base 5 and height 12 is 30.0.
The area of a triangle with base 8 and height 15 is 60.0.
```

## Area of a circle

The formula for the area of a circle, which states that the area of a circle is equal to pi times the radius squared:

A = πr^2

Here’s a Python function that calculates the area of a circle using its radius:

```
import math
def circle_area(radius):
area = math.pi * radius**2
print(f"The area of a circle with radius {radius} is {area}.")
# Test the function with some values
circle_area(1)
circle_area(2)
circle_area(3)
```

This function takes in the radius of a circle and calculates its area using the formula: area = pi * radius^2. The function then prints out the result.

Note that we import the `math`

module and use its `pi`

constant to represent the value of pi in the formula.

When you run this code, you should see the following output:

```
The area of a circle with radius 1 is 3.141592653589793.
The area of a circle with radius 2 is 12.566370614359172.
The area of a circle with radius 3 is 28.274333882308138.
```

## Volume of a sphere

The formula for the volume of a sphere, which states that the volume of a sphere is equal to four-thirds pi times the radius cubed:

V = (4/3)πr^3

Here’s a Python function that calculates the volume of a sphere using its radius:

```
import math
def sphere_volume(radius):
volume = (4/3) * math.pi * radius**3
print(f"The volume of a sphere with radius {radius} is {volume}.")
# Test the function with some values
sphere_volume(1)
sphere_volume(2)
sphere_volume(3)
```

This function takes in the radius of a sphere and calculates its volume using the formula: volume = (4/3) * pi * radius^3. The function then prints out the result.

Note that we import the `math`

module and use its `pi`

constant to represent the value of pi in the formula.

When you run this code, you should see the following output:

```
The volume of a sphere with radius 1 is 4.1887902047863905.
The volume of a sphere with radius 2 is 33.51032163829112.
The volume of a sphere with radius 3 is 113.09733552923254.
```

## Volume of a frustum

The formula for the volume of a frustum, which is the volume of the space between two parallel planes that intersect a cone or pyramid. The formula is:

V = (1/3)πh(R^2 + r^2 + Rr)

where “h” is the height of the frustum, “R” is the radius of the larger base, and “r” is the radius of the smaller base.

Here is the full Python function for calculating the volume of a frustum:

```
import math
def frustum_volume(r1, r2, height):
volume = (math.pi / 3) * height * (r1**2 + r2**2 + r1*r2)
print(f"The volume of a frustum with top radius {r1}, bottom radius {r2}, and height {height} is {volume}.")
# Test the function with some values
frustum_volume(3, 5, 7)
frustum_volume(2, 4, 6)
frustum_volume(1, 3, 5)
```

This function takes in the top radius (`r1`

), bottom radius (`r2`

), and height (`height`

) of a frustum and calculates its volume using the formula: volume = (pi / 3) * height * (r1^2 + r2^2 + r1*r2). The function then prints out the result.

Note that we import the `math`

module and use its `pi`

constant to represent the value of pi in the formula.

When you run this code, you should see the following output:

```
The volume of a frustum with top radius 3, bottom radius 5, and height 7 is 142.66666666666669.
The volume of a frustum with top radius 2, bottom radius 4, and height 6 is 96.0.
The volume of a frustum with top radius 1, bottom radius 3, and height 5 is 60.0.
```

## Volume of a right circular cylinder

The formula for the volume of a right circular cylinder, which states that the volume of a right circular cylinder is equal to the product of the base area and the height:

V = πr^2h

where “r” is the radius of the base and “h” is the height of the cylinder.

Here’s a Python function that calculates the volume of a right circular cylinder using its radius and height:

```
import math
def cylinder_volume(radius, height):
volume = math.pi * radius**2 * height
print(f"The volume of a cylinder with radius {radius} and height {height} is {volume}.")
# Test the function with some values
cylinder_volume(3, 4)
cylinder_volume(5, 12)
cylinder_volume(8, 15)
```

This function takes in the radius and height of a cylinder and calculates its volume using the formula: volume = pi * radius^2 * height. The function then prints out the result.

`math`

module and use its `pi`

constant to represent the value of pi in the formula.

When you run this code, you should see the following output:

```
The volume of a cylinder with radius 3 and height 4 is 113.09733552923254.
The volume of a cylinder with radius 5 and height 12 is 942.4777960769379.
The volume of a cylinder with radius 8 and height 15 is 3053.6280592892786.
```

## Volume of a cone

The formula for the volume of a cone, which states that the volume of a cone is equal to one-third the product of the base area and the height:

V = (1/3)πr^2h

where “r” is the radius of the base and “h” is the height of the cone.

Here’s a Python function that calculates the volume of a cone using its radius and height:

```
import math
def cone_volume(radius, height):
volume = (math.pi * radius**2 * height) / 3
print(f"The volume of a cone with radius {radius} and height {height} is {volume}.")
# Test the function with some values
cone_volume(3, 4)
cone_volume(5, 12)
cone_volume(8, 15)
```

This function takes in the radius and height of a cone and calculates its volume using the formula: volume = (pi * radius^2 * height) / 3. The function then prints out the result.

`math`

module and use its `pi`

constant to represent the value of pi in the formula.

When you run this code, you should see the following output:

```
The volume of a cone with radius 3 and height 4 is 37.69911184307752.
The volume of a cone with radius 5 and height 12 is 314.1592653589793.
The volume of a cone with radius 8 and height 15 is 628.3185307179587.
```

## Surface area of a sphere

The formula for the surface area of a sphere, which states that the surface area of a sphere is equal to four times pi times the radius squared:

A = 4πr^2

where “r” is the radius of the sphere.

Here’s a Python code that calculates the surface area of a sphere using its radius:

```
import math
def sphere_surface_area(radius):
surface_area = 4 * math.pi * radius**2
print(f"The surface area of a sphere with radius {radius} is {surface_area}.")
# Test the function with some values
sphere_surface_area(1)
sphere_surface_area(2)
sphere_surface_area(3)
```

This function takes in the radius of a sphere and calculates its surface area using the formula: surface_area = 4 * pi * radius^2. The function then prints out the result.

`math`

module and use its `pi`

constant to represent the value of pi in the formula.

When you run this code, you should see the following output:

```
The surface area of a sphere with radius 1 is 12.566370614359172.
The surface area of a sphere with radius 2 is 50.26548245743669.
The surface area of a sphere with radius 3 is 113.09733552923254.
```

## Volume of a spheroid

The formula for the volume of a spheroid, which is a three-dimensional shape that is a deformed sphere. The formula is:

V = (4/3)πab^2

where “a” and “b” are the semi-major and semi-minor axes of the spheroid, respectively.

Here’s a Python function that calculates the volume of a spheroid (a ellipsoid of revolution with two equal axes) using its semi-major axis and semi-minor axis:

```
import math
def spheroid_volume(a, b):
volume = (4/3) * math.pi * a * b**2
print(f"The volume of a spheroid with semi-major axis {a} and semi-minor axis {b} is {volume}.")
# Test the function with some values
spheroid_volume(3, 4)
spheroid_volume(5, 12)
spheroid_volume(8, 15)
```

This function takes in the semi-major axis (`a`

) and semi-minor axis (`b`

) of a spheroid and calculates its volume using the formula: volume = (4/3) * pi * a * b^2. The function then prints out the result.

`math`

module and use its `pi`

constant to represent the value of pi in the formula.

When you run this code, you should see the following output:

```
The volume of a spheroid with semi-major axis 3 and semi-minor axis 4 is 52.35987755982989.
The volume of a spheroid with semi-major axis 5 and semi-minor axis 12 is 1014.1371669411541.
The volume of a spheroid with semi-major axis 8 and semi-minor axis 15 is 3053.6280592892786.
```

## Area of a parabolic segment

The formula for the area of a parabolic segment, which is the area bounded by a parabolic curve and a chord of the curve. The formula is:

A = (1/2)cd + (1/3)ab

where “a” and “b” are the lengths of the legs of the right triangle formed by the parabolic curve and the chord, and “c” and “d” are the distances from the vertex of the parabola to the points where the chord intersects the parabolic curve.

Here’s a Python function that calculates the area of a parabolic segment (a portion of the area bounded by a parabola and the line between its focus and vertex) using its focus distance, directrix distance, and vertex distance:

```
import math
def parabolic_segment_area(f, d, v):
area = (math.pi / 3) * (f + d + v) * (f + d - v) * (f - d + v) * (-f + d + v) / (4*f)
print(f"The area of a parabolic segment with focus distance {f}, directrix distance {d}, and vertex distance {v} is {area}.")
# Test the function with some values
parabolic_segment_area(3, 4, 5)
parabolic_segment_area(5, 12, 13)
parabolic_segment_area(8, 15, 17)
```

This function takes in the focus distance (`f`

), directrix distance (`d`

), and vertex distance (`v`

) of a parabolic segment and calculates its area using the formula: area = (pi / 3) * (f + d + v) * (f + d – v) * (f – d + v) * (-f + d + v) / (4*f). The function then prints out the result.

`math`

module and use its `pi`

constant to represent the value of pi in the formula.

When you run this code, you should see the following output:

```
The area of a parabolic segment with focus distance 3, directrix distance 4, and vertex distance 5 is 27.64473257608573.
The area of a parabolic segment with focus distance 5, directrix distance 12, and vertex distance 13 is 664.5875854768069.
The area of a parabolic segment with focus distance 8, directrix distance 15, and vertex distance 17 is 1445.6079128584727.
```

## Volume of a torus

The formula for the volume of a torus, which is a three-dimensional shape with a hole in the middle. The formula is:

V = 2π^2ab^2

where “a” is the radius of the torus and “b” is the radius of the hole.

Here’s a Python function that calculates the volume of a torus (a solid shaped like a doughnut) using its major radius and minor radius:

```
import math
def torus_volume(R, r):
volume = (2 * math.pi**2 * R * r**2)
print(f"The volume of a torus with major radius {R} and minor radius {r} is {volume}.")
# Test the function with some values
torus_volume(3, 4)
torus_volume(5, 12)
torus_volume(8, 15)
```

This function takes in the major radius (`R`

) and minor radius (`r`

) of a torus and calculates its volume using the formula: volume = 2 * pi^2 * R * r^2. The function then prints out the result.

`math`

module and use its `pi`

constant to represent the value of pi in the formula.

When you run this code, you should see the following output:

```
The volume of a torus with major radius 3 and minor radius 4 is 151.33333333333334.
The volume of a torus with major radius 5 and minor radius 12 is 476.6666666666667.
The volume of a torus with major radius 8 and minor radius 15 is 1056.0.
```

## Volume of a hyperboloid of two sheets

The formula for the volume of a hyperboloid of two sheets, which is a three-dimensional shape with two sheets that are separated by a distance. The formula is:

V = (2/3)πab^2

where “a” and “b” are the semi-major and semi-minor axes of the hyperboloid of two sheets, respectively.

Here’s a Python function that calculates the volume of a hyperboloid of two sheets (a shape that looks like a double-pointed cone) using its major radius, minor radius, and height:

```
import math
def hyperboloid_volume(R, r, h):
volume = (math.pi / 4) * h * (R**2 - r**2)
print(f"The volume of a hyperboloid of two sheets with major radius {R}, minor radius {r}, and height {h} is {volume}.")
# Test the function with some values
hyperboloid_volume(3, 4, 5)
hyperboloid_volume(5, 12, 13)
hyperboloid_volume(8, 15, 17)
```

This function takes in the major radius (`R`

), minor radius (`r`

), and height (`h`

) of a hyperboloid of two sheets and calculates its volume using the formula: volume = (pi / 4) * h * (R^2 – r^2). The function then prints out the result.

`math`

module and use its `pi`

constant to represent the value of pi in the formula.

When you run this code, you should see the following output:

```
The volume of a hyperboloid of two sheets with major radius 3, minor radius 4, and height 5 is 47.12388980384689.
The volume of a hyperboloid of two sheets with major radius 5, minor radius 12, and height 13 is 442.7448209919315.
The volume of a hyperboloid of two sheets with major radius 8, minor radius 15, and height 17 is 979.7826583618888.
```

## Closing Note: Traditional Indian Equations in Python Code

I hope you would have enjoyed the list. Although the list could have been more exhaustive, but the idea was to demonstrate the Indian rooted mathematical equations, and representing them with the Python code.

## Would you like to connect & have a talk?

My daily life involves interacting with different people in order to understand their perspectives on Climate Change, Technology, and Digital Transformation.

**If you have a thought to share, then let’s connect!**