In this Python tutorial, we will learn about the “**Scipy Constants**” where we will know about the different **types of constants in Scipy**. Additionally, cover the following topics.

- Scipy Constants Python
- Scipy Constants Units
- Scipy Constants list
- Scipy Constants C
- Scipy Constants epsilon 0
- Scipy Constants find
- Scipy Constants hbar
- Scipy Constants mu0
- Scipy Constants speed of light
- Scipy Constants Rydberg
- Scipy Constants Temperature

## Scipy Constants Python

The Scipy Constants is a Python sub-package that contains many different types of constants for scientific domains. These constants can be used according to our needs in Data Science, Deep Learning, and Machine Learning.

There are three types of constants in Scipy:

**Physical constants:**The Physical constants are the speed of light in a vacuum (), the magnetic constant (`c`

), etc.**mu_0****Mathematical constants:**The Mathematical constants are Pi (), Golden ratio (`pi`

, and (`golden`

)).`golden_ratio`

**Units:**The Units are

,*Mass*

,*Time*

, etc.*Angle*

Later in the below sub-sections, we will learn about each constant separately.

Here we will use the Jupyter Notebook for the demonstration of how to import and use the Scipy Constants.

Open Jupyter Notebook and type the below code in the cell to import the Scipy Constants.

`import scipy.constants as constant`

Let’s check the value of some of Scipy’s constants.

Check the value of the Mathematical Constant `Pi`

using the below code.

`print(constant.pi)`

Check the value of the Physical Constant `speed of light`

using the below code.

`print(constant.speed_of_light)`

Check the value of the Uni`gram`

using the below code.

`print(constant.gram)`

Also, check: What is Scikit Learn in Python

## Scipy Constants Units

Here we will learn about the Scipy Units, there are 15 types of Units in Scipy and each type contains its constants.

The type of Units in Scipy is given below.

- Angle
- Mass
- SI prefixes
- Binary prefixes
- Time
- Length
- Pressure
- Volume
- Speed
- Area
- Temperature
- Energy
- Power
- Optics
- Force

### Angle

The Angle Units has constants like** **,

`degree`

*arcmin*

, *arcminute*

, *arcsec*

and *arcsecond*

. These constants have units value in radians.Run the below code to see the value of all the constants in Angle.

```
print('The value of degree in radians :',const.degree)
print('The value of arc minute in radians :',const.arcmin)
print('The value of arc minute in radians :',const.arcminute)
print('The value of arc second in radians :',const.arcsec)
print('The value of arc second in radians :',const.arcsecond)
```

### Mass

The Mass Unit has constants like

, *gram*

, *metric*

, etc. It returns the unit value in a kg. All the constant is shown below using the code.*grain*

Run the below code to see all the values of contacts in Mass.

```
print('The value of gram is equal to 10 to the power -3 in kg :',const.gram)
print('The value of gram is equal to 10 to the power 3 in kg :',const.metric_ton)
print('The value of one grain in kg :',const.grain)
print('The value of one pound in kg :',const.lb)
print('The value of one pound in kg :',const.pound)
print('The value of one ounce in kg :',const.oz)
print('The value of one ounce in kg :',const.ounce)
print('The value of one stone in kg :',const.stone)
print('The value of one slug in kg :',const.slug)
print('The value of one long ton in kg :',const.long_ton)
print('The value of one short ton in kg :',const.short_ton)
print('The value of one inch version of a slug in kg :',const.slinch)
print('The value of one inch version of a slug in kg :',const.blob)
print('The value of one troy ounce in kg :',const.troy_ounce)
print('The value of one troy pound in kg :',const.troy_pound)
print('The value of one carat in kg :',const.carat)
print('The value of one atomic mass constant in kg :',const.atomic_mass)
print('The value of one atomic mass constant in kg :',const.m_u)
print('The value of one atomic mass constant in kg :',const.u)
```

Read Scipy Optimize

### SI Prefixes

The SI Prefixes Unit has constants like

, *Zetta*

, *Yotta*

, etc. It returns the unit value in a meter. All the constant is shown below using the code.*Peta*

```
print('The value of yotta is equal to 10 to the power 24 :',const.yotta)
print('The value of zetta is equal to 10 to the power 21 :',const.zetta)
print('The value of exa is equal to 10 to the power 18 :',const.exa)
print('The value of peta is equal to 10 to the power 15 :',const.peta)
print('The value of tera is equal to 10 to the power 12 :',const.tera)
print('The value of giga is equal to 10 to the power 9 :',const.giga)
print('The value of mega is equal to 10 to the power 6 :',const.mega)
print('The value of kilo is equal to 10 to the power 3 :',const.kilo)
print('The value of hecto is equal to 10 to the power 2 :',const.hecto)
print('The value of deka is equal to 10 to the power 1 :',const.deka)
print('The value of deci is equal to 10 to the power -1 :',const.deci)
print('The value of centi is equal to 10 to the power -2 :',const.centi)
print('The value of milli is equal to 10 to the power -3 :',const.milli)
print('The value of micro is equal to 10 to the power -6 :',const.micro)
print('The value of nano is equal to 10 to the power -9 :',const.nano)
print('The value of pico is equal to 10 to the power -12 :',const.pico)
print('The value of femto is equal to 10 to the power -15 :',const.femto)
print('The value of atto is equal to 10 to the power -18 :',const.atto)
print('The value of zepto is equal to 10 to the power -21 :',const.zepto)
print('The value of yocto is equal to 10 to the power -24 :',const.yocto)
```

### Binary Prefixes

The Binary Prefixes Unit has constants like

, *gibi*

, *pebi*

, etc. It returns the unit value in bytes. All the constant is shown below using the code.*mebi*

```
print('The value of kibi is equal to 2 to the power 10 :',const.kibi)
print('The value of kibi is equal to 2 to the power 20 :',const.mebi)
print('The value of kibi is equal to 2 to the power 30 :',const.gibi)
print('The value of kibi is equal to 2 to the power 40 :',const.tebi)
print('The value of kibi is equal to 2 to the power 50 :',const.pebi)
print('The value of kibi is equal to 2 to the power 60 :',const.exbi)
print('The value of kibi is equal to 2 to the power 70 :',const.zebi)
print('The value of kibi is equal to 2 to the power 80 :',const.yobi)
```

### Time

The Time Unit has constants like a

, *minute*

, *day*

, etc. It returns the unit value in seconds. All the constant is shown below using the code.*hour*

```
print('The value of one minute in seconds :',const.minute)
print('The value of one hour in seconds :',const.hour)
print('The value of one day in seconds :',const.day)
print('The value of one week in seconds :',const.week)
print('The value of one year in seconds :',const.year)
print('The value of one Julian_year in seconds :',const.Julian_year)
```

### Length

The Length Unit has constants like a

, *foot*

, *mile*

, etc. It returns the unit value in meters. All the constant is shown below using the code.*fermi*

```
print('The value of one inch in meters :',const.inch)
print('The value of one foot in meters :',const.foot)
print('The value of one yard in meters :',const.yard)
print('The value of one mile in meters :',const.mile)
print('The value of one mil in meters :',const.mil)
print('The value of one pt in meters :',const.pt)
print('The value of one point in meters :',const.point)
print('The value of one survey foot in meters :',const.survey_foot)
print('The value of one survey mile in meters :',const.survey_mile)
print('The value of one nautical mile in meters :',const.nautical_mile)
print('The value of one fermi in meters :',const.fermi)
print('The value of one angstrom in meters :',const.angstrom)
print('The value of one micron in meters :',const.micron)
print('The value of one astronomical unit in meters :',const.au)
print('The value of one astronomical unit in meters :',const.astronomical_unit)
print('The value of one light year in meters :',const.light_year)
print('The value of one parsec in meters :',const.parsec)
```

### Pressure

The Pressure Unit has constants like

, *psi*

, *atm*

, etc. It returns the unit value in pascals. All the constant is shown below using the code.*bar*

```
print('The value of standard atomsphere in pascals :',const.atm)
print('The value of standard atomsphere in pascals :',const.atmosphere)
print('The value of one bar in pascals :',const.bar)
print('The value of one torr in pascals :',const.torr)
print('The value of one torr in pascals :',const.mmHg)
print('The value of one psi in pascals :',const.psi)
```

### Volume

The Volume Unit has constants like a

, *gallon*

, *litre*

, etc. It returns the unit value in cubic meters. All the constant is shown below using the code.*barrel*

```
print('The value of one litre in cubic meters :',const.liter)
print('The value of one litre in cubic meters :',const.litre)
print('The value of one gallon (United States) in cubic meters :',const.gallon)
print('The value of one gallon (United States) in cubic meters :',const.gallon_US)
print('The value of one gallon (United Kingdom) in cubic meters :',const.gallon_imp)
print('The value of one fluid ounce (United States) in cubic meters :',const.fluid_ounce)
print('The value of one fluid ounce (United States) in cubic meters :',const.fluid_ounce_US)
print('The value of one fluid ounce (United Kindom) in cubic meters :',const.fluid_ounce_imp)
print('The value of one barrel in cubic meters :',const.barrel)
print('The value of one barrel in cubic meters :',const.bbl)
```

### Speed

The Speed Unit has constants like

, *mph*

, *mach*

, etc. It returns the unit value in meters per second. All the constant is shown below using the code.*knot*

```
print('The value of kmh kilometers per hour in meters per second :',const.kmh)
print('The value of mph miles per hour in meters per second :',const.mph)
print('The value of one mach meters per second :',const.mach)
print('The value of one mach meters per second :',const.speed_of_sound)
print('The value of one knot meters per second :',const.knot)
```

### Area

The Area Unit has constants like hectare, acre. It returns the unit value in square meters. All the constant is shown below using the code.

```
print('The value of one hectare in square meters :',const.hectare)
print('The value of one acre in square meters :',const.acre)
```

### Temperature

The Temperature Unit has constants like zero_Celsius, degree_Fahrenheit. It returns the unit value in Kelvin. All the constant is shown below using the code.

```
print('The value of zero of celsius scale in Kelvin :',const.zero_Celsius)
print('The value of zero of fahrenheit scale in Kelvin :',const.degree_Fahrenheit)
```

### Energy

The Energy Unit has constants like eV, calories, etc. It returns the unit value in Joules. All the constant is shown below using the code.

```
print('The value of one electron volt in Joules :',const.eV)
print('The value of one electron volt in Joules :',const.electron_volt)
print('The value of one calorie (Thermochemical) in Joules :',const.calorie)
print('The value of one calorie (Thermochemical) in Joules :',const.calorie_th)
print('The value of one calorie (International steam table calorie)in Joules :',const.calorie_IT)
print('The value of one erg in Joules :',const.erg)
print('The value of one british thermal unit in Joules :',const.Btu)
print('The value of one british thermal unit (International steam table) in Joules :',const.Btu_IT)
print('The value of one british thermal unit (International steam table) in Joules :',const.Btu_th)
print('The value of one ton of TNT in Joules :',const.ton_TNT)
```

### Power

The Power Unit has constants like hp, horsepower. It returns the unit value in watts. All the constant is shown below using the code.

```
print('The value of one horsepower in watts :',const.hp)
print('The value of one horsepower in watts :',const.horsepower)
```

### Optics

The Optics Unit has constants

that return the optical frequency, and *lambda2nu( )*

that returns the wavelength.*nu2lambda( )*

### Force

The Force Unit has constants like

, *kgf*

, etc. It returns the unit value in newton. All the constant is shown below using the code.*dyn*

```
print('The value of one dyne in newtons :',const.dyn)
print('The value of one dyne in newtons :',const.dyne)
print('The value of one pound force in newtons :',const.lbf)
print('The value of one pound force in newtons :',const.pound_force)
print('The value of one kilogram force in newtons :',const.kgf)
print('The value of one kilogram force in newtons :',const.kilogram_force)
```

Read: Tensorflow in Python

## Scipy Constants list

To view or list all the constants in Scipy, for that we are going to use the function , we pass the imported constants from Scipy to this function to view all the constants.

`dir( )`

Here we are going to import the Scipy sub-package Constants using the below code.

`import scipy.constants as const`

Now pass the above-imported sub-package to a function

.*dir( )*

`print(dir(const))`

Here in the above code function

accept the sub-package name *dir( )*

and show all constants within that package which is shown in the below output.*const*

Read: What is PyTorch and how to use it

## Scipy Constants C

In Scipy, the constants

represent the speed of light in a vacuum and it is a physical constant.*c *

To import these constants follow the below steps:

`import scipy.constants as cons`

Check the value of the constant speed of light in a vacuum.

`print('The value of speed of light in vacuum :',cons.c)`

Here, we can access the constant using

.*cons.c*

The value of the speed of light in a vacuum which represented by constant

is *c***299792458.0**.

Read: Machine Learning using Python

## Scipy Constants epsilon 0

In Scipy, the

is an electric constant that exists within *epsilon 0*

.*scipy.constants*

To import these constants follow the below steps:

`import scipy.constants as cons`

Check the value of the electric constant using the below code.

```
print('The value of the electric constant :',cons.epsilon_0)
```

Here, we can access the constant using

.**cons.epsilon_0**

Read: Scipy Sparse – Helpful Tutorial

## Scipy Constants find

To get the keys to physical constants in Scipy, the method

of *find( )*

are used.*scipy.constants*

The syntax is given below.

`scipy.constants.find(sub_str=None, disp=False)`

Where parameters are:

It is substring or the name of physical constants whose keys we want to search.*sub_str:*If it is set to*dips:*`True`

then found keys are returned, otherwise list all the keys without showing anything.

Let’s take an example of how to import and list the keys of physical constants using the below code.

`from scipy.constants import find, physical_constants`

Check the keys in physical constants containing a dictionary

.*'avogadro'*

`find('avogadro')`

List the constant

using the below code.*'Avogadro constant'*

`physical_constants['Avogadro constant']`

Read: Scipy Stats Zscore + Examples

## Scipy Constants hbar

In Scipy, the constant

is a modified form of Planck’s constant that exists within *hbar*

whose value is equal to *scipy.constants*

.*h= h/2pi)*

To import these constants follow the below steps:

`import scipy.constants as cons`

Check the value of Planck’s constant using the below code.

`print('The value of Plancs constant :',cons.hbar)`

Read: Python Scipy Minimize [With 8 Examples]

## Scipy Constants mu0

In Scipy, the

is the magnetic constant that exists within *mu_0*

.*scipy.constants*

To import these constants follow the below steps:

`import scipy.constants as cons`

Check the value of the magnetic constant using the below code.

`print('The value of the magnetic constant :',cons.mu_0)`

Here, we can access the constant

.*cons.mu_0*

Read: Python Scipy Confidence Interval

## Scipy Constants speed of light

In Scipy, the constants

represent the speed of light in a vacuum and it is a physical constant.*speed_of_ligh*

To import these constants follow the below steps:

`import scipy.constants as cons`

Check the value of the constant speed of light in a vacuum.

`print('The value of speed of light in vacuum :',cons.c)`

## Scipy Constants Rydberg

In Scipy, the constant

is Rydberg constant and it is a physical constant.*Rydberg*

To import these constants follow the below steps:

`import scipy.constants as cons`

Check the value of the Rydberg constant.

`print('The value of Rydberg constant :',cons.Rydberg)`

Read: Python Scipy Exponential

## Scipy Constants Temperature

The Temperature Unit has constants like

, *zero_Celsius*

. It returns the unit value in Kelvin. All the constant is shown below using the code.*degree_Fahrenheit*

```
print('The value of zero of celsius scale in Kelvin :',const.zero_Celsius)
print('The value of zero of fahrenheit scale in Kelvin :',const.degree_Fahrenheit)
```

Look at the value of both constants in the above output.

Also, take a look at some more tutorials.

In this tutorial, we have learned about the “**Scipy Constants**” and covered the following topics.

- Scipy Constants Python
- Scipy Constants Units
- Scipy Constants list
- Scipy Constants C
- Scipy Constants epsilon 0
- Scipy Constants find
- Scipy Constants hbar
- Scipy Constants mu0
- Scipy Constants speed of light
- Scipy Constants Rydberg
- Scipy Constants Temperature

Python is one of the most popular languages in the United States of America. I have been working with Python for a long time and I have expertise in working with various libraries on Tkinter, Pandas, NumPy, Turtle, Django, Matplotlib, Tensorflow, Scipy, Scikit-Learn, etc… I have experience in working with various clients in countries like United States, Canada, United Kingdom, Australia, New Zealand, etc. Check out my profile.