1

Both analytical solutions or all numerical solutions are good enough. FindRoot may be a possible solution, any better solution?

FindRoot[Cos[x] Cosh[x] == 1, {x, Table[i, {i, 5, 50, 3}]}]

{x->{4.73004,7.8532,10.9956,14.1372,17.2788,20.4204,10.9956,10.9956,14.1372,14.1372,17.2788,17.2788,41.,44.,47.,50.}}
Kattern
  • 2,561
  • 19
  • 35

2 Answers2

2

observe since Cosh blows up the solutions are all near the zeros of the periodic Cos:

 x /. # & /@ 
    Flatten[Table[ 
       FindRoot[ Cos[x] Cosh[x] - 1 , {x, Pi(1/2 + n)}, 
      WorkingPrecision -> 20]  , {n, 1, 100}]]

{4.7300407448627040260, 7.8532046240958375565, 10.995607838001670908, \ 14.137165491257464177, 17.278759657399481438, 20.420352245626061091, \ 23.561944902040455075, 26.703537555508186248, 29.845130209103254267, \ 32.986722862692819562, 36.128315516282622650, 39.269908169872415463, \ 42.411500823462208720, 45.553093477052001958, 48.694686130641795196, \ 51.836278784231588435, 54.977871437821381673, 58.119464091411174912, \ 61.261056745000968150, 64.402649398590761388, 67.544242052180554627, \ 70.685834705770347865, 73.827427359360141104, 76.969020012949934342, \ 80.110612666539727581, ....

(plus 0 .. and it is symmetric of course)

I suppose that's pretty close to where you started except make the table {3Pi/2,..,Pi}

Edit --- large x approximation:

 asymp = Simplify[x /. First@Solve[ 
         Simplify[ Normal@Series[ Cos[x] Cosh[x] ,
               {x, Pi ( n + 1/2) , 1}] == 1,
                Element[n, Integers]] , x ]]

(1/2 + n) Pi - (-1)^-n Sech[(1/2 + n) Pi ]

This shows the error in this approximation, as well as the error with simply using Pi(n+1/2)

 Show[{
    ListLogPlot[ 
      Table[asymp - (x /. FindRoot[Cos[x] Cosh[x] - 1, {x, Pi (1/2 + n)} ,
         WorkingPrecision -> 100]) , {n, 20}] , PlotStyle -> Red],
    ListLogPlot[ 
      Table[Pi ( n + 1/2) - (x /. FindRoot[Cos[x] Cosh[x] - 1, {x, Pi (1/2 + n)} ,
         WorkingPrecision -> 100]) , {n, 20}] ]}]

enter image description here

george2079
  • 38,913
  • 1
  • 43
  • 110
  • Yes, you are right. Your solution is better. The solutions will be approximately n Pi+Pi/2. Although, cannot be seen from the numerical solutions. Is there any way to make Mathematica give this approximation for large x? – Kattern Dec 09 '14 at 02:52
  • The part about large x approximation is great! – Kattern Dec 10 '14 at 03:44
  • An additional question. My origin equation is 2 x^2 (-1 + Cos[x] Cosh[x]) == 0, how could I know I should first divide the equation by x^2, before applying your code on big x approximation. Do we have a universal step to get the approximation? – Kattern Dec 10 '14 at 08:33
1

I would use Solve. It gives a list of rules for the exact solutions on a bounded domain.

Solve[Cos[x] Cosh[x] == 1 && 0 < x < 50, x, Reals]

(* output omitted *)

N[%]

(* {{x->4.73004},{x->7.8532},{x->10.9956},{x->14.1372},{x->17.2788},{x->20.4204},{x->23.5619},{x->26.7035},{x->29.8451},{x->32.9867},{x->36.1283},{x->39.2699},{x->42.4115},{x->45.5531},{x->48.6947}} *)
Fred Simons
  • 10,181
  • 18
  • 49
  • Why not use NSolve to begin with? – Greg Hurst Dec 08 '14 at 15:24
  • @Chip Good question. Actually, I do not know. I think it is my abstract mathematical background. I prefer having exact solutions, that I can approximate as accurate as I wish. Therefore, Solve (or Reduce) usually is my first choice. But I completely agree that when only numerical approximations are wanted, I could also have used NSolve directly. – Fred Simons Dec 08 '14 at 15:49
  • I prefer Solve \ Reduce too. I only asked because you ended up taking N of your result. – Greg Hurst Dec 08 '14 at 15:51
  • NSolve is about 10x faster than Solve // N. FindRoot is in turn 10x faster in this case since we can trivially feed it very close guesses.. – george2079 Dec 08 '14 at 17:35
  • It seems always add a range of solution is a good idea. – Kattern Dec 09 '14 at 02:17