Hi I have a very simple system of ODEs and DSolve ignores the linear solutions from the output. Any idea why this might happen?
It is a shortcoming of the software, which only deals with the generic case.
DSolve[{y'[x] == y[x]/ z[x],
z'[x] == z[x]/ y[x],
y[0] == 1, z[0] == 1},
{y, z}, x]
gives empty solution set, while this
DSolve[{y'[x] == y[x]/ z[x],
z'[x] == z[x]/ y[x],
y[1] == 1, z[1] == 1},
{y, z}, x]
gives a funny Indeterminate output, when it should give y[x] == z[x] == x.
The option IncludeSingularSolutionsdoes not help in this case.
The linear solutions can be recovered for example this way:
eqs = {y'[x] == y[x]/ z[x],
z'[x] == z[x]/ y[x]};
linearSolutions = {y -> Function[x, a x + b],
z -> Function[x, c x + d]};
linearSolutions /. SolveAlways[eqs /.
linearSolutions,
x]
For what itβs worth, the computed solution has the missing solutions as limits of the generic solution:
Limit[
DSolveValue[
{y'[x] == y[x]/ z[x], z'[x] == z[x]/ y[x]}, {y[x], z[x]}, x
] /. C[2] -> a - 1/C[1],
C[1] -> 0]
(* {a + x, a + x} *)
This is fairly typical of generic symbolic-algebraic solutions to nonlinear equations.DSolve does some checking of limits of the generic solution (at least which with the IncludeSingularSolutions -> True option), but it does not do a thorough analysis.
Another way to get the missing solution:
withclosure = {y'[x] == y[x]/z[x], z'[x] == z[x]/y[x]} /.
z -> Function[x, u[x] y[x]] // Reduce;
sols = DSolve[# /. e_Rule /; FreeQ[e, Derivative] :> (e /. x -> 0) /.
Rule -> Equal,
{y, u}, x
] & /@ Solve[withclosure];
{y[x], u[x] y[x]} /. Join @@ sols //
Map[Thread[{y[x], z[x]} -> #] &] //
DSolve`DSolveToPureFunction
(*
{{y -> Function[{x}, (E^(x/C[1]) C[1] (1 - E^(-(x/C[1])) C[2]))/C[2]],
z -> Function[{x}, C[1] (1 - E^(-(x/C[1])) C[2])]},
{y -> Function[{x}, x + C[2]],
z -> Function[{x}, x + C[2]]}}
*)