1
$\begingroup$

For example applied to y^2*x^3 + z^2+1 it should give 5 due to the y^2*x^3component.

$\endgroup$
0

2 Answers 2

3
$\begingroup$
Max[Total@*First /@ CoefficientRules[y^2*x^3 + z^2 + 1]]

5

This extracts rules for all coefficient combinations, ignores the constant multiplier for them, sums powers in each of them, and takes the largest sum.

$\endgroup$
1
$\begingroup$

may be this will work in general. Did not test it fully

ClearAll[x,y,z];
p = y^2* x^3 + z^2 + 1;
Exponent[p /. {y -> x, z -> x}, x]

(* 5 *)
$\endgroup$
2
  • 1
    $\begingroup$ You could also automate the replacement of variables with Exponent[p /. Alternatives @@ Variables@p -> x, x]. $\endgroup$
    – kirma
    Commented Apr 24, 2020 at 9:28
  • $\begingroup$ @kirma thanks for the nice hint. $\endgroup$
    – Nasser
    Commented Apr 24, 2020 at 9:29

Not the answer you're looking for? Browse other questions tagged or ask your own question.