The logspace() function in Python is used to return numbers which are evenly spaced on the log scale.
numpy.logspace(start, stop, num=50, endpoint=True, base=10.0, dtype=None, axis=0)
The logspace() function takes the following parameter values:
start: This represents the starting value of the sequence.stop: This represents the final value of the sequence, unless the endpoint parameter is False.dtype: This represents the data type of the output arraynum: This represents the number of samples to generate.endpoint: This takes a boolean value. If True, the value of the stop parameter is the last sample. Otherwise, it is not included. It is True by default.base: This represents the base of the log space.axis: This represents the axis in the result to store the samples. It is 0 by default.The logspace() function returns number samples equally spaced on a log scale.
import numpy as np# creating the arraymyarray = np.logspace(1, 10, num=10, endpoint = True, base = 2, dtype = float, axis = 0)print(myarray)
numpy library.1, stops at 10, with a True value for its endpoint (the stop value is included), log base of 2, float data type and a default value for the axis. We assign the result to a variable myarray.myarray.