BASIC GUIDE - CalcMe

In this page you will know the basics of CalcMe. We will explore vectors, matrices, polynomials and general expressions. Some useful tips about lists comprehension and randomness will be given before some basic programming commands are explained. A detailed explanation about graphics is given. Finally, some statistics functions and user functions will be shown.

Vectors

Vector are constructed with square brackets [], and the elements are separated by commas ,.

We can sum vectors or compute the scalar product between them.

LIVE DEMO

Matrices

Matrices are vectors of vectors, that is, vectors whose rows are vectors. We can create matrices with two different syntaxes

As vectors, we can sum and multiply matrices (as long as dimensions match)

LIVE DEMO

Element access

We can access a specific element of a vector using subindeces, that start on 1. In the same way, we can retrieve an element of a matrix

LIVE DEMO

More elemental computations can be found in the documentation.

Polynomials are created with numbers times a power of a variable.

LIVE DEMO

We can sum, multiply, divide and, for instance, find roots of polynomials.

LIVE DEMO

We can create a more complex expressions and operate with them.

LIVE DEMO

See a basic introduction in the manual.

CalcMe allows us to deal with geometrical figures such points, lines, planes and conic sections. We can also create polygons and polyhedras, both in 2D and 3D. See some examples of plotting options here. It is also possible to compute the distance between figures, the angle they form and or the symmetry by an object.

LIVE DEMO

The random function in Wiris Quizzes is adaptable to many cases of use. For example, we'll show you how to remove the "0" from a random selection. The normal command would be something like:

LIVE DEMO

By default, this includes all of the numbers between -10 and 10. If the number 0 supposes some sort of difficulty or wrong behavior for our question, we can remove it with the simple instruction (the slash / should be used through the Logic and sets tab):

LIVE DEMO

We have to add brackets around the first list for this to work. As you may suspect, this can work for any other number we use instead of zero:

LIVE DEMO

The above would produce a random number between -10 and 10, except the number 8. Or you can even do this with more than one number:

LIVE DEMO

This would remove 8,-8, and 0 from the selection. As can be seen, we have many more options than it seems at first when creating a random variable.

So far we have retrieve integer numbers. We can also obtain real numbers

LIVE DEMO

This section is a short guide to creating lists in Wiris Quizzes algorithms, using the commands with and where. This method of defining lists is based on the common mathematical notation of "set comprehension" or "set-builder notation", for instance:

We'll explain the commands through the following examples.

Example 1

At the most basic level, with simply provides a more compact form of writing long lists. We could write

LIVE DEMO

or we could greatly simplify it to the following:

LIVE DEMO

The command where comes in when we want additional restrictions. To get only the even numbers, for example:

LIVE DEMO

Alternatively we could, of course, have gone with:

LIVE DEMO

Example 2

In the first example the size of the list was fixed. However, using comprehension shows its most benefit when defining lists of variable size. Here for example is a list with random elements, of random size

LIVE DEMO

As you may notice, the first expression need not explicitly depend on . We can think of as just a counter within a specified range. Then, we may or may not use it to define the list elements. It can also be any variable name we choose, as in the following:

LIVE DEMO

Example 3

The list comprehension notation can also be extended to more than one variable. In that case, we must specify the range for each variable used as a counter. For example, here is a list with all positive proper fractions in simplest terms, with single digit numerator and denominator:

LIVE DEMO

Another recommendation illustrated in the above example is to enclose each condition after where in parentheses, if we have more than one joined by .

Example 4

Finally, we note that the range for the counter variable can itself be a list, defined previously.

LIVE DEMO

Example 5

It is also possible to create matrices using this notation. For instance, creating a matrix with random coefficients is as simple as this:

LIVE DEMO

We can use some programming functions. You can see the basic ones here. For instance, creating a list as before, we can easily compute the square of the first primes.

LIVE DEMO

There are a lot of functions involving statistical functions, like mean, quantile, quartile... You can see a complete list here.

LIVE DEMO

We can create our own functions. As you can imagine, the random command is very useful but it could be a bit tedious to write every time random(-10,10), for instance. Instead, we can create a function that generates a random number when called:

LIVE DEMO

This way is very easy creating a matrix with random coefficients. Another more elaborated example is creating a function that constructs a tri-diagonal matrix given three numbers. Therefore, every time we want to create a tri-diagonal matrix, we just need to call this function with the upper-diagonal, diagonal and lower-diagonal terms.

LIVE DEMO