Compound Inequalities and Domain Restrictions

I was looking at the point collector for help and was wondering if someone had an explanation of the following script:

function("g"): simpleFunction("\\left\\{${input8.latex}:1,\ 0\\right\\}","x") 

I see how it is used in the graphing calculator with g(x)>0 in the domain restriction, but I don’t know how to reconcile the latex input within simpleFunction. Would like to learn so I can extend.

Thanks!

So, input8.latex is just the student’s inequality entered in the math input. The function is “if x fits the student inequality, then output 1 otherwise 0.” If you look in the Point Counters folder, lists A_1 for the blue points, and A_2 are passed through this function to count how many of each point are collected. Then, s_1 calculates the difference for their score.

Alright, I think I wasn’t quite clear on my sticking point:

I know what the latex part means, I meant to refer to the actual \left{${latex}:1,\ 0\right} portion.

I know the \left{ and \right} give L and R braces, but what about the "\\{ }", ":1", and the "\ 0" portions. I’ve just not seen this in the calculator or CL before. Interested in those operators specifically.

That was this. It’s basically a when-otherwise statement in the form {condition: result if true, result if false}

Normally you might use it for a single variable:

a={m>0:10,5}

So in the above, “when m>0 a=10 otherwise a=5”.

Your function in question uses the student input as the condition. Then, as I pointed out, in the other folder, g(A_1) takes the list of all the blue points and checks if they fit the student inequality, and totaling the score. Same for A_2, the red points. s_1 is blue score minus red score giving the overall score.

1 Like

Thank you so much. This is a new power you have taught me.

1 Like

It’s very useful. I use it often for calculating correctness in a graph.