Re: How to prevent Solve from DSolve?

*To*: mathgroup at christensen.cybernetics.net*Subject*: [mg909] Re: How to prevent Solve from DSolve?*From*: danl (Daniel Lichtblau)*Date*: Sun, 30 Apr 1995 03:43:35 -0400*Organization*: Wolfram Research, Inc.

In article <3nkbu2$mq8 at news0.cybernetics.net> chen at fractal.eng.yale.edu (Richard Q. Chen) writes: > Hi, > I find it very frustrating that Mma always tries > to give explicit solutions to an ODE, even if the solutions are > so complicated as to be useless. For example > > In[2]:= Needs["Calculus`DSolve`"] > > In[3]:= DSolve[2 y[x] + (x + y[x]) y'[x] == 0, y[x], x] > > Out[3]= {{y[x] -> > > 1/3 2 > > -2 x + (3 2 x ) / > > 3 6 3 2 1/3 > > (54 x + 27 C[1] + Sqrt[-2916 x + (54 x + 27 C[1]) ]) + > > 3 6 3 2 1/3 1/3 > > (54 x + 27 C[1] + Sqrt[-2916 x + (54 x + 27 C[1]) ]) / (3 2 )} > > > , {y[x] -> > > 2 > > -2 x - (3 (1 + I Sqrt[3]) x ) / > > 2/3 3 6 3 2 1/3 > > (2 (54 x + 27 C[1] + Sqrt[-2916 x + (54 x + 27 C[1]) ]) ) - > > 3 > > ((1 - I Sqrt[3]) (54 x + 27 C[1] + > > 6 3 2 1/3 1/3 > > Sqrt[-2916 x + (54 x + 27 C[1]) ]) ) / (6 2 )}, > > 2 > > {y[x] -> -2 x - (3 (1 - I Sqrt[3]) x ) / > > 2/3 3 6 3 2 1/3 > > (2 (54 x + 27 C[1] + Sqrt[-2916 x + (54 x + 27 C[1]) ]) ) - > > 3 > > ((1 + I Sqrt[3]) (54 x + 27 C[1] + > > 6 3 2 1/3 1/3 > > Sqrt[-2916 x + (54 x + 27 C[1]) ]) ) / (6 2 )}} > > > I would like to have Mma out put something like f(x,y) == C[1] so > that I will know what kind of simpler function f(x,y) may be. I can > then choose to solve for y in terms of x if it is desirable. > > In this particular case I had to use pencil and paper and I obtained > the much simpler implicit solution > > f(x,y) = y*(y+2x)^2 = C[1] > > This is the kind of solution I wanted. > > How can I prevent DSolve from using Solve to give complicated > solution? > > Thanks for any info. > > -- > Richard Q. Chen > chen at fractal.eng.yale.edu > > You cannot, so far as I know, safely prevent DSolve from calling Solve. You can either alter Solve, or else disable the use of radical solns for cubics. (* Here we disable cubic solns *) In[19]:= SetOptions[Roots, Cubics -> False]; In[20]:= DSolve[2 y[x] + (x + y[x]) y'[x] == 0, y[x], x] 2 2 3 Out[20]= {ToRules[Roots[9 x y[x] + 6 x y[x] + y[x] == C[1], y[x]]]} (* Here we short-circuit Solve *) In[22]:= Unprotect[Solve]; In[23]:= Solve[a_, b___] := a In[24]:= DSolve[2 y[x] + (x + y[x]) y'[x] == 0, y[x], x] 2 Out[24]= y[x] (3 x + y[x]) == C[1] Daniel Lichtblau, WRI