How to check if two numbers in a table make the correct Ratio

I want to check two numbers in a table to make sure they make a ratio equal to 2. That is my first hurdle. The \frac line is wrong.

I want it to be correct when the ratio = 2 but make sure the student did not just use one of the earlier table entries given.

Here is what I have:

f1=t6.cellNumericValue(4,1)
f2=t6.cellNumericValue(4,2)
ratio=numericValue(“\frac{{f2}{{f1}}”)

correct: (not(f1=1) and not(f1=2) and not(f1)=3 and ratio=2)

I am not sure why it is not showing what I typed in. It should have ${f2} in there.
Thank you for helping me figure this out.

I think the activity below does what you were looking for.

In your correct = definition you have (not(f1=1) and not(f1=2) and not(f1)=3 and ratio=2) but I believe you mean for that to be (not(f1=1) and not(f1=2) and not(f1=3) and ratio=2)

I don’t know why you can’t include the CL code for the ratio script here on the forum without it showing that “Extra open…” error message. I am getting the same message, so I guess you’ll have to see what I used in the CL of the activity linked above.

That is perfect. Thank you!!

If you want to include code on the forum that displays correctly, enclose it using triple backticks (the apostrophe like mark by the “1” key). You can use it inline, or on the lines before and after a block of code, which is really handy for copying it!

f1 = t6.cellNumericValue(4,1)
f2 = t6.cellNumericValue(4,2)
ratio = numericValue(`\frac{${f2}}{${f1}}`)
1 Like