dot
Computes the dot product of two vectors.
Concrete vectors must have the same length. Their corresponding elements are multiplied and summed to produce a scalar Expression. Symbolic non-vector operands can remain as an unevaluated dot call.
Examples
These examples use Nerdamer Notation.
Compute a numeric three-dimensional dot product.
dot([1,2,3],[4,5,6]) // → 32
Keep symbolic vector components in the scalar result.
dot([x,y],[a,b])Interfaces
The same operation is available through the interfaces below.
Nerdamer Notation
Use this form inside input passed to nerdamer(...).
dot(arg1, arg2)
nerdamer.dot
Call the operation through the default nerdamer import.
nerdamer.dot(a: ParserEntity, b: ParserEntity): Expression
Parameters
| Name | Type | Description |
|---|---|---|
a | ParserEntity | First Vector, or a symbolic Expression operand. |
b | ParserEntity | Second Vector, or a symbolic Expression operand. |
Returns
Expression — The scalar dot product for Vectors, or an unevaluated `dot(a, b)` Expression when both operands are Expressions.
Direct JavaScript / TypeScript API
Import the operation directly from its package entry point.
import { dot } from 'nerdamer/structures';
dot(a: ParserEntity, b: ParserEntity): Expression
Parameters
| Name | Type | Description |
|---|---|---|
a | ParserEntity | First Vector, or a symbolic Expression operand. |
b | ParserEntity | Second Vector, or a symbolic Expression operand. |
Returns
Expression — The scalar dot product for Vectors, or an unevaluated `dot(a, b)` Expression when both operands are Expressions.
