simple-squiggle

A restricted subset of Squiggle
Log | Files | Refs | README

dot.md (889B)


      1 <!-- Note: This file is automatically generated from source code comments. Changes made in this file will be overridden. -->
      2 
      3 # Function dot
      4 
      5 Calculate the dot product of two vectors. The dot product of
      6 `A = [a1, a2, ..., an]` and `B = [b1, b2, ..., bn]` is defined as:
      7 
      8    dot(A, B) = conj(a1) * b1 + conj(a2) * b2 + ... + conj(an) * bn
      9 
     10 
     11 ## Syntax
     12 
     13 ```js
     14 math.dot(x, y)
     15 ```
     16 
     17 ### Parameters
     18 
     19 Parameter | Type | Description
     20 --------- | ---- | -----------
     21 `x` | Array &#124; Matrix | First vector
     22 `y` | Array &#124; Matrix | Second vector
     23 
     24 ### Returns
     25 
     26 Type | Description
     27 ---- | -----------
     28 number | Returns the dot product of `x` and `y`
     29 
     30 
     31 ### Throws
     32 
     33 Type | Description
     34 ---- | -----------
     35 
     36 
     37 ## Examples
     38 
     39 ```js
     40 math.dot([2, 4, 1], [2, 2, 3])       // returns number 15
     41 math.multiply([2, 4, 1], [2, 2, 3])  // returns number 15
     42 ```
     43 
     44 
     45 ## See also
     46 
     47 [multiply](multiply.md),
     48 [cross](cross.md)