How to stop DSolve from solving equations
It seems that Solve
will be called during the DSolve
calculation, so if you stop Solve
, the DSolve
doesn't work as well.
To avoid that, we can think in another way. Do not stop Solve
, but store the equations whenever Solve
is called. The last stored equations is what you need.
Here is a sample code, the usage of Block
comes from What are some advanced uses for Block?
Unprotect[Solve];
Solve[args___ /; ! TrueQ[inF]] := Block[{inF = True}, Sow[args]; Solve[args]];
Protect[Solve];
Reap[DSolve[y'[x] == Sqrt[1 + (x/y[x])^2] - x/y[x], y[x], {x}]][[2, -1]]
(*{Log[1 - Sqrt[1 + y[x]^2/x^2]] == C[1] - Log[x]}*)
I do not know why the approach taken in the question does not work, because it depends on the inner workings of DSolve
. However, this may provide the desired result.
Quiet@Block[{Integrate = Inactive@Integrate},
DSolve[y'[x] == Sqrt[1 + (x/y[x])^2] - x/y[x], y[x], {x}]];
Activate[%[[1]] /. y[x] -> z[x] x] /. z[x] -> y[x]/x
(* -ArcTanh[Sqrt[1 + y[x]^2/x^2]] + 1/2 Log[-(y[x]^2/x^2)] == C[1] - Log[x] *)