Compute the inner product of vectors for 1-D arrays using NumPy in Python Last Updated : 29 Aug, 2020 Summarize Comments Improve Suggest changes Share Like Article Like Report Python has a popular package called NumPy which used to perform complex calculations on 1-D and multi-dimensional arrays. To find the inner product of two arrays, we can use the inner() function of the NumPy package. Syntax: numpy.inner(array1, array2) Parameters: array1, array2: arrays to be evaluated Returns: Inner Product of two arrays Example 1: Python3 # Importing library import numpy as np # Creating two 1-D arrays array1 = np.array([6,2]) array2 = np.array([2,5]) print("Original 1-D arrays:") print(array1) print(array2) # Output print("Inner Product of the two array is:") result = np.inner(array1, array2) print(result) Output: Original 1-D arrays: [6 2] [2 5] Inner Product of the two array is: 22 Example 2: Python3 # Importing library import numpy as np # Creating two 1-D arrays array1 = np.array([1,3,5]) array2 = np.array([0,1,5]) print("Original 1-D arrays:") print(array1) print(array2) # Output print("Inner Product of the two array is:") result = np.inner(array1, array2) print(result) Output: Original 1-D arrays: [1 3 5] [0 1 5] Inner Product of the two array is: 28 Example 3: Python3 # Importing library import numpy as np # Creating two 1-D arrays array1 = np.array([1,2,2,8]) array2 = np.array([2,1,0,6]) print("Original 1-D arrays:") print(array1) print(array2) # Output print("Inner Product of the two array is:") result = np.inner(array1, array2) print(result) Output: Original 1-D arrays: [1 2 2 8] [2 1 0 6] Inner Product of the two array is: 52 Comment More infoAdvertise with us Next Article Compute the inner product of vectors for 1-D arrays using NumPy in Python K kartik Follow Improve Article Tags : Numpy Python-numpy Similar Reads Python NumPy Numpy is a general-purpose array-processing package. It provides a high-performance multidimensional array object, and tools for working with these arrays. It is the fundamental package for scientific computing with Python.Besides its obvious scientific uses, Numpy can also be used as an efficient m 6 min read NumPy Tutorial - Python Library NumPy (short for Numerical Python ) is one of the most fundamental libraries in Python for scientific computing. It provides support for large, multi-dimensional arrays and matrices along with a collection of mathematical functions to operate on arrays.At its core it introduces the ndarray (n-dimens 3 min read Disease Prediction Using Machine Learning Disease prediction using machine learning is used in healthcare to provide accurate and early diagnosis based on patient symptoms. We can build predictive models that identify diseases efficiently. In this article, we will explore the end-to-end implementation of such a system. Step 1: Import Librar 5 min read NumPy Introduction NumPy(Numerical Python) is a fundamental library for Python numerical computing. It provides efficient multi-dimensional array objects and various mathematical functions for handling large datasets making it a critical tool for professionals in fields that require heavy computation.Table of ContentK 7 min read numpy.where() in Python We will explore the basics of numpy.where(), how it works, and practical use cases to illustrate its importance in data manipulation and analysis.Syntax of numpy.where()Syntax :numpy.where(condition[, x, y]) Parameters condition: A condition that tests elements of the array.x (optional): Values from 3 min read Multiply All Numbers in the List in Python Our task is Multiplying all numbers in a list Using Python. This can be useful in calculations, data analysis, and whenever we need a cumulative product. In this article we are going to explore various method to do this. Using a loopWe can simply use a loop (for loop) to iterate over the list elemen 2 min read numpy.zeros() in Python numpy.zeros() function creates a new array of specified shapes and types, filled with zeros. It is beneficial when you need a placeholder array to initialize variables or store intermediate results. We can create 1D array using numpy.zeros().Let's understand with the help of an example:Pythonimport 2 min read numpy.arange() in Python numpy.arange() function creates an array of evenly spaced values within a given interval. It is similar to Python's built-in range() function but returns a NumPy array instead of a list. Let's understand with a simple example:Pythonimport numpy as np #create an array arr= np.arange(5 , 10) print(arr 2 min read NumPy - linspace() Function linspace() function in NumPy returns an array of evenly spaced numbers over a specified range. Unlike the range() function in Python that generates numbers with a specific step size. linspace() allows you to specify the total number of points you want in the array, and NumPy will calculate the spaci 2 min read Basics of NumPy Arrays NumPy stands for Numerical Python and is used for handling large, multi-dimensional arrays and matrices. Unlike Python's built-in lists NumPy arrays provide efficient storage and faster processing for numerical and scientific computations. It offers functions for linear algebra and random number gen 4 min read Like