1
$\begingroup$

For example,

ODE:

$$(2x - 5y + 3)dx - (2x + 4y - 6)dy = 0$$

The implicit function solution:

$$(2x+y-3)^2 (4y-x-3) = C$$

However, if it is solved directly with DSolve, the solution is very complex:

Clear[eqn, sol, x, y];
eqn = (2*x - 5*y[x] + 3)*Dt[x] - (2*x + 4*y[x] - 6)*Dt[y[x]] == 0;
sol = DSolve[eqn, y[x], x]

(*

    {{y[x] -> (3 - x)/2 + 
        1/(4 Root[
            4 + (-72 + 72 x) #1 + (324 - 648 x + 324 x^2) #1^2 + (864 - 
                 2592 x + 2592 x^2 - 864 x^3) #1^3 + (-7776 + 31104 x - 
                 46656 x^2 + 31104 x^3 - 7776 x^4) #1^4 + (46656 + 
                 729 E^(12 C[1]) - 279936 x + 699840 x^2 - 933120 x^3 + 
                 699840 x^4 - 279936 x^5 + 46656 x^6) #1^6 &, 1])},
    
     {y[x] -> (3 - x)/2 + 
        1/(4 Root[
            4 + (-72 + 72 x) #1 + (324 - 648 x + 324 x^2) #1^2 + (864 - 
                 2592 x + 2592 x^2 - 864 x^3) #1^3 + (-7776 + 31104 x - 
                 46656 x^2 + 31104 x^3 - 7776 x^4) #1^4 + (46656 + 
                 729 E^(12 C[1]) - 279936 x + 699840 x^2 - 933120 x^3 + 
                 699840 x^4 - 279936 x^5 + 46656 x^6) #1^6 &, 2])},
    
     {y[x] -> (3 - x)/2 + 
        1/(4 Root[
            4 + (-72 + 72 x) #1 + (324 - 648 x + 324 x^2) #1^2 + (864 - 
                 2592 x + 2592 x^2 - 864 x^3) #1^3 + (-7776 + 31104 x - 
                 46656 x^2 + 31104 x^3 - 7776 x^4) #1^4 + (46656 + 
                 729 E^(12 C[1]) - 279936 x + 699840 x^2 - 933120 x^3 + 
                 699840 x^4 - 279936 x^5 + 46656 x^6) #1^6 &, 3])},
    
     {y[x] -> (3 - x)/2 + 
        1/(4 Root[
            4 + (-72 + 72 x) #1 + (324 - 648 x + 324 x^2) #1^2 + (864 - 
                 2592 x + 2592 x^2 - 864 x^3) #1^3 + (-7776 + 31104 x - 
                 46656 x^2 + 31104 x^3 - 7776 x^4) #1^4 + (46656 + 
                 729 E^(12 C[1]) - 279936 x + 699840 x^2 - 933120 x^3 + 
                 699840 x^4 - 279936 x^5 + 46656 x^6) #1^6 &, 4])},
    
     {y[x] -> (3 - x)/2 + 
        1/(4 Root[
            4 + (-72 + 72 x) #1 + (324 - 648 x + 324 x^2) #1^2 + (864 - 
                 2592 x + 2592 x^2 - 864 x^3) #1^3 + (-7776 + 31104 x - 
                 46656 x^2 + 31104 x^3 - 7776 x^4) #1^4 + (46656 + 
                 729 E^(12 C[1]) - 279936 x + 699840 x^2 - 933120 x^3 + 
                 699840 x^4 - 279936 x^5 + 46656 x^6) #1^6 &, 5])}, 
    
    {y[x] -> (3 - x)/2 + 
        1/(4 Root[
            4 + (-72 + 72 x) #1 + (324 - 648 x + 324 x^2) #1^2 + (864 - 
                 2592 x + 2592 x^2 - 864 x^3) #1^3 + (-7776 + 31104 x - 
                 46656 x^2 + 31104 x^3 - 7776 x^4) #1^4 + (46656 + 
                 729 E^(12 C[1]) - 279936 x + 699840 x^2 - 933120 x^3 + 
                 699840 x^4 - 279936 x^5 + 46656 x^6) #1^6 &, 6])}}
    
    *)

Is there any code that can get the implicit function solution of ODE?

The following is the previous question: For example,

ODE: $$xy'(x) - y(x) - (y(x)^2 - x^2)^{1/2} = 0$$

Implicit function solution: $$y+(y^2-x^2)^{1/2}=Cx^2\ (x>0)$$

$$y-(y^2-x^2)^{1/2}=C\ (x<0)$$

If it is solved directly with DSolve, the running time is very long and no solution is obtained (Version: 11.3. Updated: After the computer was restarted, the problem was solved. ):

Clear[eqn, sol, x, y];
eqn = x*y'[x] - y[x] - ((y[x])^2 - x^2)^(1/2) == 0;
sol = DSolve[eqn, y[x], x]

Example 2:

Clear[eqn, sol, x, y];
eqn = x*y'[x] == y[x]*Log[y[x]/x];
sol = DSolve[eqn, y[x], x]

How to get the implicit function solution of the differential equation?

$\endgroup$
14
  • 1
    $\begingroup$ There is no option in DSolve to ask for implicit solution. But these ode's are solved immediately in V 13 $\endgroup$
    – Nasser
    Commented Feb 5, 2022 at 8:15
  • 1
    $\begingroup$ I just want to add that they are also solved immediately in V 12. Specifics are "12.0.0 for Linux x86 (64-bit) (April 7, 2019)" $\endgroup$
    – user49048
    Commented Feb 5, 2022 at 8:16
  • $\begingroup$ Thank you very much! $\endgroup$
    – lotus2019
    Commented Feb 5, 2022 at 8:24
  • $\begingroup$ After the computer was restarted, the problem was solved. The Question has been updated. $\endgroup$
    – lotus2019
    Commented Feb 5, 2022 at 9:47
  • $\begingroup$ The line "Implicit function solution: y[x]+(y[x])^2-x^2)^(1/2)==C[1]*x^2 (x>0);…" involves typo, please double-check it. Also, you may use $\LaTeX$ to typeset the equation better. $\endgroup$
    – xzczd
    Commented Feb 6, 2022 at 3:28

2 Answers 2

3
$\begingroup$

Some things change to better. In 13.0.0 on Windows 10

Clear[eqn, sol, x, y];eqn = x*y'[x] - y[x] - ((y[x])^2 - x^2)^(1/2) == 0;
sol = DSolve[eqn, y[x], x]

{{y[x] -> (-x - x Tanh[1/2 (C[1] + Log[x])]^2)/(-1 + Tanh[1/2 (C[1] + Log[x])]^2)}}

Clear[eqn, sol, x, y];eqn = x*y'[x] == y[x]*Log[y[x]/x];
sol = DSolve[eqn, y[x], x]

{{y[x] -> E^(1 + E^C[1] x) x}}

$\endgroup$
2
  • $\begingroup$ Thank you very much! $\endgroup$
    – lotus2019
    Commented Feb 5, 2022 at 8:24
  • $\begingroup$ After the computer was restarted, the problem was solved. The Question has been updated. $\endgroup$
    – lotus2019
    Commented Feb 5, 2022 at 9:47
2
$\begingroup$

Here's a hacky way to intercept the last Solve that DSolve calls in V13 (warning: the behavior of DSolve may change in future):

eqn = x*y'[x] - y[x] - ((y[x])^2 - x^2)^(1/2) == 0;
Internal`InheritedBlock[{Solve},
 Unprotect@Solve;
 Solve[e_, y[x], opts___] /; ! TrueQ[$in] := Block[{$in = True},
   Inactive[Solve][e, y[x], opts]]; (* Return[e, DSolve]; *)
 Protect@Solve;
 sol = DSolve[eqn, y[x], x]
 ]
% // First // Activate
(*
  {{y[x] -> (-x - x Tanh[1/2 (C[1] + Log[x])]^2)/
       (-1 + Tanh[1/2 (C[1] + Log[x])]^2)}}
*)
$\endgroup$
2
  • $\begingroup$ You seem to have to use Return[..] for the OP's Dt[] example. Also, it doesn't work on IVPs; need to solve for parameters after, if possible. $\endgroup$
    – Michael E2
    Commented Feb 6, 2022 at 6:17
  • $\begingroup$ Thank you! @Michael E2 $\endgroup$
    – lotus2019
    Commented Feb 6, 2022 at 6:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.