Created
April 18, 2020 03:08
-
-
Save 801YutaKa108/0c6a4c6b7d050f563e31e52fb8e9e747 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
# arrange(stop) | |
x = np.arange(5) | |
# x → array([0, 1, 2, 3, 4]) | |
# arrange(start, stop) | |
y = np.arange(5, 10) | |
# y → array([5, 6, 7, 8, 9]) | |
# arrange(start, stop, step) | |
z = np.arange(10, 20, 3) | |
# z → array([10, 13, 16, 19]) | |
# arange(stop, step=step) | |
x = np.arange(10, step=2) | |
# x → array([0, 2, 4, 6, 8]) | |
# stop < start | |
x = np.arange(start=10, stop=9) | |
# array([], dtype=int32) | |
# arangeとlinspaceの違い | |
x = np.arange(0, 100, 25) | |
# x → array([ 0, 10, 20, 30, 40, 50, 60, 70, 80, 90]) | |
y = np.linspace(0, 100, 10) | |
# y → array([ 0. , 11.11111111, 22.22222222, 33.33333333, | |
# 44.44444444, 55.55555556, 66.66666667, 77.77777778, | |
# 88.88888889, 100. ]) | |
# arangeとlinspaceの違い(最小限の引数) | |
x = np.arange(0, 50) | |
# x → array([ 0, 1, 2, 3,..., 49]) #1ずつ増える | |
y = np.linspace(0, 10) | |
# y → array([ 0. , 0.20408163, 0.40816327,..., 10.]) #50要素 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment