Alessandro Languasco on Fri, 22 May 2015 13:57:30 +0200

```Dear all,

I’m trying to let gp perform the following computation but I’m stuck

The problem is:

1) I have a polynomial in variables dvar=[d_0, … , d_n] and  xvar=[x_0, … , x_n] which
is generated by another part of the program;
2)  I need to transform this polynomial the following way:
2a) consider each x_j as functions in the d_i variables;
2b) consider any d_i*x_j product in the polynomial as a partial derivative of x_j with respect to d_i;
3) perform this formal derivation on monomials of the type d_i^a*x_j^b, with (a,b) different from (1,1) ;
4) substitute the result of the formal derivations in the polynomial.

So for example:

d_0 * x_0^2  should be transformed into  2*x_0*d_0*x_0
d_0^2 * x_0^2 should be transformed into  2* (d_0*x_0)^2 + 2*x_0*(d_0^2)*x_0

I was doing some experimentation with the diffop function and

diffop(x_0^2, xvar, d_0*xvar)

gives something similar to what I want in the first example since it gives me

2*d_0*x_0^2

Here the problem is that I need a non associative product while gp immediately transforms
2*x_0*d_0*x_0 into 2*d_0*x_0^2.

For the second example, I tried with diffop(x_0^2, xvar, d_0*xvar,2) but the
non associativity problem here gives a quite different result form what I would like to get.

At this point I don’t see a way to realize steps 2)-4) described above.
Do you have any suggestion?