mathjs
Version:
Math.js is an extensive math library for JavaScript and Node.js. It features a flexible expression parser with support for symbolic computation, comes with a large set of built-in functions and constants, and offers an integrated solution to work with dif
43 lines (26 loc) • 837 B
Markdown
<!-- Note: This file is automatically generated from source code comments. Changes made in this file will be overridden. -->
# Function dot
Calculate the dot product of two vectors. The dot product of
`A = [a1, a2, ..., an]` and `B = [b1, b2, ..., bn]` is defined as:
dot(A, B) = conj(a1) * b1 + conj(a2) * b2 + ... + conj(an) * bn
## Syntax
```js
math.dot(x, y)
```
### Parameters
Parameter | Type | Description
--------- | ---- | -----------
`x` | Array | Matrix | First vector
`y` | Array | Matrix | Second vector
### Returns
Type | Description
---- | -----------
number | Returns the dot product of `x` and `y`
## Examples
```js
math.dot([2, 4, 1], [2, 2, 3]) // returns number 15
math.multiply([2, 4, 1], [2, 2, 3]) // returns number 15
```
## See also
[multiply](multiply.md),
[cross](cross.md)