
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Calculate Cube Root and Exponential Values in Python using SciPy
When it is required to find the cube root of values, a function present in SciPy library can be used.
Syntax of ‘cbrt’ function
scipy.special.cbrt(x)
The ‘x’ is the parameter that is passed to the function ‘cbrt’ that is present in ‘special’ class of ‘SciPy’ library. Here’s an example −
Example
from scipy.special import cbrt my_cb = cbrt([27, 89]) print("The cube roots are :") print(my_cb)
Output
The cube roots are : [3. 4.4647451]
Explanation
- The required packages are imported.
- The ‘cbrt’ function is called on the list of values whose cube root needs to be computed.
- The output is displayed on the console.
When it is required to find the 10**x of an element or a list of elements, a function named ‘exp10’ present in SciPy library can be used.
Syntax of ‘exp10’ function
scipy.special.exp10(x)
The ‘x’ is the parameter that is passed to the function ‘exp10’ that is present in ‘special’ class of ‘SciPy’ library.
Example
from scipy.special import exp10 my_exp = exp10([12,17]) print("The exponential function has been called") print(my_exp)
Output
The exponential function has been called [1.e+12 1.e+17]
Explanation
- The required packages are imported.
- The ‘exp10’ function is called on the list of values whose exponential values needs to be computed.
- The output is displayed on the console.
Advertisements