The calculator can work with variables of other types in programs. Here, we show some examples of manipulating and accessing all other types of variables from a program. It is assumed you understand basic operation of the variable types.

Complex

Complex numbers on the calculator use the same variables as Real numbers. So, the A variable can hold both 3.14 and 3i+2, but not at the same time. Essentially, you do not have to use different types of variables for real and complex numbers.

Matrices

Matrices store data in two dimensions, much like a table. To instantiate a matrix:

:DelVar [A]
:{x,y}→dim([A])


*Where x and y are the dimensions of the matrix.

To get and set a value in the matrix:

:[A](x,y) // Get a value
:3.14→[A](x,y) // Storing a value


*Where x is the row and y is the column.

Examples

4x4 Multiplication Table

:DelVar [A]
:{4,4},dim([A])
:For(I,1,4)
:For(J,1,4)
:I*J→[A](I,J)
:End
:End
:Disp [A]


The Hadamard product for two matrices of equal dimension is (in this example 3x3 matrices):

${\displaystyle {\begin{bmatrix}a_{11}&a_{12}&a_{13}\\a_{21}&a_{22}&a_{23}\\a_{31}&a_{32}&a_{33}\end{bmatrix}}\circ {\begin{bmatrix}b_{11}&b_{12}&b_{13}\\b_{21}&b_{22}&b_{23}\\b_{31}&b_{32}&b_{33}\end{bmatrix}}={\begin{bmatrix}a_{11}\,b_{11}&a_{12}\,b_{12}&a_{13}\,b_{13}\\a_{21}\,b_{21}&a_{22}\,b_{22}&a_{23}\,b_{23}\\a_{31}\,b_{31}&a_{32}\,b_{32}&a_{33}\,b_{33}\end{bmatrix}}}$

This code performs the Hadamard product of Matrix A and B and stores it into Matrix C:

:DelVar [C]
:If sum(dim([A])≠dim([B]))≠0 // Comparing lists
:Stop
:dim([A])→L1
:L1→dim([C])
:For(X,1,L1(1))
:For(Y,1,L1(2))
:[A](X,Y)*[B](X,Y)→[C](X,Y)
:End
:End

Y-Vars

The Y-Vars are special strings that hold the expressions used in graphing. They operate just like normal strings, but are used when graphing and are parsed as expressions. Entering a string into a Y-Var will allow it to be graphed on the screen. Use the letter X to denote the variable, just like you would when entering an equation into the Y= screen.

Examples

Simple Graph

:ZStandard
:"3X+2"→Y1
:DispGraph


Pics

Pics store a snapshot of the graph screen, including all the drawings made to the graph screen. Pics do not store the equations that make up the drawing, but rather just the pixels that are colored.

To store and recall Pics means to write and read pics, respectively:

:StorePic n
:RecallPic n


Where n is a number from 0–9, or a Pic variable like Pic1.

Graph Databases

Graph Databases (GBD) are used for storing the current graphing information. It includes:

• The current graphing mode (one of FUNC, PAR, POL, or SEQ)
• All graphing equations in the current mode
• Window variables excluding zoom and table settings
• Graph formatting

To store and recall GBDs:

:StoreGBD n
:RecallGBD n


Where n is a number from 0–9, or a GBD variable like GBD1.

Previous: Loops
Next: GetKey