Numpy Arrays within the numerical rangeThis section of the tutorial illustrates how the numpy arrays can be created using some given specified range. Numpy.arrangeIt creates an array by using the evenly spaced values over the given interval. The syntax to use the function is given below. It accepts the following parameters.
group ExampleOutput: [0. 2. 4. 6. 8.] ExampleOutput: The array over the given range is [10 15 20 25 30 35 40 45 50 55 60 65 70 75 80 85 90 95] NumPy.linspaceIt is similar to the arrange function. However, it doesn?t allow us to specify the step size in the syntax. Instead of that, it only returns evenly separated values over a specified period. The system implicitly calculates the step size. The syntax is given below. It accepts the following parameters.
ExampleOutput: The array over the given range is [10. 12.5 15. 17.5 20.] ExampleOutput: The array over the given range is [10. 12. 14. 16. 18.] numpy.logspaceIt creates an array by using the numbers that are evenly separated on a log scale. The syntax is given below. It accepts the following parameters.
ExampleOutput: The array over the given range is [1.00000000e+10 3.16227766e+12 1.00000000e+15 3.16227766e+17 1.00000000e+20] ExampleOutput: The array over the given range is [1.02400000e+03 5.79261875e+03 3.27680000e+04 1.85363800e+05 1.04857600e+06] Next TopicNumPy Broadcasting |