I would like Desmos to mark correct if a student inputs x <= 8. However, I can only get it to mark numeric values as correct. In the math input, is there a way for it to mark inequalities correct?
Welcome to our community!
As it happens, this is now possible because of the new parseInequality function
If you just want it to accept the inequality you’ve given, here is some sample code to put in the math input’s CL.
ineq = parseInequality(this.latex)
correct: ineq.lhs= `x` and ineq.rhs = `8` and
not(ineq.isLeftGreater) and not(ineq.isStrict)
Note that this won’t accept 8 <= x as correct. If you want to add that possibility you could swap around the ineq.lhs
and ineq.rhs
and get rid of the not
before the ineq.isLeftGreater
.
You may also want to watch out for the latex comparison for 8
here. It may not be so problematic here (the likelihood that a student enters something like 08 or 8.0 is very low), but once you move on to other numeric inputs, it may be a good idea to evaluate numeric values.
This is not all that different from matching the whole string
latex = x \le 8
since it looks for exactly “x” on the left side, exactly “8” on the right and exactly the less than or equal to sign in between
I also pondered that issue and thought “no student would type x <= 3+5” but fair point once you’ve got a value that could be expressed as a fraction or a decimal equally well.
I think the only difference from the string comparison is that whitespace would be ignored.
Ooh fun fact: with latex strings, white space is ignored!
Hello,
I’m working in a table and would love to be able to set solutions at the beginning and not have to change all of the code below. I have been working with numericValue in the following format:
solution1 = numericValue("\frac{20}{23}")
I have not yet figured out how to use latex to define solution1, and I’m curious what I need to change. I recognize numericValue doesn’t go with latex, but I’m not sure which command to use.
How would I use latex to define solution 1 as x<8?
parseInequality is fairly new tech so we’re still tinkering with the best way to work with it, but here’s kind of where we stand. Typically we won’t use the countNumberUsage to make sure only one number is entered (mostly because of how we like to give feedback), but if this is exactly what you want to see then it might be your best option right now.
Generally:
- check that one side is “x” and the other is a single number
- make sure that the boundary is in the right place. No need to worry about which side, the previous check will catch that
- make sure the direction of the inequality is correct. Difference function formats as greater-lesser so check for a value on one side of the boundary and check if that value is > or < 0. Here x<8 so difference function is 8-x. Testing at x=9 should yield a value of -1.
- check if the inequality is strict or not. Here x is strictly less than 8 so make sure ineq.isStrict.
Happy and greatly appreciative to hear any alternative methods people have been toying with.
I am trying to understand parseInequality. I am working on an activity where students need to solve a compound inequality but I want them to enter each step along the way. For example, the inequality I gave them is 3x+4<=2(x+7)-3<8.
I want them to state the two inequalities but I can’t get the first one to give them feedback. Not sure where I am going wrong with parseInequality. This is what I have in the math input CL.
Y = YouTry1a1
ineq = parseInequality(Y.latex)
lhs = simpleFunction(ineq.lhs,x
)
rhs = simpleFunction(ineq.rhs,x
)
valid =
(lhs.evaluateAt(-1) = 1 and lhs.evaluateAt(-3) = -5) and
(rhs.evaluateAt(0) = 11 and rhs.evaluateAt(1) = 13 and rhs.evaluateAt(-20) =-20)
boundary = countNumberUsage(ineq.lhs,3)=1 and countNumberUsage(ineq.lhs,4)=1 and countNumberUsage(ineq.rhs,2)=1 and countNumberUsage(ineq.rhs,14)=1 and countNumberUsage(ineq.rhs,11)=1 and countNumberUsage(ineq.rhs,3)=1
correct = valid and boundary
YouTry1a1Score =
when correct 1
otherwise 0
disableEvaluation: true
showSubmitButton: false
This is what I have in the note for feedback:
feedback=
when YouTry1a1.script.correct “\n\nGreat job!” otherwise “”
Thanks!
Julia
Hi All,
In this activity on slide 1, in the table labeled “sol” I was attempting to check each step of converting a linear inequality in standard form to slope-intercept form. I attempted to use code from slides 2 and 3 of this activity:
Could anyone help with the code in the table?
Thanks.
This activity has some domain and range questions that uses inequalities. Feel free to poke through this and see if it helps at all
Thanks, while I was working on systems of inequalities word problems I was able to figure it out.
Here is the updated activity (the problem is still on slide one):
Here is the activity with the word problem I was working on:
Here is my current algebra 1 collection for this year:
https://teacher.desmos.com/collection/611f085c67ca6a5fb94d3a7d
When you say that white space is ignored, does this mean that it would ignore the spaces when comparing a student’s answer to a latex string? I only ask because I’m trying to account for potential spaces that students might place in when comparing their answer to the latex string “40%”.
I try to never use latex string comparisons but having students supply an answer with the percent symbol has been problematic.
Have you tried pattern matching using a literal for the % symbol? I am a very beginner with pattern matching, but I can give it a go if needed.