NumPy Tutorial

Python NumPy Tutorial numpy.empty() in Python numpy.empty_like() in Python numpy.eye() in Python numpy.identity() in Python numpy.ones() in Python numpy.ones_like() in Python numpy.zeros in Python numpy.zeros_like() in Python numpy.full() in Python numpy.full_like() in Python numpy.asarray() in Python numpy.frombuffer() in Python numpy.fromiter() in Python numpy.fromstring () in Python numpy.asanyarray() in Python with Example numpy.ascontiguousarray() in Python with Example Numpy.asmatrix() in Python with Example Numpy.copy() in Python with Example numpy.loadtxt() Python numpy.arrange() in Python numpy.linspace() in Python numpy.logspace() in Python numpy.geomspace() in Python numpy.meshgrid() in Python numpy.diag() in Python numpy.diagflat() in Python numpy.tri() in Python numpy.tril() in Python numpy.copyto() in Python numpy.reshape() in Python numpy.ravel() in Python numpy.ndarray.flat() in Python numpy.ndarray.flatten() in Python numpy.rollaxis() in Python numpy.swapaxes() in Python numpy.ndarray.T in Python numpy.transpose() in Python numpy.atleast_1d() in Python numpy.atleast_2d() in Python numpy.atleast_3d() in Python numpy.broadcast_to() in Python numpy.broadcast_arrays() in Python numpy.expand_dims() in Python numpy.squeeze() in Python numpy.asarray_chkfinite() in Python numpy.asscalar() in Python numpy.concatenate() in Python numpy.stack() in Python numpy.column_stack() in Python numpy.dstack() in Python numpy.hstack() in Python numpy.vstack() in Python numpy.split() in Python numpy.tile() in Python numpy.repeat() in Python numpy.delete() in Python numpy.append() in Python numpy.resize() in Python numpy.trim_zeros() in Python numpy.unique() in Python numpy.flip() in Python NumPy vs SciPy

Misc

Numpy Attributes

numpy.geomspace() in Python

numpy.geomspace() in Python

The geomspace() function of Python numpy class returns the numbers spaced equally on a log scale (a geometric progression). This method is similar to numpy.logspace() but with endpoints specified directly.

Syntax

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

Parameter

start: This parameter represents the starting number of the sequence. stop: It signifies the final value of the sequence unless endpoint is False. num: The num argument represents the number of samples to generate. It is an optional parameter, and its default value is 50. endpoint: It optional parameter which takes Boolean values. If passed true, the stop is the last sample. dtype: This parameter represents the type of output array.

Return

This function returns the ‘ndarray’ where the ‘num’ samples are equally spaced on a log scale.

Example 1

# Python3 Program demonstrate
# numpy.geomspace() function
import numpy as np
print("Matrix:\n", np.geomspace(3.0, 4.0, num = 6), "\n")
# To evaluate sin() in long range 
point = np.geomspace(1, 2, 10)
print("Matrix\n", np.sin(point))

Output

Matrix:
[ 3.          3.17767152  3.36586544  3.56520492  3.77635005  4.     ]
Matrix:
[ 0.84147098  0.88198596  0.91939085  0.95206619  0.9780296   0.9948976
  0.99986214  0.98969411  0.96079161  0.90929743]