# Getting latex from a table input

I am trying to make a self-checking activity where I take the values input from a table and compare them to a latex string but I can’t seem to get this to work. I have the following code inside the CL of the table:

correct1 = “3+\sqrt{2}i”
correct2 = “3-\sqrt{2}i”
#input1 = “${table1.cellContent(2,1)}” correct: “${table1.cellContent(2,1)}” = correct1

It worked when I used a math input (not a table) and I put an extra \ in front of the ,of the \sqrt (so the first line would be “3+\\sqrt{2}i”). Try that in your table?

Hey Simon,

We strongly recommend against checking exact latex strings as its very easy to mark students wrong for work they’ve done correctly (even extra white space somewhere will throw it off).

Here’s an alternative using simpleFunction to find the numeric value of the expression. Here, we interpret i as a variable that we can use to evaluate the expression. There are other options as well.

Hey Jay,

This is totally awesome and I don’t think I could have worked this out by myself. Working with latex strings is a pain so this is great.

When the i is in quotation marks, does this mean treat i as a variable?

Thanks,

Simon

Yup! SimpleFunction defaults to using x as the only variable. If you want to change it he variable or add on, you can list out letters, comma separated, in double quotes.

Hi Jay,

I am trying to do the following:

I have this in the input CL and the correct answer would be -1+ sqrt(3)i but would be entered using math text in the input box.

I can’t seem to get this to work and I see that the correct icon changes to X as soon as I begin typing the answer. I’m trying to evaluate the answer as a function and treat “i” as the variable.

Thanks,

Simon

I’m guessing there is an issue with the number of decimal places. I was able to get it to work by using fewer digits. This should also work without needing to type the digits. Basically, it’s comparing the correct answer to the input and seeing if they evaluate to the same amount.

fn1 = simpleFunction("-1+\\sqrt{3}i", "i")
fn2 = simpleFunction(input6.latex, "i")
correct = fn1.evaluateAt(3)=fn2.evaluateAt(3)


Thanks - that seems like a much more efficient way of doing it.

I’ve don’t this before too, but have been told even that will sometimes evaluate unequal. So you should always round yourself.

fn1 = simpleFunction("\\round(-1+\\sqrt{3}i,4)", "i")
fn2 = simpleFunction("\\round(${input6.latex},4)", "i") correct = fn1.evaluateAt(3)=fn2.evaluateAt(3)  Thanks Daniel. I’m guessing the 4 means 4dp? Also, what is the dollar sign in fn2 doing here? Thanks I have made an assessment using desmos but I have two issues that I can’t figure out: 1. The correct indicator turns incorrect and correct before the answer is submitted allowing students to keep guessing when entering an input. 1. For multiple choice questions, students can keep selecting until they see the correct indicator turn to a tick. So now they would just select the others until they get a tick in the grey box. How can I fix this? Thanks Hey Simon! The grey box is a preview of the summary tab in the teacher dashboard. Students won’t see it from student.desmos.com Yes, 4 is the number of decimal places for rounding. You use${ } in CL to call variables or here the latex entry from student input. If you put input6.latex without the dollar sign and curly brackets, it would just insert that text.

Does anyone know if it is possible to embed links to external sites in desmos activity builder?

Thanks

You can insert links, but not embed. Basically, it will display a clickable URL, but you can’t choose your own text and whatnot. I suggest using a URL shortener if it’s a long URL.

I have a slider that allows a movable point on a graph to be dragged around but I want to restrict this to quadrants 1-3. How can I do this? I tried to get the x and y values from the slider in the CL but couldn’t seem to do this.

Thanks