# Vector norm

`vector-norm` · version 1.0.0 · Vectors & matrices · free, no key needed

Compute the L1, L2 (Euclidean), or L-infinity (Chebyshev) norm of a finite-number vector.

**Use when you need to: vector norm · vector magnitude · euclidean length.**

## Supported

- vector norm
- vector magnitude
- euclidean length
- L1 norm
- L2 norm
- infinity norm

## Not supported

- general p-norms for non-integer or fractional p
- matrix norms (use matrix-frobenius-norm-style tools)

## Behavior

- Input vector is an array of 1 to 64 finite JSON numbers, each bounded to at most 1000000 in magnitude.
- Optional input p selects the norm: 1 for the L1 (sum of absolute values) norm, 2 (default) for the Euclidean norm, or the string "inf" for the L-infinity (maximum absolute value) norm.
- The L2 norm uses Math.sqrt over an IEEE-754 double-precision sum of squares; results for irrational magnitudes are rounded to double precision, not exact.
- The result is always non-negative; -0 is normalized to 0.

## Input

- `vector` (array of number, required): min items 1; max items 64
- `p` (one of 1, 2 or one of "inf", optional)

## Output

- `result` (number, required)

## Limits

- max dim: 64
- max abs value: 1000000

## Example

Request input:

```json
{
  "vector": [
    3,
    4
  ]
}
```

Response:

```json
{
  "result": {
    "result": 5
  }
}
```

## How to call it

### MCP

Connect `https://computefirst.net/mcp` ([setup](/docs#connect)), then call `execute` with:

```json
{
  "id": "vector-norm",
  "version": "1.0.0",
  "input": {
    "vector": [
      3,
      4
    ]
  }
}
```

### HTTP (no key)

```sh
curl -X POST https://computefirst.net/v1/tools/vector-norm/versions/1.0.0/execute \
  -H "Content-Type: application/json" \
  -d '{"vector":[3,4]}'
```

The machine-readable contract is at [/v1/tools/vector-norm/versions/1.0.0](/v1/tools/vector-norm/versions/1.0.0).

### CLI

```sh
node cli.mjs run vector-norm 1.0.0 --input input.json --base-url https://computefirst.net
```

Get the client at [/clients/cli/](/clients/cli/).

## Related tools

- [Vector distance](/tools/vector-distance): Compute the Euclidean, Manhattan, or Chebyshev distance between two equal-length finite-number vectors.
- [Vector normalize](/tools/vector-normalize): Scale a finite-number vector to unit Euclidean length.
- [Matrix vector multiply](/tools/matrix-vector-multiply): Multiply an MxN finite-number matrix by a length-N finite-number vector, producing a length-M vector.
- [Vector add](/tools/vector-add): Add two equal-length finite-number vectors elementwise.
- [Vector angle](/tools/vector-angle): Compute the angle in radians between two equal-length finite-number vectors.
- [Vector approx equal](/tools/vector-approx-equal): Compare two equal-length finite-number vectors for approximate equality within an absolute tolerance.
