Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

Sometimes I get the feeling I'm just flailing blindly with Mathematica. Is solving for $x$ in the equation $$ \frac{\cosh (x/2)}{x} = \sqrt{2} $$ really beyond the scope of Mathematica? I try to solve it with the command:

Reduce[(1/x)Cosh[x/2] == Sqrt[2], x]

and am met with

Reduce::nsmet: This system cannot be solved with the methods available to Reduce.

I get a feeling that I'm doing something very silly. Cheers for any assistance!

share|improve this question
    
I don't see any special functions in the question or the answers, I must say... –  J. M. Jun 8 '12 at 5:34
    
Well, to avoid possible ambiguities there should be a tag transcendental concerning questions on transcendental equations (and numbers) as opposed to polynomial or elementary functions. There are at least a few questions which definitely should belong to transcendental. –  Artes Jun 8 '12 at 10:04
add comment

2 Answers

up vote 24 down vote accepted

Use

Reduce[(1/x) Cosh[x/2] == Sqrt[2], x, Reals]

or

Solve[(1/x) Cosh[x/2] == Sqrt[2], x, Reals]

the latter yields

{{x -> Root[{-E^(-(#1/2)) - E^(#1/2) + 2 Sqrt[2] #1 &,      0.75858229952537718426}]}, 
 {x ->  Root[{-E^(-(#1/2)) - E^(#1/2) + 2 Sqrt[2] #1 &, 5.4693513860610533998}]}}

For transcendental equations you may get with Reduce or Solve roots represented symbolically by Root though they are in general transcendental numbers, so their values are written numerically beside the transcendental function written in the form of a pure function.

Plot[ (1/x) Cosh[x/2] - Sqrt[2], {x, -7, 7}, PlotStyle -> Thick, PlotRange -> {-4, 4}]

enter image description here

Edit

It should be emphasized that using domain specifications in Reduce or Solve you may still get messages of unsolvability of a given equation or a system (of eqations or/and inequalities), e.g.

Reduce[ x Cos[x/2] == Sqrt[2], x, Reals]
Reduce::nsmet: This system cannot be solved with the methods available to Reduce. >>
Reduce[x Cos[x/2] == Sqrt[2], x, Reals]

even though for a slightly different equation you can get the full solution, e.g.

Reduce[x Cos[x/2] == 0, x, Reals]

enter image description here

In these two cases there is an infinite number of solutions, but the latter case is much easier, because a solution satisfies one of the two conditions : x == 0 or Cos[x/2] == 0. In the first case we need to restrict a region where we'd like to find solutions. There we find all of them with Reduce (as well as with Solve) if in a given region there is only a finite number of solutions, e.g. restricting the domain to real numbers such, that -25 <= x <= 25 i.e. adding a condition -25 <= x <= 25 to a given equation (now we needn't specify explicitly the domain to be Reals because Reduce[expr,vars] assumes by default that quantities appearing algebraically in inequalities are real):

sols = Reduce[x Cos[x/2] == Sqrt[2] && -25 <= x <= 25, x]

enter image description here

Defining

f[x_] := x Cos[x/2] - Sqrt[2]

we can easily check that sols are indeed the solutions :

FullSimplify[ f[ sols[[#, 2]]]] & /@ Range @ Length[sols]
{0, 0, 0, 0, 0, 0, 0}

To extract only numerical values of the roots combined with zero we can do (see e.g. this answer):

Tuples[{List @@ sols[[All, 2, 1, 2]], {0}}]

Now we can plot the function with appropriately marked roots and the specified domain :

Plot[ f[x], {x, -40, 40}, PlotStyle -> Thick, 
             Epilog -> {Thickness[0.003], Darker@Red, Line[{{-25, 0}, {25, 0}}], 
                        PointSize[0.01], Cyan, Point /@ Tuples[{List @@ sols[[All, 2, 1, 2]], {0}}]}]

enter image description here

Here the dark red line denotes the domain of our interest, and the cyan points denote all roots of the function f in this region.

share|improve this answer
3  
I guess it would have been nice for Mathematica to tell me it was having trouble solving for complex x... thanks for the help. –  Glen Wheeler Apr 24 '12 at 12:22
3  
Yes, there are some omissions, however I think both Solve and Reduce are really powerful functions. –  Artes Apr 24 '12 at 12:43
2  
@Artes Of course, Mathematica has found exact solutions here; those solutions are just expressed using Root objects. If you plug one of those roots back into the function and use FullSimplify, you get exactly zero. –  Mark McClure Apr 24 '12 at 12:50
    
@MarkMcClure Thank you for your remark, indeed the solutions were represented symbolically with Root, but I meant their values only numerically. –  Artes Apr 24 '12 at 13:09
    
@GlenWheeler You may be interested in this blog post to make more sense of the solution that Mathematica returns. You might notice that the solution is just a symbolic representation of the root of the equation you entered near two values. –  Szabolcs Apr 24 '12 at 14:46
show 3 more comments

All of these work:

f[x_] := Cosh[x/2]/x - Sqrt[2];

FindRoot      [f[x] == 0, {x, 1}]
N@FindInstance[f[x] == 0, x, Reals, 2]
N@Reduce      [f[x] == 0, x, Reals]
NSolve        [f[x] == 0, x, Reals]
N@Solve       [f[x] == 0, x, Reals]
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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