Function reference · Algebra

factor

Factors an expression into a product of simpler factors.

Use factor to expose multiplicative structure in polynomial-like expressions. It can factor univariate and multivariate polynomials, extract common factors, recognize repeated factors, and prime-factor exact integers.

If Nerdamer cannot factor an input using its supported symbolic methods, the expression may remain unchanged or as an unevaluated factor call.

Examples

These examples use Nerdamer Notation.

Factor a quadratic over the integers.

factor(x^2+5*x+6)
// → (2+x)*(3+x)

Recognize a multivariable perfect square.

factor(x^2+2*x*y+y^2)
// → (x+y)^2

Prime-factor an exact integer.

factor(4677271)
// → 2089*2239

Interfaces

The same operation is available through the interfaces below.

Nerdamer Notation · nerdamer API · Direct API

Nerdamer Notation

Use this form inside input passed to nerdamer(...).

factor(expression)

Parameters

  • expression — Expression to factor.

nerdamer.factor

Call the operation through the default nerdamer import.

nerdamer.factor(x: ExpressionInput): Expression

Parameters

NameTypeDescription
xExpressionInputExpression-compatible value to factor.

Returns

Expression — A factored expression or an unevaluated symbolic `factor` call.

Browse the nerdamer API →

Direct JavaScript / TypeScript API

Import the operation directly from its package entry point.

import { factor } from 'nerdamer/algebra';
factor(x: ExpressionInput): Expression

Parameters

NameTypeDescription
xExpressionInputExpression-compatible value to factor.

Returns

Expression — A factored expression or an unevaluated symbolic `factor` call.

Browse nerdamer/algebra

← Back to Reference