Reasoning about Degree of Polynomial

3

Apologies if this is outside of the realm of Mathematica -- I'm still trying to figure out the limits of how expressive Mathematica is (and how much of my work can be automated).

Suppose I define the following:

f[1] = x
f[n_] = x * f[n-1]

Then, I want to ask:

for integral k>1, what is the degree of f[k] ?

so for example, I want to write a function:

degreeOf[f, k] = k

Now, I know that in this above example, given that we know how f is defined, it's trivial that degreeOf[f, k] = k. However, is it possible to write generic degreeOf ?

In a sense, I'm curious if the "computational" part of mathematica -- it's ability to handle symbols and do substitutions + simplifications -- or if it can reason about them at a deeper level.

Thanks!

user1602

Posted 2012-07-11T06:48:21.860

Reputation:

Answers

6

Since you have defined your function recursively, you will first need to solve the recurrence equation using RSolve to get the general form.

For example:

F = f /. First @ RSolve[{f[n] == x f[n - 1], f[1] == x}, f, n]
(*  Function[{n}, x^n]  *)

Exponent[F[k], x]
(*  k  *)

Simon Woods

Posted 2012-07-11T06:48:21.860

Reputation: 81 905

This is amazing. – None – 2012-07-11T22:53:01.633

6

Does Exponent do what you expect from degreeOf[]?

enter image description here

 f = (x^3 + 1)^3 + 1;
 Exponent[f, x]
 (* ==> 9 *)

kglr

Posted 2012-07-11T06:48:21.860

Reputation: 302 076

I did not explain my question well. The point is that I want to get Exponent[f[n], x] WITHOUT knowing n, i.e. I want a symbolic response back of "n". – None – 2012-07-11T07:41:42.253

@term-rewritica You mean as in Exponent[x^(n - 1) + x^a, x] (=> Max[a,n-1])? Seems Exponent works fine in that case as well. – jVincent – 2012-07-11T07:44:51.367

term-rewritica, similar to the example in @jVincent's comment, f = (x^n + 1)^3 + 1; Exponent[f, x] gives Max[0, n, 2 n, 3 n]. – kglr – 2012-07-11T08:33:28.187