ode2 problem (negative log arguments)



I (still) think Maxima's answer is OK, but getting the solution into
the form you would like isn't easy. Try something like:
(Surely there are better ways to do this, but I can't
concentrate right now. Maybe somebody else can show you
*the* way to do this.)

(%i1) 'diff(p,x) = 1/(W-x) - ((R-1)/(W-x)-1)*p$

(%i9) de : 'diff(p,x) = 1/(W-x) - ((R-1)/(W-x)-1)*p$

(%i10) sol : ode2(de,p,x)$

(%i11) sol : opsubst('myint,'integrate,sol)$

(%i12) load('opsubst)$
(%i13) myint(f,x) := integrate(subst(x = %x,f),%x,0,x)$

(%i14) sol : opsubst('myint,'integrate,sol)$


/* Require p = 0 when x = 0. */

(%i15) ev(subst([p=0,x=0],sol));
Is  x   positive, negative, or zero? pos;
Is  W - x   positive, negative, or zero? pos;

(%o15) 0=%c*%e^((R-1)*log(-W))

(%i16) solve(%,%c);

(%o16) [%c=0]

(%i17) sol : subst(%,sol)$

(%i18) sol : ev(sol);
Is  x   positive, negative, or zero? pos;
Is  W - x   positive, negative, or zero? pos;

(%o18)
p=%e^((R-1)*log(x-W)+x)*integrate(%e^(-(R-1)*log(%x-W)-%x)/(W-%x),%x,0,x)

(%i19) sol : map('radcan,sol);

(%o19) p=(%e^x*integrate(%e^(-%x)/(%x-W)^R,%x,0,x)*(x-W)^R)/(W-x)

(%i20) sol : subst((-1)^R * (W-x)^R, (x-W)^R,sol)$

(%i21) sol : subst((-1)^R * (W-%x)^R, (%x-W)^R,sol);

(%o21) p=%e^x*(W-x)^(R-1)*integrate(%e^(-%x)/(W-%x)^R,%x,0,x)

BW