Questions about simpleFunction

@desmos two questions

  1. Slide 3: How can I get the simpleFunction to use \theta as an input variable? I currently have to use T.

  2. Slide 2: How can I get the simpleFunction to use the latex of choiceContent(n)?

Thank you!

These are great questions. I’m not sure about the theta problem but I know that you can’t retrieve the latex from choiceContent (I’ve had that issue before). I think it’s because the choice content can be both latex and/or text.

1 Like
  1. There are a number of special characters it doesn’t recognize. I think you’re stuck with T for now.
  2. I think you can just use backticks and call it as a variable. Basically converting the string to latex.

I can’t seem to get this code example to work when trying to define a function in a graph using the content of MC answers. My hope is to create a screen where one only need edit the MC answers and have the graphs of those answers follow suit. Have you been able to create a working example of taking the string and converting it to latex?

You’d need to replace n with a specific choice number. You could use a when-otherwise to define the latex and use that in the function:

exp= when multChoice.isSelected(1) `${multChoice.choiceContent(1)}`
when multChoice.isSelected(2) `${multChoice.choiceContent(2)}`
otherwise `1/0` #to have an undefined function when there's no selection

Thanks for the tip! I gave it a shot but am still seeing an error. Any ideas on what’s wrong?

I removed the `${ }` from each one and that fixed the error message, but the graph still wasn’t working (i.e. it wouldn’t recognize the latex). However, if you define the choices in the multiple choice CL with backticks, it works:

choiceContent(1): `y=x+3`
choiceContent(2): `y=2x+3`

Thanks for taking a look! Perhaps it’s because defining choices in the CL means it’s solely latex, whereas defining them in the builder leaves it a mix of string and latex. Appreciate the help!