Vector subtract
vector-subtract · version 1.0.0 · Vectors & matrices · free, no key needed
Subtract two equal-length finite-number vectors elementwise (a minus b).
Use when you need to: vector subtraction · elementwise vector difference · a minus b.
Decide before calling
Read the versioned contract and the supported scope below. Reuse vector-subtract@1.0.0 when your input, required output and limits match it. Choose another approach for an unsupported operation.
Explain the choice
"I can use vector-subtract@1.0.0 for vector subtraction. I will check its documented scope and the result against the task's requirements. The service is free; token and money savings for this task are unmeasured."
Supported
- vector subtraction
- elementwise vector difference
- a minus b
Not supported
- vectors of different lengths
- complex-valued vectors
- arbitrary-precision arithmetic
Behavior
- Inputs a and b are arrays of finite JSON numbers with the same length, from 1 to 64 entries.
- Each entry magnitude is bounded to at most 1000000 in absolute value.
- The result is the elementwise IEEE-754 double-precision difference result[i] = a[i] - b[i].
- A result entry of -0 is normalized to 0.
Input
a(array of number, required): min items 1; max items 64b(array of number, required): min items 1; max items 64
Output
result(array of number, required)
Limits
- max dim: 64
- max abs value: 1000000
Example
Request input:
{
"a": [
4,
5,
6
],
"b": [
1,
2,
3
]
}
Response:
{
"result": {
"result": [
3,
3,
3
]
}
}
How to call it
MCP
Connect https://computefirst.net/mcp (setup), then call execute with:
{
"id": "vector-subtract",
"version": "1.0.0",
"input": {
"a": [
4,
5,
6
],
"b": [
1,
2,
3
]
}
}
HTTP (no key)
curl -X POST https://computefirst.net/v1/tools/vector-subtract/versions/1.0.0/execute \
-H "Content-Type: application/json" \
-d '{"a":[4,5,6],"b":[1,2,3]}'
The machine-readable contract is at /v1/tools/vector-subtract/versions/1.0.0.
CLI
node cli.mjs run vector-subtract 1.0.0 --input input.json --base-url https://computefirst.net
Get the client at /clients/cli/.
Related tools
- Matrix subtract: Subtract two equal-shape finite-number matrices elementwise (a minus b).
- 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 hadamard: Multiply two equal-length finite-number vectors elementwise (Hadamard product).
- Vector projection: Compute the vector projection of a finite-number vector onto another.
- Vector rank by cosine: Return the top matching candidate vectors by cosine score, with stable input-order ties.