numpy.geomspace()
is used to return numbers evenly spaced on a logarithmic scale (geometric progression).
This looks like logspacepython/ rel=noopener target=_blank> numpy.logspace ()
but with endpoints specified directly. Each output pattern is a constant multiple of the previous one.
Syntax: numpy.geomspace (start, stop, num = 50, endpoint = True, dtype = None)
Parameters:
start: [scalar] The starting value of the sequence.
stop: [ scalar] The final value of the sequence, unless endpoint is False. In that case, num + 1 values are spaced over the interval in logspace, of which all but the last (a sequence of length num) are returned.
num: [integer, optional] Number of samples to generate. Default is 50.
endpoint: [boolean, optional] If true, stop is the last sample. Otherwise, it is not included. Default is True.
dtype: [dtype] The type of the output array. If dtype is not given, infer the data type from the other input arguments.Return:
samples: [ndarray] num samples , equally spaced on a log scale.
Code # 1: Work

Output:
B [2. 2.21336384 2.44948974 2.71080601 3.] A [0.84147098 0.88198596 0.91939085 0.95206619 0.9780296 0.9948976 0.99986214 0.98969411 0.96079161 0.90929743]
Code # 2: Graphical representation (numpy.geomspace)
# Graphical representation of numpy.geomspace ()
import
numpy as geek
import
pylab as p
%
matplotlib inline
# Start = 1
# End = 3
# Samples to generate = 10
x1
=
geek.geomspace (
1
,
3
,
10
, endpoint
=
False
)
y1
=
geek.ones (
10
)
p.plot (x1, y1,
`+`
)
Output:
This book is not just about learning the code; even if you learn to program. If you want to program professionally, learning to code is not enough; For this reason, in addition to helping you program,...
05/09/2021
Big data is, admittedly, an overhyped buzzword used by software and hardware companies to boost their sales. Behind the hype, however, there is a real and extremely important technology trend with imp...
10/07/2020
Cloud computing provides the capability to use computing and storage resources on a metered basis and reduce the investments in an organization’s computing infrastructure. The spawning and deletion ...
10/07/2020
Grokking Deep Learning teaches you to build deep learning neural networks from scratch! In his immersive style, deep learning expert Andrew Trask shows you the hidden science so you can uncover every ...
05/09/2021