A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://www.tutorialspoint.com/python/python_cmath_tau_constant.htm below:

Python cmath.tau Constant

Python cmath.tau Constant

The Python cmath.tau constant is defined as the ratio of the circumference of the circle to the given radius. Tau is a constant, and its value is equal to 2.

Mathematically, tau is denoted as ( =6.283185307179586). This makes ( = circumference/radius) practically useful while dealing with circles and angles, as this directly relates to the concept of radians, and this function also includes many formulas and calculations involving circles and trigonometry.

Syntax

Following is the basic syntax of the Python cmath.tau constant −

cmath.tau
Return Value

This constant returns the mathematical constant tau.

Example 1

In the below example, we are using the cmath.tau constant to calculate the circumference of a circle, which is twice the value of . We are going to multiply the radius of the circle by to obtain the circumference.

import cmath
r = 3 #radius
circumference = cmath.tau * r
print("The circumference of the circle is:",circumference)
Output

Following is the output of the above code −

The circumference of the circle is: 18.84955592153876
Example 2

Here, we are calculating the volume of the cylinder using the cmath.tau constant. The volume of a cylinder is half of times the square of the radius times the height.

import cmath
r = 10 #radius
h = 20 #height
v = cmath.tau * (r **2) * h/2  #Volume
print(v)
Output

The result is obtained as follows −

6283.185307179587
Example 3

In the following example, we are calculating the surface area of a sphere using the cmath.tau constant. We are multiplying the square of the radius by to obtain the surface area.

import cmath
r = 9     #radius
s = cmath.tau * (r ** 2) #surface area
print(s)
Output

We will get the output as shown below −

508.93800988154646

python_modules.htm


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4