Function reference · Algebra

partfrac

Decomposes a rational expression into partial fractions with respect to a variable.

Nerdamer handles rational expressions with distinct or repeated linear factors, supported irreducible quadratic factors, and improper fractions that first require polynomial division.

When no useful decomposition is available, the original expression is returned unchanged.

Examples

These examples use Nerdamer Notation.

Decompose a rational function with two distinct linear factors.

partfrac((4*k-1)/(k*(k+2)),k)
// → (-1/2)*k^-1+(9/2)*(2+k)^-1

Reduce an improper rational expression when the remainder is zero.

partfrac((x^2-1)/(x-1),x)
// → 1+x

Decompose a denominator containing a repeated linear factor.

partfrac(1/(x^2*(x-1)),x)

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(...).

partfrac(arg1, [arg2])

nerdamer.partfrac

Call the operation through the default nerdamer import.

nerdamer.partfrac(x: ExpressionInput, variable?: ExpressionInput): Expression

Parameters

NameTypeDescription
xExpressionInputRational expression to decompose.
variableExpressionInputMain variable; defaults to the first variable reported by the expression.

Returns

Expression — A new decomposition when one is found, otherwise the original parsed expression.

Browse the nerdamer API →

Direct JavaScript / TypeScript API

Import the operation directly from its package entry point.

import { partfrac } from 'nerdamer/algebra';
partfrac(x: ExpressionInput, variable?: ExpressionInput): Expression

Parameters

NameTypeDescription
xExpressionInputRational expression to decompose.
variableExpressionInputMain variable; defaults to the first variable reported by the expression.

Returns

Expression — A new decomposition when one is found, otherwise the original parsed expression.

Browse nerdamer/algebra

← Back to Reference