Something is wrong with your solution, coeff(Q,diff(w(x),x$2)) works well, but
coeff(Q,diff(w(x),x$1)) or coeff(Q,diff(w(x),x)) not. I absolutely don't understand why.
jakubi
Luckily, jakubi's solution works well. In fact I don't understand every detail, but very strange for me, that in Help there is coeff - extract a coefficient of a polynomial.
I suspect that in jacubi's solution dop is somehow a polynomial differential operator that is the reason that Maple can apply coeff.
Sorry, I should have realized that this might not work, because diff(w(x),x) "occurs" inside diff(w(x),x$2) , which is actually stored as diff(diff(w(x),x),x).
For sure, 'coeff' should work for polynomials. Hence, the idea is to get the differential operator for this ODE, that 'de2diffop' writes as a polynomial in 'Dx', which represents d/dx.
one way
is with differential operators:
with(DEtools): _Envdiffopdomain:=[Dx,x]: ode:=p(x,a)* diff(w(x),x$2) + q(x,a)* diff(w(x),x) + r(x,a)* w(x); / 2 \ |d | /d \ ode := p(x, a) |--- w(x)| + q(x, a) |-- w(x)| + r(x, a) w(x) | 2 | \dx / \dx / dop:=de2diffop(ode,w(x)); 2 dop := p(x, a) Dx + q(x, a) Dx + r(x, a) coeff(dop,Dx,2); p(x, a)coeff
coeff of Differential operator
Hi Robert,
Something is wrong with your solution, coeff(Q,diff(w(x),x$2)) works well, but
coeff(Q,diff(w(x),x$1)) or coeff(Q,diff(w(x),x)) not. I absolutely don't understand why.
jakubi
Luckily, jakubi's solution works well. In fact I don't understand every detail, but very strange for me, that in Help there is coeff - extract a coefficient of a polynomial.
I suspect that in jacubi's solution dop is somehow a polynomial differential operator that is the reason that Maple can apply coeff.
Thanks, Sandor
oops
Sorry, I should have realized that this might not work, because diff(w(x),x) "occurs" inside diff(w(x),x$2) , which is actually stored as diff(diff(w(x),x),x).
coefficient of a polynomial
For sure, 'coeff' should work for polynomials. Hence, the idea is to get the differential operator for this ODE, that 'de2diffop' writes as a polynomial in 'Dx', which represents d/dx.
Another way
Depending on the situation, the following also might work,
ode:=p(x,a)* diff(w(x),x$2) + q(x,a)* diff(w(x),x$2) + r(x,a)* w(x); / 2 \ |d | /d \ ode := p(x, a) |--- w(x)| + q(x, a) |-- w(x)| + r(x, a) w(x) | 2 | \dx / \dx / subs(diff(w(x),x$2)=1, diff(w(x),x)=0, w(x)=0, ode); p(x, a) subs(diff(w(x),x$2)=0, diff(w(x),x)=1, w(x)=0, ode); q(x, a) subs(diff(w(x),x$2)=0, diff(w(x),x)=0, w(x)=1, ode); r(x, a)Alec