Bill Allombert on Fri, 22 May 2015 19:43:50 +0200

[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

Re: advice

On Fri, May 22, 2015 at 01:57:22PM +0200, Alessandro Languasco wrote:
> Dear all,
> I’m trying to let gp perform the following computation but I’m stuck
> and so I’m writing to ask for an advice.
> 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.

Fundamentally you cannot use the multiplication to mean 'apply a differential operator',
because PARI polynomial variables are commutative.

There are two way I would experiment with:

- use of new variables name of differentials:

? diffop(x0^2,[x0],[dx0])
%1 = 2*dx0*x0
? diffop(x0^2+x0*x1,[x0,x1],[dx0,dx1])
%1 = (2*dx0+dx1)*x0+dx0*x1

- use the formalism of 'differential operators ring', which is 
not implemented in PARI.  However, I have written a very inefficient script to
compute with differential operators, which I can send you.