Polynomial factorization check
polynomial-factorization-check · version 1.0.0 · Numbers & math · free, no key needed
Check a claimed factorization c * prod f_i^e_i of a rational polynomial: monic distinct factors, degrees, coefficients.
Use when you need to: check a factorization of a polynomial · verify polynomial factors multiply back to the original · is this polynomial factored correctly over the rationals.
Decide before calling
Read the versioned contract and the supported scope below. Reuse polynomial-factorization-check@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 polynomial-factorization-check@1.0.0 for check a factorization of a polynomial. 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
- check a factorization of a polynomial
- verify polynomial factors multiply back to the original
- is this polynomial factored correctly over the rationals
- check factors are monic and the leading constant is right
- validate repeated factors and multiplicities of a polynomial
- verify a quadratic factor is irreducible over q
Not supported
- factoring a polynomial (supply the claimed factorization)
- proving irreducibility of factors of degree 3 or more (accepted, reported as irreducibility_verified false)
- factorization over finite fields, Z[x] content conventions, or multivariate polynomials
- floating-point coefficients or approximate roots
Behavior
- Polynomials are canonical ascending coefficient arrays (entry k = coefficient of x^k, last entry nonzero) of exact rational strings (<= 40 characters), degree <= 64. Claim: f = leading_coefficient * prod factors[i].coefficients ^ multiplicity with distinct monic non-constant factors (Cohen 1993, ch. 3; reference_version cohen-gtm138-1993-ch3). f = [] is not_computable.
- Order: per factor i ascending: degree >= 1 (factor_degree_violation), monic (factor_not_monic), distinct from earlier factors (duplicate_factor); then leading_coefficient = lc(f) (leading_coefficient_mismatch); then sum of multiplicity * degree = deg f (degree_mismatch); then coefficients from degree 0 upward (coefficient_mismatch); then each quadratic factor must have a discriminant that is not a rational square (factor_reducible, rhs = the square-root witness).
- first_discrepancy is {check, factor_index, degree, lhs, relation, rhs}. degree = deg f is always returned; irreducibility_verified is true only when valid and every factor has degree <= 2 (degree 1 always irreducible, degree 2 by the exact discriminant test).
Input
polynomial(array of string, required): max items 65; each max length 40; each pattern^-?(0|[1-9][0-9]*)(/[1-9][0-9]*|\.[0-9]+)?$leading_coefficient(string, required): max length 40; pattern^-?(0|[1-9][0-9]*)(/[1-9][0-9]*|\.[0-9]+)?$factors(array of object, required): max items 16
Output
valid(boolean, required)reason(one of "factor_degree_violation", "factor_not_monic", "duplicate_factor", "leading_coefficient_mismatch", "degree_mismatch", "coefficient_mismatch", "factor_reducible", null, required)first_discrepancy(object or null, required)degree(integer, required): min 0irreducibility_verified(boolean, required)reference_version(constant "cohen-gtm138-1993-ch3", required)
Limits
- max degree: 64
- max factors: 16
- max multiplicity: 64
- max number chars: 40
Example
Request input:
{
"polynomial": [
"-2",
"0",
"2"
],
"leading_coefficient": "2",
"factors": [
{
"coefficients": [
"-1",
"1"
],
"multiplicity": 1
},
{
"coefficients": [
"1",
"1"
],
"multiplicity": 1
}
]
}
Response:
{
"result": {
"valid": true,
"reason": null,
"first_discrepancy": null,
"degree": 2,
"irreducibility_verified": true,
"reference_version": "cohen-gtm138-1993-ch3"
}
}
How to call it
MCP
Connect https://computefirst.net/mcp (setup), then call execute with:
{
"id": "polynomial-factorization-check",
"version": "1.0.0",
"input": {
"polynomial": [
"-2",
"0",
"2"
],
"leading_coefficient": "2",
"factors": [
{
"coefficients": [
"-1",
"1"
],
"multiplicity": 1
},
{
"coefficients": [
"1",
"1"
],
"multiplicity": 1
}
]
}
}
HTTP (no key)
curl -X POST https://computefirst.net/v1/tools/polynomial-factorization-check/versions/1.0.0/execute \
-H "Content-Type: application/json" \
-d '{"polynomial":["-2","0","2"],"leading_coefficient":"2","factors":[{"coefficients":["-1","1"],"multiplicity":1},{"coefficients":["1","1"],"multiplicity":1}]}'
The machine-readable contract is at /v1/tools/polynomial-factorization-check/versions/1.0.0.
CLI
node cli.mjs run polynomial-factorization-check 1.0.0 --input input.json --base-url https://computefirst.net
Get the client at /clients/cli/.
Related tools
- Polynomial division check: Check a claimed polynomial division A = BQ + R over exact rationals: remainder degree, quotient degree, coefficients.
- Contingency expected check: Check claimed expected counts (row total x column total / N) of a count table exactly; returns the first wrong cell.
- Lp primal feasibility check: Check that a claimed LP point satisfies x >= 0 and Ax <= b exactly; report the first violated bound or row.
- Polynomial identity check: Check a polynomial identity over exact rationals by expanding both sides; report the lowest disagreeing coefficient.
- Regression normal equations check: Check that claimed coefficients and residuals satisfy X^T e = 0 exactly; rejects singular, ambiguous designs.
- Chi square decomposition check: Check a claimed Pearson chi-square, its per-cell (O-E)^2/E terms and df exactly; returns the first wrong term.