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.

This question already has an answer here:

Why doesn't Mathematica solve x == Cos[x] properly?

Both Solve and NSolve fail with the message:

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

share|improve this question

marked as duplicate by Artes, Sjoerd C. de Vries, bobthechemist, rm -rf Dec 30 '13 at 15:25

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

4  
NSolve works when restricted to reals: NSolve[x==Cos[x],x,Reals] gives {{x -> 0.739085}}. –  Rahul Narain Oct 22 '12 at 6:58
2  
The "Dottie number" is not known to have an explicit closed form. –  J. M. Oct 22 '12 at 7:12
2  
Strongly related: Can Reduce really not solve for x here? –  Mr.Wizard Oct 22 '12 at 11:25

2 Answers 2

up vote 8 down vote accepted

In this case you might use:

InverseFunction[Cos]
ArcCos

One can see that this is valid only over the interval (-1, 1) which is probably why Solve does not give an answer:

Plot[{Cos@x, ArcCos@x}, {x, -Pi, Pi}, PlotStyle -> Thick]

Mathematica graphics

A few methods to find the intersection in the illustration:

N @ FindInstance[x == Cos[x], x]

N @ Reduce[{x == Cos[x], -1 < x < 1}, x]

FindRoot[x == Cos[x], {x, 0}]
{{x -> 0.739085}}

x == 0.739085

{x -> 0.739085}

I would be remiss not to point out that my plot above is only looking at real values. One can see that as implemented ArcCos does handle the full circle:

Plot[{Cos @ ArcCos @ x, x + 1}, {x, -20, 20}]

Mathematica graphics

share|improve this answer
    
Thx, I just wanted to know why Mathematica didn't know to use arccos... –  Tom Wellington Oct 22 '12 at 7:09
    
Of note is that Reduce[] returns a Root[] object, which can then be evaluated to arbitrary precision. –  J. M. Oct 22 '12 at 7:19
    
@J.M. I get x == Root[{-Cos[#1] + #1 &, 0.73908513321516064165}] where the "Dottie number" has 20.6 digits of precision. How can that be accurately evaluated to arbitrary precision? (Assuming that you mean arbitrary in the general sense.) –  Mr.Wizard Oct 22 '12 at 7:31
1  
@Mr.Wizard The 0.739... in the argument is not used to compute the value of the root, only to isolate it from any other potential roots. In this sense, it is similar to the index for normal polynomial Root objects, as returned by say, Solve[x^5 -x-1 == 0, x]. Of course, the root can be computed to arbitrary precision using the -Cos[#1] + #1 &. –  Mark McClure Oct 22 '12 at 10:32
1  
@TomWellington This answer gives more detailed discussion of the issue mathematica.stackexchange.com/questions/4694/… –  Artes Oct 22 '12 at 10:35

Another possibility :

FixedPoint[Cos[#] &, 0.5]

(* 0.739085 *)
share|improve this answer
3  
You don't need &: FixedPoint[Cos, 0.5] –  Mr.Wizard Oct 22 '12 at 7:06
    
@Mr.Wizard Thanks, I was aware of this but thought to make the answer easier to generalize. –  b.gatessucks Oct 22 '12 at 7:11

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