When should I use rawExpression?

rawExpression, and its related sinks (rawExpressionColor, rawExpresionStyle, etc), are all marked as “brittle! use at your own risk!”

What about these sinks are brittle, and when should they be used?

Because you can type anything you want, we can’t tell before-hand what impact it will have on the rest of the activity (e.g. it could define a variable that conflicts with another one). This means that we can’t always do all the magic we need to do to make the teacher dashboard work correctly, and we can’t always do all the magic we need to prevent confusing errors. They’re generally more OK to use for just drawing something to the graph, and more problematic if they’re being used to define variables that are used elsewhere.

If you’re using them, look at simpleFunction() as an alternative - that can frequently achieve the same thing without the problems of rawExpression.

Hi to everybody and thanks for your beatiful work,

Sorry for reviving this topic; I couldn’t find any alternative. If I’m wrong please forgive me.

My problem is: how to allow students to insert relationships which are NOT functions?

In this activity (sorry for its being in Italian, I hope it is understandable anyway) I wanted students to insert the expression for the simmetry axis of a parabola:


In slide 5 I used RawExpression. Obviously I can get it also in another way (slide 8), but I want the students to write explicitly ALL the expression, because vertical lines are usually neglected compared with “normal” ones, as they are a “special situation” which they forget too often.

And in general: I would like to prepare activities on other conics, which are not functions. So my only possibility is currently to let them insert the expression directly into the graph on a dedicated slide, but in this way I’m prevented from using CL, interactive feedback and so on…

I understand that RawExpression is “dangerous”, but are you planning to replace it with some “parseLatex()” expression which may include some safety constraint without preventing us from getting “reasonable” results?

…or do you have any other hint?

thank you SO much!

There are some better features for this that aren’t well documented yet. This activity has an example of a function called “parseEquation” that might help you.

In addition to parseEquation, you can still use simpleFunction for the axis of symmetry, just change the argument to y. If you want them to be able to write both y= and x= just make the argument both x and y. This will also allow students to write horizontal parabolas.


As for ellipses and hyperbolas, I had to resort to rawExpression, but I used parseEquation for the correctness checker.

Here is some work with parabolas I have done.

Conic Sections:

There are some bugs in the problem generator I still have to go back and comb through, but either way you might be able to take this apart for your own purposes.

I’m guessing that parseEquation will not handle compound inequalities like 2<y<3 very well, since there’s no clear left-hand side and right-hand side. Is that correct? Does it even work with inequalities at all?

I know it’s an old post, but parseEquation does not work with inequalities. Not to be coarse, but inequalities are not equations!

1 Like