deg
Returns the degree of a polynomial expression.
With no variable argument, deg returns the total degree: the largest sum of powers in any term. With a variable, it returns the largest power of that variable while treating other variables as coefficients.
If the input cannot be converted to a polynomial, the operation remains symbolic.
Examples
These examples use Nerdamer Notation.
Return the total degree of a multivariable polynomial.
deg(x^2*y^3+x)
// → 5Return the degree with respect to x.
deg(x^2*y^3+x,x)
// → 2Return the degree with respect to y.
deg(x^2*y^3+x,y)
// → 3Interfaces
The same operation is available through the interfaces below.
Nerdamer Notation
Use this form inside input passed to nerdamer(...).
deg(arg1, [arg2])
nerdamer.deg
Call the operation through the default nerdamer import.
nerdamer.deg(x: ExpressionInput | Polynomial, variable?: ExpressionInput): Expression
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.
Direct JavaScript / TypeScript API
Import the operation directly from its package entry point.
import { deg } from 'nerdamer/algebra';
deg(x: ExpressionInput | Polynomial, variable?: ExpressionInput): Expression
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.
