[Chennaipy] Query on numpy.logspace() in Python
rajeshkumar p
gprkumar at gmail.com
Tue Jul 6 04:26:19 EDT 2021
Hi,
The below snippet will add few info:
>>> import numpy as np
>>> np.logspace(2, 4, num=1, base=10)
array([100.])
# Our result is 10**2
>>> np.logspace(2, 4, num=2, base=10)
array([ 100., 10000.])
# Our result is 10**2, 10**3
>>> np.logspace(2, 4, num=3, base=10)
array([ 100., 1000., 10000.])
# Our result is 10**2, 10**3, 10**4
>>> np.logspace(2, 4, num=4, base=10)
array([ 100. , 464.15888336, 2154.43469003, 10000. ])
>>> np.linspace(2, 4, num=4)
array([2. , 2.66666667, 3.33333333, 4. ])
>>> np.power(10, np.linspace(2, 4, num=4))
array([ 100. , 464.15888336, 2154.43469003, 10000. ])
### Observation:
### np.power(10, np.linspace(2, 4, num=4)) is the same as np.logspace(2, 4,
num=4, base=10).
Hope this helps.
regards,
Rajeshkumar P
On Tue, 6 Jul 2021 at 12:48, Nithya Duraisamy <nithyadurai87 at gmail.com>
wrote:
> >
> > It’s because you are looking at log space. Try linspace if you want it
> in between the numbers.
>
>
> What is mean by log space?
>
> Where to read about that?
> _______________________________________________
> Chennaipy mailing list
> Chennaipy at python.org
> https://mail.python.org/mailman/listinfo/chennaipy
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.python.org/pipermail/chennaipy/attachments/20210706/3052c9d1/attachment.html>
More information about the Chennaipy
mailing list