On 03/21/2013 06:52 AM, Thomas D. Dean wrote:
> eq1:x^2*y=1+c*x;
> eq2:solve(eq1,y);
>
> eq3:subst(y=y(x),eq2);
> eq4:diff(eq3,x);
> eq5:subst(y(x)=y,eq4);
>
> eq6:solve(eq5,c);
> eq7:subst(eq6,eq1);
> eq8:lhs(eq7)-rhs(eq7)=0;
> ode2(eq8,y,x);
> ratsimp(%*x^2);
>
> Is there a simpler way to get from eq3 to eq5?
Sure,
(%i2) eq1: x^2*y=1+c*x$
(%i3) depends(y,x)$
(%i4) eq5: solve(diff(eq1,x),diff(y,x));
(%o4) ['diff(y,x,1) = -(2*x*y-c)/x^2]
But since you seem to be interested in finding the linear ODE whose
solution is eq1, why not to do it directly:
(%i1) display2d: false$
(%i2) eq1: x^2*y=1+c*x$
(%i3) depends(y,x)$
(%i4) eliminate ([eq1, diff(eq1,x)], [c]);
(%o4) [-x^3*'diff(y,x,1)-x^2*y-1]
Regards,
Jaime