Finding roots of $e^x\sin^2(x)-\cos(x)=0$ using Mathematica

965 Views Asked by At

$$e^x\sin^2(x)-\cos(x)=0$$

I'm trying to find 5 roots of this equation but mathematica keeps giving me back an error saying $\sin^2$ is not a well-formed equation. Thanks, Joe

1

There are 1 best solutions below

7
On BEST ANSWER

In Mathematica you have to write

Exp[x] * Sin[x]^2 -Cos[x]

Functions are always written in capital letters, if you write exp(x) it will just be a variable like x the argument of a function is written in these [ ] parenthesis.

Nevertheless this is more a question for mathematica stack exchange

The equation $$ \exp(x) \cdot \sin^2(x)-\cos(x)=0$$ is equivalent to $$\exp(x)\cdot \sin^2(x)=\cos(x)$$ This equation can not be solved analytical by Mathematica.

Still you can solve it numerical, for example using

FindRoot[Exp[x]*Sin[x]^2 -Cos[x],{x,1}]

FindRoot uses methods like newtons-method to find the root of a function, the first argument takes the function of which you want to find the root, the second (here {x,1}) says that x is the variable and it should start searching at x=1