# Solving differential equation in Mathematica without ProductLog

**URL:** <https://community.wolfram.com/t/solving-differential-equation-in-mathematica-without-productlog/22013>\
**Category:** Questions\
**Tags:** calculus, equation-solving, symbolic-computations\
**Created:** [May 1, 2023, 8:00am UTC](https://community.wolfram.com/t/solving-differential-equation-in-mathematica-without-productlog/22013 "2023-05-01T08:00:20Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![carljohan6](https://avatars.discourse-cdn.com/v4/letter/c/f0a364/32.png) [@carljohan6](https://community.wolfram.com/u/carljohan6)\
**Post date:** [May 1, 2023, 8:00am UTC](https://community.wolfram.com/t/solving-differential-equation-in-mathematica-without-productlog/22013/1 "2023-05-01T08:00:20Z")

</div>

[Open in Wolfram Cloud ↗](https://www.wolframcloud.com/obj/2e4a0b06-29b7-49d2-9e15-95ac75083cd9)

Im trying to solve this Differential Equation with Mathematica to see if the result equals the result I got by solving the equation by hand.

However Mathematica gives me an answer with ProductLog which doesn’t make sence to me.

Answer given when solving by hand: y = xLn|((x+y)^2)/(x)| + Cx, where C is constant of integration

---

<div class="post-metadata">

**Author:** ![mariuszi28cg](https://yyz1.discourse-cdn.com/wolfram/user_avatar/community.wolfram.com/mariuszi28cg/32/308_2.png) [@mariuszi28cg](https://community.wolfram.com/u/mariuszi28cg)\
**Post date:** [May 1, 2023, 9:00am UTC](https://community.wolfram.com/t/solving-differential-equation-in-mathematica-without-productlog/22013/2 "2023-05-01T09:00:28Z")

</div>

Mathematica give you solution with explicit form it’s a general solving diff equation.

```
EQ = y'[x] == (x^2 + y[x]^2)/(x*y[x] - x^2);
sol = DSolve[EQ, y, x] // Quiet
EQ /. sol[[1]] // FullSimplify(*A correct solution*)

```

Your solution by hand are implicit form:

```
Solve[y == x*Log[((x + y)^2)/(x)] + C[1]*x, y] // PowerExpand

(*{{y -> -x - 
    2 x ProductLog[-(E^(1/2 (-1 - C[1]))/(2 Sqrt[x]))]}, {y -> -x - 
    2 x ProductLog[E^(1/2 (-1 - C[1]))/(2 Sqrt[x])]}}*)

```

Regards M.I.

---

<div class="post-metadata">

**Author:** ![mariuszi28cg](https://yyz1.discourse-cdn.com/wolfram/user_avatar/community.wolfram.com/mariuszi28cg/32/308_2.png) [@mariuszi28cg](https://community.wolfram.com/u/mariuszi28cg)\
**Post date:** [May 1, 2023, 9:18am UTC](https://community.wolfram.com/t/solving-differential-equation-in-mathematica-without-productlog/22013/3 "2023-05-01T09:18:08Z")

</div>

From [here](https://mathematica.stackexchange.com/questions/148226/dsolve-with-setoptionssolve-method-reduce-behaving-differently-in-ver-11-1) give you solution with implicit form(with **Solve** ),but is very mesy:

```
  On[$Assumptions]; (*shows when $Assumptions is changed*)
  Module[{assum = True}, 
   Internal`InheritedBlock[{Solve, $Assumptions}, Unprotect[Solve];
    call : Solve[eq_, v_, opts___] /; ! TrueQ[$in] := 
     Block[{$in = True, $res1, $res2}, 
      Check[(*Use Check to try default settings& respond to \
  messages*)$res1 = call (*try original call*),(*Check[]*)
       Print["Trying \"ReduceOptions\" -> \"UseTranscendentalSolve\" -> \
  True on ", HoldForm[call]];
       With[{redopts = SystemOptions["ReduceOptions"]}, 
        Internal`WithLocalSettings[
          SetSystemOptions[
           "ReduceOptions" -> "UseTranscendentalSolve" -> True],(*I`WLS:
          init*)$res2 = Solve[eq, v, GeneratedParameters -> $S, opts];
          $res2 = $res2 /. 
            ConditionalExpression[e_, 
              c_] :>(*map condition to assumption*)($Assumptions = \
  $Assumptions && c;(*for solvers and Simplify[]*)
              assum = assum && c;(*for addConditions[] at end*)e);
          Print[
           "$Assumptions now ", $Assumptions];(*context for \
  On[$Assumptions]*)$res2 = Simplify[$res2];
          Print["Result= ", $res2], 
          SetSystemOptions[
           redopts] (*I`WLS:
          reset*)];];
       If[FreeQ[$res2, 
         Solve], $res2, $res1],(*Check[]*){Solve::ifun}]];
    Protect[Solve];
    sol = DSolve[DSolve[y'[x] == (x^2 + y[x]^2)/(x*y[x] - x^2), y, x]];
    Print["$Assumptions finally ", $Assumptions];(*context for \
  On[$Assumptions]*)sol = sol /. addConditions[assum]]]
  Off[$Assumptions];

```

---

<div class="post-metadata">

**Author:** ![carljohan6](https://avatars.discourse-cdn.com/v4/letter/c/f0a364/32.png) [@carljohan6](https://community.wolfram.com/u/carljohan6)\
**Post date:** [May 1, 2023, 2:04pm UTC](https://community.wolfram.com/t/solving-differential-equation-in-mathematica-without-productlog/22013/4 "2023-05-01T14:04:58Z")

</div>

Okay, but when i solve it by hand i make the substitution y = vx, can this be done with mathematica to give the anwer that i get by hand and not the one that explicit one which mathematica gives (ProducLog etc…)

---

<div class="post-metadata">

**Author:** ![mariuszi28cg](https://yyz1.discourse-cdn.com/wolfram/user_avatar/community.wolfram.com/mariuszi28cg/32/308_2.png) [@mariuszi28cg](https://community.wolfram.com/u/mariuszi28cg)\
**Post date:** [May 1, 2023, 4:28pm UTC](https://community.wolfram.com/t/solving-differential-equation-in-mathematica-without-productlog/22013/5 "2023-05-01T16:28:32Z")

</div>

S = DSolveChangeVariables[  
Inactive[DSolve][y’ == (x^2 + y^2)/(x\*y - x^2), y, x], v,  
x, y == v\*x] // FullSimplify

```
   S // Activate
   (*{{v -> Function[{x}, -1 - 
        2 ProductLog[-(1/2) Sqrt[E^(-1 - C[1])/x]]]}, {v -> 
      Function[{x}, -1 - 2 ProductLog[1/2 Sqrt[E^(-1 - C[1])/x]]]}}*)

```

Looks the same.

---

<div class="post-metadata">

**Author:** ![gianlucagorni](https://avatars.discourse-cdn.com/v4/letter/g/ec9cab/32.png) [@gianlucagorni](https://community.wolfram.com/u/gianlucagorni)\
**Post date:** [May 1, 2023, 4:56pm UTC](https://community.wolfram.com/t/solving-differential-equation-in-mathematica-without-productlog/22013/6 "2023-05-01T16:56:01Z")

</div>

This is a simulation of doing it by hand step-by-step with your substitution:

```
(y'[x] == (x^2 + y[x]^2)/(x*y[x] - x^2)) /. y -> Function[t, t*v[t]]
Solve[%, v'[x]][[1, 1]] /. Rule -> Equal // Simplify
DivideSides[%, %[[2]] x, GenerateConditions -> False]
ApplySides[Integrate[#, x] &, %]
SubtractSides[%, 0 == C[1]]
% /. v -> Function[t, y[t]/t]
Solve[%, y[x]]

```
