I am porting some code I have in Mathematica to Maple.
Mathematica has command Exponent which returns largest power on x, even if the power is not integer.
It is defined as
Maple's degree command does not allow this and returns FAIL (since it is meant to work only on polynomial, I understand that).
Is there a different command I could use which does the same as Exponent? Otherwise I have to parse it manually. The expressions will all be univariant polynomial in x, but the power on x can contain a symbol and numbers. The expression can be more complicated, but it will always have just one x in it, and I just want to extract the power in that x inside the expression.
Here are examples
In the above all fail except the first one which returns 2. For reference here is the result from Mathematica's Exponent command
Exponent[x^(n - 1), x]
Exponent[3*x^(n + 2), x]
I googled and could not find anything so far. I looked at PolynomialTools but do not see such command in it.
On possibility to do this manually is
if nops(z)<>0 then
Eitherway, if there is a builtin command in Maple, it will be better to use than my code which might still fail for some cases I did not think of.