# DSolve bvfail “For some branches of the general solution, unable to solve the conditions”

I have a problem with the DSolve function and its usage:

solOC1 = DSolve[{y'[t] == (r - (1 - x[t]/X0)) y[t], x'[t] == -C*y[t], y[0] == Y0,
x[0] == X0} /. {Y0 -> 1, r -> 1, X0 -> 1, C -> 1}, {y, x}, t]


The Professor of our Institute coded it some months ago and this was the result:

{{x -> Function[{t}, Sqrt[3] Sqrt[Tanh[1/2 (-Sqrt[3] t - 2 ArcTanh[1/Sqrt[3]])]^2]],
y -> Function[{t}, -(3/2) (-1 + Tanh[1/2 (-Sqrt[3] t - 2 ArcTanh[1/Sqrt[3]])]^2)]},
{x -> Function[{t}, Sqrt[3] Sqrt[Tanh[1/2 (-Sqrt[3] t + 2 ArcTanh[1/Sqrt[3]])]^2]],
y -> Function[{t}, -(3/2) (-1 + Tanh[1/2 (-Sqrt[3] t + 2 ArcTanh[1/Sqrt[3]])]^2)]}}


But when we run the script now we get a bvfail:

DSolve::bvfail: For some branches of the general solution, unable to solve the conditions.>>


I have no idea what is causing this. Any suggestions how to handle the problem ?

Sebastian

-

First of all I'd like to point out that the equations you showed us are not those your professor had coded:

eqn = {y'[t] == (r - (1 - x[t]/X0)) y[t], x'[t] == -C*y[t],
y[0] == Y0, x[0] == X0} /. {Y0 -> 1, r -> 1, X0 -> 1, C -> 1};
rule = {{x -> Function[{t}, Sqrt[3] Sqrt[Tanh[1/2 (-Sqrt[3] t - 2 ArcTanh[1/Sqrt[3]])]^2]],
y -> Function[{t}, -(3/2) (-1 + Tanh[1/2 (-Sqrt[3] t - 2 ArcTanh[1/Sqrt[3]])]^2)]},
{x -> Function[{t}, Sqrt[3] Sqrt[Tanh[1/2 (-Sqrt[3] t + 2 ArcTanh[1/Sqrt[3]])]^2]],
y -> Function[{t}, -(3/2) (-1 + Tanh[1/2 (-Sqrt[3] t + 2 ArcTanh[1/Sqrt[3]])]^2)]}};

eqn /. rule /. t -> 1

{{False, False, True, True}, {False, False, True, True}}


For your equations, we can still get the analytic solution with some effort. DSolve can't give the particular solution directly, but it can give the corresponding general solution:

sol = DSolve[eqn[[1 ;; 2]], {y, x}, t]

{{y -> Function[{t},
C[1] - C[1] Tanh[1/2 (-Sqrt[2] t Sqrt[C[1]] - 2 Sqrt[2] Sqrt[C[1]] C[2])]^2],
x -> Function[{t},
Sqrt[2] Sqrt[C[1]] Tanh[1/2 (-Sqrt[2] t Sqrt[C[1]] - 2 Sqrt[2] Sqrt[C[1]] C[2])]]}}


Then we can plug it into the boundary conditions and Reduce it:

coe = eqn[[3 ;; 4]] /. sol // Flatten // Reduce

C[3] ∈ Integers && C[1] == 3/2 && C[2] == -((ArcTanh[1/Sqrt[3]] - I π C[3])/Sqrt[3])


Hmm… seems that there's an infinite number of solutions, but is it true? Let's try to FullSimplify it:

rst = MapThread[Rule, {{x[t], y[t]},
FullSimplify[{x[t], y[t]} /. First@sol /. ToRules[Rest@coe], First@coe]}]

{x[t] -> -Sqrt[3] Tanh[(Sqrt[3] t)/2 - ArcCoth[Sqrt[3]]],
y[t] -> 3/(1 + Cosh[Sqrt[3] t - 2 ArcCoth[Sqrt[3]]])}


OK, in fact there's only one solution. We can check it by:

eqn /. ({x -> (t \[Function] x[t]), y -> (t \[Function] y[t])} /. rst) // Simplify

{True, True, True, True}

-