cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
dmg34
Community Contributor

Variable in formula question IN equation editor?

Jump to solution

Is there a way to do this? I want to write a question like the one below, using a formula, so each student gets a slightly different model. Rather than do it like it's written below (where the model is in terms of the parameters A, B and k, and then each student is given their parameter values), I would prefer that I could just put the variable-based model in the question. I hope my question makes sense. Is there a way to do this? As far as I can tell, I can't use the variable placeholder in conjunction with the equation editor.

296545_pastedImage_1.png

1 Solution

Accepted Solutions
James
Community Champion

 @dmg34 ,

You are correct in your assessment. There is no way to do this with the core functionality of Canvas.  I'll add the caveat that I haven't played with quizzes.next, but I haven't seen much discussion-wise that would make me think it's got better formula questions.

Equations are sourced as images and are not subject to variable substitution like the textual content of the question.

Here's some background that really doesn't change anything, but helps explain maybe why it wasn't done.

The URL to the image includes a twice-encoded version of the LaTeX used to generate the image. The LaTeX brackets [ ] would get encoded as %5B and %5D respectively. Then each % would get encoded as %25, so it would end up %255B and %255D. Those aren't unsurmountable obstacles if Canvas really wanted to support variables in equations.

A more complex issue is that mathematicians sometimes use brackets as grouping symbols and if that happened to be around a possible variable name, should it be treated as a substitution or not?

The equations are generated by an LTI, which is under Canvas' control but still separated from the variable expansion process.

All three of those probably have a technical solution, but it's not a priority for Canvas who has said that they're not going to add new functionality to the legacy quizzes, instead focusing on Quizzes.Next. I don't expect it to happen in the forseable future -- perhaps if an open source contributed made it happen or with Quizzes.Next, it's supposed (I think I heard this) to have the ability to create your own question types, so that might happen with something related to that.

Along with the idea of using variable substitution in equations, some would like to use answers in the questions. For example, what is the square root of [y] where the random number generated is [x] and a formula has the equation y=x*x

Essentially, there are a lot of deficiencies for math and science teachers when it comes to Canvas quizzing.

I wrote that you couldn't do this with the core product. I wouldn't recommend what I'm about to write, but if your school was experienced enough, it could replace the Canvas equations with a JavaScript generated version through the global custom JavaScript file. It could look for things like \( S(t)=\dfrac{[A]}{1+[B]e^{-[k]t}} \) and then render it, although it would be quicker for the programmers to bounce it off a span with a class like <span class="math">S(t)=\dfrac{[A]}{1+[B]e^{-[k]t}}</span>. With luck, Canvas would have already replaced the [A], [B], and [k] by their values since it's just text to Canvas and not an image. However, you would need to make sure that your solution worked across browsers and devices and maintained the accessibility that Canvas provides. In short, it's not an easy thing to do.

What I've done in cases like this is to work the numbers into the text and expect the students to know what the variables represent. That's essentially what you've done, you just made it a little easier than them.

Another thing I've done is to create multiple versions of the questions with the different values in there as numeric response questions. Then I pull them from a question group. I know that loses the benefit of a formula question, which makes it harder. I've used Excel and Respondus in the past to make that process easier. Recently I just copy the question (or find it in the Unfiled questions bank and re-add it) and then modify it.

By the way, not sure if you gave us a real question or just created it for the Community, but you're missing the t from your question. It says "after days" instead of "after t days".

View solution in original post

5 Replies
James
Community Champion

 @dmg34 ,

You are correct in your assessment. There is no way to do this with the core functionality of Canvas.  I'll add the caveat that I haven't played with quizzes.next, but I haven't seen much discussion-wise that would make me think it's got better formula questions.

Equations are sourced as images and are not subject to variable substitution like the textual content of the question.

Here's some background that really doesn't change anything, but helps explain maybe why it wasn't done.

The URL to the image includes a twice-encoded version of the LaTeX used to generate the image. The LaTeX brackets [ ] would get encoded as %5B and %5D respectively. Then each % would get encoded as %25, so it would end up %255B and %255D. Those aren't unsurmountable obstacles if Canvas really wanted to support variables in equations.

A more complex issue is that mathematicians sometimes use brackets as grouping symbols and if that happened to be around a possible variable name, should it be treated as a substitution or not?

The equations are generated by an LTI, which is under Canvas' control but still separated from the variable expansion process.

All three of those probably have a technical solution, but it's not a priority for Canvas who has said that they're not going to add new functionality to the legacy quizzes, instead focusing on Quizzes.Next. I don't expect it to happen in the forseable future -- perhaps if an open source contributed made it happen or with Quizzes.Next, it's supposed (I think I heard this) to have the ability to create your own question types, so that might happen with something related to that.

Along with the idea of using variable substitution in equations, some would like to use answers in the questions. For example, what is the square root of [y] where the random number generated is [x] and a formula has the equation y=x*x

Essentially, there are a lot of deficiencies for math and science teachers when it comes to Canvas quizzing.

I wrote that you couldn't do this with the core product. I wouldn't recommend what I'm about to write, but if your school was experienced enough, it could replace the Canvas equations with a JavaScript generated version through the global custom JavaScript file. It could look for things like \( S(t)=\dfrac{[A]}{1+[B]e^{-[k]t}} \) and then render it, although it would be quicker for the programmers to bounce it off a span with a class like <span class="math">S(t)=\dfrac{[A]}{1+[B]e^{-[k]t}}</span>. With luck, Canvas would have already replaced the [A], [B], and [k] by their values since it's just text to Canvas and not an image. However, you would need to make sure that your solution worked across browsers and devices and maintained the accessibility that Canvas provides. In short, it's not an easy thing to do.

What I've done in cases like this is to work the numbers into the text and expect the students to know what the variables represent. That's essentially what you've done, you just made it a little easier than them.

Another thing I've done is to create multiple versions of the questions with the different values in there as numeric response questions. Then I pull them from a question group. I know that loses the benefit of a formula question, which makes it harder. I've used Excel and Respondus in the past to make that process easier. Recently I just copy the question (or find it in the Unfiled questions bank and re-add it) and then modify it.

By the way, not sure if you gave us a real question or just created it for the Community, but you're missing the t from your question. It says "after days" instead of "after t days".

View solution in original post

dmg34
Community Contributor

Thank you  @James ‌! And ACK yes I did forget that t - thank you for catching that!

I have not tried quizzes.next, since the bit of looking into it that I did revealed that all the basic functionality that users have been asking for (like more robust options in formula questions such as being able to ask for MORE THAN ONE result, or use variables in the question as you suggest) for YEARS have NOT been implemented.

At any rate, I have also done the many-versions-of-same-question workaround that you suggest, but I find it ridiculously tedious (it would help, I'm sure, if I would become adept in the use of Excel or Respondus for such a task).

Thanks again for your help!

James
Community Champion

I'm with you on Quizzes.Next -- that's the primary reason I haven't looked into it. If I thought it was a viable alternative for what I need with Canvas, I might.

James
Community Champion

 @dmg34 , 

I'm revisiting this question in light of Quizzes.Next. I'm assessing whether or not it's usable and beyond the fact that I can't get it to work at all in my sandbox, it has made some progress. I created a new course in our beta instance to play with it (we don't have it turned on for our production instance and I think my toggling back and forth is what it doesn't work in my sandbox), and created a formula question.

Here's what I ended with while previewing the question using the Student View.

315242_pastedImage_7.png

Quizzes.Next uses LaTeX within the question text, delimited by \( and \), rather than creating an image as Quizzes does. 

Quizzes.Next uses a backtick to separate variables rather than brackets. Instead of typing [x], we type `x`. I did test that multi-character variable names were supported and it worked. The documentation doesn't mention that.

It turns out that you can include backticked variables within LaTeX and it does the substitution before it does the LaTeX. This isn't documented either.

That is, you can use \(`x`+5\) and it will replace the `x` with the value of x and make it styled as an equation object.

I tried to duplicate your question to fully test it.

Here is what my question text looks like with Quizzes.Next.

A flu virus spreads through a student population such that the number of students sick after t days can be modeled by the logistics growth function:

\(\displaystyle S(t)=\frac{`A`}{1+`B`e^{-`k`t}}\)

Estimate the number of students who are sick with the flu after `t` days.

My Answers section was similar to Quizzes.

315236_pastedImage_5.png

The Formula Definition is much the same

315237_pastedImage_6.png

One problem with Quizzes.Next is that it doesn't remember the generated answers if you go in and edit the question. You have to regenerate the answers (or cancel), even if you don't don't change anything variable related.

dmg34
Community Contributor

Thanks so much for coming back to this and doing this experimentation,  @James ‌! As of now, my school has not yet implemented quizzes.next, but I've been asking about it and I think it might be possible by request. I'll definitely check into it!