solving problem exp(x) - 2cos(x) = 0

hi everone,

i m new user . My dad just got for me MAPLE 11 last week. So interested! But when i do sloving equtaion 2*cos(x) - exp(x)= 0 interval -3..3. Maple only give me 1 solution instead of 2 solutions . I wonder if i my imput date is wrong. Can anyone help me, thx!


fsolve([exp(x) - 2*cos(x) = 0],x=-3..3);
{x = .5397851608}

Scott03's picture

2 options

One option to get both the solutions is with the avoid option for fsolve.  It would look something like this

fsolve([exp(x) - 2*cos(x) = 0],x=-3..3);

fsolve([exp(x) - 2*cos(x) = 0],x=-3..3,avoid=%);

 

This tells fsolve to avoid the solution that was given in the previous output (which should be the line above if it was executed first).

 

Another options is to use the Roots command found in the Student:-Calculus1 package.  The following will give both those solutions you were looking for in one output

Student:-Calculus1:-Roots(exp(x)-2*cos(x), x = -3 .. 3, 'numeric');

 

Scott

lemelinm's picture

ploting before calculating

Usually, I ask to plot before doing anything else.  In this case, I do:

=x->exp(x)

=x->2*cos(x)

plot([f(x),g(x)],x=-3..3)

Then the plot reveile what is happening

so now I can do:

fsolve(f(x)=g(x),x=-3..-1)

and

fsolve(f(x)=g(x),x=0..1)

 

Mario Lemelin

mario.lemelin@cgocable.ca

yes this is always helpful

i used to get something wrong

then I was told to plot before calculating, espeacially exponential and log and some high power functions..

lemelinm's picture

OUPS!

Sorry for the first two line:

=x->2*cos(x)

 

Mario Lemelin

mario.lemelin@cgocable.ca

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
}