Here is the situation.
I have a function say:
f[x_] = x^3 + x^2 + x + 1
Taking the derivative D[f[x], x],
I get 1 + x + x^2 + x^3.
My question is how do I programtically define function g[x_]:=1 + x + x^2 + x^3?
Defining g[x_] := D[f[x], x] is probably not the right way to go, as every time I evaluate g[x], it will compute D[f[x],x].
I want the result of D[f[x],x] memorized and defined as g[x]. In other words, I want g[x]:=1 + x + x^2 + x^3. Is there any way to do this?