- Trending Categories
- Data Structure
- Networking
- RDBMS
- Operating System
- Java
- iOS
- HTML
- CSS
- Android
- Python
- C Programming
- C++
- C#
- MongoDB
- MySQL
- Javascript
- PHP
- Physics
- Chemistry
- Biology
- Mathematics
- English
- Economics
- Psychology
- Social Studies
- Fashion Studies
- Legal Studies

- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who

# How can we use various mathematical and physical constants in scipy library?

To implement Scientific or Mathematical calculation, we need various universal constants. For example, the formula to calculate area of a circle is pi*r*r where Pi is a constant having value = 3.141592653. There are various other scenarios like this where we need constants. It would really be helpful if we can incorporate these constants into our calculation with ease. The scipy.constants(), a sub-module inside the Scipy library, does the job for us and provide us a reference material to look up exhaustive list of Physical Constants, universal mathematical constants, and various units such as SI prefixes, Binary prefixes, Mass, Angle, Time, etc.

We can access the value of any constant by typing the name of the constant in scipy.constants.name_of_constant. For example, if you want to access the value of constant Pi, type scipy.constants.pi.

## Example

#Importing the module from scipy import constants #Printing the values of constants print("The value of sciPy - pi = ", constants.pi) print("The value of Golden ratio = ", constants.golden_ratio) print("The value of Speed of light in vaccum = ", constants.c) print("The value of Gravitational Constant = ", constants.G) print("The value of Molar Gas Constant = ", constants.R) print("The value of Boltzman Constant = ", constants.k) print("The value of Proton mass Constant = ", constants.proton_mass)

## Output

The value of sciPy - pi = 3.141592653589793 The value of Golden ratio = 1.618033988749895 The value of Speed of light in vaccum = 299792458.0 The value of Gravitational Constant = 6.6743e-11 The value of Molar Gas Constant = 8.314462618 The value of Boltzman Constant = 1.380649e-23 The value of Proton mass Constant = 1.67262192369e-27

- Related Articles
- How can we use the SciPy library to solve a Linear equation?
- What is interpolation and how can we implement it in the SciPy Python library?
- What are various sub-packages in Python SciPy library?
- Mathematical Constants in Python
- PHP Predefined Mathematical Constants
- Mathematical Functions in Python - Special Functions and Constants
- How can we call the documentation for NumPy and SciPy?
- What is SciPy and why should we use it?
- What is the use of scipy.interpolate.interp1d class of SciPy python library?
- Comparing ‘cubic’ and ‘linear’ 1-D interpolation using SciPy library
- How to implement ‘cubic’ 1-D interpolation using SciPy library?
- Can we order a MySQL result with mathematical operations?
- State the various ways in which we can avoid (or minimize) the use of plastics.
- How can we create and use ENUM columns in MySQL?
- How can we import a gson library in JShell in Java 9?