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

  • Mathematica
  • Thread starter TitoSmooth
  • Start date
  • Tags
    Mathematica
In summary, to solve the equation x - 2 cos[x] == 0, use the command FindRoot[x == 2Cos[x], {x,0}]. The 0 represents the initial starting point in the numerical solver. The Solve function may not work for this equation since it looks for an exact solution, while the equation is transcendental and has no exact solution. Using FindRoot or NSolve should allow for a numerical solution to be found.
  • #1
TitoSmooth
158
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
  • #2
Have you tried it without the curly braces on the x at the end?
 
  • #3
Mugged said:
Have you tried it without the curly braces on the x at the end?
yes I get an error code.
 
  • #4
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:
  • #5
Yes, follow Mugged's advice and use FindRoot. You also have to use an uppercase C: Cos[x]
 

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

What is Mathematica and how does it solve equations?

Mathematica is a powerful software program used for mathematical computation and visualization. It uses advanced algorithms and methods to solve equations, including the one given in the question, by manipulating mathematical expressions and using built-in functions and commands.

What is the correct syntax for solving equations in Mathematica?

To solve an equation in Mathematica, you can use the "Solve" function followed by the equation in curly brackets. For example, to solve the equation x^2 + 3x - 7 = 0, you would type "Solve[x^2 + 3x - 7 == 0, x]".

Can Mathematica solve any type of equation?

Mathematica is capable of solving a wide range of equations, including polynomial, trigonometric, exponential, and logarithmic equations. However, there may be certain equations that are too complex for Mathematica to solve or may require additional input from the user.

How does Mathematica handle multiple solutions to an equation?

In the case of the equation given in the question (x-2cosx=0), Mathematica will return a list of all possible solutions. If there are an infinite number of solutions, Mathematica will use the "Reduce" function to find a general solution that satisfies all possible values for the variable.

Can I use Mathematica to graph the solutions to an equation?

Yes, Mathematica has built-in functions for graphing equations and their solutions. You can use the "Plot" function to graph the equation and the "Solve" function to find the solutions, then combine them to visualize the solutions on a graph.

Similar threads

Replies
4
Views
1K
Replies
1
Views
775
Replies
1
Views
611
Replies
9
Views
557
Replies
5
Views
2K
Replies
19
Views
857
Replies
3
Views
2K
Back
Top