Polar Coordinate Check

I want my students to enter the ordered pair for a polar coordinate using exact radian measures. How to I code it so that the student has to enter the answer as (4, -7pi/4)?

mypair = parseOrderedPair(this.latex)
my_x = numericValue(mypair.x)
my_y = numericValue(mypair.y)
check=my_x=4 and my_y=-\frac{7\pi}{4}
correct: check

I get the following error
Syntax error: Unexpected token “-”

The recommended format is to use countNumberUsage and a range of values, so you would need to change your check to this:

check=my_x=4 and countNumberUsage(this.latex,4)=2 and (countNumberUsage(this.latex,-7)=1 or countNumberUsage(this.latex,7)=1) and my_y<-5.497 and my_y>-5.498

Because you are expecting an exact form (kind of like checking for spelling errors), you could possibly get away with replacing all of your code above with this LaTeX check for the whole point:

check=this.latex=`\left(4,-\frac{7\pi}{4}\right)` or this.latex=`\left(4,\frac{-7\pi}{4}\right)`
correct: check 

Note that both ways would need to include the possibilities for the negative before or with 7.

I tried the second way and it worked - thank you so much :grinning: