Automatically Rounding Within A Table

Greetings Desmos aficionados,

I am trying to get it to automatically round a table cell (integer would be fine). I’ve been trying to use \round, but just can’t seem to get it to work.

cellContent(3,2): “{numericValue("{T}/${M}”)}"

If you would like to see it, go to slide 11:
https://student.desmos.com/join/mq3va8

Thanks!

Could you share the teacher link rather than the student link so we can see the code behind it?

It looks like the forum might have mangled the code in your post somewhat. In general though I would use:

round=simpleFunction(`\operatorname{round}\left(x,2\right)`)
cellContent(3,2): "${round.evaluateAt(.....)}"
2 Likes

Sorry about that, I didn’t realize there was a separate teacher link.

I’m thinking this is the correct link?

Greatly appreciate you taking a look at this for me!

The following tweaks should sort you if I’ve interpreted your code correctly.

M12=numericValue("12*${M}")
round=simpleFunction(`\operatorname{round}\left(x\right)`)
TdivM=numericValue("${T}/${M}")

cellContent(3,1): "Entire\ class:\ ${M12}"


cellContent(3,2): "${round.evaluateAt(TdivM)}"

I can’t really test it without sitting and unpicking where each bit of data is coming from but if you make those changes and report back we might be able to assist further.

The reason I’ve moved the numericValue stuff out into separate variables is to avoid situations where you have quotes inside quotes, like

"${numericValue(".....")"

as this invariably throws off the parser. Probably get around it with backticks but much cleaner to just pull it out to be completely separate.

1 Like

Thank you!
I just tried it out, and I think it will work.

I have a class coming in next period, so that will be the ultimate trial.

I also appreciate the explanation about using too many quotes, I never knew that made a difference.

Yeah, it’s more about the fact they don’t nest within each other, so the first " is interpreted as the opening of a quote but the subsequent one is considered to be the close rather than the opening of a nested one. So while you might expect

" blah blah “blah blah” blah "

the parser sees

" blah blah " blah blah " blah "

if you catch my drift.

1 Like

Got it.

I just had a class and it worked perfectly.

Much appreciated!

1 Like