Dot Product
Description
The dot product of any two vectors $a = \begin{pmatrix} a_1 \\ a_2 \\ a_3 \end{pmatrix}$ and $b=\begin{pmatrix} b_1 \\ b_2 \\ b_3 \end{pmatrix}$ is defined as
(1)\begin{align} \mathbf a \cdot \mathbf b = \sum_{i=1}^n a_i b_i \end{align}
The Sage cell below calculates the dot product for the vectors $a = \begin{pmatrix} 1 \\ 2 \\ 3 \end{pmatrix}$ and $b = \begin{pmatrix} 4 \\ 5 \\ 6 \end{pmatrix}$.
Sage Cell
Code
a = vector( QQ, 3, [ 1, 2, 3 ] )
b = vector( QQ, 3, [ 4, 5, 6 ] )
dotproduct=a.dot_product(b)
dotproduct
Options
None
Tags
Primary Tags:
Secondary Tags:
Related Cells
Attribute
Permalink:
Author:
Date: 06 Nov 2018 15:55
Submitted by: James A Phillips