Message Boards Message Boards


Solve Function on a Specific Interval

Posted 1 month ago
2 Replies
0 Total Likes

In order to get the exact answer using the Solve[] function, it would be useful to enter the specific interval. For example in calculating the values of x in the Solve function

Solve[2 Sin[x]^2 - Sin[x] - 1 == 0, x, Reals]

I would like the answer on the interval from 0 to 2 Pi.

Without the ability to enter the desired interval, I get the answer of:

{{x -> ConditionalExpression[-(\[Pi]/6) + 2 \[Pi] C[1], 
    C[1] \[Element] Integers]}, {x -> 
   ConditionalExpression[\[Pi]/2 + 2 \[Pi] C[1], 
    C[1] \[Element] Integers]}, {x -> 
   ConditionalExpression[(7 \[Pi])/6 + 2 \[Pi] C[1], 
    C[1] \[Element] Integers]}}

Which is not exactly correct since answer #1 is less than 0 and the answer for 2 pi (11pi/6) is not listed.


Mitch Sandlin

2 Replies
Posted 1 month ago

Hi Mitchell,

One way

Solve[2 Sin[x]^2 - Sin[x] - 1 == 0 && 0 < x < 2 Pi, x, Reals] // DeleteDuplicates
(* {{x -> π/2}, {x -> (7 π)/6}, {x -> (11 π)/6}} *)

Thanks so much. I also found that Reduce[] works real well also. Additionally you do not need to suffix // DeleteDuplicates to the Reduce[] expression.

Thanks again,

Mitch Sandlin

Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
or Discard

Group Abstract Group Abstract