Documentation moved.
This entry is documented with its primary interface. Open the documentation →
Function
src/index.ts:1095nerdamer.deg
nerdamer.deg(x: ExpressionInput | Polynomial, variable?: ExpressionInput): ExpressionReturns the degree of a polynomial expression.
remarks
With no variable, deg(p) returns the total degree: the largest sum of powers in any
term. With a variable, deg(p, x) returns the largest power of x, treating the other
variables as coefficients. If the input cannot be converted to a polynomial, the call
remains symbolic instead of throwing.
Parameters
| Name | Type | Description |
|---|---|---|
x | ExpressionInput | Polynomial | Expression-like input or polynomial to inspect. |
variable | ExpressionInput | Optional variable whose degree should be returned. |
Returns
Expression — A numeric expression for polynomial input, otherwise an unevaluated deg(...) call.
Examples
deg('x^2*y^3+x').text(); // "5"
deg('x^2*y^3+x', 'x').text(); // "2"
deg('x^2*y^3+x', 'y').text(); // "3"