Features & Development

jsMath/previewing independent variables

jsMath/previewing independent variables

by Gavin LaRose -
Number of replies: 2
Hi all (in particular Davide),

I was talking with an instructor this afternoon, and we noted the following about previewing mathematics expression input. If one previews something like (sin((x+1)^2)/3)(x+2), the display of the answer may show up with various sized parens, etc., to show what the meaning of the expression is.

Extending this further, we wondered if the previewer could do something like display the independent variable(s) in a different color, e.g., blue. Similarly, one "could" color other parameters. In that I use jsMath for previewing by default, this would require that the jsMath renderer be able to figure out what the independent variable(s) is(are) for the problem, and be able to color the occurrences of the independent variable(s).

My understanding is that jsMath uses either local fonts, or downloaded images, to create the display. Thus the second part of this, it seems, would depend on either being able to use colored local fonts or to have different color font images.

In any event, if anyone has thoughts about the desirability or feasibility of this, I'd be interested to hear them.


In reply to Gavin LaRose

Re: jsMath/previewing independent variables

by Davide Cervone -
JsMath can colorize mathematics, but only when actual fonts are used, not the image fonts. (I don't know any way to change the colors in the images on the fly, and having pre-colored images would make for a prohibitively large number of image files.) It is unlikely that your students are downloading the fonts, so I don't think that coloring the characters would work well. It is possible, however, to use background colors, and they would work in image mode as well as tex-font mode.

On the other hand, I'm really not sure I understand the desired result. Since ALL the variables are independent, does that mean you just want the variables to be colored differently from the numbers and operators? I'm not sure how much value that adds. If there are other parameters (like 'a' and 'b') is there really much confusion about whether they are variables or not?

The MathObject's TeX method could be made to colorize variable names, but I'm not sure it's worth the effort. Can you convince me otherwise?

In reply to Davide Cervone

Re: jsMath/previewing independent variables

by Gavin LaRose -
Hi Davide,

I don't know if I can convince you otherwise, in that I'm increasingly thinking that it is a red herring, but I'll try to elucidate the original question a bit better.

We were thinking that one of the concerns some students have is that they will type something like sin(x) when the question asks for sin(t) and therefore get the problem wrong. We were thinking that if the preview automatically colored the independent variable in the problem it would provide a visual clue that they had the argument that they wanted in the problem.

That said, I think for the moment that the question is moot, because if they actually preview their answer and it uses an illegal variable (e.g., x instead of t), the previewer reports "Variable 'x' is not defined in this context," which should be obvious enough. I think some of my original thinking about this was informed by the original homework/testing software we were using being silent about variable errors (answering sin(x) instead of sin(t) would be marked wrong without an error message), and I think at some point I may have tweaked the grader we were using in WeBWorK to similarly ignore such errors, but that's obviously no longer the case.

More philosophically, we were thinking that there are three levels on which one could expect students to understand when they enter an incorrect variable in a problem: that they understand that the variable is incorrect if the system reports the error; or that they understand the error in the absence of warnings; or a middle ground, that they understand the error if they are given some visual clue short of an error message when they preview the problem.

I think a good analogy is probably the case of a student using correctly matched but incorrectly placed parentheses. The level of warning that is given now is that the previewer gives a visual clue that there's an error: it previews with the parentheses in the wrong place. If one decides that the error of using the wrong variable name is of a similar order of magnitude as mis-placed parentheses, then it would make sense to have the previewer give an indication of the error rather than simply return an error. But for the moment I think that's probably irrelevant.

Sorry that was so long-winded.