Vector normalize
vector-normalize · version 1.0.0 · Vectors & matrices · free, no key needed
Scale a finite-number vector to unit Euclidean length.
Use when you need to: vector normalization · unit vector · make vector unit length.
Supported
- vector normalization
- unit vector
- make vector unit length
Not supported
- normalizing the zero vector (undefined direction)
- normalization by a norm other than L2
Behavior
- Input vector is an array of 1 to 64 finite JSON numbers, each bounded to at most 1000000 in magnitude.
- The Euclidean (L2) norm is computed with IEEE-754 double-precision Math.sqrt over the sum of squares.
- Optional input tolerance (default 1e-9, range 0 to 1) is the minimum norm accepted; vectors whose norm is at or below tolerance are rejected as having no well-defined direction.
- The result is result[i] = vector[i] / norm, computed in IEEE-754 double precision; -0 is normalized to 0.
- Every result entry is checked to be a finite number before it is returned; a non-finite intermediate is rejected as invalid input rather than silently serialized.
Input
vector(array of number, required): min items 1; max items 64tolerance(number, optional): min 0; max 1
Output
result(array of number, required)
Limits
- max dim: 64
- max abs value: 1000000
Example
Request input:
{
"vector": [
3,
4
]
}
Response:
{
"result": {
"result": [
0.6,
0.8
]
}
}
How to call it
MCP
Connect https://computefirst.net/mcp (setup), then call execute with:
{
"id": "vector-normalize",
"version": "1.0.0",
"input": {
"vector": [
3,
4
]
}
}
HTTP (no key)
curl -X POST https://computefirst.net/v1/tools/vector-normalize/versions/1.0.0/execute \
-H "Content-Type: application/json" \
-d '{"vector":[3,4]}'
The machine-readable contract is at /v1/tools/vector-normalize/versions/1.0.0.
CLI
node cli.mjs run vector-normalize 1.0.0 --input input.json --base-url https://computefirst.net
Get the client at /clients/cli/.
Related tools
- Vector norm: Compute the L1, L2 (Euclidean), or L-infinity (Chebyshev) norm of a finite-number vector.
- Matrix vector multiply: Multiply an MxN finite-number matrix by a length-N finite-number vector, producing a length-M vector.
- Vector add: Add two equal-length finite-number vectors elementwise.
- Vector angle: Compute the angle in radians between two equal-length finite-number vectors.
- Vector approx equal: Compare two equal-length finite-number vectors for approximate equality within an absolute tolerance.
- Vector cross: Compute the 3-dimensional cross product of two finite-number vectors.