Inginne

Introducing Compell REPL

December 24, 2022

Compell is a newborn high-level technical computing language that can be used to solve computational problems. It natively supports multiple data entities, e.g., numbers, arrays, and matrices, and has various high-level functions. Compell can be used to do simple calculations (e.g., Addition, Subtraction, Multiplication, Division, etc.) as well as more complex computations (e.g., Matrix Inverses, Eigenvalues & Eigenvectors, Singular Value Decomposition, etc.).

Consider the following mathematical expression:

$$ 14.4 + \sin(3.3) + \ln(10) $$

It could be computed in Compell by typing the following command.

14.4 + sin(3.3) + ln(10)

Consider a more complex expression,

$$ 12 \times e^{-0.7\times 10 \times 2.2} \times \sin\left(10\times 2.2 \times\sqrt{1-0.7^2} - 20\right) $$

Using Compell, it could be easily expressed as follows.

12 * exp(-0.7 * 10 * 2.2) * sin(10 * 2.2 * sqrt(1 - 0.7 ^ 2) - 20)

We can also work with arrays. Consider finding the cosine of four degree measurements: 0°, 45°, 90°, and 135°. This can be calculated as follows.

cosd([0,45,90,135])

What if we would like to find the dot product of two vectors. We can simply do this using the dot function,

dot([2.2,-3,4.4],[10,6.6,-7.3])

A more concise way to do this is to use the dot product operator , coded as **,

[2.2,-3,4.4] • [10,6.6,-7.3]

Matrices is also an important data entity that we can handle in Compell. Consider the following square matrix

$$ \begin{bmatrix} 3.3 & 1 & 5 \\ 10 & -5 & 12.2\\ 4.4 & 10 & -8 \end{bmatrix} $$

This matrix can be coded into Compell as follows

[3.3, 1, 5; 10, -5, 12.2; 4.4, 10, -8]

Row elements are separated by commas, whereas columns are separated by semicolons. We can calculate the determinant of the last matrix using the det function,

det([3.3, 1, 5; 10, -5, 12.2; 4.4, 10, -8])

This is how simple it is to define a matrix and find its determinant in Compell.