Algorithm lines in CalcMe

A brand new way to define variables and create algorithms is available in CalcMe. The purpose of this page is to provide an outline of what this new feature has to offer, the problems it intends to solve and the expected user interaction.

Live demos

There are several live demos on this page. If you click into the area containing the CalcMe parameters, it will open in CalcMe. Try it out, change the parameters or options. You won't break anything.


Algorithm line example

After analyzing the CalcMe user experience deeply, we realized several minor issues could be improved with the algorithm lines development. The main problems this new feature intends to address are:

  • It's not possible to copy and paste multiple lines in CalcMe. From now on, it will be possible to reuse parts of an algorithm easily.
  • It's complicated to remember by heart all the commands. The new autocompletion option will help you to find the appropriate function at each moment.
  • CalcMe presents performance issues in sessions with an intermediate length due to the many instances of MathType editors that need to be used. You won't face this problem anymore by generating the algorithms with the provided plain text.
  • It's not possible to add comments inside multiple line structures. Besides, it's also not possible to switch a line from being commented to being active easily.

There is a new button in the toolbar allowing you to instance a code editor. That button enables the algorithm line feature in the current line, and you can enter your algorithms directly there.

User-created functions and constants (such has the represented by r(), create_random_matrix(m,n) and A) get their styling once the code editor loses focus, to avoid the performance impact of updating the grammar every keystroke.

On the other hand, variables defined inside a code editor are available in posterior standard CalcMe lines for operations or value checking. Besides, multiple code editors can be created on a page, and each one can access the variables of the previous ones.


Old Wiris Quizzes versions

If you're using the feature in a Wiris Quizzes version before 4.2.7 (which includes Wiris Quizzes 3), sessions with only algorithm won't be detected. This can be solved by adding something in CalcMe's Sheet, as you can see in the screenshot below.

The syntax used in the code editors is the Omega language, the internal language of the Wiris CAS kernel. Even though it's very similar to the syntax used in standard CalcMe lines, several actions help you get the correct syntax.

  • Clicking a button from CalcMe menu while inside a code editor will enter its Omega equivalent expression:

  • Using the function name autocompletion mode through the shortcut Ctrl + Space (Cmd + Shift + Space in macOS):

Comment syntax

As mentioned above, it's possible to use the comment syntax within the code editor. You can use the symbol # to mark a line as a comment and the sequence /# to start a comment block (you can close it using the symbol #/).

String substitution command

If you want to use the string_substitution() command within a mathematical expression, you will have to keep using the CalcMe sheet accordingly. It's a limitation of the current editor and, although it's not ideal, the formulas won't be displayed properly if they are included through the code editor.


String substitution command example