numpy.geomspace() is used to return numbers spaced evenly on a log scale (a geometric progression).
This is similar to
numpy.logspace() but with endpoints specified directly. Each output sample is a constant multiple of the previous.
Syntax : numpy.geomspace(start, stop, num=50, endpoint=True, dtype=None)
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 log-space, 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.
samples : [ndarray] num samples, equally spaced on a log scale.
Code #1 : Working
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 of numpy.geomspace()
- Python | Merge Python key values to list
- Reading Python File-Like Objects from C | Python
- Python | Index of Non-Zero elements in Python list
- Important differences between Python 2.x and Python 3.x with examples
- Python | Sort Python Dictionaries by Key or Value
- Python | Add Logging to Python Libraries
- Python | Set 4 (Dictionary, Keywords in Python)
- Python | Add Logging to a Python Script
- Python | Visualizing O(n) using Python
- Any & All in Python
- bin() in Python
- Python Set | pop()
- Python vs PHP
- Use of min() and max() in Python
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to email@example.com. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.