Question: Let dcoeffs also list zero-coefficients

Here is a standard example of how dcoeffs works:

> with(PDEtools);
> X := a*(diff(y(x), x, x))^2+b*(diff(y(x), x, x))+c*(diff(y(x), x));
                             2                                    
             / d  / d      \\      / d  / d      \\     / d      \
           a |--- |--- y(x)||  + b |--- |--- y(x)|| + c |--- y(x)|
             \ dx \ dx     //      \ dx \ dx     //     \ dx     /
> dcoeffs(X, y(x));
                                   a, b, c
> dcoeffs(subs(b = 0, X), y(x));
                                    a, c

However I would like the second result to be [a,0,c] instead of [a,c], so it would be easier to fit the coefficients in a (companion) matrix without the need to recheck for vanishing coefficients.

Is there a clever way to achieve that? (A stupid way would be to add something like Y: = add( z_i(x) * diff( y(x), x$i,i=0..2) and then run dcoeffs( X+Y) - dcoeffs( Y) again. Here z_i(x) would be indetermined functions)

Please Wait...