Vector
An ordered, operable parser aggregate with heterogeneous ParserEntity elements.
Vector is not restricted to numeric linear-algebra values. General arithmetic is element-wise: scalar operands are broadcast across the Vector, while Vector operands are paired by position and must have the same length. Vector-to-Vector times remains an element-wise product rather than an alias for dot. A Matrix operand interprets this Vector as a row vector for the standard
`Vector * Matrix`product; orientation is supplied by operand position rather than stored on the Vector. Structural methods such as append, insert, extend, reverse, and trim mutate this Vector. True linear-algebra operations (dot, cross, and norm) require Expression elements.
`dot`requires equal lengths, while
`cross`requires two three-element Vectors. These operations throw rather than assigning arithmetic meaning to arbitrary aggregate elements. Construction from a Collection copies its elements. Construction from an array normalizes inputs but retains existing parser entities; copy deep-copies every element. Comparisons are component-wise predicates, not a total ordering, and return false for a type or length mismatch.
Members
__get__(indices: number[]): ParserEntityMethodReturns the element at the given zero-based index. Used by the parser for bracket indexing, e.g. [a, b, c][1] returns b.
UnexpectedDataType If the index is out of bounds.
Parameters
| Name | Type | Description |
|---|---|---|
indices | number[] | Zero-based parser indices after index-base adjustment. |
Returns
ParserEntity — The stored parser entity.
__set__(indices: number[], value: ParserEntity): voidMethodSets the element at the given index.
Parameters
| Name | Type | Description |
|---|---|---|
indices | number[] | A single-element array [i] |
value | ParserEntity | The value to set |
Returns
void
abs(): VectorMethodNo description is available yet.
Returns
add(x: ParserEntity): thisMethodAppends an existing parser entity by reference and returns this Vector.
Parameters
| Name | Type | Description |
|---|---|---|
x | ParserEntity | — |
Returns
this
append(e: ParserEntity): thisMethodAppends an existing parser entity by reference.
Parameters
| Name | Type | Description |
|---|---|---|
e | ParserEntity | Element to append. |
Returns
this
arrayMap(callback: (e: ParserEntity): unknown): unknown[]MethodNo description is available yet.
Parameters
| Name | Type | Description |
|---|---|---|
callback | (e: ParserEntity): unknown | — |
Returns
unknown[]
at(i: number): ParserEntityMethodReturns the stored entity at a zero-based index without copying it.
Parameters
| Name | Type | Description |
|---|---|---|
i | number | Zero-based index. |
Returns
ParserEntity — The entity, or `undefined` at runtime for an out-of-range index.
clear(): thisMethodRemoves all elements from the vector.
Returns
this
Vector(elements?: Collection | NerdamerInput[]): VectorConstructorCreates a Vector from normalized input values or a copied Collection.
Parameters
| Name | Type | Description |
|---|---|---|
elements | Collection | NerdamerInput[] | — |
Returns
copy(): VectorMethodCopies the Vector and every contained entity.
Returns
count(): numberMethodGets the number of current elements in the Vector.
Returns
number — Current length.
create(v: ExpressionInput[]): VectorMethodCreates an Expression-only Vector from expression-compatible inputs.
Parameters
| Name | Type | Description |
|---|---|---|
v | ExpressionInput[] | — |
Returns
Computes the three-dimensional cross product.
DimensionError Unless both Vectors have exactly three elements.
UnexpectedDataType If any required element is not an Expression.
Parameters
| Name | Type | Description |
|---|---|---|
v | Vector | — |
Returns
dataType: "VEC"PropertyNo description is available yet.
delete(x: ParserEntity): booleanMethodNo description is available yet.
Parameters
| Name | Type | Description |
|---|---|---|
x | ParserEntity | — |
Returns
boolean
diff(variable?: ExpressionInput, n?: number | Expression): VectorMethodNo description is available yet.
Parameters
| Name | Type | Description |
|---|---|---|
variable | ExpressionInput | — |
n | number | Expression | — |
Returns
dimensions(): number[]MethodNo description is available yet.
Returns
number[]
dimensionsMatch(x: ParserEntity): xMethodNo description is available yet.
Parameters
| Name | Type | Description |
|---|---|---|
x | ParserEntity | — |
Returns
x
div(x: NerdamerInput): VectorMethodDivides corresponding elements, or broadcasts a scalar divisor.
Vector-to-Vector division is element-wise and requires equal lengths. This is distinct from scalar division, which applies the same divisor to every element.
DimensionError If a Vector divisor has a different length.
Parameters
| Name | Type | Description |
|---|---|---|
x | NerdamerInput | — |
Returns
dot(v: Vector): ExpressionMethodComputes the sum of pairwise products.
DimensionError If the Vector lengths differ.
UnexpectedDataType If a required element is not an Expression.
Parameters
| Name | Type | Description |
|---|---|---|
v | Vector | — |
Returns
each(callback: (e: ParserEntity, i: number): ParserEntity): thisMethodReplaces elements with callback results in place, in ascending index order.
Parameters
| Name | Type | Description |
|---|---|---|
callback | (e: ParserEntity, i: number): ParserEntity | — |
Returns
this
elements: ParserEntity[]PropertyNo description is available yet.
eq(V: ParserEntity): booleanMethodNo description is available yet.
Parameters
| Name | Type | Description |
|---|---|---|
V | ParserEntity | — |
Returns
boolean
evaluate(): VectorMethodEvaluates a copied Vector, resolving symbolic bracket access when values are supplied.
Parameters
| Name | Type | Description |
|---|---|---|
values | ParserValuesObject | — |
Returns
expand(): VectorMethodExpands a copied Vector, leaving this one unchanged.
Returns
extend(v: ParserEntity): VectorMethodAppends another Vector's element references, mutating this Vector.
UnexpectedDataType If
`v`is not a Vector.
Parameters
| Name | Type | Description |
|---|---|---|
v | ParserEntity | Vector whose elements should be appended. |
Returns
Vector — This Vector.
factor(): VectorMethodNo description is available yet.
Returns
getExpressionAt(n: number): ExpressionMethodReturns an element after verifying that it is an Expression.
UnexpectedDataType If the stored entity is not an Expression.
Parameters
| Name | Type | Description |
|---|---|---|
n | number | Zero-based index. |
Returns
Expression — The stored Expression reference.
gt(V: ParserEntity): booleanMethodNo description is available yet.
Parameters
| Name | Type | Description |
|---|---|---|
V | ParserEntity | — |
Returns
boolean
gte(V: ParserEntity): booleanMethodNo description is available yet.
Parameters
| Name | Type | Description |
|---|---|---|
V | ParserEntity | — |
Returns
boolean
indexOf(x: ParserEntity): numberMethodGets the index of the first element structurally equal to
`x`.
Parameters
| Name | Type | Description |
|---|---|---|
x | ParserEntity | Value to locate. |
Returns
number — The zero-based index, or `-1` when absent.
insert(i: number, x: ParserEntity): thisMethodInserts an entity by reference before the provided index.
Parameters
| Name | Type | Description |
|---|---|---|
i | number | Zero-based insertion index. |
x | ParserEntity | Entity to insert. |
Returns
this — This mutated Vector.
integrate(variable?: ExpressionInput): VectorMethodNo description is available yet.
Parameters
| Name | Type | Description |
|---|---|---|
variable | ExpressionInput | — |
Returns
isEnumerable: booleanPropertyNo description is available yet.
isVector(obj: unknown): objMethodNo description is available yet.
Parameters
| Name | Type | Description |
|---|---|---|
obj | unknown | — |
Returns
obj
lt(V: ParserEntity): booleanMethodNo description is available yet.
Parameters
| Name | Type | Description |
|---|---|---|
V | ParserEntity | — |
Returns
boolean
lte(V: ParserEntity): booleanMethodNo description is available yet.
Parameters
| Name | Type | Description |
|---|---|---|
V | ParserEntity | — |
Returns
boolean
minus(x: NerdamerInput): VectorMethodSubtracts corresponding elements, or broadcasts a scalar subtrahend.
DimensionError If a Vector operand has a different length.
Parameters
| Name | Type | Description |
|---|---|---|
x | NerdamerInput | — |
Returns
norm(): ExpressionMethodReturns the Euclidean norm
`sqrt(sum(abs(element)^2))`.
UnexpectedDataType If any element is not an Expression.
Returns
plus(x: NerdamerInput): VectorMethodAdds corresponding elements, or broadcasts a scalar addend.
DimensionError If a Vector operand has a different length.
Parameters
| Name | Type | Description |
|---|---|---|
x | NerdamerInput | — |
Returns
pop(index?: number): ParserEntity | undefinedMethodRemoves an element given an index. If none is provided it removes the last element. Indices are zero-based.
Parameters
| Name | Type | Description |
|---|---|---|
index | number | Optional zero-based index. |
Returns
ParserEntity | undefined — The removed entity, or `undefined` when no entity is present.
pow(x: NerdamerInput): VectorMethodRaises corresponding elements to powers, or broadcasts a scalar exponent.
DimensionError If a Vector exponent has a different length.
Parameters
| Name | Type | Description |
|---|---|---|
x | NerdamerInput | — |
Returns
precision: numberPropertyNo description is available yet.
prod(): ExpressionMethodMultiplies all Expression elements in order.
UnexpectedDataType If an element is not an Expression.
Returns
Expression — Their product, or one for an empty Vector.
remove(x: ParserEntity): VectorMethodRemoves the first element equal to
`x`, rather than matching by reference.
Parameters
| Name | Type | Description |
|---|---|---|
x | ParserEntity | Value to remove. |
Returns
Vector — This Vector, whether or not a match was found.
reverse(): thisMethodReverses the Vector in place.
Returns
this — This Vector.
simplify(): VectorMethodNo description is available yet.
Returns
sort(compareFn?: (a: ParserEntity, b: ParserEntity): number): thisMethodNo description is available yet.
Parameters
| Name | Type | Description |
|---|---|---|
compareFn | (a: ParserEntity, b: ParserEntity): number | — |
Returns
this
subst(value: ExpressionInput, withValue: ExpressionInput): VectorMethodNo description is available yet.
Parameters
| Name | Type | Description |
|---|---|---|
value | ExpressionInput | — |
withValue | ExpressionInput | — |
Returns
sum(): ExpressionMethodAdds all Expression elements in order.
UnexpectedDataType If an element is not an Expression.
Returns
Expression — Their sum, or zero for an empty Vector.
symbolicAccessor: Expression[]PropertyPublic index expressions retained when bracket access cannot yet be resolved. This state belongs to a copied structured entity, never the stored source value.
symbolicTarget: ExpressionPropertyOriginal symbolic target used to render and later re-evaluate bracket access.
text(): stringMethodNo description is available yet.
Returns
string
times(x: NerdamerInput): VectorMethodMultiplies corresponding Vector elements, broadcasts a scalar factor, or multiplies this Vector from the left of a Matrix.
Vector-to-Vector multiplication is the element-wise (Hadamard) product. Use dot when a scalar inner product is intended. For a Matrix operand, this Vector is interpreted as a row vector. Nonzero-width products reuse the existing Matrix-vector product through the transpose; a compatible zero-width Matrix has the empty Vector as its result because its transpose cannot be represented.
DimensionError If Vector dimensions are incompatible.
MathError If Matrix dimensions are incompatible.
Parameters
| Name | Type | Description |
|---|---|---|
x | NerdamerInput | — |
Returns
toPolynomial(vars: string[]): PolynomialMethodInterprets ordered elements as ascending polynomial coefficients.
Parameters
| Name | Type | Description |
|---|---|---|
vars | string[] | — |
Returns
toString(): stringMethodNo description is available yet.
Returns
string
trim(): VectorMethodRemoves every element equal to zero.
Returns
Vector — This mutated Vector.
withSymbolicAccessor(target: Expression, indices: Expression[]): VectorMethodReturns a copied structured entity carrying an unresolved bracket access. Existing accessor state is retained so chained symbolic access can be extended.
Parameters
| Name | Type | Description |
|---|---|---|
target | Expression | — |
indices | Expression[] | — |
