Message Boards Message Boards

Solve Cos[x]^2=1/2 in n[0,2Pi] geometrical

Posted 10 years ago

I succed to plot the two functions

Plot[{Cos[x]^2, 1/2}, {x, 0, 2 Pi}, Ticks -> {{0, Pi/2, \[Pi], 2 \[Pi]}, Automatic}]

Can you make mathematica spot in the graf where the function crosses each other? (for a demonstration task)

POSTED BY: peter B

How about the following?

(*Define the two functions. *)
f[x_] := Cos[x]^2; g[x_] := 1/2;
(*Find the intercepts and thread them.*)
xv = x /. Solve[f[x] == g[x], x] ; yv = f[xv]; pts = Thread[{xv, yv}]

(* Overlay the original and intercept plots using Show[].*)
Show[
 (*Plot original functions*)Plot[{f[x], g[x]}, {x, -2 Pi, 2 Pi}(*End Plot*)],
 (*Plot the intercepts*)    ListPlot[pts, PlotMarkers -> Style[\[FilledCircle],18](*End ListPlot*)](*End Show*)]
POSTED BY: Isaac Abraham
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract