How to solve Solve x-2cosx=0 in mathematica

  • Context: Mathematica 
  • Thread starter Thread starter TitoSmooth
  • Start date Start date
  • Tags Tags
    Mathematica
Click For Summary

Discussion Overview

The discussion revolves around solving the equation x - 2cos(x) = 0 using Mathematica. Participants explore the appropriate commands and functions to use within the software for handling trigonometric equations, particularly focusing on the differences between exact and numerical solutions.

Discussion Character

  • Technical explanation
  • Homework-related

Main Points Raised

  • One participant shares their initial input for solving the equation but encounters an error, seeking guidance on the correct command.
  • Another participant suggests removing the curly braces around x in the Solve function, implying it may resolve the error.
  • A different participant recommends using the FindRoot function, explaining that the original equation is transcendental and thus lacks an exact solution, which may be the source of the error.
  • It is noted that FindRoot requires an initial starting point for the numerical solver.
  • Another participant emphasizes the need to use an uppercase 'C' in Cos[x] when inputting the function in Mathematica.

Areas of Agreement / Disagreement

Participants generally agree on the recommendation to use FindRoot for numerical solutions, but there is no consensus on the effectiveness of the original Solve function or the specific error encountered.

Contextual Notes

The discussion does not clarify the specific error code encountered by the original poster, nor does it resolve the implications of using exact versus numerical methods in Mathematica.

TitoSmooth
Messages
158
Reaction score
6
Solve[x - 2 cos[x] == 0, {x}]


this is my imput but i get an error. What is the command to solve trig functions in mathematica

thanks. I searched online but no avail.
 
Physics news on Phys.org
Have you tried it without the curly braces on the x at the end?
 
Mugged said:
Have you tried it without the curly braces on the x at the end?
yes I get an error code.
 
Ok you probably should try the find root function.

FindRoot[x == 2Cos[x], {x,0}]

the 0 is an initial starting point in the numerical solver. I haven't used mathematica in a while but the problem might be that the solve function looks for an exact solution while your equation is transcendental...so no exact solution exists. mathematica's findroot or nsolve functions should work to numerically solve your equation.

Post back your result.
 
Last edited:
Yes, follow Mugged's advice and use FindRoot. You also have to use an uppercase C: Cos[x]
 

Similar threads

Replies
8
Views
4K
  • · Replies 4 ·
Replies
4
Views
4K
  • · Replies 4 ·
Replies
4
Views
3K
  • · Replies 9 ·
Replies
9
Views
3K
  • · Replies 1 ·
Replies
1
Views
3K
  • · Replies 1 ·
Replies
1
Views
3K
  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 5 ·
Replies
5
Views
3K
  • · Replies 5 ·
Replies
5
Views
4K
  • · Replies 19 ·
Replies
19
Views
3K