# CalcMe exercises solutions

**Note**: There are several live demos on this page, identified with the label INTERACTIVE DEMO. If you click into the area containing the CalcMe parameters, it will launch a new browser window containing a CalcMe session with all the operations you can see. Try it out, change the parameters or options. You won't break anything.

## Becoming familiar with the interface and basic commands

Write a CalcMe algorithm that does the following actions in the order they appear:

- Define the variable
**y**as the quotient of 39 divided by 7 and the variable**z**as the remainder of 63 divided by 11. - Specify the variable
**y**as a prime number and factor the variable**z**. - Define
**p**as a 2nd degree polynomial in x with roots**y**and**z**. - Evaluate
**p**in 0 and -3 and save the results in two variables, then find the greater common divisor of these results. - Illustrate the graph of
**p**and cos(**y**·x+**z**).

INTERACTIVE DEMO

## Introduction to randomization

Write a CalcMe algorithm that does the following actions in the order they appear:

- Define a list
**L**of 4 random numbers between –10 and 10 excluding 0. - Find the least common multiple of two random different numbers of the list.
- Define a random number
**x**as a**decimal number**(to the second decimal place) between 7 and 15 that is not an integer number. - Define a random number
**y**as a**rational number**(to the first decimal place) between 3.2 and 6.8 that is not an integer number.

INTERACTIVE DEMO

## Commands sections

Write a CalcMe algorithm that does the following actions in the order they appear:

- Define a list
**L**of random coefficients between -5 and 5, excluding 0 of random length between 5 and 10 (creating a user function for the randomness). - Define a polynomial
**p(x)**of degree 2 with random coefficients from the list L and find its roots. - Plot the graph of
**p(x)**in green, draw the minimum or the maximum of the function and write on the plotter the coordinates of the point. - Create a list
**K**whose elements are the quotient of**L**'s elements and its position if, and only if, its greatest common denominator is 1.

INTERACTIVE DEMO

## Programming methods

### Exercise 1

Write a CalcMe algorithm that generates order 3 random matrices until you find one with the determinant 1. Besides, this algorithm should count how many matrices are generated until finding the required one.

INTERACTIVE DEMO

### Exercise 2

Write a CalcMe algorithm that does the following actions in the order they appear:

- Create two lists
**L1**and**L2**, that contain the first ten multiples of two different random numbers between 3 and 9. - Merge the two lists into one ordered list
**L3**. - Create a new list
**L**that only saves the numbers appearing on both lists**L1**and**L2**using programming tools.

INTERACTIVE DEMO

### Exercise 3

Write a CalcMe algorithm that does the following actions in the order they appear:

- If the matrix is square and invertible, calculate its inverse.
- If the matrix is square but not invertible, calculate its nucleus.
- If the matrix is not square, call the function again with the matrix multiplied by its transpose.

INTERACTIVE DEMO