# How can SciPy be used to calculate the cube root of values and exponential values in Python?

PythonServer Side ProgrammingProgramming

#### Beyond Basic Programming - Intermediate Python

Most Popular

36 Lectures 3 hours

#### Practical Machine Learning using Python

Best Seller

91 Lectures 23.5 hours

#### Practical Data Science using Python

22 Lectures 6 hours

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

Live Demo

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

Live Demo

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.
Updated on 10-Dec-2020 13:36:14

Advertisements