0 votes
in Python by
explain numpy.logspace() in Python

1 Answer

0 votes
by

numpy.logspace() in Python

The logspace() function of Python numpy class returns the equal number of spaces over every interval on a log scale.

Syntax

numpy.logspace(start, stop, num=50, endpoint=True, base=10.0, dtype=None, axis=0)

Parameter

start: It represents the start of the interval range.

stop: This parameter represents the end of the interval range.

endpoint: It optional parameter which takes Boolean values. If passed True, the stop is the last sample.

num:This parameter represents the total number no. of samples to generate.

base: It represents the Base of the log scale. It is an optional float parameter, and by default, it is equal to 10.0.

dtype: This parameter represents the type of output array.

Return

This function returns the ‘ndarray’.

Example 1

# Python Programming explaining
# numpy.logspace() function
import numpy as np
# passing base value as 11
print("Matrix:\n",np.logspace(2.0, 3.0, num=5, base = 11))

Output

Matrix:
[  121.           220.36039471   401.31159963   730.8527479   1331.        ]
...