0
$\begingroup$

I am not very good with Mathematica but I am trying to solve the following initial value problem

$y''(t)=\lambda_1 y'(t)e^{y(t)}+ \lambda_2 y'(t)e^{-y(t)},$

$ y(0)=0$

I have tried first the following generic expression

y[t_,  Lambda1_,  Lambda2_, c1_ , c2_] := 
 y[t] /. First @ 
     DSolve[   { 
       y''[t] == Lambda1 y'[t] Exp[y[t]] +  Lambda2  y'[
           t] Exp[-y[t]]  }   , y[t],t ] ] /. C[1] -> c1 /. C[2] -> c2  

Giving

Log[(-c1 + 
  Sqrt[-c1^2 - 4 Lambda1 Lambda2
    Tan[1/2 (c2 Sqrt[-c1^2 - 4 Lambda1 Lambda2 + 
       t Sqrt[-c1^2 - 4Lambda1 Lambda2)])/(2 Lambda1)]

Which is always a complex number. Trying to insert the boundary condition leads to

 DSolve[   { 
  y''[t] == Lambda1 y'[t] Exp[y[t]] + Lambda2  y'[
      t] Exp[-y[t]], y[0] == 0  }   , y[t], t ]



   Solve::ifun: Inverse functions are being used by Solve, so some solutions may not be found; use Reduce for complete solution information.

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


   {}

Can anyone help me to interpret this equation, or the way I am possibly mishandling it?

$\endgroup$
  • $\begingroup$ I'm missing a second intial condition. What do you know about Lamda1, Lamda2? $\endgroup$ – Ulrich Neumann Jan 17 at 15:08
  • $\begingroup$ lambda1 and lambda2 are just positive constants. Adding y`[0]=y0 does not change the picture above $\endgroup$ – Mr_3_7 Jan 17 at 18:28
5
$\begingroup$

With this equation, I would operate a bit differently.

First, let us observe that the equation exhibits no explicit dependence on t. This allows us to easily decrease its order. Let us denote y'[t]=u[y]. In other words, we will consider the derivative, y'(t) as dependent only on y. Then dy'/dt=(du/dy)(dy/dt). This yileds dy'/dt=uu'. With this the equation is transformed to u*u'=(lambda1+lambda2)uexp(y). This one readily integrates yielding y'(t)=(lambda1+lambda2)exp(y)+c, where c is the constant of the first integration.

It makes sense to solve this one by DSolve:

DSolve[{y'[t] == lambda*Exp[y[t]] + c, y[0] == 0}, y, t]

(*  {{y -> Function[{t}, -Log[-(lambda/c) - 
       E^(-c t) (-1 - lambda/c)]]}}   *)

Have fun!

$\endgroup$
  • $\begingroup$ Thanks Alexei. Is this a general techinque? And the natural quesiton: how come Mathematica does not know about it (or, it gives an impossible answer)? $\endgroup$ – Mr_3_7 Jan 17 at 18:36
  • $\begingroup$ First question: If an ODE shows no explicit dependence on t, yes it is generally so. Second question: Mathematica knows a lot, but not everything. Sometimes one needs to help it. $\endgroup$ – Alexei Boulbitch Jan 18 at 15:29
  • $\begingroup$ A precisation. Under your transformation the equation actually becomes u*u'=lambda1exp(y) - lambda2 exp(-y) + c(lambda,1, lambda2). Mathematica still seems to struggle with this: the generic form returns five distinct solutions all of which require lambda1lambda2 <0, but lambda1=lambda2=1 (sinh) returns an actual solution. I accept your answer as the mehtodologically correct though. $\endgroup$ – Mr_3_7 Jan 22 at 9:37
  • $\begingroup$ @Mr_3_7 In the equation you have written above there is no -y in the exponent. I solved what you gave. $\endgroup$ – Alexei Boulbitch Jan 22 at 13:19
  • $\begingroup$ The minus appears in the code but you are right, there is a typo in the tex. Edited. $\endgroup$ – Mr_3_7 Jan 22 at 15:46
2
$\begingroup$

Here's another solution:

General solution:

dsol = First@ DSolve[{y''[t] == Lambda1 y'[t] Exp[y[t]] + Lambda2 y'[t] Exp[-y[t]]}, y, t]
(*
{y -> Function[{t}, 
   Log[(1/(2 Lambda1))(-C[1] + 
      Sqrt[-4 Lambda1 Lambda2 - C[1]^2] Tan[1/2 (t Sqrt[-4 Lambda1 Lambda2 - C[1]^2] + 
           Sqrt[-4 Lambda1 Lambda2 - C[1]^2] C[2])])]]}
*)

General initial conditions:

c2sol = First@Solve[y[0] == Log@c1 /. First@dsol, C[2]]
(*
{C[2] -> ConditionalExpression[(
   2 (ArcTan[(2 c1 Lambda1 + C[1])/Sqrt[-4 Lambda1 Lambda2 - C[1]^2]] + π C[3]))/
   Sqrt[-4 Lambda1 Lambda2 - C[1]^2], 
   C[3] ∈ Integers && -π < Im[Log[c1]] <= π]}
*)

c1sol = First@Solve[y'[0] == c2 /. dsol /. c2sol, C[1]]
(*
{C[1] -> ConditionalExpression[(c1 c2 - c1^2 Lambda1 + Lambda2)/c1, C[3] ∈ Integers]}
*)

ysol = y[t] /. dsol /. c2sol /. c1sol // 
  Simplify[#, C[3] ∈ Integers && Log@c1 ∈ Reals] &
(*
Log[(1/(2 c1 Lambda1))(-c1 c2 + c1^2 Lambda1 - Lambda2 + 
   c1 Sqrt[-4 Lambda1 Lambda2 - (c1 c2 - c1^2 Lambda1 + Lambda2)^2/c1^2]
     Tan[1/2 Sqrt[-4 Lambda1 Lambda2 - (c1 c2 - c1^2 Lambda1 + Lambda2)^2/c1^2] t + 
      ArcTan[(c1 c2 + c1^2 Lambda1 + Lambda2)/(
       c1 Sqrt[-4 Lambda1 Lambda2 - (c1 c2 - c1^2 Lambda1 + Lambda2)^2/c1^2])]])]
*)

Solution to OP's IVP:

yivp = ysol /. c1 -> 1
(*
Log[(1/(2 Lambda1))(-c2 + Lambda1 - Lambda2 + 
   Sqrt[-4 Lambda1 Lambda2 - (c2 - Lambda1 + Lambda2)^2]
     Tan[1/2 Sqrt[-4 Lambda1 Lambda2 - (c2 - Lambda1 + Lambda2)^2] t +
       ArcTan[(c2 + Lambda1 + Lambda2)/
       Sqrt[-4 Lambda1 Lambda2 - (c2 - Lambda1 + Lambda2)^2]]])]
*)

Check:

{y''[t] == Lambda1 y'[t] Exp[y[t]] + Lambda2 y'[t] Exp[-y[t]], 
   y[0] == 0} /. y -> Function @@ {t, yivp} // Simplify
(*  {True, True}  *)
$\endgroup$
  • $\begingroup$ Thanks! DSolve really needs some pre-processing I see $\endgroup$ – Mr_3_7 Jan 28 at 9:42
  • $\begingroup$ There is still something fishy with the way Mathematica does this though. Lambda1 and Lambda2 cannot be positive in this solution. However, when I plug in positive values right at the outset, I get a (different) solution without problem. $\endgroup$ – Mr_3_7 Jan 28 at 9:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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