# Vector

The `Vector` built-in class (which is a child of the `Array` class), provides support for defining and working with vectors:

```ruby
Vector(1, 2, 3, 4, 5)
```

Alternatively:

```ruby
%v(1 2 3 4 5)
```

## Operations

```ruby
var A = Vector(1, 2, 3, 4)
var B = Vector(9, 8, 7, 6)

say (A + B)                    # vector entrywise addition
say (A - B)                    # vector entrywise subtraction
say (A * B)                    # cross product

say (A + 42)                   # vector-scalar addition
say (A - 42)                   # vector-scalar subtraction
say (A * 42)                   # vector-scalar multiplication
say (A / 42)                   # vector-scalar division

say A.sum                      # vector sum
say A.prod                     # vector product

say A.norm                     # normalized value: sum of squares
say A.manhattan_norm           # Manhattan normalized: sum of absolute values

say A.dist(B)                  # distance between two vectors
say A.dist_norm(B)             # distance squared between two vectors
say A.manhattan_dist(B)        # Manhattan distance between two vectors
say A.chebyshev_dist(B)        # Chebyshev distance between two vectors
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://trizen.gitbook.io/sidef-lang/syntax_and_semantics/literals/vector.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
