# How to perform the first and second derivatives of Nth polynomials?

Suppose

$$P(x,y)=\displaystyle\sum^{N}_{i+j=0}\alpha_{ij}x^{i}y^{i} \equiv \alpha_{00}+\alpha_{10}x+\alpha_{01}y+a_{11}xy+\ldots+a_{0N}y^{N}$$

is a multivariable polynomial of $$N$$th degree. I want to express the first and second derivatives of $$P(x,y)$$ through Mathematica.

My attemps:

Previously, I attempted to study the derivatives of the above polynomial through the following code

poly[vars_List, a_, order_] := Module[{n = Length@vars, idx, z}, idx = Cases[Tuples[Range[0, order], n], x_ /; Plus @@ x <= order]; z = Times @@@ (vars^# & /@ idx); z.((Subscript[a, Row[#]]) & /@ idx)] poly[{x, y}, a, N] (*a is used for coefficient*).

However, it looks like that this code only works when N is equal to some integer number, for example N=2.

Based on the above, is there another way to express the general form of $$P(x,y)$$ and obtain its first and second derivatives?

Ps:I have read other posts, however, those did not help me.

You should have shown your own attempts. Anyway, try this

s = Sum[a[i, j]*x^i*y^j, {i, 0, n}, {j, 0, n}]


Then

D[s, x]


yields D[s, x, y]


The other second derivatives are, in principle the same, but require a simple additional effort for the simplification:

MapAt[Simplify, D[s, {x, 2}], {1}]


returns Have fun!

• Many Thanks, @Alexei Boulbitch! I think you got the "spirit", however, this is not exactly what is asked. Let me explain it better. I want to obtain the first and second derivatives of the following polynomial: $\sum^{N}_{i+j=0}\alpha_{ij}x^{i}y^{i} \equiv \alpha_{00}+\alpha_{10}x+\alpha_{01}y+a_{11}xy+\ldots+a_{0n}y^{n}$. As you may see, the polynomial posses only one summation sign whose index is $i+j$\$. I will update my post and include my attempts. Thanks once more for your help. May 8 at 12:11
• I do not understand what you mean under "only one summation sign whose index is i+j". Indeed, the polynomial in your comment is written exactly like you will obtain opening the expression that I have given in the answer. May 9 at 10:24