From: Sam Takoy on
Hi,

Mathematica has a problem with this:

DSolve[y''[x] + (2/Cosh[x - h]^2 - 1) y[x] == 0, y, x]

although the solution is not too difficult. One of the solutions is

1/(Cosh[2(x-h)]+1)^(1/2)

Is there a way to help Mathematica along?

Thanks!

From: schochet123 on
On Jul 19, 9:09 am, Sam Takoy <sam.ta...(a)yahoo.com> wrote:
> Hi,
>
> Mathematica has a problem with this:
>
> DSolve[y''[x] + (2/Cosh[x - h]^2 - 1) y[x] == 0, y, x]
>
> although the solution is not too difficult. One of the solutions is
>
> 1/(Cosh[2(x-h)]+1)^(1/2)
>
> Is there a way to help Mathematica along?
>
> Thanks!

Define

lhs[y_] := D[y, x, x] + (2/Cosh[x - h]^2 - 1) y

Then when

DSolve[lhs[y[x]] == 0, y, x]

doesn't yield an answer, but you know the solution 1/(Cosh[2(x-h)]
+1)^(1/2) you can use the variation of parameters method

DSolve[lhs[1/(Cosh[2 (x - h)] + 1)^(1/2) w[x]] == 0, w, x]

which yields

{{w -> Function[{x},
C[2] + C[1] (1/2 (-h + x) - 1/4 Sinh[2 (h - x)])]}}

C[2]->1, C[1]->0 corresponds to the solution you already knew, and
C[2]->0, C[1]->1 yields a second, linearly independent solution
y[x_]=1/(Cosh[2(x-h)]+1)^(1/2) (1/2 (-h + x) - 1/4 Sinh[2 (h - x)])

Steve

From: Sam Takoy on
That's quite nifty. Thanks!

On 7/20/2010 3:45 AM, schochet123 wrote:
> On Jul 19, 9:09 am, Sam Takoy<sam.ta...(a)yahoo.com> wrote:
>> Hi,
>>
>> Mathematica has a problem with this:
>>
>> DSolve[y''[x] + (2/Cosh[x - h]^2 - 1) y[x] == 0, y, x]
>>
>> although the solution is not too difficult. One of the solutions is
>>
>> 1/(Cosh[2(x-h)]+1)^(1/2)
>>
>> Is there a way to help Mathematica along?
>>
>> Thanks!
>
> Define
>
> lhs[y_] := D[y, x, x] + (2/Cosh[x - h]^2 - 1) y
>
> Then when
>
> DSolve[lhs[y[x]] == 0, y, x]
>
> doesn't yield an answer, but you know the solution 1/(Cosh[2(x-h)]
> +1)^(1/2) you can use the variation of parameters method
>
> DSolve[lhs[1/(Cosh[2 (x - h)] + 1)^(1/2) w[x]] == 0, w, x]
>
> which yields
>
> {{w -> Function[{x},
> C[2] + C[1] (1/2 (-h + x) - 1/4 Sinh[2 (h - x)])]}}
>
> C[2]->1, C[1]->0 corresponds to the solution you already knew, and
> C[2]->0, C[1]->1 yields a second, linearly independent solution
> y[x_]=1/(Cosh[2(x-h)]+1)^(1/2) (1/2 (-h + x) - 1/4 Sinh[2 (h - x)])
>
> Steve
>