validation display for sign function

validation display for sign function

by Martin Kraska -
Number of replies: 2

I am trying to author a question where the answer contains the signum function. None of sgn(), sign() and signum() are handled in a way I want it to be seen by students.

  • sgn() and signum() seem to be unknown and are written in italic in the validation output. 
  • sign() is converted to pnz.
I know that I could do something like texput(sgn,"\\mathrm{sgn}"); but that doesn't work properly, the validation shows the (correct) raw tex expression (reported here).

I wonder if I missed a straightforward option to input sgn(), as this is a quite common function not only for engineers. 

Currently, the only workaround seems to use abs(a)/a as a replacement. This is awkward yet displays consistently.

Average of ratings: -
In reply to Martin Kraska

Re: validation display for sign function

by Christopher Sangwin -
Picture of Particularly helpful Moodlers Picture of Plugin developers
I think the function you want in Maxima is "signum". I've tried this out, and this works for students' input. It is rather a surprise that this isn't included in Maxima's tex function, but the function itself still exists. I'll add this in to tex, and if you have a very recent version of STACK you can now add a texput command to fix this yourself in students' input (this is a very recent addition so may not work for your setup until you upgrade).

"sgn" is not known, and "sign" is already taken with another Maxima function which it would be silly to change. I suggest you forbid sign in any question in which a student is likely to use it.
In reply to Christopher Sangwin

Re: validation display for sign function

by Martin Kraska -
Thanks for clarifying this. On our experimental Moodle instance this works:

texput("signum","\\mathrm{signum}");

Yet, we still have problems with reliable math formatting. 

Indeed, in wxmaxima, the tex function doesn't know that signum should be roman. 


It would perhaps be a good idea to rename signum(x) to sgn(x) in STACK with proper tex formatting, because sgn() seems to be the accepted way to write the function outside Maxima. Perhaps this could use the same mechanism like thehandling of alternate names for trig functions.