Compound inequalities in one variable-- how to use CL to check

I’m wondering about how to go about checking compound inequalities such as 5≤x≤10.

1 Like

I was able to copy the input inequality as a restriction for a function f(x). You can then use your function f(x) to check for the logic of correctness. One way might be to test against a lot of different values in a list. I tried to build it so that it would test against another function that was defined to be 1 on the values of the solution of the inequality. I did this by checking that the regions inside the inequality matched using a few integrals. However, that wouldn’t catch whether the endpoints should be included. At any rate, here is what I came up with. Inequality • Activity Builder by Desmos

1 Like

Can you help me understand what this latex is doing?
function(“f”): simpleFunction(“0*\{${words}\}”, “x”)

It’s a mystery to me how this interpreting the input (words) so that it comes out as a complex inequality. Desmos magic! (Serge magic)

Pretty sure he made a function, f(x)=0 with restrictions from student input, so evaluating f(x) with a table of values will only yield results within the domain of the complex inequality entered.

1 Like

I’m getting closer. Here is what I have so far-- there are some different versions. The last version is the most general at this point and combines approaches shown on previous slides. I think I check for endpoint correctness in the last slide like I did on the first slide.

Hi there! I see that this has already been answered, but here’s what I came up with.

Program Description:
Students will reply to a question. If students give the compound inequality 1 <=x <=5, then they will see the following reply: “CORRECT!”

  1. Make a math input component and call it, for example’s sake, domain1
  2. Create a note component with the following CL code:

content: when domain1.latex = “1\le x\le5” “CORRECT!” otherwise “”

Just a side-note: I found that the code 1\le x\le5 is very picky – if there are spaces anywhere there should not be, then the program will not work.

Hope this helps!

Welcome @Albert_Schutzman_Gui. Your code will work a little better if you use backticks instead of quotes, then the extra spaces and such won’t interfere. However, in this thread, I believe they’re looking for more computational ways of checking because matching latex is not the most recommended way of checking answers.

1 Like