4
$\begingroup$

I was trying to solve the following differential equation: $$A'(y)^2 = -\frac{1}{l^2} e^{-2A(y)} + \frac{1}{L^2}.$$ I know that one possible answer is $$A(y) = \log\left( \frac{L}{l}\cosh\frac{y}{L}\right),$$ which isn't too complicated. There is a more general answer (with some free parameter that needed to be fixed to a certain value to obtain the solution above) that I don't know but I've seen it and I know it's not too complicated either.

Still, when I try to solve it using

DSolve[(A'[y])^2 == -1/(l^2) Exp[-2*A[y]] + 1/(L^2), A[y], y]

Mathematica returns

{{A[y] ->  InverseFunction[( E^#1 Sqrt[l^2 - E^(-2 #1) L^2]
Log[l (E^#1 l + Sqrt[E^(2 #1) l^2 - L^2])])/( l Sqrt[E^(2 #1) l^2 - L^2]) &]
[-(y/(l L)) + C[1]]},
{A[y] ->  InverseFunction[(E^#1 Sqrt[l^2 - E^(-2 #1) L^2]
Log[l (E^#1 l + Sqrt[E^(2 #1) l^2 - L^2])])/(l Sqrt[E^(2 #1) l^2 - L^2]) &]
[y/(l L) + C[1]]}}

Why can't I get a nicer output? I'm pretty sure there is a way to make it nicer, so I must be doing something wrong (I'm completely new to Mathematica).

$\endgroup$
5
$\begingroup$

With a bit of assistance, DSolve can obtain a simpler general answer. Begin by changing dependent variables

Unevaluated[(D[a[y], y]^2 + 1/(l^2) Exp[-2*a[y]] - 1/(L^2))] /. a[y] -> Log[b[y]];
eq = Simplify[% b[y]^2]
(* 1/l^2 - b[y]^2/L^2 + Derivative[1][b][y]^2 *)

Then solve this equation

DSolve[eq == 0, b[y], y] // Expand
(* {{b[y] -> E^(y/L + l C[1])/(2 l^2) + 1/2 E^(-(y/L) - l C[1]) L^2}, 
    {b[y] -> E^(-(y/L) + l C[1])/(2 l^2) + 1/2 E^(y/L - l C[1]) L^2}} *)

redefine the constant of integration

FullSimplify[% /. l C[1] -> c + Log[l L]] // Flatten
(* {b[y] -> (L Cosh[c + y/L])/l}, {b[y] -> (L Cosh[c - y/L])/l} *)

and transform back to the original variable a[y]

Rule[a[y], Log[#[[2]]]] & /@ %
(* {a[y] -> Log[(L Cosh[c + y/L])/l], a[y] -> Log[(L Cosh[c - y/L])/l]} *)

which is the desired general result.

Simplification

Actually, the two solutions are the same, as can be seen by replacing c by -c in the second solution.

$\endgroup$
4
  • $\begingroup$ Am I missing something or are these steps really not so obvious? How does one see that these are the necessary steps to be taken to solve the problem? Is there some general rule to be followed? $\endgroup$ – user138784 Dec 9 '15 at 8:25
  • 1
    $\begingroup$ @user138784 At first, I tried to convert the original DSolve answer to a simpler form but with only partial success. Then, I decide to try changing dependent variables, which is a common course of action, and I chose Log to eliminate Exp from the ODE. I used the substitution l C[1] -> c + Log[l L] to cast the exponentials into a form in which they could be converted into hyperbolic functions. These were the key steps. $\endgroup$ – bbgodfrey Dec 9 '15 at 13:37
  • $\begingroup$ Thanks but I was wondering if there was a general rule to be followed to solve this kind of problems or if this was just done by rewriting it with trial and error until Mathematica figured out how to solve it. $\endgroup$ – user138784 Dec 9 '15 at 14:28
  • 1
    $\begingroup$ @user138784 Not that I am aware of. However, for first order ODEs in which the independent variable does not appear explicitly, Integrate also can be used. $\endgroup$ – bbgodfrey Dec 9 '15 at 14:46

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.