NumPy is a Python library for numerical computing. It provides tools for working with arrays of numerical data, which makes it particularly useful for scientific and mathematical applications. Here’s an example of how to use NumPy to create a simple array and perform some basic operations on it:
import numpy as np
# create a simple array
my_array = np.array([1, 2, 3, 4, 5])
# print the array
print(my_array) # Output: [1 2 3 4 5]
# perform some basic operations on the array
print(my_array + 1) # Output: [2 3 4 5 6]
print(my_array * 2) # Output: [ 2 4 6 8 10]
print(np.sin(my_array)) # Output: [ 0.84147098 0.90929743 0.14112001 -0.7568025 -0.95892427]